From 47273eaab69fa967cb575609f476a3cc53e6c3cd Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Wed, 5 Mar 2014 19:01:11 -0500 Subject: [PATCH] Fix identification of CSD windows when checking whether to force fullscreen We try to exempt CSD windows from being forced fullscreen if they are undecorated and the size of the screen; however, we also catch almost all windows that *do* need to be forced fullscreen in this check, since they also have decorations turned off. Identify actual CSD windows by checking whether _GTK_FRAME_EXTENTS is set - GTK+ will always set this on CSD windows even if they have no invisible borders or shadows at the current time. https://bugzilla.gnome.org/show_bug.cgi?id=723029 --- src/core/constraints.c | 2 +- src/core/window-private.h | 2 ++ src/core/window.c | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/core/constraints.c b/src/core/constraints.c index b59aa065f..c6950ce01 100644 --- a/src/core/constraints.c +++ b/src/core/constraints.c @@ -426,7 +426,7 @@ setup_constraint_info (ConstraintInfo *info, */ if (meta_prefs_get_force_fullscreen() && !window->hide_titlebar_when_maximized && - window->decorated && + (window->decorated || !meta_window_is_client_decorated (window)) && 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 b282efe36..03f671525 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -694,4 +694,6 @@ Window meta_window_get_toplevel_xwindow (MetaWindow *window); void meta_window_get_client_area_rect (const MetaWindow *window, cairo_rectangle_int_t *rect); +gboolean meta_window_is_client_decorated (MetaWindow *window); + #endif diff --git a/src/core/window.c b/src/core/window.c index 2593f2769..2ac5a10c9 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -10127,6 +10127,24 @@ meta_window_same_client (MetaWindow *window, (other_window->xwindow & ~resource_mask)); } +/** + * meta_window_is_client_decorated: + * + * Check if if the window has decorations drawn by the client. + * (window->decorated refers only to whether we should add decorations) + */ +gboolean +meta_window_is_client_decorated (MetaWindow *window) +{ + /* Currently the implementation here is hackish - + * has_custom_frame_extents() is set if _GTK_FRAME_EXTENTS is set + * to any value even 0. GTK+ always sets _GTK_FRAME_EXTENTS for + * client-side-decorated window, even if the value is 0 because + * the window is maxized and has no invisible borders or shadows. + */ + return window->has_custom_frame_extents; +} + void meta_window_refresh_resize_popup (MetaWindow *window) {