[evince] Set DESKTOP_STARTUP_ID env var on spawned evince processes to prevent focus stealing
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evince] Set DESKTOP_STARTUP_ID env var on spawned evince processes to prevent focus stealing
- Date: Wed, 21 Oct 2009 18:06:23 +0000 (UTC)
commit 9e737159821cbf89d0311df1708892897410c4dd
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Wed Oct 21 20:04:08 2009 +0200
Set DESKTOP_STARTUP_ID env var on spawned evince processes to prevent focus stealing
shell/ev-application.c | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 0690cdb..d8aff98 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -399,11 +399,23 @@ build_args (GdkScreen *screen,
}
static void
+child_setup (gpointer user_data)
+{
+ gchar *startup_id;
+
+ startup_id = g_strdup_printf ("_TIME%lu",
+ (unsigned long)GPOINTER_TO_INT (user_data));
+ g_setenv ("DESKTOP_STARTUP_ID", startup_id, TRUE);
+ g_free (startup_id);
+}
+
+static void
ev_spawn (const char *uri,
GdkScreen *screen,
EvLinkDest *dest,
EvWindowRunMode mode,
- const gchar *search_string)
+ const gchar *search_string,
+ guint timestamp)
{
gchar *argv[6];
guint arg = 0;
@@ -446,7 +458,10 @@ ev_spawn (const char *uri,
argv[arg] = NULL;
res = gdk_spawn_on_screen (screen, NULL /* wd */, argv, NULL /* env */,
- 0, NULL, NULL, NULL, &error);
+ 0,
+ child_setup,
+ GINT_TO_POINTER(timestamp),
+ NULL, &error);
if (!res) {
g_warning ("Error launching evince %s: %s\n", uri, error->message);
g_error_free (error);
@@ -608,7 +623,7 @@ ev_application_open_uri_at_dest (EvApplication *application,
if (application->window && !ev_window_is_empty (application->window)) {
if (application->uri && strcmp (application->uri, uri) != 0) {
/* spawn a new evince process */
- ev_spawn (uri, screen, dest, mode, search_string);
+ ev_spawn (uri, screen, dest, mode, search_string, timestamp);
return;
}
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]