]> git.0d.be Git - empathy.git/commitdiff
Make empathy_present_window() also move to current desktop with compiz. Fixes bug...
authorXavier Claessens <xclaesse@gmail.com>
Mon, 23 Nov 2009 13:31:30 +0000 (14:31 +0100)
committerXavier Claessens <xclaesse@gmail.com>
Mon, 23 Nov 2009 16:04:28 +0000 (17:04 +0100)
libempathy-gtk/empathy-ui-utils.c

index 523b89351c2743881c0d71b6517fc8b7b6003b50..be6aaa24998fa11d7eef4eacc39a810696520619 100644 (file)
@@ -1302,14 +1302,26 @@ empathy_window_present (GtkWindow *window,
        /* Move the window to the current workspace before trying to show it.
         * This is the behaviour people expect when clicking on the statusbar icon. */
        gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
-       if (gdk_window)
+       if (gdk_window) {
+               gint x, y;
+               gint w, h;
+
+               /* Has no effect if the WM has viewports, like compiz */
                gdk_x11_window_move_to_current_desktop (gdk_window);
 
+               /* If window is still off-screen, hide it to force it to
+                * reposition on the current workspace. */
+               gtk_window_get_position (window, &x, &y);
+               gtk_window_get_size (window, &w, &h);
+               if (x + w < 0 || y + h < 0 ||
+                   x > gdk_screen_width () ||
+                   y > gdk_screen_height ())
+                       gtk_widget_hide (GTK_WIDGET (window));
+       }
+
        timestamp = gtk_get_current_event_time ();
        gtk_window_present_with_time (window, timestamp);
        gtk_window_set_skip_taskbar_hint (window, FALSE);
-       /* FIXME: This shouldn't be required as gtk_window_present's doc says
-        *        it deiconify automatically. */
        gtk_window_deiconify (window);
 }