diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-09-02 16:46:16 +0930 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-10-03 09:03:49 +0930 |
commit | d3d7e6dccf4a980ba3a57b0435c9720501c09d1f (patch) | |
tree | ea35081904d808060eda74ff7b81e2630832a491 | |
parent | ff6db53b7d8d7dd5e86df9e3628d8436de2c765a (diff) |
Grab device button for client window to allow better focus setting.
-rw-r--r-- | src/Manager.cpp | 16 | ||||
-rw-r--r-- | src/PointerDevice.cpp | 4 | ||||
-rw-r--r-- | src/WMWindow.cpp | 1 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/Manager.cpp b/src/Manager.cpp index 1ba4e24..cd5daa1 100644 --- a/src/Manager.cpp +++ b/src/Manager.cpp @@ -642,7 +642,9 @@ void Manager::handleButtonPress(XDeviceButtonEvent* bev) return; } - if (wmwindow->isResizeBar(bev->window) || wmwindow->isWindowBar(bev->window)) + if (wmwindow->isResizeBar(bev->window) || + wmwindow->isWindowBar(bev->window) || + wmwindow->isClientWindow(bev->window)) { XSetClientPointer(x11->dpy, wmwindow->getClientWindow(), dev->getDevice()); @@ -654,7 +656,14 @@ void Manager::handleButtonPress(XDeviceButtonEvent* bev) wmwindow->getClientWindow(), PointerRoot, CurrentTime); it++; } - raiseWindow(wmwindow); + + if (wmwindow->isClientWindow(bev->window)) + { + XAllowDeviceEvents(x11->dpy, dev->getDevice(), + ReplayThisDevice, CurrentTime); + } + else + raiseWindow(wmwindow); } if (wmwindow->isWindowBar(bev->window)) @@ -798,6 +807,9 @@ void Manager::handlePresenceNotify(XDevicePresenceNotifyEvent* ev) } dock->setPointerEvents(&pointers); + + + } catch (DeviceError* e) { ERR("%s\n", e->message.c_str()); diff --git a/src/PointerDevice.cpp b/src/PointerDevice.cpp index d5bd91f..48d60ae 100644 --- a/src/PointerDevice.cpp +++ b/src/PointerDevice.cpp @@ -212,6 +212,10 @@ void PointerDevice::setWMEvents(WMWindow* window) XSelectExtensionEvent(x11->dpy, window->getResizeBtNW(), &classes[1], 1); XSelectExtensionEvent(x11->dpy, window->getResizeBtSE(), &classes[1], 1); XSelectExtensionEvent(x11->dpy, window->getResizeBtSW(), &classes[1], 1); + + XGrabDeviceButton(x11->dpy, dev, Button1, AnyModifier, + NULL, window->getClientWindow(), False, + 0, NULL, GrabModeSync, GrabModeSync); } void PointerDevice::setDockEvents(Window win) diff --git a/src/WMWindow.cpp b/src/WMWindow.cpp index 3a11367..40749c4 100644 --- a/src/WMWindow.cpp +++ b/src/WMWindow.cpp @@ -945,3 +945,4 @@ void WMWindow::paintButton(cairo_t* cr) cairo_rel_curve_to(cr, 0, -rounded, 0, -rounded, rounded, -rounded); cairo_fill(cr); } + |