diff options
author | sabetts <sabetts> | 2000-10-20 17:39:03 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2000-10-20 17:39:03 +0000 |
commit | c32146268b261c8b2296427f476c4c1aa9e17bc7 (patch) | |
tree | 7334c8d0e0827b069209e457ccf461f08e25f128 /src/events.c | |
parent | e4d6a91e68beae9112624c6d1320b8c7c1119917 (diff) | |
download | ratpoison-c32146268b261c8b2296427f476c4c1aa9e17bc7.zip |
added initial support for hiding the rat on key events
Diffstat (limited to 'src/events.c')
-rw-r--r-- | src/events.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/events.c b/src/events.c index 2c75b41..99788b9 100644 --- a/src/events.c +++ b/src/events.c @@ -302,10 +302,27 @@ key_press (XEvent *ev) s = find_screen (ev->xkey.root); - if (s && ks == KEY_PREFIX && (modifier & MODIFIER_PREFIX)) + if (rat_visible) + { + XWarpPointer (dpy, None, s->root, 0, 0, 0, 0, s->root_attr.width, s->root_attr.height); +/* rat_visible = 0; */ + } + + if (!s) return; + + if (ks == KEY_PREFIX && (modifier & MODIFIER_PREFIX)) { handle_key (s); } + else + { + if (rp_current_window) + { + ev->xkey.window = rp_current_window->w; + XSendEvent (dpy, rp_current_window->w, False, KeyPressMask, ev); + XSync (dpy, False); + } + } } void @@ -330,6 +347,19 @@ property_notify (XEvent *ev) } } +void +rat_motion (XMotionEvent *ev) +{ + if (!rat_visible) + { + XWarpPointer (dpy, None, ev->root, 0, 0, 0, 0, rat_x, rat_y); + /* rat_visible = 1; */ + } + + rat_x = ev->x_root; + rat_y = ev->y_root; +} + /* Given an event, call the correct function to handle it. */ void delegate_event (XEvent *ev) @@ -398,7 +428,9 @@ delegate_event (XEvent *ev) case MotionNotify: PRINT_DEBUG ("MotionNotify\n"); + rat_motion (&ev->xmotion); break; + case Expose: PRINT_DEBUG ("Expose\n"); break; |