Mercurial > pidgin.yaz
annotate src/browser.c @ 4263:74f65a3d2a1f
[gaim-migrate @ 4514]
I wanted to get this into cvs before I went to bed. Now proto-specific
themes will work. The code's a bit crude at parts and it's not as fast
as I'd like, but I can work some more on it tomorrow. Just figured you'd
want to get a look at this.
8 penguin points to whoever finds out why gtk_smiley_tree_destroy (commented
out right now, causing leakage) segfaults on me now.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Thu, 09 Jan 2003 09:41:49 +0000 |
parents | 02f4eacf4c58 |
children | b5669740e34c |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * some code: (most in this file) | |
7 * Copyright (C) 1996 Netscape Communications Corporation, all rights reserved. | |
8 * Created: Jamie Zawinski <jwz@netscape.com>, 24-Dec-94. | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
12 * the Free Software Foundation; either version 2 of the License, or | |
13 * (at your option) any later version. | |
14 * | |
15 * This program is distributed in the hope that it will be useful, | |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 * GNU General Public License for more details. | |
19 * | |
20 * You should have received a copy of the GNU General Public License | |
21 * along with this program; if not, write to the Free Software | |
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
23 * | |
24 * This code is mainly taken from Netscape's sample implementation of | |
25 * their protocol. Nifty. | |
26 * | |
27 */ | |
28 | |
29 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
79
diff
changeset
|
30 #ifdef HAVE_CONFIG_H |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2077
diff
changeset
|
31 #include <config.h> |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
79
diff
changeset
|
32 #endif |
3630 | 33 #ifdef _WIN32 |
34 #include <gdk/gdkwin32.h> | |
35 #else | |
36 #include <unistd.h> | |
37 #include <gdk/gdkx.h> | |
38 #endif | |
1 | 39 #include <stdio.h> |
40 #include <stdlib.h> | |
41 #include <string.h> | |
42 | |
43 | |
44 | |
45 | |
46 #include <gtk/gtk.h> | |
47 #include <gdk/gdkprivate.h> | |
48 #include "gaim.h" | |
49 | |
50 #ifndef _WIN32 | |
51 | |
52 | |
53 | |
54 | |
55 #include <X11/Xlib.h> | |
56 #include <X11/Xatom.h> | |
57 | |
58 | |
59 static const char *progname = "gaim"; | |
60 static const char *expected_mozilla_version = "1.1"; | |
61 | |
62 #define MOZILLA_VERSION_PROP "_MOZILLA_VERSION" | |
63 #define MOZILLA_LOCK_PROP "_MOZILLA_LOCK" | |
64 #define MOZILLA_COMMAND_PROP "_MOZILLA_COMMAND" | |
65 #define MOZILLA_RESPONSE_PROP "_MOZILLA_RESPONSE" | |
66 | |
3466 | 67 static GdkAtom GDKA_MOZILLA_VERSION = 0; |
68 static GdkAtom GDKA_MOZILLA_LOCK = 0; | |
69 static GdkAtom GDKA_MOZILLA_COMMAND = 0; | |
70 static GdkAtom GDKA_MOZILLA_RESPONSE = 0; | |
1 | 71 |
72 | |
73 static int netscape_lock; | |
74 | |
75 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
76 static Window VirtualRootWindowOfScreen(screen) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
77 Screen *screen; |
1 | 78 { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
79 static Screen *save_screen = (Screen *) 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
80 static Window root = (Window) 0; |
1 | 81 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
82 if (screen != save_screen) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
83 Display *dpy = DisplayOfScreen(screen); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
84 Atom __SWM_VROOT = None; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
85 unsigned int i; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
86 Window rootReturn, parentReturn, *children; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
87 unsigned int numChildren; |
1 | 88 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
89 root = RootWindowOfScreen(screen); |
1 | 90 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
91 /* go look for a virtual root */ |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
92 __SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
93 if (XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren)) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
94 for (i = 0; i < numChildren; i++) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
95 Atom actual_type; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
96 int actual_format; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
97 unsigned long nitems, bytesafter; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
98 Window *newRoot = (Window *) 0; |
1 | 99 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
100 if (XGetWindowProperty(dpy, children[i], |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
101 __SWM_VROOT, 0, 1, False, XA_WINDOW, |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
102 &actual_type, &actual_format, |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
103 &nitems, &bytesafter, |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2099
diff
changeset
|
104 (unsigned char **)&newRoot) == Success |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2099
diff
changeset
|
105 && newRoot) { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
106 root = *newRoot; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
107 break; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
108 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
109 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
110 if (children) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
111 XFree((char *)children); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
112 } |
1 | 113 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
114 save_screen = screen; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
115 } |
1 | 116 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
117 return root; |
1 | 118 } |
119 | |
120 /* The following code is Copyright (C) 1989 X Consortium */ | |
121 | |
122 static Window TryChildren(); | |
123 | |
124 /* Find a window with WM_STATE, else return win itself, as per ICCCM */ | |
125 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
126 static Window GClientWindow(dpy, win) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
127 Display *dpy; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
128 Window win; |
1 | 129 { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
130 Atom WM_STATE; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
131 Atom type = None; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
132 int format; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
133 unsigned long nitems, after; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
134 unsigned char *data; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
135 Window inf; |
1 | 136 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
137 WM_STATE = XInternAtom(dpy, "WM_STATE", True); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
138 if (!WM_STATE) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
139 return win; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
140 XGetWindowProperty(dpy, win, WM_STATE, 0, 0, False, AnyPropertyType, |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
141 &type, &format, &nitems, &after, &data); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
142 if (type) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
143 XFree(data); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
144 return win; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
145 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
146 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
147 inf = TryChildren(dpy, win, WM_STATE); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
148 if (!inf) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
149 inf = win; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
150 |
26 | 151 XFree(data); |
152 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
153 return inf; |
1 | 154 } |
155 | |
156 static | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
157 Window TryChildren(dpy, win, WM_STATE) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
158 Display *dpy; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
159 Window win; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
160 Atom WM_STATE; |
1 | 161 { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
162 Window root, parent; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
163 Window *children; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
164 unsigned int nchildren; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
165 unsigned int i; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
166 Atom type = None; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
167 int format; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
168 unsigned long nitems, after; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
169 unsigned char *data; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
170 Window inf = 0; |
1 | 171 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
172 if (!XQueryTree(dpy, win, &root, &parent, &children, &nchildren)) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
173 return 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
174 for (i = 0; !inf && (i < nchildren); i++) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
175 XGetWindowProperty(dpy, children[i], WM_STATE, 0, 0, False, |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
176 AnyPropertyType, &type, &format, &nitems, &after, &data); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
177 if (type) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
178 inf = children[i]; |
26 | 179 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
180 XFree(data); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
181 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
182 for (i = 0; !inf && (i < nchildren); i++) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
183 inf = TryChildren(dpy, children[i], WM_STATE); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
184 if (children) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
185 XFree((char *)children); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
186 return inf; |
1 | 187 } |
188 | |
189 /* END X Consortium code */ | |
190 | |
191 | |
192 | |
193 static void mozilla_remote_init_atoms() | |
194 { | |
3466 | 195 if (!GDKA_MOZILLA_VERSION) |
196 GDKA_MOZILLA_VERSION = gdk_atom_intern(MOZILLA_VERSION_PROP, 0); | |
197 if (!GDKA_MOZILLA_LOCK) | |
198 GDKA_MOZILLA_LOCK = gdk_atom_intern(MOZILLA_LOCK_PROP, 0); | |
199 if (!GDKA_MOZILLA_COMMAND) | |
200 GDKA_MOZILLA_COMMAND = gdk_atom_intern(MOZILLA_COMMAND_PROP, 0); | |
201 if (!GDKA_MOZILLA_RESPONSE) | |
202 GDKA_MOZILLA_RESPONSE = gdk_atom_intern(MOZILLA_RESPONSE_PROP, 0); | |
1 | 203 } |
204 | |
205 static GdkWindow *mozilla_remote_find_window() | |
206 { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
207 int i; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
208 Window root = VirtualRootWindowOfScreen(DefaultScreenOfDisplay(gdk_display)); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
209 Window root2, parent, *kids; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
210 unsigned int nkids; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
211 Window result = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
212 Window tenative = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
213 unsigned char *tenative_version = 0; |
1 | 214 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
215 if (!XQueryTree(gdk_display, root, &root2, &parent, &kids, &nkids)) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
216 debug_printf("%s: XQueryTree failed on display %s\n", progname, |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
217 DisplayString(gdk_display)); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
218 return NULL; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
219 } |
1 | 220 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
221 /* root != root2 is possible with virtual root WMs. */ |
1 | 222 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
223 if (!(kids && nkids)) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
224 debug_printf("%s: root window has no children on display %s\n", |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
225 progname, DisplayString(gdk_display)); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
226 return NULL; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
227 } |
1 | 228 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
229 for (i = nkids - 1; i >= 0; i--) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
230 Atom type; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
231 int format; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
232 unsigned long nitems, bytesafter; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
233 unsigned char *version = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
234 Window w = GClientWindow(gdk_display, kids[i]); |
3466 | 235 int status = XGetWindowProperty(gdk_display, w, |
236 gdk_x11_atom_to_xatom(GDKA_MOZILLA_VERSION), | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
237 0, (65536 / sizeof(long)), |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
238 False, XA_STRING, |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
239 &type, &format, &nitems, &bytesafter, |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
240 &version); |
26 | 241 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
242 if (!version) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
243 continue; |
26 | 244 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
245 if (strcmp((char *)version, expected_mozilla_version) && !tenative) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
246 tenative = w; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
247 tenative_version = version; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
248 continue; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
249 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
250 XFree(version); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
251 if (status == Success && type != None) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
252 result = w; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
253 break; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
254 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
255 } |
1 | 256 |
26 | 257 XFree(kids); |
258 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
259 if (result && tenative) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
260 debug_printf("%s: warning: both version %s (0x%x) and version\n" |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
261 "\t%s (0x%x) are running. Using version %s.\n", |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
262 progname, tenative_version, (unsigned int)tenative, |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
263 expected_mozilla_version, (unsigned int)result, expected_mozilla_version); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
264 XFree(tenative_version); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
265 return gdk_window_foreign_new(result); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
266 } else if (tenative) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
267 debug_printf("%s: warning: expected version %s but found version\n" |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
268 "\t%s (0x%x) instead.\n", |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
269 progname, expected_mozilla_version, |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
270 tenative_version, (unsigned int)tenative); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
271 XFree(tenative_version); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
272 return gdk_window_foreign_new(tenative); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
273 } else if (result) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
274 return gdk_window_foreign_new(result); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
275 } else { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
276 debug_printf("%s: not running on display %s\n", progname, DisplayString(gdk_display)); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
277 return NULL; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
278 } |
1 | 279 } |
280 | |
281 | |
282 static char *lock_data = 0; | |
283 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
284 static void mozilla_remote_obtain_lock(GdkWindow * window) |
1 | 285 { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
286 Bool locked = False; |
1 | 287 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
288 if (!lock_data) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
289 lock_data = (char *)g_malloc(255); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
290 sprintf(lock_data, "pid%d@", getpid()); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
291 if (gethostname(lock_data + strlen(lock_data), 100)) { |
1 | 292 return; |
293 } | |
294 } | |
295 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
296 do { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
297 int result; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
298 GdkAtom actual_type; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
299 gint actual_format; |
1 | 300 gint nitems; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
301 unsigned char *data = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
302 |
3466 | 303 result = gdk_property_get(window, GDKA_MOZILLA_LOCK, |
304 gdk_x11_xatom_to_atom (XA_STRING), 0, | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
305 (65536 / sizeof(long)), 0, |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
306 &actual_type, &actual_format, &nitems, &data); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
307 if (result != Success || actual_type == None) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
308 /* It's not now locked - lock it. */ |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
309 debug_printf("%s: (writing " MOZILLA_LOCK_PROP |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
310 " \"%s\" to 0x%x)\n", progname, lock_data, (unsigned int)window); |
1 | 311 |
3466 | 312 gdk_property_change(window, GDKA_MOZILLA_LOCK, |
313 gdk_x11_xatom_to_atom (XA_STRING), | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
314 8, PropModeReplace, |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
315 (unsigned char *)lock_data, strlen(lock_data)); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
316 locked = True; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
317 } |
1 | 318 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
319 if (!locked) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
320 /* Then just fuck it. */ |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
321 if (data) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
322 g_free(data); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
323 return; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
324 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
325 if (data) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
326 g_free(data); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
327 } while (!locked); |
1 | 328 } |
329 | |
330 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
331 static void mozilla_remote_free_lock(GdkWindow * window) |
1 | 332 { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
333 int result = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
334 GdkAtom actual_type; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
335 gint actual_format; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
336 gint nitems; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
337 unsigned char *data = 0; |
1 | 338 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
339 debug_printf("%s: (deleting " MOZILLA_LOCK_PROP |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
340 " \"%s\" from 0x%x)\n", progname, lock_data, (unsigned int)window); |
1 | 341 |
3466 | 342 result = gdk_property_get(window, GDKA_MOZILLA_LOCK, |
343 gdk_x11_xatom_to_atom (XA_STRING), | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
344 0, (65536 / sizeof(long)), |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
345 1, &actual_type, &actual_format, &nitems, &data); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
346 if (result != Success) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
347 debug_printf("%s: unable to read and delete " MOZILLA_LOCK_PROP " property\n", progname); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
348 return; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
349 } else if (!data || !*data) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
350 debug_printf("%s: invalid data on " MOZILLA_LOCK_PROP |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
351 " of window 0x%x.\n", progname, (unsigned int)window); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
352 return; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
353 } else if (strcmp((char *)data, lock_data)) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
354 debug_printf("%s: " MOZILLA_LOCK_PROP |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
355 " was stolen! Expected \"%s\", saw \"%s\"!\n", progname, lock_data, data); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
356 return; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
357 } |
1 | 358 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
359 if (data) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
360 g_free(data); |
1 | 361 } |
362 | |
363 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
364 static int mozilla_remote_command(GdkWindow * window, const char *command, Bool raise_p) |
1 | 365 { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
366 int result = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
367 Bool done = False; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
368 char *new_command = 0; |
1 | 369 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
370 /* The -noraise option is implemented by passing a "noraise" argument |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
371 to each command to which it should apply. |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
372 */ |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
373 if (!raise_p) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
374 char *close; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
375 new_command = g_malloc(strlen(command) + 20); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
376 strcpy(new_command, command); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
377 close = strrchr(new_command, ')'); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
378 if (close) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
379 strcpy(close, ", noraise)"); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
380 else |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
381 strcat(new_command, "(noraise)"); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
382 command = new_command; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
383 } |
1 | 384 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
385 debug_printf("%s: (writing " MOZILLA_COMMAND_PROP " \"%s\" to 0x%x)\n", |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
386 progname, command, (unsigned int)window); |
1 | 387 |
3466 | 388 gdk_property_change(window, GDKA_MOZILLA_COMMAND, |
389 gdk_x11_xatom_to_atom (XA_STRING), | |
390 8, GDK_PROP_MODE_REPLACE, (unsigned char *)command, strlen(command)); | |
1 | 391 |
392 while (!done) { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
393 GdkEvent *event; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
394 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
395 event = gdk_event_get(); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
396 |
1 | 397 if (!event) |
398 continue; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
399 |
1 | 400 if (event->any.window != window) { |
401 gtk_main_do_event(event); | |
402 continue; | |
403 } | |
404 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
405 if (event->type == GDK_DESTROY && event->any.window == window) { |
1 | 406 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
407 /* Print to warn user... */ |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
408 debug_printf("%s: window 0x%x was destroyed.\n", progname, (unsigned int)window); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
409 result = 6; |
1267
9cff8ff01d37
[gaim-migrate @ 1277]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
410 done = True; |
1 | 411 } else if (event->type == GDK_PROPERTY_NOTIFY && |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
412 event->property.state == GDK_PROPERTY_NEW_VALUE && |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
413 event->property.window == window && |
3466 | 414 event->property.atom == GDKA_MOZILLA_RESPONSE) { |
1 | 415 GdkAtom actual_type; |
416 gint actual_format, nitems; | |
417 unsigned char *data = 0; | |
418 | |
3466 | 419 result = gdk_property_get(window, GDKA_MOZILLA_RESPONSE, |
420 gdk_x11_xatom_to_atom (XA_STRING), 0, | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
421 (65536 / sizeof(long)), |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
422 1, &actual_type, &actual_format, &nitems, &data); |
1 | 423 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
424 |
1 | 425 if (result == Success && data && *data) { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
426 debug_printf("%s: (server sent " MOZILLA_RESPONSE_PROP |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
427 " \"%s\" to 0x%x.)\n", |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
428 progname, data, (unsigned int)window); |
1 | 429 } |
430 | |
431 if (result != Success) { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
432 debug_printf("%s: failed reading " MOZILLA_RESPONSE_PROP |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
433 " from window 0x%0x.\n", progname, (unsigned int)window); |
1 | 434 result = 6; |
435 done = True; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
436 } else if (!data || strlen((char *)data) < 5) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
437 debug_printf("%s: invalid data on " MOZILLA_RESPONSE_PROP |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
438 " property of window 0x%0x.\n", |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
439 progname, (unsigned int)window); |
1 | 440 result = 6; |
441 done = True; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
442 } else if (*data == '1') { /* positive preliminary reply */ |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
443 debug_printf("%s: %s\n", progname, data + 4); |
1 | 444 /* keep going */ |
445 done = False; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
446 } else if (!strncmp((char *)data, "200", 3)) { |
1 | 447 result = 0; |
448 done = True; | |
449 } else if (*data == '2') { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
450 debug_printf("%s: %s\n", progname, data + 4); |
1 | 451 result = 0; |
452 done = True; | |
453 } else if (*data == '3') { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
454 debug_printf("%s: internal error: " |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
455 "server wants more information? (%s)\n", progname, data); |
1 | 456 result = 3; |
457 done = True; | |
458 } else if (*data == '4' || *data == '5') { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
459 debug_printf("%s: %s\n", progname, data + 4); |
1 | 460 result = (*data - '0'); |
461 done = True; | |
462 } else { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
463 debug_printf("%s: unrecognised " MOZILLA_RESPONSE_PROP |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
464 " from window 0x%x: %s\n", |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
465 progname, (unsigned int)window, data); |
1 | 466 result = 6; |
467 done = True; | |
468 } | |
469 | |
470 if (data) | |
471 g_free(data); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2099
diff
changeset
|
472 } else if (event->type == GDK_PROPERTY_NOTIFY && |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2099
diff
changeset
|
473 event->property.window == window && |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2099
diff
changeset
|
474 event->property.state == GDK_PROPERTY_DELETE && |
3466 | 475 event->property.atom == GDKA_MOZILLA_COMMAND) { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
476 debug_printf("%s: (server 0x%x has accepted " |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
477 MOZILLA_COMMAND_PROP ".)\n", progname, (unsigned int)window); |
1 | 478 } |
479 gdk_event_free(event); | |
480 } | |
481 | |
482 if (new_command) | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
483 g_free(new_command); |
1 | 484 |
485 return result; | |
486 } | |
487 | |
488 | |
4168 | 489 gboolean check_netscape(gpointer data) |
1 | 490 { |
4168 | 491 char *msg = data; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
492 int status; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
493 GdkWindow *window; |
1 | 494 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
495 mozilla_remote_init_atoms(); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
496 window = mozilla_remote_find_window(); |
1 | 497 |
3554 | 498 if (window && (GDK_WINDOW_OBJECT(window)->destroyed == FALSE)) { |
1 | 499 |
1944
2d5fef1f986d
[gaim-migrate @ 1954]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1267
diff
changeset
|
500 XSelectInput(gdk_display, GDK_WINDOW_XWINDOW(window), |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
501 (PropertyChangeMask | StructureNotifyMask)); |
1 | 502 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
503 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
504 mozilla_remote_obtain_lock(window); |
1 | 505 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
506 status = mozilla_remote_command(window, msg, False); |
1 | 507 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
508 if (status != 6) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
509 mozilla_remote_free_lock(window); |
1 | 510 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
511 netscape_lock = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
512 |
1 | 513 g_free(msg); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
514 return FALSE; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
515 } else |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
516 return TRUE; |
1 | 517 } |
518 | |
519 | |
520 static void netscape_command(char *command) | |
521 { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
522 int status; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
523 pid_t pid; |
1 | 524 GdkWindow *window; |
525 | |
526 if (netscape_lock) | |
527 return; | |
528 | |
529 netscape_lock = 1; | |
530 | |
531 | |
532 | |
533 mozilla_remote_init_atoms(); | |
534 window = mozilla_remote_find_window(); | |
535 | |
3554 | 536 if (window && (GDK_WINDOW_OBJECT(window)->destroyed == FALSE)) { |
1 | 537 |
1944
2d5fef1f986d
[gaim-migrate @ 1954]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1267
diff
changeset
|
538 XSelectInput(gdk_display, GDK_WINDOW_XWINDOW(window), |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
539 (PropertyChangeMask | StructureNotifyMask)); |
1 | 540 |
541 mozilla_remote_obtain_lock(window); | |
542 | |
543 status = mozilla_remote_command(window, command, False); | |
544 | |
545 if (status != 6) | |
546 mozilla_remote_free_lock(window); | |
547 | |
548 netscape_lock = 0; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
549 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
550 gdk_window_destroy(window); |
1 | 551 } else { |
552 pid = fork(); | |
553 if (pid == 0) { | |
554 char *args[2]; | |
555 int e; | |
556 | |
557 args[0] = g_strdup("netscape"); | |
558 args[1] = NULL; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
559 e = execvp(args[0], args); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
560 printf("Hello%d\n", getppid()); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
561 |
1 | 562 _exit(0); |
563 } else { | |
564 char *tmp = g_strdup(command); | |
4168 | 565 g_timeout_add(200, check_netscape, tmp); |
1 | 566 } |
567 } | |
568 | |
569 } | |
570 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
571 void open_url(GtkWidget *w, char *url) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
572 { |
4189 | 573 gchar *space_free_url; |
733 | 574 |
1 | 575 if (web_browser == BROWSER_NETSCAPE) { |
2828
06539a384d6b
[gaim-migrate @ 2841]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
576 char *command; |
1 | 577 |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
578 if (misc_options & OPT_MISC_BROWSER_POPUP) |
2828
06539a384d6b
[gaim-migrate @ 2841]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
579 command = g_strdup_printf("OpenURL(%s, new-window)", url); |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
580 else |
2828
06539a384d6b
[gaim-migrate @ 2841]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
581 command = g_strdup_printf("OpenURL(%s)", url); |
1 | 582 |
583 netscape_command(command); | |
584 g_free(command); | |
3472 | 585 /* fixme: GNOME helper * |
586 * } else if (web_browser == BROWSER_GNOME) { * | |
587 * gnome_url_show(url); */ | |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
588 } else { |
2566 | 589 pid_t pid; |
590 | |
591 pid = fork(); | |
592 | |
593 if (pid == 0) { | |
3455 | 594 /* args will be allocated below but we don't bother |
595 * freeing it since we're just going to exec and | |
596 * exit */ | |
3466 | 597 char **args=NULL; |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
598 char command[1024]; |
3417 | 599 |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
600 if (web_browser == BROWSER_OPERA) { |
3455 | 601 args = g_new(char *, 4); |
3320 | 602 args[0] = "opera"; |
603 args[1] = "-newwindow"; | |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
604 args[2] = url; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
605 args[3] = NULL; |
3320 | 606 } else if (web_browser == BROWSER_KONQ) { |
3455 | 607 args = g_new(char *, 4); |
3320 | 608 args[0] = "kfmclient"; |
609 args[1] = "openURL"; | |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
610 args[2] = url; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
611 args[3] = NULL; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
612 } else if (web_browser == BROWSER_GALEON) { |
3455 | 613 args = g_new(char *, 4); |
3320 | 614 args[0] = "galeon"; |
615 if (misc_options & OPT_MISC_BROWSER_POPUP) { | |
616 args[1] = "-w"; | |
617 args[2] = url; | |
618 args[3] = NULL; | |
619 } else { | |
620 args[1] = url; | |
621 args[2] = NULL; | |
622 } | |
623 } else if (web_browser == BROWSER_MOZILLA) { | |
3455 | 624 args = g_new(char *, 4); |
3320 | 625 args[0] = "mozilla"; |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
626 args[1] = url; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
627 args[2] = NULL; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
628 } else if (web_browser == BROWSER_MANUAL) { |
4189 | 629 if(strcmp(web_command,"") == 0) |
630 _exit(0); | |
3418
0d1af9166119
[gaim-migrate @ 3440]
Christian Hammond <chipx86@chipx86.com>
parents:
3417
diff
changeset
|
631 space_free_url = g_strdelimit(url, " ", '+'); |
0d1af9166119
[gaim-migrate @ 3440]
Christian Hammond <chipx86@chipx86.com>
parents:
3417
diff
changeset
|
632 g_snprintf(command, sizeof(command), web_command, space_free_url); |
0d1af9166119
[gaim-migrate @ 3440]
Christian Hammond <chipx86@chipx86.com>
parents:
3417
diff
changeset
|
633 g_free(space_free_url); |
0d1af9166119
[gaim-migrate @ 3440]
Christian Hammond <chipx86@chipx86.com>
parents:
3417
diff
changeset
|
634 args = g_strsplit(command, " ", 0); |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
635 } |
2566 | 636 |
637 execvp(args[0], args); | |
638 _exit(0); | |
639 } | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
640 } |
1 | 641 } |
642 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
643 void add_bookmark(GtkWidget *w, char *url) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
644 { |
1 | 645 if (web_browser == BROWSER_NETSCAPE) { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
646 char *command = g_malloc(1024); |
1 | 647 |
648 g_snprintf(command, 1024, "AddBookmark(%s)", url); | |
649 | |
650 netscape_command(command); | |
651 g_free(command); | |
652 } | |
653 } | |
654 | |
655 #else | |
656 | |
657 /* Sooner or later, I shall support Windows clicking! */ | |
658 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
659 void add_bookmark(GtkWidget *w, char *url) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
660 { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
661 } |
3630 | 662 void open_url(GtkWidget *w, char *url) |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
663 { |
3630 | 664 ShellExecute(NULL, NULL, url, NULL, ".\\", 0); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
665 } |
1 | 666 |
667 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2099
diff
changeset
|
668 #endif /* _WIN32 */ |