From 7a41c0171c4ed2ecbafa81f2af2c4ba658775952 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Mon, 3 Jul 2017 08:19:58 +0200 Subject: [PATCH 1/5] Use a non grabbing zxdg_popup_v6 for tooltips Change-Id: I9de16c48a1dee7728fb02faa590c112bd656aa09 Reviewed-by: David Edmundson Reviewed-by: Pier Luigi Fiorini --- src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp | 10 ++++++---- src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp index 9479402131d..cd81778c79c 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6.cpp @@ -163,8 +163,8 @@ void QWaylandXdgSurfaceV6::setAppId(const QString &appId) void QWaylandXdgSurfaceV6::setType(Qt::WindowType type, QWaylandWindow *transientParent) { - if (type == Qt::Popup && transientParent) { - setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial()); + if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent) { + setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial(), type == Qt::Popup); } else { setToplevel(); if (transientParent) { @@ -189,7 +189,7 @@ void QWaylandXdgSurfaceV6::setToplevel() m_toplevel = new Toplevel(this); } -void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) +void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial, bool grab) { Q_ASSERT(!m_toplevel && !m_popup); @@ -209,7 +209,9 @@ void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice m_popup = new Popup(this, parentXdgSurface, positioner); positioner->destroy(); delete positioner; - m_popup->grab(device->wl_seat(), serial); + if (grab) { + m_popup->grab(device->wl_seat(), serial); + } } void QWaylandXdgSurfaceV6::zxdg_surface_v6_configure(uint32_t serial) diff --git a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h index 12f7301d550..769f19837b4 100644 --- a/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h +++ b/src/plugins/platforms/wayland/qwaylandxdgshellv6_p.h @@ -121,7 +121,7 @@ private: }; void setToplevel(); - void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); + void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial, bool grab); QWaylandXdgShellV6 *m_shell; QWaylandWindow *m_window; From 6a1f52c90d3bbe19b8be68494d16e8af25559b96 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 19 Jul 2017 13:01:24 +0100 Subject: [PATCH 2/5] Reset mFrameCallback in destruction Otherwise we crash if we call reset twice. For example if we call setParent and setVisible together. Change-Id: I7f07825167bf8c3236a80e649a6d6805fd6c868b Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 5585fd52aba..98d0603ccbd 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -249,8 +249,10 @@ void QWaylandWindow::reset() if (isInitialized()) destroy(); - if (mFrameCallback) + if (mFrameCallback) { wl_callback_destroy(mFrameCallback); + mFrameCallback = nullptr; + } } QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface) From f41bd9c06eb8a5f78a661bdfa5a8ef4d378cdca9 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 14 Jul 2017 14:04:48 +0100 Subject: [PATCH 3/5] Check surface exists when setting textinput focus QWaylandWindow resets the surface on various events. Handling focus comes in a posted event, so this can be after we've hidden a window and lost a surface. Task-number: QTBUG-61704 Change-Id: I535ff78c6bc2b86816696a08f8eebc47186d1225 Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandinputcontext.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index dcc4ad5c7a0..fac5fb840ff 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -541,8 +541,10 @@ void QWaylandInputContext::setFocusObject(QObject *) if (window && window->handle() && inputMethodAccepted()) { if (mCurrentWindow.data() != window) { struct ::wl_surface *surface = static_cast(window->handle())->object(); - textInput()->enable(surface); - mCurrentWindow = window; + if (surface) { + textInput()->enable(surface); + mCurrentWindow = window; + } } textInput()->updateState(Qt::ImQueryAll, QtWayland::zwp_text_input_v2::update_state_enter); } From 66af01b17f8ab8e39158fb9bb67a6d3ef3c17a15 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 25 Jul 2017 14:40:41 +0200 Subject: [PATCH 4/5] Fallback to focusWindow as transient parent The wayland protocol requires Popup windows to have a transient parent set, in order to correctly position the window on the screen. In Qt, some popup menus don't have it, so they will appear misplaced in the screen. This adds an heuristic which makes transientParent() return the current application focus window, which is an approximation which won't be always correct, but seems to fix most applications Task-number: QTBUG-60932 Change-Id: Icec1e306d3f64f4f00ad735a8c2eedb99e85eabb Reviewed-by: Johan Helsing --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 98d0603ccbd..4a60a661684 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -720,6 +720,8 @@ QWaylandWindow *QWaylandWindow::transientParent() const // events. if (auto transientParent = window()->transientParent()) return static_cast(topLevelWindow(transientParent)->handle()); + else if (QGuiApplication::focusWindow() && (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup)) + return static_cast(topLevelWindow(QGuiApplication::focusWindow())->handle()); return nullptr; } From 9041247dc7264331ac5167c772a41f8cf66f56eb Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 21 Jul 2017 16:51:04 +0200 Subject: [PATCH 5/5] Try -lEGL when checking for wayland-egl This will detect wayland-egl on an imx6 without pkg-config Change-Id: I9c0fe6eef375fd0431a218c3b0407505c29eead9 Reviewed-by: Karim Pinter Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/wayland/configure.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/configure.json b/src/plugins/platforms/wayland/configure.json index d216960e1db..b11416f688b 100644 --- a/src/plugins/platforms/wayland/configure.json +++ b/src/plugins/platforms/wayland/configure.json @@ -28,7 +28,8 @@ "test": "wayland_egl", "sources": [ { "type": "pkgConfig", "args": "wayland-egl" }, - "-lwayland-egl" + "-lwayland-egl", + "-lEGL" ] }, "xcomposite": {