diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-09-28 14:01:22 +0930 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-10-03 09:03:50 +0930 |
commit | 43ebc80ff1634281c8816a19403cb4d0bf04c8f5 (patch) | |
tree | 6cad5a40e58383dfc2cee809efe807805058eb4d | |
parent | da1516e5b4a2d5fc3445deb11af8fe67921099e7 (diff) |
Fix up resizing and button close handling.
Resizing should grab the device to not lose it while resizing.
And listening to button release events requires listening to button press
events.
-rw-r--r-- | src/Manager.cpp | 10 | ||||
-rw-r--r-- | src/PointerDevice.cpp | 13 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/Manager.cpp b/src/Manager.cpp index 735d58a..697ce79 100644 --- a/src/Manager.cpp +++ b/src/Manager.cpp @@ -661,8 +661,6 @@ void Manager::handleButtonPress(XDeviceButtonEvent* bev) { XSetClientPointer(x11->dpy, wmwindow->getClientWindow(), dev->getDevice()); - XAllowDeviceEvents(x11->dpy, dev->getDevice(), - ReplayThisDevice, CurrentTime); } else raiseWindow(wmwindow); @@ -692,6 +690,10 @@ void Manager::handleButtonPress(XDeviceButtonEvent* bev) wmwindow->setMinimize(true); dock->appendProcess(wmwindow); } + XAllowDeviceEvents(x11->dpy, dev->getDevice(), + ReplayThisDevice, CurrentTime); + XAllowDeviceEvents(x11->dpy, dev->getDevice(), + AsyncOtherDevices, CurrentTime); } void Manager::handleButtonRelease(XDeviceButtonEvent* bev) @@ -727,9 +729,7 @@ void Manager::handleButtonRelease(XDeviceButtonEvent* bev) return; } - // FIXME: I don't know what I did wrong here. It's supposed to report the - // button, not the button as subwindow. Nevermind for now. - if (win->isButtonClose(bev->subwindow)) + if (win->isButtonClose(bev->window)) { win->destroy(); return; diff --git a/src/PointerDevice.cpp b/src/PointerDevice.cpp index c819877..6b9a1d5 100644 --- a/src/PointerDevice.cpp +++ b/src/PointerDevice.cpp @@ -141,9 +141,11 @@ bool PointerDevice::resizeOn(WMWindow* win, Window button, int x, int y) resizeOffset[1] = y; resizeButton = button; - // in case we get out of the window we still need to catch the release - XEventClass classes[2] = {evclasses[XI_MotionNotify], evclasses[XI_ButtonRelease]}; - XSelectExtensionEvent(x11->dpy, x11->root, classes, 2); + XEventClass classes[3] = {evclasses[XI_MotionNotify], + evclasses[XI_ButtonPress], + evclasses[XI_ButtonRelease]}; + XGrabDevice(x11->dpy, this->dev, win->getWindowBar(), + True, 3, classes, GrabModeAsync, GrabModeAsync, CurrentTime); return true; } @@ -162,8 +164,7 @@ void PointerDevice::resizeOff() resizeWindow = NULL; resizeOffset[0] = resizeOffset[1] = 0; - XEventClass motion = evclasses[XI_MotionNotify]; - XSelectExtensionEvent(x11->dpy, x11->root, &motion, 1); + XUngrabDevice(x11->dpy, this->dev, CurrentTime); } bool PointerDevice::isResizing() @@ -198,7 +199,7 @@ void PointerDevice::setWMEvents(WMWindow* window) XSelectExtensionEvent(x11->dpy, window->getWindowBar(), &classes[0], 3); //XSelectExtensionEvent(x11->dpy, window->getResizeBar(), &classes[0], 3); - XSelectExtensionEvent(x11->dpy, window->getButtonClose(), &classes[2], 1); + XSelectExtensionEvent(x11->dpy, window->getButtonClose(), &classes[1], 2); XSelectExtensionEvent(x11->dpy, window->getButtonFloor(), &classes[1], 1); XSelectExtensionEvent(x11->dpy, window->getButtonOverlay(), &classes[1], 1); XSelectExtensionEvent(x11->dpy, window->getButtonMinimize(), &classes[1], 1); |