-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
gtk3: disable low level keyboard hook #6244
Conversation
Just curious: What happens to keyboard combos with CSD apps with this? They just do nothing? |
Yes, the code we loose is low_level_keystroke_handler(). It handles the "Windows Key+Arrow Keys" combos, but only for CSD windows, so they'll simply do nothing in the CSD case as you suspected. |
What about guarding it with a |
To be honest I don't like the idea of introducing an undocumented environment variable that is not part of the upstream API. Most people won't know about it and will continue to suffer from bad performance. That is especially true if client side decorations are disabled (our default) because we don't have any need for the hook in this case. It certainly feels wrong to install it in the first place then, as it only has disadvantages. I could settle for checking if (Arguably the loss of combos might be preferable over bad performance even for the CSD case, but yes, this probably comes down to personal preference) |
You're introducing a feature change that is not part of upstream, so I don't think it is worse, but ymmv.
The reason I'm wary is that I use key hooks in my programs anyway, so gtk adding another one doesn't bother me.
apps can use CSD without the env var, but this is better I guess, so 👍
|
The hook is used to intercept keyboard combos in order to provide AeroSnap-like functionality for CSD windows. However it causes significant performance issues, especially on startup of gtk3 apps (those are system-wide and *not* limited to the gtk3 app itself). Performance can be continuously degraded to any console application that is attached to the gtk3 app, e.g. debuggers. Related issues: - https://gitlab.gnome.org/GNOME/gtk/issues/2015 - https://gitlab.gnome.org/GNOME/gtk/issues/1082 - https://gitlab.gnome.org/GNOME/gtk/issues/1033 As the hook is completely useless for non-CSD windows, only install it if CSD is explicitly requested (environment variable GTK_CSD=1).
bba4207
to
723765a
Compare
AFAIU the problem is not the hook itself but how it's implemented, though:
Updated the MR with the env var check. I'm aware windows can still use CSD if GTK_CSD!=1 (is there any direct way to enable it programatically short of putting widgets into the titlebar btw.?). However we should achieve reasonable behavior without any loss of functionality in the majority of cases with the updated patch, which seems to be the best we can hope for without actually fixing the underlying issues. |
I have a very simple case, so likely not that easy in gtk, let's see.
I think, besides having it as a default, only set_titlebar() will enable it, but not 100% sure. |
The hook is used to intercept keyboard combos so gtk is able to trigger the AeroSnap-like functionality it implements as a replacement for real AeroSnap when client-side decorations (CSD) are used on a window.
However the keyboard hook causes significant performance issues, especially on startup of gtk3 apps (those are system-wide and not limited to the gtk3 app itself). Input performance can be continuously degraded for any console application that is attached to the gtk3 app, e.g. debuggers.
Loss of the keyboard combos in CSD windows seems to be acceptable considering the severe functional limitations the hook itself causes.
This is especially true as we do not use CSD by default so we do not even depend on the (incomplete) AeroSnap-emulation GTK provides in most cases. Instead we're using native AeroSnap as provided by the OS directly, with keyboard combos working as expected.
Related issues: