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