Skip to content
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

Fix sloppy focus issues around desktop windows (file managers, etc), fix uninitialized windowType #617

Merged
merged 5 commits into from
Jul 7, 2024

Conversation

achadwick
Copy link
Contributor

@achadwick achadwick commented Jul 3, 2024

This combines two separate commits that fix some issues with background/desktop windows and JWM's sloppy focus.

The user probably considers background widows, like those provided by file managers, to be something other than a regular window, and might consider sloppy focus to be broken by them (see #613). In point of fact, these windows should probably not receive sloppy focus; however they can still be usefully focussed and interacted with.

Therefore, require clicks before interaction even in sloppy focus mode.

They also may not appreciate a giant rectangle in the pager behind all the other ones. You can't usefully move one of these background filer windows, and it probably shouldn't hide the pager's desktop number either if the current desktop happens to be empty.

The rationale here is that the user will probably think of desktop
windows with icons and wallpaper images as "unoccupied space" and not
just another window.

Addresses joewing#613 (comment)
This allows the user's mouse to pass over background windows provided
by file managers etc. (usually things with icons, rubber band selections,
and wallpaper images) without JWM's sloppy focus modes transferring focus
to them. This helps maintain the illusion that such windows are neutral,
unoccupied space and not just a big window.

Such background windows can still be clicked to focus, allowing keyboard
interaction with file icons and suchlike.

fixes joewing#613
@achadwick
Copy link
Contributor Author

For some reason, I wasn't able to test with np->state.windowType != WINDOW_TYPE_DESKTOP (the results felt like click-to-focus instead). Since that's 0 in the enum, is it being set correctly for regular windows? 🤔

If you prefer, I can reimplement this patch and investigate.

@achadwick achadwick changed the title Fix sloppy focus issues around deskto windows (file managers, etc) Fix sloppy focus issues around desktop windows (file managers, etc) Jul 3, 2024
ReadWindowState() was creating ClientState structs without
initializing every field, so windowType was typically zero (might
not be: this is undefined behaviour I think). Zero is the same as
WINDOW_TYPE_DESKTOP, which was breaking my checks for whether a
window is a desktop window. For some reason, all normal windows
were initialized that way too.

Default it to WINDOW_TYPE_NORMAL, much like the defaultLayer is
defaulted to LAYER_NORMAL.
@achadwick
Copy link
Contributor Author

Looks like windowType wasn't being properly initialized during construction. I'm not sure what the full ramifications of that will be, but a default to WINDOW_TYPE_NORMAL seems safe.

@joewing Let me know if you want this rebasing before you accept it, since it changes the same lines twice.

@achadwick achadwick changed the title Fix sloppy focus issues around desktop windows (file managers, etc) Fix sloppy focus issues around desktop windows (file managers, etc), fix uninitialized windowType Jul 4, 2024
@achadwick
Copy link
Contributor Author

@joewing Does the exception this branch introduces for desktop windows while in sloppy focus modes need documenting? I don't think the pager stuff does, necessarily.

This permits explanatory comments, and documents the flow better.
Reintroduce tests for LAYER_DESKTOP too, since the logic applies
for that too.
@achadwick
Copy link
Contributor Author

I think the logic and behaviour is right now.

@joewing
Let me know if you'd prefer me to rebase it into a couple of commits, and/or if anything needs to be changed stylistically.

@joewing
Copy link
Owner

joewing commented Jul 7, 2024

This looks reasonable to me. Thanks!

@joewing joewing merged commit e6ca090 into joewing:master Jul 7, 2024
@achadwick achadwick deleted the desktop-window-fix branch July 8, 2024 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants