From 822fca474b0e9150c5a87f35fa9b78e1d54e67d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 17 Jun 2014 14:49:24 +0200 Subject: [PATCH] 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 --- events.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/events.cpp b/events.cpp index d84e09d240..514eecc69d 100644 --- a/events.cpp +++ b/events.cpp @@ -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(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(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(&event)); + } + return true; } } else if (eventType == XCB_MOTION_NOTIFY) { if (movingClient->moveResizeGrabWindow() == reinterpret_cast(e)->event && movingClient->windowEvent(e)) {