mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
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
This commit is contained in:
parent
d64c5bfc11
commit
9729a99ec5
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -1589,6 +1589,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,
|
||||
@ -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 },
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user