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 665617 - window: Support GTK+'s hide-titlebar-when-maximized hint
window: Support GTK+'s hide-titlebar-when-maximized hint
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on: 665616
Blocks:
 
 
Reported: 2011-12-05 18:29 UTC by Florian Müllner
Modified: 2011-12-15 15:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
window: Support GTK+'s hide-titlebar-when-maximized hint (7.09 KB, patch)
2011-12-05 18:30 UTC, Florian Müllner
needs-work Details | Review
window: Support GTK+'s hide-titlebar-when-maximized hint (5.23 KB, patch)
2011-12-07 23:08 UTC, Florian Müllner
committed Details | Review

Description Florian Müllner 2011-12-05 18:29:52 UTC
New applications designed by the design team request that titlebars should be hidden when windows are maximized[0]. The designers think that applications need to be designed with this maximization state in mind, so we cannot just remove titlebars on all maximized windows - for that purpose, bug 665616 adds a GtkSetting which allows applications to request from the window manager that titlebars should be hidden during maximization. Implement support for the hint set by GTK+.

[0] https://live.gnome.org/GnomeOS/Design/Whiteboards/WindowStates
Comment 1 Florian Müllner 2011-12-05 18:30:00 UTC
Created attachment 202858 [details] [review]
window: Support GTK+'s hide-titlebar-when-maximized hint

For maximized windows, titlebars cannot be used to reposition or
scale the window, so if an application does not use it to convey
useful information (other than the application name), the screen
space occupied by titlebars could be put to better use.
To account for this use case, a setting for requesting that windows'
titlebars should be hidden during maximization has been added to
GTK+, add support for this in the window manager.
Comment 2 Owen Taylor 2011-12-06 16:16:48 UTC
So, hmm, how do you unmaximize such a window?
Comment 3 Florian Müllner 2011-12-06 16:48:31 UTC
Keyboard shortcut or dragging the toolbar (when using Adwaita). I also have a shell patch locally which extends the dragable area to unused space in the top bar.
Comment 4 Matthias Clasen 2011-12-07 15:52:41 UTC
The design notes mention Super+Drag to unmaximize, but that doesn't work on arbitrary window content in my tests
Comment 5 Florian Müllner 2011-12-07 16:03:42 UTC
(In reply to comment #4)
> The design notes mention Super+Drag to unmaximize, but that doesn't work on
> arbitrary window content in my tests

Nope, because "mouse-button-modifier" is currently set to 'Alt' - I know the designers would like to have it changed to 'Super' (mostly because 'Alt' as mouse button modifier is commonly used by graphics applications), but there's a bug regarding the overview key which would need fixing first (see bug 665616)
Comment 6 Owen Taylor 2011-12-07 17:53:10 UTC
Review of attachment 202858 [details] [review]:

I guess we'll see about whether people figure out unmaximize.

It feels a little wasteful to me to use a whole property round-trip for one bit, but I suppose adding a _GTK_FRAME_FLAGS property with one defined bit would be silly future-proofing, and it's good to keep this isolated as a somewhat experimental feature.

::: src/core/constraints.c
@@ +443,3 @@
    */
   if (meta_prefs_get_force_fullscreen() &&
+      !window->hide_titlebar_when_maximized &&

Think this could do with a comment above, e.g., 

 'Don't get fooled by a title-bar hidden, maximized window;
  that's not the same as fullscreen, even if there are no
  struts making the workarea smaller than the monitor.'

::: src/core/window-props.c
@@ +1616,3 @@
+      META_WINDOW_MAXIMIZED (window) &&
+      window->frame)
+    meta_ui_reset_frame_bg (window->screen->ui, window->frame->xwindow);

A) Ugh ... the only current usage of this is inside meta-frame.c, this strikes me as an encapsulation leakage
B) Won't we hit meta_frame_sync_to_window() if it matters and we add or remove the frame
C) At least add some meta_frame_ wrapper to avoid window->frame->xwindow access?
D) Isn't it wrong to have the !window->hide_titlebar_when_maximized - do we need to do this when both adding and removing the frame, not just in one direction?

::: src/meta/common.h
@@ +55,3 @@
   META_FRAME_TILED_LEFT               = 1 << 15,
+  META_FRAME_TILED_RIGHT              = 1 << 16,
+  META_FRAME_TITLEBAR_HIDDEN          = 1 << 17

This strikes me as strongly duplicating META_FRAME_TYPE_BORDER which is a window with titlebar hidden; can we combine them in some fashion? Either get rid of FRAME_TYPE_BORDER in favor of this (if we want to support different appearance for different frame types with the titlebar hidden), or just use FRAME_TYPE_BORDER.
Comment 7 Florian Müllner 2011-12-07 23:08:25 UTC
Created attachment 203036 [details] [review]
window: Support GTK+'s hide-titlebar-when-maximized hint

(In reply to comment #6)
> ::: src/core/constraints.c
> @@ +443,3 @@
>     */
>    if (meta_prefs_get_force_fullscreen() &&
> +      !window->hide_titlebar_when_maximized &&
> 
> Think this could do with a comment above

Done.


> ::: src/core/window-props.c
> @@ +1616,3 @@
> +      META_WINDOW_MAXIMIZED (window) &&
> +      window->frame)
> +    meta_ui_reset_frame_bg (window->screen->ui, window->frame->xwindow);
> 
> A) Ugh ... the only current usage of this is inside meta-frame.c, this strikes
> me as an encapsulation leakage

Not sure I agree - I don't see much of a difference to meta_ui_(un)map_frame, meta_ui_set_frame_title, meta_ui_queue_frame_draw or meta_ui_update_frame_style, all of which are used outside of meta-frame.c.


> B) Won't we hit meta_frame_sync_to_window() if it matters and we add or remove
> the frame

Usually yes, but I've seen flashes/artifacts when toggling the hide-titlebar and prefers-dark-theme properties in gtk3-demo (which is admittedly a corner case, as neither property is expected to actually change)


> C) At least add some meta_frame_ wrapper to avoid window->frame->xwindow
> access?

Not sure I'd deem that necessary - there are already precendents for accessing window->frame->xwindow from window-props.c/window.c (see (A))


> D) Isn't it wrong to have the !window->hide_titlebar_when_maximized - do we
> need to do this when both adding and removing the frame, not just in one
> direction?

The assumption was that if hide_titlebar_when_maximized == TRUE, the visible frame area would decrease, so the existing background would remain valid. Can't hurt to update anyway, so I removed that condition.


> ::: src/meta/common.h
> @@ +55,3 @@
>    META_FRAME_TILED_LEFT               = 1 << 15,
> +  META_FRAME_TILED_RIGHT              = 1 << 16,
> +  META_FRAME_TITLEBAR_HIDDEN          = 1 << 17
> 
> [...]
> just use FRAME_TYPE_BORDER.

OK. When I played around with that, it did not remove the titlebar from windows (though the titlebar itself ended up empty) - apparently Adwaita's metacity theme was incomplete there (fixed in master), but it still leaves the question whether we should enforce has_title=false for META_FRAME_TYPE_BORDER.
Comment 8 Owen Taylor 2011-12-15 15:17:46 UTC
Review of attachment 203036 [details] [review]:

Looks good to me
Comment 9 Florian Müllner 2011-12-15 15:41:25 UTC
Attachment 203036 [details] pushed as 9729a99 - window: Support GTK+'s hide-titlebar-when-maximized hint