New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Made scale-screen add heads before removing heads #1008
Conversation
This prevents stumpwm from temporarliy having no heads when switching from one monitor to another in a single xrandr call (See Github issues stumpwm#647 and stumpwm#763 )
I got a little bit further in tracking down the other issue tonight: Visually, there is a frame that is correctly sized for the old head's resolution, but taking up the same visual space as the correctly sized frames (above or below them) on the new (only) head. You can create new frames incorrectly configured by generating them while this frame is highlighted, and cycle-through them with next-window. You can "jump" to a correctly configured frame by raising one of its windows.
The last two commands were run from repls different windows (the last being from the one in the messed-up frame). Notice the sizes. Some windows are left associated with frames no longer in any group's frame-tree (and other than the per-group frame trees I don't think stump keeps a global list of frames anywhere, you could get it by walking calling window-frame on a list of all windows tho---probably from xlib too). However, it's not just the frame list that's messed up:
While the screen object knows what size it should be, the actual underlying xlib object is much too large, in fact, it's the exact size it should be if both monitors were on (xrandr confirms that only one is enabled (or even connected)). This and a review of the code leads me to, unfortunately, believe that this isn't caused by inverting the order of adding and removing screens, but rather is a race in handling |
Does Stumpwm ever tell xlib about the display size? If not, at least the second part of the previous comment is a cl-xlib bug:
The frame issue can be (hackily) resolved by:
and then getting all windows to refresh/redisplay. I'm not sure how significant the xlib object being too large is, but it looks like things should function correctly if we stop that single window from continuing to be assigned to a frame that shouldn't exist anymore. |
|
I agree that ultimately having no monitors should be supported, at least as a transitory state but your workaround should cover most scenarios. Thanks! |
Did a bit more digging, it's actually the xlib "screen" size that is incorrect: it's just bigger than the display size.
Fixes the xlib screen size and
fixes the modeline scaling. Interestingly, these are both about 2.19x larger than the values reported by xrandr, must be something being smart about HiDPI along the way. So whatever should be resizing the screen on head-changes isn't working---tho so long as no windows were assigned to orphaned frames, I'm not sure anyone would have noticed their screen being larger than their actual display---since you were still constrained to a frame within your head, splitting and such would work correctly. I'll make either new issues or new pull requests to keep track of this and the orphaned frame, depending on how quickly I figure it out. |
This resolves the crash in #647 and #763 .
Ultimately, this happens because
group-remove-head
can't handle there not being any frames in a group. If you try to remove the only head,group-remove-head
will delete its frames from the group'stile-group-frame-tree
, leaving it empty, then it will try to grab the group's first frame;; just set current frame to whatever.
, which will, unfortunately, be nil, and proceed to set all of the windows' window-frame to nil, causing this problem.https://github.com/stumpwm/stumpwm/blob/master/tile-group.lisp#L196-L208
This pull request solves the problem by simply preventing there from not being any heads during normal operation: adding new heads before removing the old ones if both happen in a single
:CONFIGURE-NOTIFY
event.I do, however, think that stumpwm ought be able to handle not having any actual heads attached, at least temporarily, and this patch is really papering over the issues with that (and, in fact, prevents
tile-window
's frame slots from being set to nil if you have safety turned up on sbcl).Furthermore, it doesn't looks like frames are properly adopted and scaled when moving between heads of different resolution.