GNOME Bugzilla – Bug 775061
hide_titlebar_when_maximized not respected in wayland
Last modified: 2019-07-04 12:55:39 UTC
Created attachment 340724 [details] [review] Exposes the hide_titlebar_when_maximized property of MetaWindow with public getter and setter methods The hide_titlebar_when_maximized property is ignored under Wayland. It works as expected on X11, but maximized windows maintain the titlebar on Wayland. The attached patch exposes the hide_titlebar_when_maximized property of MetaWindow with public getter and setter methods. This is useful for testing from the looking glass inspector and for gnome extensions that want to hide applications' title bars like Pixel Saver or Maximus(|2|NG).
(In reply to César Izurieta from comment #0) > The hide_titlebar_when_maximized property is ignored under Wayland. It works > as expected on X11, but maximized windows maintain the titlebar on Wayland. That's not quite accurate. The hide_titlebar_when_maximized() property works for windows that are decorated by mutter. As windows that are using the wayland backend are all client-side decorated, it's up to the client to offer that functionality (or not) - note that the same is true with the X11 backend when client-side decorations are used (for example headerbars - though in that case, implementing the property doesn't sound useful at all). Reassigning to GTK+, as there's nothing useful mutter can do in that case (other than cutting off a random amount of pixels and scale up the remaining texture to occupy the original area again).
Florian, thanks for your answer, that makes total sense. So in that case, I need to update the hide_titlebar_when_maximized in the GtkWindow then? Do you know if there's any way to access the GtkWindow from the MetaWindow for gtk+ apps? That way the set_hide_titlebar_when_maximized function could update the property there too.
Created attachment 340823 [details] [review] Add GSettings conf for hide_titlebar_when_maximized This patch adds a new GSettings setting org.gtk.Settings:hide-titlebar-when-maximized that is used as a default value for the hide_titlebar_when_maximized property for new GtkWindows.
Created attachment 340838 [details] [review] Hide the title bar for tiled windows if hide_titlebar_when_maximized is set Mutter hides the title bar when hide_titlebar_when_maximized is set. Gtk doesn't do that for CSD windows. This patch unifies that behaviour.
I don't think we want to expand the hide-when-maximized stuff. I think it will be going away in gtk4, actually.
Thanks for your reply. In that case, what would be the way forward for a gnome shell extension to control the visibility of a title bar when maximized or tiled?
i don't see much of a future for such an extenion. The hide-titlebar-when-maximized was an initial attempt at improving our vertical space handling in early gnome 3.x; since then, we've gone a different way with client-side decorations and headerbars - applications can use that space at all times now, not just when maximized. I don't think we need the setting going forward.
The motivation for these patches is to support extensions like pixel-saver and maximus on wayland. There are still lots of very important gtk apps that use a title bar, like gnome-terminal, evolution or firefox. When used on small screens every pixel is useful and hiding the title bar helps a lot. In the case that hide_titlebar_when_maximized goes away, would this be something that should be handled in themes maybe?
There definitely is user demand, so if it isn't a step back in other aspects, please consider this.
Created attachment 350812 [details] [review] Remove GtkWindow::hide-titlebar-when-maximized This was only every implemented under X11, and with CSD, this is clearly in the application realm. We should not pretend that we can support it on the toolkit level.
Please don't, many people are using this feature. That it won't work with CSD isn't a problem, since many apps still aren't using GtkHeaderBar.
Created attachment 350813 [details] [review] Remove GtkWindow::hide-titlebar-when-maximized This was only every implemented under X11, and with CSD, this is clearly in the application realm. We should not pretend that we can support it on the toolkit level.
(In reply to Jan Niklas Hasse from comment #11) > Please don't, many people are using this feature. That it won't work with > CSD isn't a problem, since many apps still aren't using GtkHeaderBar. Except of course that *all* applications using the wayland backend are CSD, no matter whether they use a custom headerbar or not.
Review of attachment 350813 [details] [review]: ::: gtk/gtkwindow.c @@ -3812,3 @@ - - if (GDK_IS_X11_WINDOW (gdk_window)) - gdk_x11_window_set_hide_titlebar_when_maximized (gdk_window, setting); This method can go as well, no?
It also doesn't work under Wayland, or on Windows, or OS X, or under Mir. Or with an X11 window manager that doesn't know to look for this undocumented window property.
Lastly, this patch is only going into GTK+ 4.
Attachment 350813 [details] pushed as 92b0d2e - Remove GtkWindow::hide-titlebar-when-maximized
> Except of course that *all* applications using the wayland backend are CSD, no > matter whether they use a custom headerbar or not. Just because it's CSD, doesn't make it technically impossible to hide it when maximized. > It also doesn't work under Wayland, or on Windows, or OS X, or under Mir. Or with an X11 window manager that doesn't know to look for this undocumented window property. > Lastly, this patch is only going into GTK+ 4. Makes sense. But please leave this bug open for GTK+ 3, as Firefox, Chromium and all Electron-based programs will still use that version for the foreseeable future and would benefit from this feature also on Wayland.
I'm begging you Matthias. Please please please consider merging this for Gtk+ 3! It's a blocker for me (and I think many other users, see https://github.com/deadalnix/pixel-saver/issues/32 for example) for using Wayland.
Created attachment 374226 [details] [review] add new schema to meson.build For everyone still interested in building with the added GSetting: When building with meson, the schema file also has to be registered in the meson.build files. This patch adds the respective entries.