[epiphany/wip/exalm/maximize] window: Sanitize maximized and fullscreen state values



commit 2b568d44a1b43f406fa6b18cfb5534b31ce6fa13
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Oct 4 22:52:40 2019 +0500

    window: Sanitize maximized and fullscreen state values
    
    Ensure window->is_maximized is always correct. Do the same to fullscreen
    for consistency. Remove an obsolete comment, since is_maximized actually
    has the correct value now.
    
    Really fixes https://gitlab.gnome.org/GNOME/epiphany/issues/1

 src/ephy-window.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 4cf1d703d..6a4acdd26 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -535,13 +535,9 @@ update_adaptive_mode (EphyWindow *window)
   else
     geometry.height = height;
 
-  /* window->is_maximized doesn't work here for some reason, so we use
-   * gtk_window_is_maximized() instead.
-   */
   is_narrow = width <= 600;
   is_mobile_landscape = geometry.height <= 400 &&
-                        (gtk_window_is_maximized (GTK_WINDOW (window)) ||
-                         window->is_fullscreen);
+                        (window->is_maximized || window->is_fullscreen);
   adaptive_mode = (is_narrow || is_mobile_landscape) && !is_desktop_pantheon () ?
                   EPHY_ADAPTIVE_MODE_NARROW :
                   EPHY_ADAPTIVE_MODE_NORMAL;
@@ -3221,7 +3217,7 @@ ephy_window_state_event (GtkWidget           *widget,
     GAction *action;
     gboolean fullscreen;
 
-    fullscreen = event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN;
+    fullscreen = !!(event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN);
 
     if (fullscreen) {
       ephy_window_fullscreen (window);
@@ -3240,7 +3236,7 @@ ephy_window_state_event (GtkWidget           *widget,
     g_simple_action_set_state (G_SIMPLE_ACTION (action),
                                g_variant_new_boolean (fullscreen));
   } else if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) {
-    window->is_maximized = event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED;
+    window->is_maximized = !!(event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED);
   }
 
   update_adaptive_mode (window);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]