Author: pollux
Date: 2007-10-28 17:05:29 +0000 (Sun, 28 Oct 2007)
New Revision: 26208
Modified:
libxfcegui4/trunk/libxfcegui4/xfce-exec.c
Log:
Start program on the correct screen.
The DISPLAY environment variable is always :0.0 even if the program has
to be started on an other screen. This patch changes the DISPLAY
environment variable to use the wanted screen, if anyone has a better
idea to fix that issue feel free to improve.
Modified: libxfcegui4/trunk/libxfcegui4/xfce-exec.c
===================================================================
--- libxfcegui4/trunk/libxfcegui4/xfce-exec.c 2007-10-28 15:50:54 UTC (rev
26207)
+++ libxfcegui4/trunk/libxfcegui4/xfce-exec.c 2007-10-28 17:05:29 UTC (rev
26208)
@@ -53,6 +53,7 @@
#include <libxfce4util/libxfce4util.h>
#include "xfce-exec.h"
+#include "xfce-gdk-extensions.h"
#include "xfce-startup-notification.h"
extern char **environ;
@@ -122,19 +123,37 @@
if (async)
{
+ gchar **cur = NULL;
+
spawn_flags = G_SPAWN_SEARCH_PATH;
if (want_child_watch)
{
spawn_flags |= G_SPAWN_DO_NOT_REAP_CHILD;
}
-
+
+ if (!free_envp)
+ free_envp = g_strdupv (envp);
+
+ for (cur = free_envp; *cur; cur++)
+ {
+ if ((strlen (*cur) > 7) && (g_strncasecmp ("DISPLAY", *cur, 7) ==
0))
+ {
+ gchar *dpyname = gdk_screen_make_display_name (screen);
+
+ g_free (*cur);
+ *cur = g_strconcat ("DISPLAY=", dpyname, NULL);
+
+ g_free (dpyname);
+ }
+ }
+
success = gdk_spawn_on_screen (screen,
NULL, argv,
- free_envp ? free_envp : envp,
- spawn_flags,
- child_setup_async, NULL, &pid,
- error);
+ free_envp,
+ spawn_flags,
+ child_setup_async, NULL, &pid,
+ error);
}
else
{
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits