Report keyboard modifiers in evdevmouse

Mouse and wheel events have no modifiers set. This is not ideal.
Pass at least QGuiApplication::keyboardModifiers() to get the
modifiers from the last key event.

Task-number: QTBUG-39812
Change-Id: Ica0c338c60c3e289dccfafa5aa6d602d4e111ad5
Reviewed-by: Leonard Lee <leonard.lee@digia.com>
Reviewed-by: Will Wagner <willw@carallon.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
Laszlo Agocs 2014-06-23 12:11:00 +02:00
parent 07297c4eaa
commit e8bb49e1d4

View File

@ -135,7 +135,9 @@ void QEvdevMouseManager::handleMouseEvent(int x, int y, bool abs, Qt::MouseButto
m_y = g.bottom() - m_yoffset;
QPoint pos(m_x + m_xoffset, m_y + m_yoffset);
QWindowSystemInterface::handleMouseEvent(0, pos, pos, buttons);
// Cannot track the keyboard modifiers ourselves here. Instead, report the
// modifiers from the last key event that has been seen by QGuiApplication.
QWindowSystemInterface::handleMouseEvent(0, pos, pos, buttons, QGuiApplication::keyboardModifiers());
#ifdef QT_QPA_MOUSEMANAGER_DEBUG
qDebug("mouse event %d %d %d", pos.x(), pos.y(), int(buttons));
@ -145,7 +147,7 @@ void QEvdevMouseManager::handleMouseEvent(int x, int y, bool abs, Qt::MouseButto
void QEvdevMouseManager::handleWheelEvent(int delta, Qt::Orientation orientation)
{
QPoint pos(m_x + m_xoffset, m_y + m_yoffset);
QWindowSystemInterface::handleWheelEvent(0, pos, pos, delta, orientation);
QWindowSystemInterface::handleWheelEvent(0, pos, pos, delta, orientation, QGuiApplication::keyboardModifiers());
#ifdef QT_QPA_MOUSEMANAGER_DEBUG
qDebug("mouse wheel event %dx%d %d %d", pos.x(), pos.y(), delta, int(orientation));