1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
diff -ur mozilla/widget/src/xremoteclient/CVS/Entries thunderbird/mozilla/widget/src/xremoteclient/CVS/Entries
--- mozilla/widget/src/xremoteclient/CVS/Entries 2003-10-03 12:00:21.000000000 -0400
+++ thunderbird/mozilla/widget/src/xremoteclient/CVS/Entries 2003-12-04 18:37:03.000000000 -0500
@@ -1,8 +1,8 @@
-/.cvsignore/1.2/Fri Mar 1 00:22:07 2002//TFIREBIRD_0_7_RELEASE
-/Makefile.in/1.14/Fri Apr 18 20:14:14 2003//TFIREBIRD_0_7_RELEASE
-/XRemoteClient.cpp/1.12/Mon Sep 8 00:31:14 2003//TFIREBIRD_0_7_RELEASE
-/XRemoteClient.h/1.5/Fri Feb 14 13:17:50 2003//TFIREBIRD_0_7_RELEASE
-/XRemoteClientFactory.cpp/1.3/Mon Sep 8 00:31:14 2003//TFIREBIRD_0_7_RELEASE
-/mozilla-xremote-client.cpp/1.1/Fri Dec 28 22:17:20 2001//TFIREBIRD_0_7_RELEASE
-/nsXRemoteClientCID.h/1.1/Fri Oct 20 05:10:43 2000//TFIREBIRD_0_7_RELEASE
+/.cvsignore/1.2/Fri Mar 1 00:22:07 2002//TTHUNDERBIRD_0_4_BRANCH
+/Makefile.in/1.14/Fri Apr 18 20:14:14 2003//TTHUNDERBIRD_0_4_BRANCH
+/XRemoteClient.cpp/1.13/Fri Nov 21 00:09:45 2003//TTHUNDERBIRD_0_4_BRANCH
+/XRemoteClient.h/1.6/Fri Nov 21 00:09:45 2003//TTHUNDERBIRD_0_4_BRANCH
+/XRemoteClientFactory.cpp/1.3/Mon Sep 8 00:31:14 2003//TTHUNDERBIRD_0_4_BRANCH
+/mozilla-xremote-client.cpp/1.1/Fri Dec 28 22:17:20 2001//TTHUNDERBIRD_0_4_BRANCH
+/nsXRemoteClientCID.h/1.1/Fri Oct 20 05:10:43 2000//TTHUNDERBIRD_0_4_BRANCH
D
diff -ur mozilla/widget/src/xremoteclient/CVS/Tag thunderbird/mozilla/widget/src/xremoteclient/CVS/Tag
--- mozilla/widget/src/xremoteclient/CVS/Tag 2003-10-03 14:56:14.000000000 -0400
+++ thunderbird/mozilla/widget/src/xremoteclient/CVS/Tag 2003-12-05 02:30:16.000000000 -0500
@@ -1 +1 @@
-NFIREBIRD_0_7_RELEASE
+TTHUNDERBIRD_0_4_BRANCH
diff -ur mozilla/widget/src/xremoteclient/XRemoteClient.cpp thunderbird/mozilla/widget/src/xremoteclient/XRemoteClient.cpp
--- mozilla/widget/src/xremoteclient/XRemoteClient.cpp 2003-09-07 20:31:14.000000000 -0400
+++ thunderbird/mozilla/widget/src/xremoteclient/XRemoteClient.cpp 2003-11-20 19:09:45.000000000 -0500
@@ -1,3 +1,4 @@
+/* vim:set ts=8 sw=2 et cindent: */
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
@@ -99,54 +100,6 @@
}
NS_IMETHODIMP
-XRemoteClient::SendCommand (const char *aCommand, PRBool *aWindowFound)
-{
- PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("XRemoteClient::SendCommand"));
-
- *aWindowFound = PR_TRUE;
-
- // find the remote window
- Window window = FindWindow();
-
- // no window? let the caller know.
- if (!window) {
- *aWindowFound = PR_FALSE;
- return NS_OK;
- }
-
- // make sure we get the right events on that window
- XSelectInput(mDisplay, window,
- (PropertyChangeMask|StructureNotifyMask));
-
- nsresult rv;
- PRBool destroyed = PR_FALSE;
-
- // get the lock on the window
- rv = GetLock(window, &destroyed);
-
- if (NS_FAILED(rv))
- return NS_ERROR_FAILURE;
-
- // send our command
- rv = DoSendCommand(window, aCommand, &destroyed);
-
- // if the window was destroyed, don't bother trying to free the
- // lock.
- if (destroyed)
- return NS_ERROR_FAILURE;
-
- // doesn't really matter what this returns
- FreeLock(window);
-
- // if we failed above we had to free the lock - return the error
- // now.
- if (NS_FAILED(rv))
- return NS_ERROR_FAILURE;
-
- return NS_OK;
-}
-
-NS_IMETHODIMP
XRemoteClient::Shutdown (void)
{
PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("XRemoteClient::Shutdown"));
@@ -164,32 +117,36 @@
return NS_OK;
}
-Window
-XRemoteClient::FindWindow(void)
+NS_IMETHODIMP
+XRemoteClient::SendCommand (const char *aCommand, PRBool *aWindowFound)
{
+ PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("XRemoteClient::SendCommand"));
+
Window root = RootWindowOfScreen(DefaultScreenOfDisplay(mDisplay));
Window root2, parent, *kids;
unsigned int nkids;
- Window result = 0;
int i;
+
+ *aWindowFound = PR_FALSE;
if (!XQueryTree(mDisplay, root, &root2, &parent, &kids, &nkids)) {
PR_LOG(sRemoteLm, PR_LOG_DEBUG,
- ("XQueryTree failed in XRemoteClient::FindWindow"));
- return 0;
+ ("XQueryTree failed in XRemoteClient::SendCommand"));
+ return NS_OK;
}
if (!(kids && nkids)) {
PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("root window has no children"));
- return 0;
+ return NS_OK;
}
+ nsresult rv = NS_OK;
for (i=nkids-1; i >= 0; i--) {
Atom type;
int format;
unsigned long nitems, bytesafter;
unsigned char *data_return = 0;
- Window w;
+ Window w, result = 0;
w = kids[i];
// find the inner window with WM_STATE on it
w = CheckWindow(w);
@@ -224,11 +181,8 @@
// if the IDs are equal then this is the window we want. if
// they aren't fall through to the next loop iteration.
- if (!strcmp(logname, (const char *)data_return)) {
- XFree(data_return);
+ if (!strcmp(logname, (const char *)data_return))
result = w;
- break;
- }
XFree(data_return);
}
@@ -238,14 +192,40 @@
// it.
else {
result = w;
- break;
+ }
+
+ if (result) {
+ // ok, let the caller know that we at least found a window.
+ *aWindowFound = PR_TRUE;
+
+ // make sure we get the right events on that window
+ XSelectInput(mDisplay, result,
+ (PropertyChangeMask|StructureNotifyMask));
+
+ PRBool destroyed = PR_FALSE;
+
+ // get the lock on the window
+ rv = GetLock(result, &destroyed);
+
+ if (NS_SUCCEEDED(rv)) {
+ // send our command
+ rv = DoSendCommand(result, aCommand, &destroyed);
+
+ // if the window was destroyed, don't bother trying to free the
+ // lock.
+ if (!destroyed)
+ FreeLock(result); // doesn't really matter what this returns
+
+ // if accepted then we're done...
+ if (NS_SUCCEEDED(rv))
+ break;
+ }
}
}
}
- PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("FindWindow returning 0x%lx\n", result));
-
- return result;
+ PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("SendCommand returning 0x%x\n", rv));
+ return rv;
}
Window
diff -ur mozilla/widget/src/xremoteclient/XRemoteClient.h thunderbird/mozilla/widget/src/xremoteclient/XRemoteClient.h
--- mozilla/widget/src/xremoteclient/XRemoteClient.h 2003-02-14 08:17:50.000000000 -0500
+++ thunderbird/mozilla/widget/src/xremoteclient/XRemoteClient.h 2003-11-20 19:09:45.000000000 -0500
@@ -42,7 +42,6 @@
private:
- Window FindWindow (void);
Window CheckWindow (Window aWindow);
Window CheckChildren (Window aWindow);
nsresult GetLock (Window aWindow, PRBool *aDestroyed);
@@ -63,5 +62,4 @@
char *mLockData;
PRBool mInitialized;
-
};
|