After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 780047 - Client Side Decoration / Headerbar bindings nonconfigurable
Client Side Decoration / Headerbar bindings nonconfigurable
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: Widget: Other
3.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 768211 772909 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2017-03-14 18:16 UTC by Daniel C. Würl
Modified: 2018-01-22 11:36 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Daniel C. Würl 2017-03-14 18:16:30 UTC
Outside of gnome client side decorations don't behave like other windows, i.e. many window managers bind a double click on the titlebar to the 'shade' function (or lower the window to the back on rightclick, as I use in my configs).

CSDs don't respect this (of course, they don't read my wm's configuration), and there is no way to customize these bindings to have them fit in (the settings in tweak tool seem to have no effect either).

There should be a way to designate actions to different mousebuttons on different parts of the decoration in a user-configurable way, thus increasing the integration at other desktops/wm's.
Comment 1 Emmanuele Bassi (:ebassi) 2017-03-14 18:27:55 UTC
It's already possible to configure the controls on a client-side decoration; see:

  https://developer.gnome.org/gtk3/stable/GtkSettings.html#GtkSettings--gtk-decoration-layout

As for the behaviour of clicks:

  https://developer.gnome.org/gtk3/stable/GtkSettings.html#GtkSettings--gtk-titlebar-double-click
  https://developer.gnome.org/gtk3/stable/GtkSettings.html#GtkSettings--gtk-titlebar-middle-click
  https://developer.gnome.org/gtk3/stable/GtkSettings.html#GtkSettings--gtk-titlebar-right-click

You can either use gsettings in a GNOME-like environment, or you can use a settings.ini file under $XDG_CONFIG_HOME/gtk-3.0.
Comment 2 Matthias Clasen 2017-03-15 10:52:53 UTC
shading is not available for csd windows
Comment 3 Daniel C. Würl 2017-03-18 21:45:06 UTC
> shading is not available for csd windows

And neither are mousebuttons 4-7 (i.e. scrollwheel) available for binding, so integration is still broken.
Comment 4 Matthias Clasen 2017-03-18 22:09:22 UTC
its not broken. it is limited to what we can and want to support here. I don't think there is much point in keeping this bug open. We are not going to go all in with making this über configurable
Comment 5 Daniel C. Würl 2017-03-18 22:21:51 UTC
> We are not going to go all in with making this über configurable

I fully understand that sentiment in regard to extended bindings, but window shading is a pretty basic feature on the linux desktop, so I cannot really follow here how this would be 'über'.
Comment 6 Matthias Clasen 2017-03-19 12:01:20 UTC
Shading is a 'trick' that is easy to implement if you are a reparenting window manager. With client-side decorations, it would be a lot of work
Comment 7 Daniel C. Würl 2017-03-19 18:11:04 UTC
By 'basic' I meant 'expected basic functionality', like maximizing or iconifying is.

Unfortunately I'm not really competent in C, or I would try myself.

It seems not too hard to implement, here is a shadable headerbar written in Python:

http://pastebin.com/nVxfuSXG

