17059
|
1 |
diff -urN yelp.orig/src/Makefile.am yelp.new/src/Makefile.am
|
|
2 |
--- yelp.orig/src/Makefile.am 2009-06-12 11:32:27.311453656 +0100
|
|
3 |
+++ yelp.new/src/Makefile.am 2009-06-12 11:42:32.735084451 +0100
|
|
4 |
@@ -28,7 +28,8 @@
|
|
5 |
yelp-info-parser.c yelp-info-parser.h \
|
|
6 |
gtkentryaction.c gtkentryaction.h \
|
|
7 |
yelp-search.c yelp-search.h \
|
|
8 |
- yelp-search-parser.c yelp-search-parser.h
|
|
9 |
+ yelp-search-parser.c yelp-search-parser.h \
|
|
10 |
+ yelp-tx.c yelp-tx.h
|
|
11 |
|
|
12 |
YELP_DEFINES = \
|
|
13 |
-DG_LOG_DOMAIN=\"Yelp\" \
|
|
14 |
diff -urN yelp.orig/src/yelp-main.c yelp.new/src/yelp-main.c
|
|
15 |
--- yelp.orig/src/yelp-main.c 2009-06-12 11:32:27.316918730 +0100
|
|
16 |
+++ yelp.new/src/yelp-main.c 2009-06-12 15:02:32.145926917 +0100
|
|
17 |
@@ -30,6 +30,7 @@
|
|
18 |
#include <dbus/dbus-glib-bindings.h>
|
|
19 |
#include <string.h>
|
|
20 |
#include <stdlib.h>
|
|
21 |
+#include <zone.h>
|
|
22 |
|
|
23 |
#ifdef WITH_SMCLIENT
|
|
24 |
#include "eggsmclient.h"
|
|
25 |
@@ -38,6 +39,7 @@
|
|
26 |
#include "yelp-window.h"
|
|
27 |
#include "yelp-base.h"
|
|
28 |
#include "yelp-html.h"
|
|
29 |
+#include "yelp-tx.h"
|
|
30 |
|
|
31 |
static gchar *cache_dir;
|
|
32 |
static gchar *open_urls;
|
|
33 |
@@ -337,6 +339,7 @@
|
|
34 |
gboolean session_started = FALSE;
|
|
35 |
gchar *local_id;
|
|
36 |
GOptionContext *context;
|
|
37 |
+ char *command;
|
|
38 |
|
|
39 |
g_thread_init(NULL);
|
|
40 |
|
|
41 |
@@ -344,6 +347,15 @@
|
|
42 |
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
|
43 |
textdomain(GETTEXT_PACKAGE);
|
|
44 |
|
|
45 |
+ if (getzoneid () == 0 && /* global zone */
|
|
46 |
+ tx_is_multi_label_session () &&
|
|
47 |
+ tx_is_non_global_display_zone ()) {
|
|
48 |
+ command = g_strdup_printf ("0:%s", g_strjoinv (" ", argv));
|
|
49 |
+ tx_proxy_app_launch (command);
|
|
50 |
+ g_free (command);
|
|
51 |
+ return 0;
|
|
52 |
+ }
|
|
53 |
+
|
|
54 |
local_id = (gchar *) g_getenv ("DESKTOP_STARTUP_ID");
|
|
55 |
|
|
56 |
if (local_id != NULL && *local_id != '\0') {
|
|
57 |
diff -urN yelp.orig/src/yelp-tx.c yelp.new/src/yelp-tx.c
|
|
58 |
--- yelp.orig/src/yelp-tx.c 1970-01-01 01:00:00.000000000 +0100
|
|
59 |
+++ yelp.new/src/yelp-tx.c 2009-06-15 08:43:33.465438182 +0100
|
|
60 |
@@ -0,0 +1,99 @@
|
|
61 |
+/*
|
|
62 |
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
|
63 |
+ * Use is subject to license terms.
|
|
64 |
+ */
|
|
65 |
+
|
|
66 |
+#include <config.h>
|
|
67 |
+#include <gdk/gdk.h>
|
|
68 |
+#include <gdk/gdkx.h>
|
|
69 |
+#include <X11/Xlib.h>
|
|
70 |
+#include <stdlib.h>
|
|
71 |
+#include <strings.h>
|
|
72 |
+#include <user_attr.h>
|
|
73 |
+#include <sys/types.h>
|
|
74 |
+#include <unistd.h>
|
|
75 |
+
|
|
76 |
+#define ATOM "_LABEL_EXEC_COMMAND"
|
|
77 |
+
|
|
78 |
+gboolean
|
|
79 |
+tx_is_multi_label_session (void)
|
|
80 |
+{
|
|
81 |
+ static int trusted = -1;
|
|
82 |
+
|
|
83 |
+ if (trusted < 0) {
|
|
84 |
+ if (getenv ("TRUSTED_SESSION")) {
|
|
85 |
+ trusted = 1;
|
|
86 |
+ } else {
|
|
87 |
+ trusted = 0;
|
|
88 |
+ }
|
|
89 |
+ }
|
|
90 |
+
|
|
91 |
+ return trusted ? TRUE : FALSE;
|
|
92 |
+}
|
|
93 |
+
|
|
94 |
+gboolean
|
|
95 |
+tx_is_non_global_display_zone (void)
|
|
96 |
+{
|
|
97 |
+ char *zoneid;
|
|
98 |
+ Display *xdpy;
|
|
99 |
+ Window root;
|
|
100 |
+ Atom atom, utf8_string;
|
|
101 |
+ unsigned long nitems;
|
|
102 |
+ unsigned long bytesafter;
|
|
103 |
+ unsigned char *prop_data = NULL;
|
|
104 |
+ Atom type = None;
|
|
105 |
+ int format;
|
|
106 |
+
|
|
107 |
+ xdpy = XOpenDisplay (NULL);
|
|
108 |
+
|
|
109 |
+ utf8_string = XInternAtom (xdpy, "UTF8_STRING", FALSE);
|
|
110 |
+
|
|
111 |
+ root = DefaultRootWindow (xdpy);
|
|
112 |
+
|
|
113 |
+ atom = XInternAtom (xdpy, "NAUTILUS_ACTIVE_DESKTOP_ID", FALSE);
|
|
114 |
+
|
|
115 |
+ gdk_error_trap_push ();
|
|
116 |
+
|
|
117 |
+ XGetWindowProperty (xdpy, root, atom, 0L, (long)1024, FALSE,
|
|
118 |
+ utf8_string, &type, &format, &nitems,
|
|
119 |
+ &bytesafter, (unsigned char **)&prop_data);
|
|
120 |
+
|
|
121 |
+ gdk_error_trap_pop ();
|
|
122 |
+
|
|
123 |
+ zoneid = strchr (prop_data, '_') + 1;
|
|
124 |
+ if (strncmp (zoneid, "0", 1) == 0 ){
|
|
125 |
+ return FALSE;
|
|
126 |
+ } else {
|
|
127 |
+ return TRUE;
|
|
128 |
+ }
|
|
129 |
+}
|
|
130 |
+
|
|
131 |
+void
|
|
132 |
+tx_proxy_app_launch (char *command)
|
|
133 |
+{
|
|
134 |
+ Display *xdpy;
|
|
135 |
+ Window root;
|
|
136 |
+ Atom atom, utf8_string;
|
|
137 |
+
|
|
138 |
+ if (!command) return;
|
|
139 |
+
|
|
140 |
+ xdpy = XOpenDisplay (NULL);
|
|
141 |
+
|
|
142 |
+ utf8_string = XInternAtom (xdpy, "UTF8_STRING", FALSE);
|
|
143 |
+
|
|
144 |
+ root = DefaultRootWindow (xdpy);
|
|
145 |
+
|
|
146 |
+ atom = XInternAtom (xdpy, ATOM, FALSE);
|
|
147 |
+
|
|
148 |
+ gdk_error_trap_push ();
|
|
149 |
+
|
|
150 |
+ XChangeProperty (xdpy, root, atom, utf8_string, 8, PropModeReplace,
|
|
151 |
+ command, strlen (command));
|
|
152 |
+
|
|
153 |
+ XSync (xdpy, False);
|
|
154 |
+
|
|
155 |
+ gdk_error_trap_pop ();
|
|
156 |
+
|
|
157 |
+ XCloseDisplay (xdpy);
|
|
158 |
+}
|
|
159 |
+
|
|
160 |
diff -urN yelp.orig/src/yelp-tx.h yelp.new/src/yelp-tx.h
|
|
161 |
--- yelp.orig/src/yelp-tx.h 1970-01-01 01:00:00.000000000 +0100
|
|
162 |
+++ yelp.new/src/yelp-tx.h 2009-06-15 08:41:35.454570771 +0100
|
|
163 |
@@ -0,0 +1,9 @@
|
|
164 |
+/*
|
|
165 |
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
|
166 |
+ * Use is subject to license terms.
|
|
167 |
+ */
|
|
168 |
+
|
|
169 |
+gboolean tx_is_multi_label_session (void);
|
|
170 |
+gboolean tx_is_non_global_display_zone (void);
|
|
171 |
+void tx_proxy_app_launch (char *command);
|
|
172 |
+
|