summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjörn Weber <[email protected]>2016-04-02 19:08:25 +0200
committerraveit65 <[email protected]>2016-05-11 21:53:30 +0200
commit1b65a062fc01e15c4a461463a055b90d8cb3235e (patch)
tree7b0e1000d873362aba38dada56ef1a058a94328e /src
parentb5000c7c6e3e8de9fb893eb1b45f71514664419b (diff)
downloadeom-1b65a062fc01e15c4a461463a055b90d8cb3235e.tar.bz2
eom-1b65a062fc01e15c4a461463a055b90d8cb3235e.tar.xz
Fix new windows not getting focus
fixes (Issue #119)
Diffstat (limited to 'src')
-rw-r--r--src/eom-application.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/eom-application.c b/src/eom-application.c
index d1797df..6d56e0c 100644
--- a/src/eom-application.c
+++ b/src/eom-application.c
@@ -279,8 +279,24 @@ eom_application_get_file_window (EomApplication *application, GFile *file)
static void
eom_application_show_window (EomWindow *window, gpointer user_data)
{
- gtk_window_present_with_time (GTK_WINDOW (window),
- GPOINTER_TO_UINT (user_data));
+ guint32 timestamp = GPOINTER_TO_UINT (user_data);
+
+ /* set the proper interaction time on the window.
+ * Fall back to roundtripping to the X server when we
+ * don't have the timestamp, e.g. when launched from
+ * terminal. We also need to make sure that the window
+ * has been realized otherwise it will not work. lame.
+ */
+ if (!gtk_widget_get_realized (GTK_WIDGET (window)))
+ gtk_widget_realize (GTK_WIDGET (window));
+
+ if (timestamp <= 0)
+ timestamp = gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (window)));
+
+ gdk_x11_window_set_user_time (gtk_widget_get_window (GTK_WIDGET (window)),
+ timestamp);
+
+ gtk_window_present (GTK_WINDOW (window));
}
/**