|
6 | 6 |
|
7 | 7 | #include <QMap> |
8 | 8 | #include <QPointer> |
| 9 | +#include <QQuickWindow> |
9 | 10 | #include <QtWaylandCompositor/QWaylandCompositor> |
10 | 11 | #include <QtWaylandCompositor/QWaylandQuickExtension> |
11 | 12 | #include <QtWaylandCompositor/QWaylandResource> |
@@ -99,8 +100,8 @@ class PluginManager : public QWaylandCompositorExtensionTemplate<PluginManager>, |
99 | 100 | void dockSizeChanged(); |
100 | 101 | void requestShutdown(const QString &type); |
101 | 102 | // Signal emitted when XEmbed window move is requested |
102 | | - // Parameters: wid (window ID), pluginId, itemKey, dx (relative x offset), dy (relative y offset) |
103 | | - void moveXEmbedWindowRequested(uint32_t wid, const QString &pluginId, const QString &itemKey, double dx, double dy); |
| 103 | + // Parameters: wid (window ID), pluginId, itemKey, dx, dy, anchorWindow (the window containing the plugin item) |
| 104 | + void moveXEmbedWindowRequested(uint32_t wid, const QString &pluginId, const QString &itemKey, double dx, double dy, QQuickWindow *anchorWindow); |
104 | 105 |
|
105 | 106 | private Q_SLOTS: |
106 | 107 | void onFontChanged(); |
@@ -192,10 +193,16 @@ class PluginSurface : public QWaylandShellSurfaceTemplate<PluginSurface>, public |
192 | 193 |
|
193 | 194 | Q_INVOKABLE void updatePluginGeometry(const QRect &geometry); |
194 | 195 | Q_INVOKABLE void setGlobalPos(const QPoint &pos); |
| 196 | + Q_INVOKABLE void setAnchorWindow(QQuickWindow *window); |
195 | 197 |
|
196 | | - // Position relative to the dock window, set from QML via updatePluginGeometry |
| 198 | + // Position relative to the containing window, set from QML via updatePluginGeometry |
197 | 199 | QPoint itemPosition() const; |
198 | 200 |
|
| 201 | + QQuickWindow *anchorWindow() const; |
| 202 | + |
| 203 | + QPoint lastGlobalPos() const { return m_lastGlobalPos; } |
| 204 | + QPoint lastGlobalPosPhysical() const { return m_lastGlobalPosPhysical; } |
| 205 | + |
199 | 206 | int margins() const; |
200 | 207 | void setMargins(int newMargins); |
201 | 208 |
|
@@ -234,7 +241,10 @@ class PluginSurface : public QWaylandShellSurfaceTemplate<PluginSurface>, public |
234 | 241 | int m_margins = 0; |
235 | 242 | int m_height; |
236 | 243 | int m_width; |
237 | | - QPoint m_itemPosition; // Position relative to dock window, for XEmbed window positioning |
| 244 | + QPoint m_itemPosition; |
| 245 | + QPointer<QQuickWindow> m_anchorWindow; |
| 246 | + QPoint m_lastGlobalPos; // Last raw global position from QML (itemGlobalPos), logical pixels |
| 247 | + QPoint m_lastGlobalPosPhysical; // The physical position sent to client via setGlobalPos |
238 | 248 | }; |
239 | 249 |
|
240 | 250 | class PluginPopup : public QWaylandShellSurfaceTemplate<PluginPopup>, public QtWaylandServer::plugin_popup |
|
0 commit comments