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

Restoring maximized windows can cause loss of focus #131

Closed
joewing opened this Issue Aug 19, 2014 · 3 comments

Comments

Projects
None yet
3 participants
@joewing
Owner

joewing commented Aug 19, 2014

Using sloppy focus, if a window is maximized and then restored using a keyboard shortcut, the focus will go to the window under the mouse after the window is restored. This can be a window other than the maximized window.

This behavior isn't necessarily wrong, but it's been brought to my attention and it might not be expected. Fixing this may be somewhat problematic because JWM uses enter notify events to determine when to change window focus. A simple approach to fix this would be to have JWM ignore the enter notify if it's not caused by a mouse motion, but then the user would have to move the mouse out of the second window and back again to focus it (or JWM could use something other than enter notify).

@joewing joewing added the enhancement label Aug 19, 2014

@STrRedWolf

This comment has been minimized.

Show comment
Hide comment
@STrRedWolf

STrRedWolf Aug 19, 2014

A suggestion on this (as a toggle-able option) is to warp the mouse to inside the closest edge of the restored window when it's restored by keyboard and the mouse would land outside it. This should keep the focus on the restored window (given right order of warp-then-restore, and my wild uninformed guess).

A suggestion on this (as a toggle-able option) is to warp the mouse to inside the closest edge of the restored window when it's restored by keyboard and the mouse would land outside it. This should keep the focus on the restored window (given right order of warp-then-restore, and my wild uninformed guess).

@bbidulock

This comment has been minimized.

Show comment
Hide comment
@bbidulock

bbidulock Aug 23, 2014

Contributor

A quicker approach used by other window managers is to rip all of the enter/leave notify events off of the stack just before returning from the key action. This can be done always for key actions regardless of their result. This is as simple as:

XSync(dpy, False);
while (XCheckMaskEvent(dpy, EnterWindowMask, &dummy)) ;

at the end of the key action routine.

Contributor

bbidulock commented Aug 23, 2014

A quicker approach used by other window managers is to rip all of the enter/leave notify events off of the stack just before returning from the key action. This can be done always for key actions regardless of their result. This is as simple as:

XSync(dpy, False);
while (XCheckMaskEvent(dpy, EnterWindowMask, &dummy)) ;

at the end of the key action routine.

@joewing

This comment has been minimized.

Show comment
Hide comment
@joewing

joewing Aug 26, 2014

Owner

This should work as of commit 6d6b8c9.
Thanks @bbidulock!

Owner

joewing commented Aug 26, 2014

This should work as of commit 6d6b8c9.
Thanks @bbidulock!

@joewing joewing closed this Aug 26, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment