[mutter] window: Support GTK+'s hide-titlebar-when-maximized hint
- From: Florian MÃllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] window: Support GTK+'s hide-titlebar-when-maximized hint
- Date: Thu, 15 Dec 2011 15:39:47 +0000 (UTC)
commit 9729a99ec541ac353906f0e2a18da3b78ad414c7
Author: Florian MÃllner <fmuellner gnome org>
Date: Fri Oct 7 12:45:56 2011 +0200
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.
https://bugzilla.gnome.org/show_bug.cgi?id=665617
src/core/constraints.c | 6 +++++-
src/core/window-private.h | 1 +
src/core/window-props.c | 29 +++++++++++++++++++++++++++++
src/core/window.c | 3 ++-
src/meta/atomnames.h | 1 +
5 files changed, 38 insertions(+), 2 deletions(-)
---
diff --git a/src/core/constraints.c b/src/core/constraints.c
index 6ceb336..bf12133 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -439,9 +439,13 @@ setup_constraint_info (ConstraintInfo *info,
monitor_info->number);
/* Workaround braindead legacy apps that don't know how to
- * fullscreen themselves properly.
+ * fullscreen themselves properly - don't get fooled by
+ * windows which hide their titlebar when maximized; that's
+ * not the same as fullscreen, even if there are no struts
+ * making the workarea smaller than the monitor.
*/
if (meta_prefs_get_force_fullscreen() &&
+ !window->hide_titlebar_when_maximized &&
meta_rectangle_equal (new, &monitor_info->rect) &&
window->has_fullscreen_func &&
!window->fullscreen)
diff --git a/src/core/window-private.h b/src/core/window-private.h
index de1c352..535fcdb 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -105,6 +105,7 @@ struct _MetaWindow
char *dbus_unique_name;
char *dbus_object_path;
+ int hide_titlebar_when_maximized;
int net_wm_pid;
Window xtransient_for;
diff --git a/src/core/window-props.c b/src/core/window-props.c
index 63e0607..f73c26f 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -1590,6 +1590,34 @@ reload_gtk_theme_variant (MetaWindow *window,
}
static void
+reload_gtk_hide_titlebar_when_maximized (MetaWindow *window,
+ MetaPropValue *value,
+ gboolean initial)
+{
+ gboolean requested_value = FALSE;
+ gboolean current_value = window->hide_titlebar_when_maximized;
+
+ if (value->type != META_PROP_VALUE_INVALID)
+ {
+ requested_value = ((int) value->v.cardinal == 1);
+ meta_verbose ("Request to hide titlebar for window %s.\n", window->desc);
+ }
+
+ if (requested_value == current_value)
+ return;
+
+ window->hide_titlebar_when_maximized = requested_value;
+
+ if (META_WINDOW_MAXIMIZED (window))
+ {
+ meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
+
+ if (window->frame)
+ meta_ui_update_frame_style (window->screen->ui, window->frame->xwindow);
+ }
+}
+
+static void
reload_dbus_application_id (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
@@ -1708,6 +1736,7 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
{ display->atom__MOTIF_WM_HINTS, META_PROP_VALUE_MOTIF_HINTS, reload_mwm_hints, TRUE, FALSE },
{ XA_WM_TRANSIENT_FOR, META_PROP_VALUE_WINDOW, reload_transient_for, TRUE, FALSE },
{ display->atom__GTK_THEME_VARIANT, META_PROP_VALUE_UTF8, reload_gtk_theme_variant, TRUE, FALSE },
+ { display->atom__GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED, META_PROP_VALUE_CARDINAL, reload_gtk_hide_titlebar_when_maximized, TRUE, FALSE },
{ display->atom__DBUS_APPLICATION_ID, META_PROP_VALUE_UTF8, reload_dbus_application_id, TRUE, FALSE },
{ display->atom__DBUS_UNIQUE_NAME, META_PROP_VALUE_UTF8, reload_dbus_unique_name, TRUE, FALSE },
{ display->atom__DBUS_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_dbus_object_path, TRUE, FALSE },
diff --git a/src/core/window.c b/src/core/window.c
index 12e3f01..378b49b 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -10539,7 +10539,8 @@ meta_window_get_frame_type (MetaWindow *window)
/* can't add border if undecorated */
return META_FRAME_TYPE_LAST;
}
- else if (window->border_only && base_type != META_FRAME_TYPE_ATTACHED)
+ else if ((window->border_only && base_type != META_FRAME_TYPE_ATTACHED) ||
+ (window->hide_titlebar_when_maximized && META_WINDOW_MAXIMIZED (window)))
{
/* override base frame type */
return META_FRAME_TYPE_BORDER;
diff --git a/src/meta/atomnames.h b/src/meta/atomnames.h
index 268c097..aa33ab7 100644
--- a/src/meta/atomnames.h
+++ b/src/meta/atomnames.h
@@ -59,6 +59,7 @@ item(_MUTTER_SET_KEYBINDINGS_MESSAGE)
item(_MUTTER_TOGGLE_VERBOSE)
item(_MUTTER_HINTS)
item(_GTK_THEME_VARIANT)
+item(_GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED)
item(_DBUS_APPLICATION_ID)
item(_DBUS_UNIQUE_NAME)
item(_DBUS_OBJECT_PATH)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]