Mercurial > pidgin.yaz
annotate src/browser.c @ 4145:b658b502b096
[gaim-migrate @ 4363]
gtk1.2 code in anything except the buddy list window is a bug. this patch from
David Brigada (jsi):
" This patch changes the mechanism in which Gaim changes
the colors on tabs for typing notification, new message
notification, etc.. The previous mechanism was causing
the font to change (possible mix of gtk1.2 and gtk2.0
code). Instead of loading the label's preferences with
gtk_widget_get_modifier_style(), changing the color
(with a -> edit), and then saving the label's
preferences with gtk_widget_modify_style(), it changes
the color with gtk_widget_modify_fg(). This fixes the
font problem on my computer. The GTK 2.0 API docs seem
to suggest the use of gtk_widget_modify_fg() over
gtk_widget_modify_style() when necessary."
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Thu, 26 Dec 2002 15:40:23 +0000 |
parents | 9682c0e022c6 |
children | ebfb80bbe1ed |
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 | |
489 gint check_netscape(char *msg) | |
490 { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
491 int status; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
492 GdkWindow *window; |
1 | 493 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
494 mozilla_remote_init_atoms(); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
495 window = mozilla_remote_find_window(); |
1 | 496 |
3554 | 497 if (window && (GDK_WINDOW_OBJECT(window)->destroyed == FALSE)) { |
1 | 498 |
1944
2d5fef1f986d
[gaim-migrate @ 1954]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1267
diff
changeset
|
499 XSelectInput(gdk_display, GDK_WINDOW_XWINDOW(window), |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
500 (PropertyChangeMask | StructureNotifyMask)); |
1 | 501 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
502 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
503 mozilla_remote_obtain_lock(window); |
1 | 504 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
505 status = mozilla_remote_command(window, msg, False); |
1 | 506 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
507 if (status != 6) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
508 mozilla_remote_free_lock(window); |
1 | 509 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
510 netscape_lock = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
511 |
1 | 512 g_free(msg); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
513 return FALSE; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
514 } else |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
515 return TRUE; |
1 | 516 } |
517 | |
518 | |
519 static void netscape_command(char *command) | |
520 { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
521 int status; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
522 pid_t pid; |
1 | 523 GdkWindow *window; |
524 | |
525 if (netscape_lock) | |
526 return; | |
527 | |
528 netscape_lock = 1; | |
529 | |
530 | |
531 | |
532 mozilla_remote_init_atoms(); | |
533 window = mozilla_remote_find_window(); | |
534 | |
3554 | 535 if (window && (GDK_WINDOW_OBJECT(window)->destroyed == FALSE)) { |
1 | 536 |
1944
2d5fef1f986d
[gaim-migrate @ 1954]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1267
diff
changeset
|
537 XSelectInput(gdk_display, GDK_WINDOW_XWINDOW(window), |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
538 (PropertyChangeMask | StructureNotifyMask)); |
1 | 539 |
540 mozilla_remote_obtain_lock(window); | |
541 | |
542 status = mozilla_remote_command(window, command, False); | |
543 | |
544 if (status != 6) | |
545 mozilla_remote_free_lock(window); | |
546 | |
547 netscape_lock = 0; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
548 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
549 gdk_window_destroy(window); |
1 | 550 } else { |
551 pid = fork(); | |
552 if (pid == 0) { | |
553 char *args[2]; | |
554 int e; | |
555 | |
556 args[0] = g_strdup("netscape"); | |
557 args[1] = NULL; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
558 e = execvp(args[0], args); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
559 printf("Hello%d\n", getppid()); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
560 |
1 | 561 _exit(0); |
562 } else { | |
563 char *tmp = g_strdup(command); | |
564 gtk_timeout_add(200, (GtkFunction)check_netscape, tmp); | |
565 } | |
566 } | |
567 | |
568 } | |
569 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
570 void open_url(GtkWidget *w, char *url) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
571 { |
733 | 572 |
1 | 573 if (web_browser == BROWSER_NETSCAPE) { |
2828
06539a384d6b
[gaim-migrate @ 2841]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
574 char *command; |
1 | 575 |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
576 if (misc_options & OPT_MISC_BROWSER_POPUP) |
2828
06539a384d6b
[gaim-migrate @ 2841]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
577 command = g_strdup_printf("OpenURL(%s, new-window)", url); |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
578 else |
2828
06539a384d6b
[gaim-migrate @ 2841]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
579 command = g_strdup_printf("OpenURL(%s)", url); |
1 | 580 |
581 netscape_command(command); | |
582 g_free(command); | |
3472 | 583 /* fixme: GNOME helper * |
584 * } else if (web_browser == BROWSER_GNOME) { * | |
585 * gnome_url_show(url); */ | |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
586 } else { |
2566 | 587 pid_t pid; |
588 | |
589 pid = fork(); | |
590 | |
591 if (pid == 0) { | |
3455 | 592 /* args will be allocated below but we don't bother |
593 * freeing it since we're just going to exec and | |
594 * exit */ | |
3466 | 595 char **args=NULL; |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
596 char command[1024]; |
3417 | 597 |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
598 if (web_browser == BROWSER_OPERA) { |
3455 | 599 args = g_new(char *, 4); |
3320 | 600 args[0] = "opera"; |
601 args[1] = "-newwindow"; | |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
602 args[2] = url; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
603 args[3] = NULL; |
3320 | 604 } else if (web_browser == BROWSER_KONQ) { |
3455 | 605 args = g_new(char *, 4); |
3320 | 606 args[0] = "kfmclient"; |
607 args[1] = "openURL"; | |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
608 args[2] = url; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
609 args[3] = NULL; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
610 } else if (web_browser == BROWSER_GALEON) { |
3455 | 611 args = g_new(char *, 4); |
3320 | 612 args[0] = "galeon"; |
613 if (misc_options & OPT_MISC_BROWSER_POPUP) { | |
614 args[1] = "-w"; | |
615 args[2] = url; | |
616 args[3] = NULL; | |
617 } else { | |
618 args[1] = url; | |
619 args[2] = NULL; | |
620 } | |
621 } else if (web_browser == BROWSER_MOZILLA) { | |
3455 | 622 args = g_new(char *, 4); |
3320 | 623 args[0] = "mozilla"; |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
624 args[1] = url; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
625 args[2] = NULL; |
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
626 } else if (web_browser == BROWSER_MANUAL) { |
3418
0d1af9166119
[gaim-migrate @ 3440]
Christian Hammond <chipx86@chipx86.com>
parents:
3417
diff
changeset
|
627 gchar *space_free_url; |
0d1af9166119
[gaim-migrate @ 3440]
Christian Hammond <chipx86@chipx86.com>
parents:
3417
diff
changeset
|
628 space_free_url = g_strdelimit(url, " ", '+'); |
0d1af9166119
[gaim-migrate @ 3440]
Christian Hammond <chipx86@chipx86.com>
parents:
3417
diff
changeset
|
629 g_snprintf(command, sizeof(command), web_command, space_free_url); |
0d1af9166119
[gaim-migrate @ 3440]
Christian Hammond <chipx86@chipx86.com>
parents:
3417
diff
changeset
|
630 g_free(space_free_url); |
0d1af9166119
[gaim-migrate @ 3440]
Christian Hammond <chipx86@chipx86.com>
parents:
3417
diff
changeset
|
631 args = g_strsplit(command, " ", 0); |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2781
diff
changeset
|
632 } |
2566 | 633 |
634 execvp(args[0], args); | |
635 _exit(0); | |
636 } | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
637 } |
1 | 638 } |
639 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
640 void add_bookmark(GtkWidget *w, char *url) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
641 { |
1 | 642 if (web_browser == BROWSER_NETSCAPE) { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
643 char *command = g_malloc(1024); |
1 | 644 |
645 g_snprintf(command, 1024, "AddBookmark(%s)", url); | |
646 | |
647 netscape_command(command); | |
648 g_free(command); | |
649 } | |
650 } | |
651 | |
652 #else | |
653 | |
654 /* Sooner or later, I shall support Windows clicking! */ | |
655 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
656 void add_bookmark(GtkWidget *w, char *url) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
657 { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
658 } |
3630 | 659 void open_url(GtkWidget *w, char *url) |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
660 { |
3630 | 661 ShellExecute(NULL, NULL, url, NULL, ".\\", 0); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1181
diff
changeset
|
662 } |
1 | 663 |
664 | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2099
diff
changeset
|
665 #endif /* _WIN32 */ |