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 775061 - hide_titlebar_when_maximized not respected in wayland
hide_titlebar_when_maximized not respected in wayland
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-11-25 00:36 UTC by César Izurieta
Modified: 2019-07-04 12:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Exposes the hide_titlebar_when_maximized property of MetaWindow with public getter and setter methods (1.46 KB, patch)
2016-11-25 00:36 UTC, César Izurieta
none Details | Review
Add GSettings conf for hide_titlebar_when_maximized (3.41 KB, patch)
2016-11-27 00:34 UTC, César Izurieta
none Details | Review
Hide the title bar for tiled windows if hide_titlebar_when_maximized is set (969 bytes, patch)
2016-11-27 10:41 UTC, César Izurieta
none Details | Review
Remove GtkWindow::hide-titlebar-when-maximized (6.78 KB, patch)
2017-05-01 16:58 UTC, Matthias Clasen
none Details | Review
Remove GtkWindow::hide-titlebar-when-maximized (10.92 KB, patch)
2017-05-01 17:26 UTC, Matthias Clasen
committed Details | Review
add new schema to meson.build (1.10 KB, patch)
2019-07-04 12:55 UTC, d.f.fischer
none Details | Review

Description César Izurieta 2016-11-25 00:36:25 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).
Comment 1 Florian Müllner 2016-11-25 14:10:43 UTC
(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).
Comment 2 César Izurieta 2016-11-25 18:23:51 UTC
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.
Comment 3 César Izurieta 2016-11-27 00:34:38 UTC
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.
Comment 4 César Izurieta 2016-11-27 10:41:09 UTC
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.
Comment 5 Matthias Clasen 2016-11-28 18:24:28 UTC
I don't think we want to expand the hide-when-maximized stuff. I think it will be going away in gtk4, actually.
Comment 6 César Izurieta 2016-11-28 19:43:34 UTC
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?
Comment 7 Matthias Clasen 2016-11-28 19:58:38 UTC
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.
Comment 8 César Izurieta 2016-11-28 20:13:07 UTC
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?
Comment 9 gnome 2017-04-22 09:46:52 UTC
There definitely is user demand, so if it isn't a step back in other aspects, please consider this.
Comment 10 Matthias Clasen 2017-05-01 16:58:21 UTC
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.
Comment 11 Jan Niklas Hasse (Account disabled) 2017-05-01 17:26:39 UTC
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.
Comment 12 Matthias Clasen 2017-05-01 17:26:59 UTC
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.
Comment 13 Florian Müllner 2017-05-01 17:57:48 UTC
(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.
Comment 14 Florian Müllner 2017-05-01 18:02:01 UTC
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?
Comment 15 Matthias Clasen 2017-05-01 18:23:30 UTC
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.
Comment 16 Matthias Clasen 2017-05-01 18:25:35 UTC
Lastly, this patch is only going into GTK+ 4.
Comment 17 Matthias Clasen 2017-05-01 18:26:28 UTC
Attachment 350813 [details] pushed as 92b0d2e - Remove GtkWindow::hide-titlebar-when-maximized
Comment 18 Jan Niklas Hasse (Account disabled) 2017-05-02 06:57:51 UTC
> 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.
Comment 19 Jan Niklas Hasse (Account disabled) 2017-09-18 20:43:32 UTC
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.
Comment 20 d.f.fischer 2019-07-04 12:55:39 UTC
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.