From f074784e6d45fd0c41ad4a5e10a932201609417c Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 29 Jan 2015 21:10:25 +0200 Subject: Send mouse events with the correct modifiers Change-Id: I33da2681bc2315b3dc7de16fa80c45e26a478caa Reviewed-by: Robin Burchell --- src/client/qwaylandinputdevice.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/client/qwaylandinputdevice.cpp') diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 39d1705c0..30bc6029b 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -419,7 +419,7 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf QWaylandWindow *grab = QWaylandWindow::mouseGrab(); if (!grab) { window->handleMouseEnter(mParent); - window->handleMouse(mParent, mParent->mTime, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); + window->handleMouse(mParent, mParent->mTime, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); } } @@ -468,9 +468,9 @@ 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()); - grab->handleMouse(mParent, time, pos, global, mButtons, Qt::NoModifier); + grab->handleMouse(mParent, time, pos, global, mButtons, mParent->modifiers()); } else - window->handleMouse(mParent, time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); + window->handleMouse(mParent, time, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); } void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time, @@ -514,9 +514,9 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time if (grab && grab != mFocus) { QPointF pos = QPointF(-1, -1); QPointF global = grab->window()->mapToGlobal(pos.toPoint()); - grab->handleMouse(mParent, time, pos, global, mButtons, Qt::NoModifier); + grab->handleMouse(mParent, time, pos, global, mButtons, mParent->modifiers()); } else if (window) - window->handleMouse(mParent, time, mSurfacePos, mGlobalPos, mButtons, Qt::NoModifier); + window->handleMouse(mParent, time, mSurfacePos, mGlobalPos, mButtons, mParent->modifiers()); } void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, int32_t value) -- cgit v1.2.3 From 7fec8a70acf8359d650a89b2eaf207b3a8b25540 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 4 Feb 2015 22:00:35 +0200 Subject: Do not send invisible key characters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit xkb_keysym_to_utf32() will return 0 if the keysym does not have a unicode representation. Task-number: QTBUG-44012 Change-Id: I85a13b58c7f0b9765c7d67db6568a90629bcfbfa Reviewed-by: Jørgen Lind --- src/client/qwaylandinputdevice.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/client/qwaylandinputdevice.cpp') diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 30bc6029b..b2dfd757d 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -778,7 +778,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); -- cgit v1.2.3 From dd69958792021e247da8caa7e9ecd503fd5e2540 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sat, 7 Feb 2015 19:29:19 +0200 Subject: Fix copying text to non-qt clients Like we do for pasting, set the mime type of text to "text/plain;charset=utf-8" too besides "text/plain". This allows copying text to clients such as weston example clients or Xwayland. Change-Id: I8a24f32d93e438f16db662e7c09b09ddd7578768 Reviewed-by: Laszlo Agocs --- src/client/qwaylandinputdevice.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/client/qwaylandinputdevice.cpp') diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index b2dfd757d..ad369bb32 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -761,6 +761,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, 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 -- cgit v1.2.3 From 8458e06b25c07ebc8cf6b210fc1ea4cc9aeb42eb Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Sat, 6 Sep 2014 22:55:07 +0200 Subject: Sanitize popup behavior. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Popups are pretty important for widget apps. Menus, combobox dropdows and such are all popups. Currently they are completely borked when activated via keyboard or touch. This is because of the bizarre set_popup request in the protocol, and Weston's current implementation, that ignore the fact that a popup can be opened as a result of a keyboard event too or may not originate from an input event at all. Pass the last input device and serial we have seen, regardless of the type, by tracking it globally in the QWaylandDisplay. With this patch menus and such will not freeze the application anymore when activated with keyboard or touch without sending a mouse event to the window first. The behavior is still broken in some ways, especially with keyboard due to immediately getting a popup_done, but at least applications remain usable. Task-number: QTBUG-41142 Task-number: QTBUG-41147 Change-Id: I18de501004ae8a62ff8667e72225d08c2d3ba491 Reviewed-by: Laszlo Agocs Reviewed-by: Jørgen Lind --- src/client/qwaylandinputdevice.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/client/qwaylandinputdevice.cpp') diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index ad369bb32..14575146d 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -476,7 +476,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; @@ -509,6 +508,8 @@ 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) { @@ -754,7 +755,6 @@ 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; @@ -769,6 +769,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 (!mXkbMap) return; @@ -875,6 +878,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); } -- cgit v1.2.3