-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Update window properties on PropertyNotify, clipboard manipulation refactor, general cleanup #69995
Conversation
} else if (wd.minimized && !_window_minimize_check(p_window)) { | ||
_set_wm_minimized(p_window, true); | ||
|
||
bool desired_fullscreen = _window_fullscreen_check(p_window); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it called desired_fullscreen
? _window_fullscreen_check
is checking if it's current full screen and desired mode is wd.fullscreen
.
The code seems to be wrong, it will never change mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested both on KDE and BSPWM, all modes are working.
The issue is that BSPWM sends MapNotify before ConfigureNotify, causing wd.minimized to be outdated. I've provided an explanation in the linked issue.
What is the proper order of these messages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_validate_mode_on_map
was added to fix initial window mode (so if it was not mapped instantly after _create_window
):
_create_window
setswd.property
values and attempts to change mode.- If window mode was not set in step 1, it's later fixed when window is mapped.
ConfigureNotify
should not be involved at all.
#68471 seems to be about switching workspaces, I'm not sure if _validate_mode_on_map
should be called in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to validate mode only on window creation? If so, would something like this work?
WindowData &wd = windows[p_window];
if (wd.validated) return;
if (wd.fullscreen && !_window_fullscreen_check(p_window)) {
_set_wm_fullscreen(p_window, true, wd.exclusive_fullscreen);
} else if (wd.maximized && !_window_maximize_check(p_window, "_NET_WM_STATE")) {
_set_wm_maximized(p_window, true);
} else if (wd.minimized && !_window_minimize_check(p_window)) {
_set_wm_minimized(p_window, true);
}
wd.validated = true;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe we can just listen for PropertyNotify events involving WM_STATE changes to set them instantly? That would fix the problem with KDE as well.
On Plasma wd.minimized is never set to true, unless window_set_mode is called from GDScript or by engine.
Plasma just calls FocusOut when window is minimized. |
This approach should work for any kind of window managers. I think, we should use PropertyNotify to monitor other properties as well (wd.fullscreen, wd.maximized etc). For finding out which property needs to be updated I just used comparison of Atoms. I am sure, there is a better way to approach this, but I am not aware of it. |
Ping @bruvzg |
patched it into my current rc2, works as expected, thank you! |
@bruvzg |
It's not related to the issue, it is used to ignore an event from the IME subwindow (which was not a thing when the issue was first reported), it should be used to skip all events except |
I see, I'll just remove these checks to resolve conflict then, since they were used to skip window properties checks, which should be redundant with this PR. |
Just rebased the PR properly, I did a merge instead of rebase yesterday duh. |
I refactored clipboard manipulation, so it updates and caches them using XFixes events. Also did a cleanup by separating certain parts into functions. |
This code is frankly a bit of mess to work with, I would like to refactor it more. |
Fixes #68471