Add ungrabButton to Xcb::Window

The order of attributes is reversed compared to xcb_ungrab_button
to better allow for default arguments.
This commit is contained in:
Martin Gräßlin 2013-09-10 10:03:37 +02:00
parent 3ee886be2d
commit f354b41680
2 changed files with 13 additions and 4 deletions

View file

@ -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,

View file

@ -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()
{