diff options
author | sabetts <sabetts> | 2004-10-05 03:07:22 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2004-10-05 03:07:22 +0000 |
commit | ad1da50e94819e8e79da1fc0246f247bfdbc99a9 (patch) | |
tree | 991682c6b11919bb5fd29eee85631bd95c1aa459 /src | |
parent | 442b8d1ae2f4419ca2e2e4d76ad06ae38d18d1c7 (diff) | |
download | ratpoison-ad1da50e94819e8e79da1fc0246f247bfdbc99a9.zip |
* src/screen.h (is_a_root_window): new prototype
* src/screen.c (is_a_root_window): new function
* src/events.c (property_notify): check for ratpoison commands on
every root window, not just the default root window.
* src/communications.c (send_command): store the root window in a
variable, root. and use it whenever the root window is needed.
Diffstat (limited to 'src')
-rw-r--r-- | src/communications.c | 16 | ||||
-rw-r--r-- | src/events.c | 2 | ||||
-rw-r--r-- | src/screen.c | 11 | ||||
-rw-r--r-- | src/screen.h | 2 |
4 files changed, 19 insertions, 12 deletions
diff --git a/src/communications.c b/src/communications.c index 79af600..4356dfa 100644 --- a/src/communications.c +++ b/src/communications.c @@ -83,7 +83,7 @@ receive_command_result (Window w) int send_command (unsigned char interactive, unsigned char *cmd, int screen_num) { - Window w; + Window w, root; int done = 0; struct sbuf *s; @@ -94,15 +94,11 @@ send_command (unsigned char interactive, unsigned char *cmd, int screen_num) /* If the user specified a specific screen, then send the event to that screen. */ if (screen_num >= 0) - { - w = XCreateSimpleWindow (dpy, RootWindow (dpy, screen_num), - 0, 0, 1, 1, 0, 0, 0); - } + root = RootWindow (dpy, screen_num); else - { - w = XCreateSimpleWindow (dpy, DefaultRootWindow (dpy), - 0, 0, 1, 1, 0, 0, 0); - } + root = DefaultRootWindow (dpy); + + w = XCreateSimpleWindow (dpy, root, 0, 0, 1, 1, 0, 0, 0); /* Select first to avoid race condition */ XSelectInput (dpy, w, PropertyChangeMask); @@ -110,7 +106,7 @@ send_command (unsigned char interactive, unsigned char *cmd, int screen_num) XChangeProperty (dpy, w, rp_command, XA_STRING, 8, PropModeReplace, sbuf_get(s), strlen (cmd) + 2); - XChangeProperty (dpy, DefaultRootWindow (dpy), + XChangeProperty (dpy, root, rp_command_request, XA_WINDOW, 8, PropModeAppend, (unsigned char *)&w, sizeof (Window)); diff --git a/src/events.c b/src/events.c index 001eab6..220e7df 100644 --- a/src/events.c +++ b/src/events.c @@ -561,7 +561,7 @@ property_notify (XEvent *ev) PRINT_DEBUG (("atom: %ld\n", ev->xproperty.atom)); if (ev->xproperty.atom == rp_command_request - && ev->xproperty.window == DefaultRootWindow (dpy) + && is_a_root_window (ev->xproperty.window) && ev->xproperty.state == PropertyNewValue) { PRINT_DEBUG (("ratpoison command\n")); diff --git a/src/screen.c b/src/screen.c index 5d7329d..56aa96e 100644 --- a/src/screen.c +++ b/src/screen.c @@ -146,6 +146,17 @@ find_screen (Window w) return NULL; } +/* Return 1 if w is a root window of any of the screens. */ +int +is_a_root_window (int w) +{ + int i; + for (i=0; i<num_screens; i++) + if (screens[i].root == w) return 1; + + return 0; +} + void init_screens (int screen_arg, int screen_num) { diff --git a/src/screen.h b/src/screen.h index d009f5d..fdc37af 100644 --- a/src/screen.h +++ b/src/screen.h @@ -37,6 +37,6 @@ rp_frame *screen_get_frame (rp_screen *s, int frame_num); void init_screens (int screen_arg, int screen_num); int is_rp_window_for_screen (Window w, rp_screen *s); - +int is_a_root_window (int w); #endif |