[balsa] Use is-maximized instead of window-state-event



commit 67c3c68e457fd22d329f15379021b23605fe87e5
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Thu May 25 11:09:35 2017 -0400

    Use is-maximized instead of window-state-event
    
        * src/main-window.c (bw_notify_is_maximized_cb),
        (balsa_window_new): connect to "notify::is-maximized" signal
        instead of "window-state-event" to avoid irrelevant state
        changes.
        * src/main.c (real_main): increase the fix-panes timeout again,
        from 600 to 700 msec.

 ChangeLog         |   11 +++++++++++
 src/main-window.c |   20 ++++++++------------
 src/main.c        |    2 +-
 3 files changed, 20 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f72e297..91f6623 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2017-05-25  Peter Bloomfield  <pbloomfield bellsouth net>
 
+       Use is-maximized property instead of window-state-event signal
+
+       * src/main-window.c (bw_notify_is_maximized_cb),
+       (balsa_window_new): connect to "notify::is-maximized" signal
+       instead of "window-state-event" to avoid irrelevant state
+       changes.
+       * src/main.c (real_main): increase the fix-panes timeout again,
+       from 600 to 700 msec.
+
+2017-05-25  Peter Bloomfield  <pbloomfield bellsouth net>
+
        Revert 45b7ce83a56690beb40c37f911f7c61b553d8828, and just
        increase the timeout from 500 to 600 msec.
 
diff --git a/src/main-window.c b/src/main-window.c
index dfa1674..599a9df 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -650,20 +650,16 @@ balsa_window_get_toolbar_model(void)
 }
 
 /*
- * "window-state-event" signal handler
+ * "notify::is-maximized" signal handler
  */
-static gboolean
-bw_window_state_event_cb(BalsaWindow * window,
-                         GdkEventWindowState * event,
-                         GtkStatusbar * statusbar)
+static void
+bw_notify_is_maximized_cb(GtkWindow  * window,
+                          GParamSpec * pspec,
+                          gpointer     user_data)
 {
     /* Note when we are either maximized or fullscreen, to avoid saving
      * nonsensical geometry. */
-    balsa_app.mw_maximized =
-        (event->new_window_state & (GDK_WINDOW_STATE_MAXIMIZED |
-                                    GDK_WINDOW_STATE_FULLSCREEN)) != 0;
-
-    return FALSE;
+    balsa_app.mw_maximized = gtk_window_is_maximized(window);
 }
 
 static void
@@ -2233,8 +2229,8 @@ balsa_window_new()
                        0);
 
     window->statusbar = gtk_statusbar_new();
-    g_signal_connect(window, "window-state-event",
-                     G_CALLBACK(bw_window_state_event_cb),
+    g_signal_connect(window, "notify::is-maximized",
+                     G_CALLBACK(bw_notify_is_maximized_cb),
                      window->statusbar);
     gtk_box_pack_start(GTK_BOX(hbox), window->statusbar, TRUE, TRUE, 0);
     gtk_widget_show_all(hbox);
diff --git a/src/main.c b/src/main.c
index d26a26c..c121e34 100644
--- a/src/main.c
+++ b/src/main.c
@@ -615,7 +615,7 @@ real_main(int argc, char *argv[])
          * to not maximized a couple of times, so we wait until it has
          * stabilized (100 msec is not enough!).
          */
-        g_timeout_add(600, (GSourceFunc) balsa_window_fix_paned, balsa_app.main_window);
+        g_timeout_add(700, (GSourceFunc) balsa_window_fix_paned, balsa_app.main_window);
     } else {
         /* No need to wait. */
         g_idle_add((GSourceFunc) balsa_window_fix_paned, balsa_app.main_window);


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