From c32146268b261c8b2296427f476c4c1aa9e17bc7 Mon Sep 17 00:00:00 2001 From: sabetts Date: Fri, 20 Oct 2000 17:39:03 +0000 Subject: added initial support for hiding the rat on key events --- src/events.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'src/events.c') 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; -- cgit v1.2.3