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 #include #include +#include #include #include @@ -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; }