Blob Blame History Raw
From 5d53aacdae7666887c5776888974db3973278a5e Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Wed, 29 Jul 2015 19:02:48 +0200
Subject: [PATCH] window: Remove fullscreen_after_placement special case

This was introduced in commit c6793d477a324f857d31d0704f84ed9de0f1d680
to prevent window self-maximisation. It turns out that that bug seems
to have been fixed meanwhile in a different way since the reproducer
in https://bugzilla.gnome.org/show_bug.cgi?id=461927#c37 now works
fine with this special handling removed.

In fact, failing to set window->fullscreen immediately when loading
the initial set of X properties causes us to create a UI frame for a
window that sets _NET_WM_STATE_FULLSCREEN.

This, in turn, might cause the fullscreen constrain code to fail if
the window also sets min_width/min_height size hints to be the monitor
size since the UI frame size added to those makes the rectangle too
big to fit the monitor. If the window doesn't set these hints, we
fullscreen it but the window will get sized such that the UI frame is
taken into account while it really shouldn't (see the reproducer
above).

https://bugzilla.gnome.org/show_bug.cgi?id=753020
---
 src/core/constraints.c    | 16 +++-------------
 src/core/window-private.h |  3 ---
 src/core/window.c         |  1 -
 src/x11/window-props.c    |  5 ++++-
 4 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/src/core/constraints.c b/src/core/constraints.c
index 1cff417..46e524f 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -508,11 +508,10 @@ place_window_if_needed(MetaWindow     *window,
   if (window->placed || did_placement)
     {
       if (window->maximize_horizontally_after_placement ||
-          window->maximize_vertically_after_placement   ||
-          window->fullscreen_after_placement)
+          window->maximize_vertically_after_placement)
         {
-          /* define a sane saved_rect so that the user can unmaximize or
-           * make unfullscreen to something reasonable.
+          /* define a sane saved_rect so that the user can unmaximize to
+           * something reasonable.
            */
           if (info->current.width >= info->work_area_monitor.width)
             {
@@ -540,15 +539,6 @@ place_window_if_needed(MetaWindow     *window,
                 (window->maximize_vertically_after_placement ?
                  META_MAXIMIZE_VERTICAL : 0), &info->current);
 
-          if (window->fullscreen_after_placement)
-            {
-              window->saved_rect = info->current;
-              window->fullscreen = TRUE;
-              window->fullscreen_after_placement = FALSE;
-
-              g_object_notify (G_OBJECT (window), "fullscreen");
-            }
-
           window->maximize_horizontally_after_placement = FALSE;
           window->maximize_vertically_after_placement = FALSE;
         }
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 713acd3..9f98739 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -174,9 +174,6 @@ struct _MetaWindow
   /* Whether the window is marked as urgent */
   guint urgent : 1;
 
-  /* Whether we have to fullscreen after placement */
-  guint fullscreen_after_placement : 1;
-
   /* Area to cover when in fullscreen mode.  If _NET_WM_FULLSCREEN_MONITORS has
    * been overridden (via a client message), the window will cover the union of
    * these monitors.  If not, this is the single monitor which the window's
diff --git a/src/core/window.c b/src/core/window.c
index 2e82741..9e2ebf5 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -860,7 +860,6 @@ _meta_window_shared_new (MetaDisplay         *display,
   window->maximize_vertically_after_placement = FALSE;
   window->minimize_after_placement = FALSE;
   window->fullscreen = FALSE;
-  window->fullscreen_after_placement = FALSE;
   window->fullscreen_monitors[0] = -1;
   window->require_fully_onscreen = TRUE;
   window->require_on_single_monitor = TRUE;
diff --git a/src/x11/window-props.c b/src/x11/window-props.c
index 3164985..0851f22 100644
--- a/src/x11/window-props.c
+++ b/src/x11/window-props.c
@@ -819,7 +819,10 @@ reload_net_wm_state (MetaWindow    *window,
       else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_SKIP_PAGER)
         priv->wm_state_skip_pager = TRUE;
       else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_FULLSCREEN)
-        window->fullscreen_after_placement = TRUE;
+        {
+          window->fullscreen = TRUE;
+          g_object_notify (G_OBJECT (window), "fullscreen");
+        }
       else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_ABOVE)
         window->wm_state_above = TRUE;
       else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_BELOW)
-- 
2.4.3