SawfishWM / sawfish-pager

Pager for Sawfish WM
GNU General Public License v2.0
10 stars 4 forks source link

Don't send window positions during viewport change #6

Closed cosurgi closed 3 years ago

cosurgi commented 4 years ago

Hi Chris,

long time :)

I have recently run into a bit annoying bug. It happens when changing viewports from pager, and happens only when there are more than roughly 200 windows open. Here's what happens: when you click to change viewport, first w commands are send to pager, with each window separately, followed by W command which lists all windows altogether. When there are lots of w being send the pipe between pager and sawfish somehow crashes. The pager is stuck in limbo, and sawfish is also frozen. The only way to recover from this situation is to kill pager (I have to ssh remotely to do that). The annoying part is that it looks a bit like an xserver freeze, because the windows on the screen stop refreshing in the middle of a redraw.

The freeze happens while sawfish is sending w commands after repositioning each window during a viewport change. So killing pager only partially recovers the situation because some of the windows have new viewport coordinates while other windows have old coordinates. So we are left with a bit of a mess with window positions.

I could not nail exactly what is wrong on the C side. I only found out that increasing the wait time to 0.5 second (or more) here significantly reduces the chances of this bug occurring, but pager becomes unusable and very slow. And the bug still happens.

However I discovered that not sending w commands during viewport change, but only W with all windows after the change is finished also significantly reduces the chances of this freeze to happen. It still (rarely) happens, though. And this code change seems pretty clean so I open a pull request for this fix.

Because this freeze still rarely happens I modified the C side of the code to save window positions to text file when pager is started, this allows the full recovery of window positions after kill -9 pager, but that part of the code is a bit dirty, so I don't put in in a pull request ;)

cheers, Janek

Nanolx commented 4 years ago

Hi,

yeah, pretty silent around here. :)

Thanks for the pr, I'm gonna test and merge it soon.

Regards, Chris

cosurgi commented 4 years ago

Haha, yeah. Not many bug reports for the perfect pager and the perfect window manager ;)

cosurgi commented 4 years ago

Oh, btw. I had to remove -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED from cc invocation to compile pager.

Nanolx commented 3 years ago

Thanks.

cosurgi commented 3 years ago

You are welcome, and Happy New Year! :)