x11: Fix MouseButtonPress events sent to decoration
ButtonPressEvent::state includes keys and buttons prior to the button press has been generated. On the other hand, it appears that QMouseEvent::buttons() should include currently pressed buttons, i.e. the button that has been just pressed should be in that bitfield. This is important for QQuickDeliveryAgent, which checks QMouseEvent::button() and QMouseEvent::buttons() to decide whether to send the button event only to tap handlers or both tap handlers and mouse areas. BUG: 476653
This commit is contained in:
parent
7c8036efef
commit
b01b626ca8
1 changed files with 12 additions and 4 deletions
|
@ -1045,8 +1045,12 @@ bool X11Window::buttonPressEvent(xcb_window_t w, int button, int state, int x, i
|
|||
x = x_root - frameGeometry().x();
|
||||
y = y_root - frameGeometry().y();
|
||||
// New API processes core events FIRST and only passes unused ones to the decoration
|
||||
QMouseEvent ev(QMouseEvent::MouseButtonPress, QPoint(x, y), QPoint(x_root, y_root),
|
||||
x11ToQtMouseButton(button), x11ToQtMouseButtons(state), Qt::KeyboardModifiers());
|
||||
QMouseEvent ev(QMouseEvent::MouseButtonPress,
|
||||
QPoint(x, y),
|
||||
QPoint(x_root, y_root),
|
||||
x11ToQtMouseButton(button),
|
||||
x11ToQtMouseButtons(state) | x11ToQtMouseButton(button),
|
||||
Qt::KeyboardModifiers());
|
||||
return processDecorationButtonPress(&ev, true);
|
||||
}
|
||||
if (w == frameId() && isDecorated()) {
|
||||
|
@ -1074,8 +1078,12 @@ bool X11Window::buttonPressEvent(xcb_window_t w, int button, int state, int x, i
|
|||
}
|
||||
}
|
||||
} else {
|
||||
QMouseEvent event(QEvent::MouseButtonPress, QPointF(x, y), QPointF(x_root, y_root),
|
||||
x11ToQtMouseButton(button), x11ToQtMouseButtons(state), x11ToQtKeyboardModifiers(state));
|
||||
QMouseEvent event(QEvent::MouseButtonPress,
|
||||
QPointF(x, y),
|
||||
QPointF(x_root, y_root),
|
||||
x11ToQtMouseButton(button),
|
||||
x11ToQtMouseButtons(state) | x11ToQtMouseButton(button),
|
||||
x11ToQtKeyboardModifiers(state));
|
||||
event.setTimestamp(time);
|
||||
event.setAccepted(false);
|
||||
QCoreApplication::sendEvent(decoration(), &event);
|
||||
|
|
Loading…
Reference in a new issue