[epiphany/gnome-3-34] window: Sanitize maximized and fullscreen state values



commit dbae7498d44a6aaec16c6b03d53708152df4943c
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 1. 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 cd105beda..c98d7b88f 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -534,13 +534,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 ?
                   EPHY_ADAPTIVE_MODE_NARROW :
                   EPHY_ADAPTIVE_MODE_NORMAL;
@@ -3220,7 +3216,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);
@@ -3239,7 +3235,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]