diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2016-08-05 10:27:06 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2016-08-10 11:33:29 +0000 |
commit | 1bc3b0fdc8d934c1ab69a902054681896b56d672 (patch) | |
tree | 1816ddb62f49e0b99999bbeb8c53f276cd4b4752 /src/client/qwaylandxdgshell.cpp | |
parent | b3b4778c237c43cfde02c4750017c37112c315c4 (diff) |
Client: Fix popup position for xdg shell
Popups used xdg_surface instead of xdg_popup. It's not possible to set a
position for an xdg_surface, because it's supposed to be a top level window (in
xdg shell v5). Consequently, popups were treated as top level windows and
positioned randomly on Weston.
Using xdg_popup instead solves the problem.
Task-number: QTBUG-55063
Change-Id: I223348677ef8a1ef1eee6a4c389276a6c802bcb5
Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Diffstat (limited to 'src/client/qwaylandxdgshell.cpp')
-rw-r--r-- | src/client/qwaylandxdgshell.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/client/qwaylandxdgshell.cpp b/src/client/qwaylandxdgshell.cpp index 9b351da6a..56bb3fae9 100644 --- a/src/client/qwaylandxdgshell.cpp +++ b/src/client/qwaylandxdgshell.cpp @@ -37,6 +37,7 @@ #include "qwaylandwindow_p.h" #include "qwaylandinputdevice_p.h" #include "qwaylandscreen_p.h" +#include "qwaylandxdgpopup_p.h" #include "qwaylandxdgsurface_p.h" #include <QtCore/QDebug> @@ -66,6 +67,19 @@ QWaylandXdgSurface *QWaylandXdgShell::createXdgSurface(QWaylandWindow *window) return new QWaylandXdgSurface(this, window); } +QWaylandXdgPopup *QWaylandXdgShell::createXdgPopup(QWaylandWindow *window) +{ + QWaylandWindow *parentWindow = window->transientParent(); + ::wl_surface *parentSurface = parentWindow->object(); + QWaylandInputDevice *inputDevice = window->display()->lastInputDevice(); + ::wl_seat *seat = inputDevice->wl_seat(); + uint serial = inputDevice->serial(); + QPoint position = window->geometry().topLeft(); + int x = position.x() + parentWindow->frameMargins().left(); + int y = position.y() + parentWindow->frameMargins().top(); + return new QWaylandXdgPopup(get_xdg_popup(window->object(), parentSurface, seat, serial, x, y), window); +} + void QWaylandXdgShell::xdg_shell_ping(uint32_t serial) { pong(serial); |