diff options
author | rsc <devnull@localhost> | 2004-04-24 04:52:49 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-04-24 04:52:49 +0000 |
commit | 78802e6993a0f44d7ac7ff7d0922d55d1b089dac (patch) | |
tree | 2131829fda5ff9ee9f8ef8c88695c361cc4ba335 /src/libdraw | |
parent | 272fd660b41d7ec793bc9d8972878510f3b66055 (diff) | |
download | plan9port-78802e6993a0f44d7ac7ff7d0922d55d1b089dac.tar.gz plan9port-78802e6993a0f44d7ac7ff7d0922d55d1b089dac.tar.bz2 plan9port-78802e6993a0f44d7ac7ff7d0922d55d1b089dac.zip |
various bug fixes
Diffstat (limited to 'src/libdraw')
-rw-r--r-- | src/libdraw/x11-mouse.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/libdraw/x11-mouse.c b/src/libdraw/x11-mouse.c index df5bf7e9..4827423c 100644 --- a/src/libdraw/x11-mouse.c +++ b/src/libdraw/x11-mouse.c @@ -149,13 +149,21 @@ setcursor(Mousectl *mc, Cursor *c) _xsetcursor(c); } +/* + * Send the mouse event back to the window manager. + * So that 9term can tell rio to pop up its button3 menu. + * Note that we're using _x.mousecon in a few places, + * so we have to be sure that the mouse proc isn't using it + * when we call! This is all a bit wonky and should be + * avoided unless you know what you're doing. + */ void bouncemouse(Mouse *m) { XButtonEvent e; + XWindow dw; e.type = ButtonPress; - e.window = DefaultRootWindow(_x.display); e.state = 0; e.button = 0; if(m->buttons&1) @@ -164,10 +172,18 @@ bouncemouse(Mouse *m) e.button = 2; else if(m->buttons&4) e.button = 3; - e.x = m->xy.x; - e.y = m->xy.y; + e.same_screen = 1; + XTranslateCoordinates(_x.display, _x.drawable, + DefaultRootWindow(_x.display), + m->xy.x, m->xy.y, &e.x_root, &e.y_root, &dw); + e.root = DefaultRootWindow(_x.mousecon); + e.window = e.root; + e.subwindow = None; + e.x = e.x_root; + e.y = e.y_root; #undef time e.time = CurrentTime; - XSendEvent(_x.display, e.window, True, ButtonPressMask, (XEvent*)&e); - XFlush(_x.display); + XUngrabPointer(_x.mousecon, m->msec); + XSendEvent(_x.mousecon, e.root, True, ButtonPressMask, (XEvent*)&e); + XFlush(_x.mousecon); } |