[Window] Bugfixes in pull() code
authorIra W. Snyder <devel@irasnyder.com>
Fri, 18 Jan 2008 00:55:32 +0000 (16:55 -0800)
committerIra W. Snyder <devel@irasnyder.com>
Fri, 18 Jan 2008 00:55:32 +0000 (16:55 -0800)
This fixes numerous bugs in the pull() code. Some window properties were
being reset by Metacity when the window was hidden, so we must re-set them
every single time the window is re-shown. Lame.

Also, Metacity iconified (minimized) the window if it was pulled down on
one workspace, pulled up while on another workspace, then pulled down on
the current workspace. We'll have to work around that (stupid) behavior
too. Doubly lame.

tilda-window.c

index 6c41340..731739b 100644 (file)
@@ -167,19 +167,35 @@ tilda_window_keybinding_cb (const gchar *keystr, gpointer data)
 
        switch (self->state)
        {
-               case WINDOW_UP:
-                       /* Pull Down */
-                       tomboy_window_present_hardcore (GTK_WINDOW(self->window));
-                       self->state = WINDOW_DOWN;
-
-                       // Focusing the term here works perfectly, near as I can tell
+               case WINDOW_UP: /* Pull the window up */
+
+                       /* Bugfix: having this here keeps the tilda window from being
+                        * hidden if you turn off "stick", pull it down on workspace 1,
+                        * switch to workspace 2, then pull it up and back down. Without
+                        * this, something in metacity (at least) hides the window. Stupid. */
+                       gtk_window_deiconify (GTK_WINDOW(self->window));
+
+                       /* Re-set the window properties that do not linger after hiding the
+                        * window. I know this looks stupid, but it keeps all of the state-
+                        * changing code in the place it belongs: the property-setting code. */
+                       g_object_set (G_OBJECT(self),
+                                       "keep-above", self->keep_above,
+                                       "stick", self->stick,
+                                       NULL);
+                       gtk_window_present_with_time (GTK_WINDOW(self->window),
+                                                                                 tomboy_keybinder_get_current_event_time());
+
+                       /* Focusing the term here works perfectly, near as I can tell */
                        tt = tilda_window_find_current_terminal (self);
                        gtk_widget_grab_focus (GTK_WIDGET(tt->vte_term));
+
+                       self->state = WINDOW_DOWN;
                        break;
 
-               case WINDOW_DOWN:
-                       /* Pull Up */
+               case WINDOW_DOWN: /* Pull the window up */
+
                        gtk_widget_hide (GTK_WIDGET(self->window));
+
                        self->state = WINDOW_UP;
                        break;