Send a synthetic button release event to the decoration for moving client

Qt doesn't process the button release event for our moveresize window
wrapper. This means that Qt still thinks the button is pressed and breaks
a few things like one cannot enter another move/resize mode.

BUG: 336204
BUG: 336343
REVIEW: 118794
This commit is contained in:
Martin Gräßlin 2014-06-17 14:49:24 +02:00
parent 52653aaede
commit 822fca474b

View file

@ -313,9 +313,21 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
}
if (movingClient) {
if (eventType == XCB_BUTTON_PRESS || eventType == XCB_BUTTON_RELEASE) {
Client *c = movingClient;
if (movingClient->moveResizeGrabWindow() == reinterpret_cast<xcb_button_press_event_t*>(e)->event && movingClient->windowEvent(e)) {
// we need to pass the button release event to the decoration, otherwise Qt still thinks the button is pressed.
return eventType == XCB_BUTTON_PRESS;
if (eventType == XCB_BUTTON_RELEASE && c->decorationId() != XCB_WINDOW_NONE) {
// the event is for the moveResizeGrabWindow and Qt doesn't forward that to the decoration
// so we need to send the event to the decoration ourselves
// TODO check whether m_moveResizeWindow can be offscreen and XAllowEvents be sufficient here
xcb_button_release_event_t event = *(reinterpret_cast<xcb_button_release_event_t*>(e));
event.event = c->decorationId();
event.child = XCB_WINDOW_NONE;
event.event_x = event.root_x - c->x() + c->paddingLeft();
event.event_y = event.root_y - c->y() + c->paddingTop();
xcb_send_event(connection(), false, c->decorationId(), XCB_EVENT_MASK_BUTTON_RELEASE, reinterpret_cast<const char*>(&event));
}
return true;
}
} else if (eventType == XCB_MOTION_NOTIFY) {
if (movingClient->moveResizeGrabWindow() == reinterpret_cast<xcb_motion_notify_event_t*>(e)->event && movingClient->windowEvent(e)) {