]> spindle.queued.net Git - midori/commitdiff
Handle window raising without the help of unique
authorChristian Dywan <christian@twotoasts.de>
Wed, 6 Jan 2010 21:30:59 +0000 (22:30 +0100)
committerChristian Dywan <christian@twotoasts.de>
Wed, 6 Jan 2010 22:40:46 +0000 (23:40 +0100)
midori/midori-app.c

index c1df59e4f91a71bf6a1f3bad1b887dafb96a652e..6a8a0f0813d0b397e5e0a716f8b115675f381100 100644 (file)
@@ -206,8 +206,10 @@ _midori_app_add_browser (MidoriApp*     app,
 
     app->browser = browser;
     #if HAVE_UNIQUE
+    /* We *do not* let unique watch windows because that includes
+        bringing windows in the foreground, even from other workspaces.
     if (app->instance)
-        unique_app_watch_window (app->instance, GTK_WINDOW (browser));
+        unique_app_watch_window (app->instance, GTK_WINDOW (browser)); */
     #endif
 }
 
@@ -391,6 +393,15 @@ midori_app_class_init (MidoriAppClass* class)
                                      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
 }
 
+static void
+midori_app_raise_window (GtkWindow* window,
+                         GdkScreen* screen)
+{
+    gtk_window_set_screen (window, screen);
+    gtk_window_present (window);
+    gtk_window_deiconify (window);
+}
+
 static gboolean
 midori_app_command_received (MidoriApp*   app,
                              const gchar* command,
@@ -410,8 +421,7 @@ midori_app_command_received (MidoriApp*   app,
         if (!app->browser)
             return FALSE;
 
-        gtk_window_set_screen (GTK_WINDOW (app->browser), screen);
-        gtk_window_present (GTK_WINDOW (app->browser));
+        midori_app_raise_window (GTK_WINDOW (app->browser), screen);
         return TRUE;
     }
     else if (g_str_equal (command, "new"))
@@ -421,8 +431,8 @@ midori_app_command_received (MidoriApp*   app,
         /* FIXME: Should open the homepage according to settings */
         midori_browser_add_uri (browser, "");
         midori_browser_activate_action (browser, "Location");
-        gtk_window_set_screen (GTK_WINDOW (app->browser), screen);
         gtk_widget_show (GTK_WIDGET (browser));
+        midori_app_raise_window (GTK_WINDOW (browser), screen);
         return TRUE;
     }
     else if (g_str_equal (command, "open"))
@@ -430,8 +440,6 @@ midori_app_command_received (MidoriApp*   app,
         if (!app->browser)
             return FALSE;
 
-        gtk_window_set_screen (GTK_WINDOW (app->browser), screen);
-        gtk_window_present (GTK_WINDOW (app->browser));
         if (!uris)
             return FALSE;
         else
@@ -446,11 +454,13 @@ midori_app_command_received (MidoriApp*   app,
             {
                 browser = midori_app_create_browser (app);
                 midori_app_add_browser (app, browser);
-                gtk_window_set_screen (GTK_WINDOW (app->browser), screen);
                 gtk_widget_show (GTK_WIDGET (browser));
             }
             else
                 browser = app->browser;
+
+            midori_app_raise_window (GTK_WINDOW (browser), screen);
+
             first = (open_external_pages_in == MIDORI_NEW_PAGE_CURRENT);
             while (*uris)
             {
@@ -605,8 +615,6 @@ midori_app_io_channel_watch_cb (GIOChannel*  channel,
         }
     }
 
-    gtk_window_present (GTK_WINDOW (app->browser));
-
     fd_close (sock);
 
     return TRUE;