diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-02-16 11:05:38 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-02-16 11:05:38 +0100 |
commit | 2d0c80018e6da8193a6c5bd5d764da509e16ab46 (patch) | |
tree | e6ffaf8ec73f6cade2d5fbd17b3ba6d27c790a77 /src/client/qwaylandinputdevice.cpp | |
parent | e6805407b62c9c57bac488813f77ee5cca71868e (diff) | |
parent | 8458e06b25c07ebc8cf6b210fc1ea4cc9aeb42eb (diff) |
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts:
src/client/qwaylanddataoffer.cpp
src/client/qwaylanddisplay.cpp
src/client/qwaylandinputdevice.cpp
src/client/qwaylandwindow.cpp
src/compositor/compositor_api/qwaylandsurfaceitem.cpp
Change-Id: I2eae0fd43a71fbfd7c907ca715707a26f3c134c5
Diffstat (limited to 'src/client/qwaylandinputdevice.cpp')
-rw-r--r-- | src/client/qwaylandinputdevice.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index db43e525b..63bbeb14a 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -439,10 +439,10 @@ void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surf // so we just set it outside of the window boundaries. pos = QPointF(-1, -1); global = grab->window()->mapToGlobal(pos.toPoint()); - MotionEvent e(time, pos, global, mButtons, Qt::NoModifier); + MotionEvent e(time, pos, global, mButtons, mParent->modifiers()); grab->handleMouse(mParent, e); } else { - MotionEvent e(time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); + MotionEvent e(time, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); window->handleMouse(mParent, e); } } @@ -450,7 +450,6 @@ void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surf void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time, uint32_t button, uint32_t state) { - Q_UNUSED(serial); QWaylandWindow *window = mFocus; Qt::MouseButton qt_button; @@ -483,15 +482,17 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time mParent->mTime = time; mParent->mSerial = serial; + if (state) + mParent->mQDisplay->setLastInputDevice(mParent, serial, window); QWaylandWindow *grab = QWaylandWindow::mouseGrab(); if (grab && grab != mFocus) { QPointF pos = QPointF(-1, -1); QPointF global = grab->window()->mapToGlobal(pos.toPoint()); - MotionEvent e(time, pos, global, mButtons, Qt::NoModifier); + MotionEvent e(time, pos, global, mButtons, mParent->modifiers()); grab->handleMouse(mParent, e); } else if (window) { - MotionEvent e(time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); + MotionEvent e(time, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); window->handleMouse(mParent, e); } } @@ -736,13 +737,13 @@ void QWaylandInputDevice::Keyboard::focusCallback(void *data, struct wl_callback void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state) { - Q_UNUSED(serial); QWaylandWindow *window = mFocus; uint32_t code = key + 8; bool isDown = state != 0; QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease; QString text; int qtkey = key + 8; // qt-compositor substracts 8 for some reason + mParent->mSerial = serial; if (!window) { // We destroyed the keyboard focus surface, but the server @@ -750,6 +751,9 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, return; } + if (isDown) + mParent->mQDisplay->setLastInputDevice(mParent, serial, window); + #ifndef QT_NO_WAYLAND_XKB if (!createDefaultKeyMap()) { return; @@ -761,7 +765,8 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, Qt::KeyboardModifiers modifiers = mParent->modifiers(); uint utf32 = xkb_keysym_to_utf32(sym); - text = QString::fromUcs4(&utf32, 1); + if (utf32) + text = QString::fromUcs4(&utf32, 1); qtkey = keysymToQtKey(sym, modifiers, text); @@ -855,6 +860,7 @@ void QWaylandInputDevice::Touch::touch_down(uint32_t serial, mParent->mTime = time; mParent->mSerial = serial; mFocus = QWaylandWindow::fromWlSurface(surface); + mParent->mQDisplay->setLastInputDevice(mParent, serial, mFocus); mParent->handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointPressed); } |