aboutsummaryrefslogtreecommitdiffstats
path: root/debian/patches/31_really_raise_window.patch
blob: c6a0e7f9bc037c060f0922b80aa1088f894becbc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Description: Force focus of the window when selected from the indicator
Bug: https://bugs.launchpad.net/bugs/442389

=== modified file 'libempathy-gtk/empathy-ui-utils.c'
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -1599,6 +1599,41 @@
    }
 }
 
+/* Really raise the window, even if the window manager doesn't agree */
+static void
+really_activate_window (GtkWindow *window)
+{
+        Screen *screen;
+        Time    timestamp;
+        XEvent  xev;
+
+        g_return_if_fail (GTK_IS_WINDOW (window));
+
+        screen = GDK_SCREEN_XSCREEN (gtk_widget_get_screen (GTK_WIDGET (window)));
+        timestamp = GDK_CURRENT_TIME;
+
+        xev.xclient.type = ClientMessage;
+        xev.xclient.serial = 0;
+        xev.xclient.send_event = True;
+        xev.xclient.display = GDK_DISPLAY ();
+        xev.xclient.window = GDK_WINDOW_XWINDOW (GTK_WIDGET (window)->window);
+        xev.xclient.message_type = gdk_x11_get_xatom_by_name ("_NET_ACTIVE_WINDOW");
+        xev.xclient.format = 32;
+        xev.xclient.data.l[0] = 2; /* Pager client type */
+        xev.xclient.data.l[1] = timestamp;
+        xev.xclient.data.l[2] = 0;
+        xev.xclient.data.l[3] = 0;
+        xev.xclient.data.l[4] = 0;
+
+        gdk_error_trap_push ();
+        XSendEvent (GDK_DISPLAY (),
+                RootWindowOfScreen (screen),
+                False,
+                SubstructureRedirectMask | SubstructureNotifyMask,
+                &xev);
+        gdk_error_trap_pop ();
+}
+
 /* Takes care of moving the window to the current workspace. */
 void
 empathy_window_present_with_time (GtkWindow *window,
@@ -1633,6 +1668,7 @@
 
    gtk_window_set_skip_taskbar_hint (window, FALSE);
    gtk_window_deiconify (window);
+   really_activate_window (window);
 }
 
 void
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -47,6 +47,7 @@
 #include <libempathy-gtk/empathy-images.h>
 #include <libempathy-gtk/empathy-contact-dialogs.h>
 #include <libempathy-gtk/empathy-sound.h>
+#include <libempathy-gtk/empathy-ui-utils.h>
 
 #include <libido/idomessagedialog.h>
 #include <libempathy-gtk/empathy-ui-utils.h>
@@ -514,7 +515,7 @@
 
   if (event->approval->dialog != NULL)
     {
-      gtk_window_present (GTK_WINDOW (event->approval->dialog));
+      empathy_window_present (GTK_WINDOW (event->approval->dialog));
       return;
     }