[yelp] Don't steal focus, optionally
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp] Don't steal focus, optionally
- Date: Fri, 5 Apr 2013 19:35:40 +0000 (UTC)
commit eec97819f8cb48f2ea1df56fab077608e75d1604
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Nov 8 21:43:31 2012 -0500
Don't steal focus, optionally
It is somewhat rude to steal focus like this, and it actively
interferes with some use cases for launching yelp in the background.
Add a commandline option --dont-steal-focus, to make those
use cases work.
src/yelp-application.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/src/yelp-application.c b/src/yelp-application.c
index 057cafd..2d004c2 100644
--- a/src/yelp-application.c
+++ b/src/yelp-application.c
@@ -43,6 +43,7 @@
#define DEFAULT_URI "help:gnome-help"
static gboolean editor_mode = FALSE;
+static gboolean dont_steal_focus = FALSE;
enum {
READ_LATER_CHANGED,
@@ -63,6 +64,7 @@ option_version_cb (const gchar *option_name,
static const GOptionEntry entries[] = {
{"editor-mode", 0, 0, G_OPTION_ARG_NONE, &editor_mode, N_("Turn on editor mode"), NULL},
+ {"dont-steal-focus", 0, 0, G_OPTION_ARG_NONE, &dont_steal_focus, N_("Don't steal focus"), NULL},
{ "version", 0, G_OPTION_FLAG_NO_ARG | G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_CALLBACK, option_version_cb,
NULL, NULL },
{ NULL }
};
@@ -472,15 +474,17 @@ application_uri_resolved (YelpUri *uri,
if (gdk_window)
gdk_x11_window_move_to_current_desktop (gdk_window);
- /* Ensure we actually present the window when invoked from the command
- * line. This is somewhat evil, but the minor evil of Yelp stealing
- * focus (after you requested it) is outweighed for me by the major
- * evil of no help window appearing when you click Help.
- */
- if (data->timestamp == 0)
- data->timestamp = gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (window)));
+ if (!dont_steal_focus) {
+ /* Ensure we actually present the window when invoked from the command
+ * line. This is somewhat evil, but the minor evil of Yelp stealing
+ * focus (after you requested it) is outweighed for me by the major
+ * evil of no help window appearing when you click Help.
+ */
+ if (data->timestamp == 0)
+ data->timestamp = gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (window)));
- gtk_window_present_with_time (GTK_WINDOW (window), data->timestamp);
+ gtk_window_present_with_time (GTK_WINDOW (window), data->timestamp);
+ }
g_object_unref (uri);
g_free (data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]