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
|
--- remote.c.orig Wed May 2 01:47:12 2001
+++ remote.c Wed May 2 01:47:34 2001
@@ -43,8 +43,8 @@
file, you can find it at "http://home.netscape.com/newsref/std/vroot.h".
If you don't care about supporting virtual root window managers, you can
comment this line out.
- */
#include "vroot.h"
+*/
#ifdef STANDALONE
@@ -81,21 +81,26 @@
mozilla_remote_find_window (Display *dpy)
{
int i;
- Window root = RootWindowOfScreen (DefaultScreenOfDisplay (dpy));
- Window root2, parent, *kids;
- unsigned int nkids;
+ Window root, root2 = DefaultRootWindow(dpy);
+ Window parent, *kids = NULL;
+ unsigned int nkids = 0;
Window result = 0;
Window tenative = 0;
unsigned char *tenative_version = 0;
- if (! XQueryTree (dpy, root, &root2, &parent, &kids, &nkids))
+ /* root != root2 is possible with virtual root WMs. */
+ /* turns out, we need to get to the bottom -- the very top root window */
+ /* what continues to puzzle me, is that xlsclients works without this -- */
+ /* The DefaultRootWindow(dpy) always returns the right thing to it... */
+ do {
+ root = root2;
+ if (! XQueryTree (dpy, root, &root2, &parent, &kids, &nkids))
{
fprintf (stderr, "%s: XQueryTree failed on display %s\n", progname,
DisplayString (dpy));
exit (2);
}
-
- /* root != root2 is possible with virtual root WMs. */
+ } while (root != root2);
if (! (kids && nkids))
{
@@ -146,11 +151,16 @@
}
else if (tenative)
{
+#ifndef STANDALONE
+ /* no point in harassing the user when run standalone; everyone has
+ * at least netscape 1.1 by now!
+ */
fprintf (stderr,
"%s: warning: expected version %s but found version\n"
"\t%s (0x%x) instead.\n",
progname, expected_mozilla_version,
tenative_version, (unsigned int) tenative);
+#endif
XFree (tenative_version);
return tenative;
}
@@ -348,7 +358,7 @@
mozilla_remote_command (Display *dpy, Window window, const char *command,
Bool raise_p)
{
- int result;
+ int result = -1;
Bool done = False;
char *new_command = 0;
@@ -507,6 +517,8 @@
int status = 0;
mozilla_remote_init_atoms (dpy);
+ if(commands == NULL) return 0;
+
if (window == 0)
window = mozilla_remote_find_window (dpy);
else
@@ -566,7 +578,7 @@
}
-void
+int
main (int argc, char **argv)
{
Display *dpy;
|