[yelp/f18: 2/2] Improve focus and window placement
Matthias Clasen
mclasen at fedoraproject.org
Fri Jan 4 20:15:33 UTC 2013
commit 928eab94e30aa9763bc25e2b14cec8d638023a0e
Author: Matthias Clasen <mclasen at redhat.com>
Date: Fri Jan 4 15:15:30 2013 -0500
Improve focus and window placement
0001-Center-new-windows.patch | 26 +++++++++++++
0001-Don-t-steal-focus-optionally.patch | 62 +++++++++++++++++++++++++++++++
yelp.spec | 12 +++++-
3 files changed, 99 insertions(+), 1 deletions(-)
---
diff --git a/0001-Center-new-windows.patch b/0001-Center-new-windows.patch
new file mode 100644
index 0000000..e971c3d
--- /dev/null
+++ b/0001-Center-new-windows.patch
@@ -0,0 +1,26 @@
+From c323dd5087a15cb2b820fedf311ca288ec347878 Mon Sep 17 00:00:00 2001
+From: Matthias Clasen <mclasen at redhat.com>
+Date: Thu, 8 Nov 2012 22:57:12 -0500
+Subject: [PATCH] Center new windows
+
+This makes more sense than letting mutter put them in the top
+left corner.
+---
+ src/yelp-application.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/yelp-application.c b/src/yelp-application.c
+index 2d004c2..e669661 100644
+--- a/src/yelp-application.c
++++ b/src/yelp-application.c
+@@ -444,6 +444,7 @@ application_uri_resolved (YelpUri *uri,
+
+ g_settings_get (settings, "geometry", "(ii)", &width, &height);
+ window = yelp_window_new (data->app);
++ gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
+ gtk_window_set_default_size (GTK_WINDOW (window), width, height);
+ g_signal_connect (window, "resized", G_CALLBACK (window_resized), data->app);
+ priv->windows = g_slist_prepend (priv->windows, window);
+--
+1.7.12.1
+
diff --git a/0001-Don-t-steal-focus-optionally.patch b/0001-Don-t-steal-focus-optionally.patch
new file mode 100644
index 0000000..5fb935e
--- /dev/null
+++ b/0001-Don-t-steal-focus-optionally.patch
@@ -0,0 +1,62 @@
+From b76206bbdeb710853f585942377badff0a4c1df9 Mon Sep 17 00:00:00 2001
+From: Matthias Clasen <mclasen at redhat.com>
+Date: Thu, 8 Nov 2012 21:43:31 -0500
+Subject: [PATCH] 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 file 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);
+--
+1.7.12.1
+
diff --git a/yelp.spec b/yelp.spec
index a8a6cf6..adc25be 100644
--- a/yelp.spec
+++ b/yelp.spec
@@ -2,10 +2,15 @@ Summary: Help browser for the GNOME desktop
Name: yelp
Epoch: 1
Version: 3.7.3
-Release: 1%{?dist}
+Release: 2%{?dist}
#VCS: git:git://git.gnome.org/yelp
Source: http://download.gnome.org/sources/yelp/3.7/%{name}-%{version}.tar.xz
+# https://bugzilla.gnome.org/show_bug.cgi?id=687957
+Patch0: 0001-Don-t-steal-focus-optionally.patch
+# https://bugzilla.gnome.org/show_bug.cgi?id=687960
+Patch1: 0001-Center-new-windows.patch
+
URL: http://live.gnome.org/Yelp
License: GPLv2+
Group: Applications/System
@@ -56,6 +61,8 @@ the libraries in the yelp-libs package.
%prep
%setup -q
+%patch0 -p1
+%patch1 -p1
%build
%configure
@@ -120,6 +127,9 @@ gtk-update-icon-cache %{_datadir}icons/hicolor &> /dev/null || :
%changelog
+* Fri Jan 4 2013 Matthias Clasen <mclasen at redhat.com> - 1:3.7.3-2
+- Optionally do the right thing with focus and window placement
+
* Fri Dec 21 2012 Kalev Lember <kalevlember at gmail.com> - 1:3.7.3-1
- Update to 3.7.3
More information about the scm-commits
mailing list