diff --git a/events.cpp b/events.cpp index eeb4fd5233..13ed239b0e 100644 --- a/events.cpp +++ b/events.cpp @@ -927,8 +927,7 @@ void Client::ungrabButton(int modifier) for (int i = 0; i < 8; ++i) - XUngrabButton(display(), AnyButton, - modifier | mods[ i ], wrapperId()); + m_wrapper.ungrabButton(modifier | mods[ i ]); } #undef XCapL #undef XNumL @@ -943,7 +942,7 @@ void Client::ungrabButton(int modifier) void Client::updateMouseGrab() { if (workspace()->globalShortcutsDisabled()) { - XUngrabButton(display(), AnyButton, AnyModifier, wrapperId()); + m_wrapper.ungrabButton(); // keep grab for the simple click without modifiers if needed (see below) bool not_obscured = workspace()->topClientOnDesktop(VirtualDesktopManager::self()->current(), -1, true, false) == this; if (!(!options->isClickRaise() || not_obscured)) @@ -969,7 +968,7 @@ void Client::updateMouseGrab() ungrabButton(ControlMask); ungrabButton(ControlMask | ShiftMask); } else { - XUngrabButton(display(), AnyButton, AnyModifier, wrapperId()); + m_wrapper.ungrabButton(); // simply grab all modifier combinations XGrabButton(display(), AnyButton, AnyModifier, wrapperId(), false, ButtonPressMask, diff --git a/xcbutils.h b/xcbutils.h index 027105cf85..117cce9b84 100644 --- a/xcbutils.h +++ b/xcbutils.h @@ -438,6 +438,7 @@ public: void reparent(xcb_window_t parent, int x = 0, int y = 0); void deleteProperty(xcb_atom_t property); void setBorderWidth(uint32_t width); + void ungrabButton(uint16_t modifiers = XCB_MOD_MASK_ANY, uint8_t button = XCB_BUTTON_INDEX_ANY); /** * Clears the window area. Same as xcb_clear_area with x, y, width, height being @c 0. **/ @@ -643,6 +644,15 @@ void Window::setBorderWidth(uint32_t width) xcb_configure_window(connection(), m_window, XCB_CONFIG_WINDOW_BORDER_WIDTH, &width); } +inline +void Window::ungrabButton(uint16_t modifiers, uint8_t button) +{ + if (!isValid()) { + return; + } + xcb_ungrab_button(connection(), button, m_window, modifiers); +} + inline void Window::clear() {