Of course it's raw and unpolished (and let the user resize the 'shaded' window, a problem I didn't really look into for this proof of concept), but given that the headerbar already has such a strong influence on size allocation, and the rest of the window is just a container (which is again filled while respecting the headerbar), I'd assume this should be doable on the toolkit level even easier than here on my client side example.
Comment 8 Daniel C. Würl 2017-03-19 18:51:13 UTC
Corrected Version -> http://pastebin.com/janCiWnD
Comment 9 Matthias Clasen 2017-12-29 17:22:46 UTC
*** Bug 768211 has been marked as a duplicate of this bug. ***
Comment 10 Matthias Clasen 2017-12-29 17:23:58 UTC
*** Bug 772909 has been marked as a duplicate of this bug. ***
Comment 11 T-Gergely 2017-12-29 20:58:23 UTC
Can this CSD be disabled? So if I don't use GNOME 3, but XFCE, is there any way to use GTK 3 programs like evince with normal themed headers (not with preloaded library hacks and double headers) where e.g. a focused window looks like a focused window? Or should I just uninstall them in disgust just like MS Office in MS Windows? :(
Comment 12 Emmanuele Bassi (:ebassi) 2017-12-30 00:03:40 UTC
(In reply to T-Gergely from comment #11)
> Can this CSD be disabled?

No; if an application is using client-side decorations (via an header bar widget) then the application developers have decided for a specific UI. Unless the application developers want to allow for two different UIs, you get what they wrote.

On Wayland, on the other hand, all GTK windows get client side decorations because that's what the windowing system expects; unless the compositor implements the KDE decoration discovery protocol, in which case GTK won't draw decorations at all — except for applications that use a custom header bar (see above).

> So if I don't use GNOME 3, but XFCE, is there any
> way to use GTK 3 programs like evince with normal themed headers (not with
> preloaded library hacks and double headers) where e.g. a focused window
> looks like a focused window?

Not unless the Evince developers wish to cater to your use case, and increase their maintenance burden by having two separate UIs.

> Or should I just uninstall them in disgust just
> like MS Office in MS Windows? :(

I strongly suggest you refrain from making this kind of comments on the GNOME project's bug tracker. You only get one warning.
Comment 13 Emmanuele Bassi (:ebassi) 2017-12-30 00:22:07 UTC
(In reply to Daniel C. Würl from comment #7)
> By 'basic' I meant 'expected basic functionality', like maximizing or
> iconifying is.

Clearly you and I have very different concepts of "basic" window management features — and I have to admit that in 20 years of using X11-based desktops, I maybe used shading 3 times in total.

> I'd assume this should be doable on the toolkit level even easier than here
> on my client side example.

It really depends on a lot more: we need to expose a behaviour that was completely internal to the window manager.

The title bar that GTK uses on Wayland for top levels without custom controls could probably support shading, though in other to have the same behaviour we'd have to hide the rest of the UI, which would be a weird change for applications. X11 window managers can do this because they can literally hide the contents of the window without the application knowing; since decorations are client-side, it means a new window state — one that GTK currently does not have. In theory it would be possible to add it, even though GTK+ 3.x is now to be considered feature and API frozen.

This whole thing is even more critical for client side decorations with a custom GtkHeaderBar, because the application is in full control of the UI, so it's entirely up to it to decide how to appear when "shaded"; a media player could use the "shaded" state to change the controls and have a minimal UI, for instance.

So, in order to implement shading, we'd need:

 - a way for the window manager to tell us to go into "shaded" state; EWMH has a _NET_WM_STATE_SHADED atom for the _NET_WM_STATE property, which will need a Wayland counterpart, if one does not exist
 - a new GdkWindowState to match the 'shaded' state
 - code in GtkWindow to catch this new state and, when using client-side decorations, update the state of the GtkHeaderBar and hide the contents of the window
 - possibly some code in GtkHeaderBar (a property, maybe) that applications can catch and update the contents of the header bar widget in response of the new state
Comment 14 T-Gergely 2017-12-30 10:29:48 UTC
(In reply to Emmanuele Bassi (:ebassi) from comment #12)

> > Can this CSD be disabled?
> 
> No;

Thanks. I won't look for a solution for fixing these projects then as long as I have acceptable alternatives. I changed my default/legacy GTK Fedora apps with multiple regressions/problems to Pluma, qpdfview, Geeqie, Gnome Mines 2.32, Liferea 1.8.14, etc. Luckily, GIMP still works OK for me out of the box. I find it ironic (in a sad way) that even Java Swing apps (I didn't even suspect Ardunio IDE was one until I looked inside) look native on my preferred OS: GNU/Linux, but apps that I though were "native" do not.
Comment 15 Matthias Clasen 2018-01-18 18:19:50 UTC
I don't think there's anything to keep this bug open - we're not going to implement client-side shading, realistically.
Comment 16 Kipp 2018-01-22 10:23:35 UTC
Hi,

Sorry, the bug isn't that *shading* isn't supported, not any more, it's that a middle click on the title bar can only raise a window, nothing else.  Other people (me, for example) have reported in other bugs the broken state of other actions, like lowering the window.  Those other bugs got closed because they are, supposedly, duplicates of this one.  The claim has been that there is some single common design flaw that leads to none of these features working, and for whatever reason it was decided that this shading bug was going to be the torch bearer.  I don't know why.  I also don't care about shading, I care about my bug :-).

In any case, this isn't a debate about the philosophy of window management, whether something is "basic" or not, there is a configuration option that users can twiddle that does not function correctly.  That's a bug.  Gnome can't won't-fix it, and just leave broken configuration options, that's not an acceptable standard of software maintenance.

What I don't understand is if Gnome literally can no longer lower a window at all because Wayland is just that flawed, or if it's easily fixed and somebody simply forgot to hook up the plumbing, or if the feature's removal is deliberate and ideological because, I don't know, some Gnome developer had a bad 3-button mouse experience in their childhood.  For example, I don't really care about middle clicking on the title bar if that's the issue, I just want to be able to lower a window without one-by-one clicking everything behind it to raise them above it.  Right-clicking on the title bar brings up a menu of window movement options which could offer to lower the window.  Having to rely on that would not be ideal, but it would work.  There exists a keyboard shortcut setting to lower a window, which I could use, but no key binding is set by default, and, anyway, if it's possible to set a keyboard shortcut, or add the lower-this-window action to a menu, if that would work, if it is possible to lower a window at all, then surely the middle-click-title-bar-to-lower feature could just be fixed, no?
Comment 17 Emmanuele Bassi (:ebassi) 2018-01-22 11:36:53 UTC
(In reply to Kipp from comment #16)
> Hi,
> 
> Sorry, the bug isn't that *shading* isn't supported,

The bug was open explicitly for shading.

> not any more, it's that a middle click on the title bar can only raise a window, nothing else.

This kind of configuration is offered on a per-backend basis, and only as a best effort.

On X11, you can configure client-side decorations to manipulate the stacking order: see the links I pasted in comment 1.

On Wayland, clients cannot know anything about the stacking order, as it's private to the window manager. This is by design, as it would allow random clients to manipulate the stacking order without user interaction.

Like I said about shading in comment 13, it would be possible to implement this functionality using a new Wayland interface, as an extension to the core Wayland protocols, just like we have xdg_shell or gtk_shell or the KDE negotiation interface for showing client-side decorations on Wayland; this would also require implementation in the toolkit and in the various Wayland-based display servers, so it would need to be discussed on the wayland-devel mailing list.

It's of course possible to re-design and re-implement all the functionality currently configurable on X11, but nobody on the GTK side, or the GNOME side, is going to work on that; if you want to contribute this functionality, feel free to do so, and re-open the bug once you have a patch.