summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--src/communications.c16
-rw-r--r--src/events.c2
-rw-r--r--src/screen.c11
-rw-r--r--src/screen.h2
5 files changed, 31 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 6807cfd..6313b4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2004-10-04 Shawn Betts <katia_dilkina@verizon.net>
+
+ * 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.
+
2004-09-29 Shawn Betts <sabetts@vcn.bc.ca>
* configure.in: Warn when the history header or library is not
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