From 0ae3761771c86563ae751e8e6ba40d01cc472232 Mon Sep 17 00:00:00 2001 From: "Ira W. Snyder" Date: Tue, 22 Jan 2008 12:06:33 -0800 Subject: [PATCH] [Window] Another try at thwarting focus-stealing prevention Try to keep focus-stealing prevention out of our way. This unconditionally sets the X11 property _NET_WM_USER_TIME on our window when activated by the global keybinding callback. --- tilda-window.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tilda-window.c b/tilda-window.c index f0852aa..f20b273 100644 --- a/tilda-window.c +++ b/tilda-window.c @@ -230,7 +230,12 @@ tilda_window_keybinding_cb (const gchar *keystr, gpointer data) TildaWindow *self = TILDA_WINDOW(data); TildaTerminal *tt; - // FIXME: this doesn't handle animation! + /* This call sets the X11 window property _NET_WM_USER_TIME, which GTK+ normally + * sets for us. However, because this callback is activated via a global keybinding, + * we see the event before GDK / GTK+ does. Therefore, to get the focus, we must + * set the property ourselves. */ + gdk_x11_window_set_user_time (GTK_WIDGET(self->window)->window, + tomboy_keybinder_get_current_event_time()); switch (self->state) { @@ -249,8 +254,7 @@ tilda_window_keybinding_cb (const gchar *keystr, gpointer data) "keep-above", self->keep_above, "stick", self->stick, NULL); - gtk_window_present_with_time (GTK_WINDOW(self->window), - tomboy_keybinder_get_current_event_time()); + gtk_widget_show (GTK_WIDGET(self->window)); /* Focusing the term here works perfectly, near as I can tell */ tt = tilda_window_find_current_terminal (self); @@ -611,6 +615,7 @@ tilda_window_constructor (GType type, tilda_window_setup_real_transparency (self); gtk_container_add (GTK_CONTAINER(self->window), self->notebook); + g_object_set (G_OBJECT(self->notebook), "can-focus", FALSE, NULL); gtk_widget_show (self->notebook); // FIXME: Remove these, and replace with reads from the config system -- 2.25.1