[ekiga/ds-clutter] GmWindow: Fixed position not being restored when the window is shown.



commit 84b933293593f3b3a3371e2fadba964dc23db340
Author: Damien Sandras <dsandras beip be>
Date:   Mon Dec 30 12:40:46 2013 +0100

    GmWindow: Fixed position not being restored when the window is shown.
    
    We fixed the code to restore the window state when it is realized. That
    prevented a flickering effect to appear when starting Ekiga. However,
    when the window is hidden, then shown again, the state was not restored
    back. This is now fixed by also connecting to the show signal.

 lib/gui/gmwindow.c |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/lib/gui/gmwindow.c b/lib/gui/gmwindow.c
index 41052c5..a9268c1 100644
--- a/lib/gui/gmwindow.c
+++ b/lib/gui/gmwindow.c
@@ -50,6 +50,7 @@ struct _GmWindowPrivate
   GSettings *settings;
   gboolean hide_on_esc;
   gboolean hide_on_delete;
+  gboolean state_restored;
   gchar *key;
   int x;
   int y;
@@ -74,6 +75,10 @@ window_realize_cb (GtkWidget *w,
                   gpointer data);
 
 static void
+window_show_cb (GtkWidget *w,
+                gpointer data);
+
+static void
 window_hide_cb (GtkWidget *w,
                gpointer data);
 
@@ -212,6 +217,7 @@ gm_window_init (GmWindow* self)
   self->priv->key = g_strdup ("");
   self->priv->hide_on_esc = TRUE;
   self->priv->hide_on_delete = TRUE;
+  self->priv->state_restored = FALSE;
 
   self->priv->accel = gtk_accel_group_new ();
   gtk_window_add_accel_group (GTK_WINDOW (self), self->priv->accel);
@@ -221,6 +227,9 @@ gm_window_init (GmWindow* self)
   g_signal_connect (self, "delete-event",
                    G_CALLBACK (gm_window_delete_event_cb), NULL);
 
+  g_signal_connect (self, "show",
+                    G_CALLBACK (window_show_cb), self);
+
   g_signal_connect (self, "realize",
                     G_CALLBACK (window_realize_cb), self);
 
@@ -260,15 +269,32 @@ window_realize_cb (GtkWidget *w,
 
   self = GM_WINDOW (w);
 
-  g_return_if_fail (g_strcmp0 (self->priv->key, "") && self);
+  g_return_if_fail (self);
 
   gm_window_restore (self);
+  self->priv->state_restored = TRUE;
 
   gtk_widget_realize (GTK_WIDGET (w));
 }
 
 
 static void
+window_show_cb (GtkWidget *w,
+                G_GNUC_UNUSED gpointer data)
+{
+  GmWindow *self = NULL;
+
+  self = GM_WINDOW (w);
+
+  g_return_if_fail (self);
+
+  if (!self->priv->state_restored)
+    gm_window_restore (self);
+}
+
+
+
+static void
 window_hide_cb (GtkWidget *w,
                 G_GNUC_UNUSED gpointer data)
 {
@@ -279,6 +305,7 @@ window_hide_cb (GtkWidget *w,
   self = GM_WINDOW (w);
 
   gm_window_save (self);
+  self->priv->state_restored = FALSE;
 }
 
 


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