Fix check for no button pressed in Client::buttonReleaseEvent()
There is a check in Client::buttonReleaseEvent() for the state of the mouse buttons compared to the button masks for button 1, 2, 3 (X11 button indices). The check was: if ((state & (Button1Mask & Button2Mask & Button3Mask)) == 0) { ... } <=> if (state & 0 == 0) <=> if (true) This change assumes what the check was supposed to be and fixes the problem. The correct fix was proposed by Thomas. REVIEW: 113359
This commit is contained in:
parent
d36319ebbe
commit
b5b7fac056
1 changed files with 12 additions and 2 deletions
14
events.cpp
14
events.cpp
|
@ -1134,7 +1134,7 @@ void Client::processMousePressEvent(QMouseEvent* e)
|
|||
}
|
||||
|
||||
// return value matters only when filtering events before decoration gets them
|
||||
bool Client::buttonReleaseEvent(xcb_window_t w, int /*button*/, int state, int x, int y, int x_root, int y_root)
|
||||
bool Client::buttonReleaseEvent(xcb_window_t w, int button, int state, int x, int y, int x_root, int y_root)
|
||||
{
|
||||
if (w == decorationId() && !buttonDown)
|
||||
return false;
|
||||
|
@ -1146,7 +1146,17 @@ bool Client::buttonReleaseEvent(xcb_window_t w, int /*button*/, int state, int x
|
|||
return true;
|
||||
x = this->x(); // translate from grab window to local coords
|
||||
y = this->y();
|
||||
if ((state & (Button1Mask & Button2Mask & Button3Mask)) == 0) {
|
||||
|
||||
// Check whether other buttons are still left pressed
|
||||
int buttonMask = XCB_BUTTON_MASK_1 | XCB_BUTTON_MASK_2 | XCB_BUTTON_MASK_3;
|
||||
if (button == XCB_BUTTON_INDEX_1)
|
||||
buttonMask &= ~XCB_BUTTON_MASK_1;
|
||||
else if (button == XCB_BUTTON_INDEX_2)
|
||||
buttonMask &= ~XCB_BUTTON_MASK_2;
|
||||
else if (button == XCB_BUTTON_INDEX_3)
|
||||
buttonMask &= ~XCB_BUTTON_MASK_3;
|
||||
|
||||
if ((state & buttonMask) == 0) {
|
||||
buttonDown = false;
|
||||
stopDelayedMoveResize();
|
||||
if (moveResizeMode) {
|
||||
|
|
Loading…
Reference in a new issue