|
11 | 11 |
|
12 | 12 | #include <QLoggingCategory> |
13 | 13 |
|
| 14 | +#include <QtWaylandClient/private/qwaylandinputdevice_p.h> |
14 | 15 | #include <QtWaylandClient/private/qwaylandscreen_p.h> |
15 | 16 | #include <QtWaylandClient/private/qwaylandsurface_p.h> |
16 | 17 | #include <QtWaylandClient/private/qwaylandwindow_p.h> |
| 18 | +#include <private/qwaylandnativeinterface_p.h> |
17 | 19 |
|
18 | 20 | Q_LOGGING_CATEGORY(layershellsurface, "dde.shell.layershell.surface") |
19 | 21 |
|
@@ -45,7 +47,8 @@ QWaylandLayerShellSurface::QWaylandLayerShellSurface(QtWayland::zwlr_layer_shell |
45 | 47 | } |
46 | 48 | } |
47 | 49 |
|
48 | | - init(shell->get_layer_surface(window->waylandSurface()->object(), output, m_dlayerShellWindow->layer(), m_dlayerShellWindow->scope())); |
| 50 | + m_surface = window->waylandSurface()->object(); |
| 51 | + init(shell->get_layer_surface(m_surface, output, m_dlayerShellWindow->layer(), m_dlayerShellWindow->scope())); |
49 | 52 |
|
50 | 53 | set_layer(m_dlayerShellWindow->layer()); |
51 | 54 | connect(m_dlayerShellWindow, &DLayerShellWindow::layerChanged, this, [this, window](){ |
@@ -80,6 +83,7 @@ QWaylandLayerShellSurface::QWaylandLayerShellSurface(QtWayland::zwlr_layer_shell |
80 | 83 | if (m_requestSize.isValid()) { |
81 | 84 | set_size(m_requestSize.width(), m_requestSize.height()); |
82 | 85 | } |
| 86 | + m_ddeShellSurface.reset(TreeLandDDEShellManager::instance()->getDDEShellSurface(m_surface)); |
83 | 87 | } |
84 | 88 |
|
85 | 89 | QWaylandLayerShellSurface::~QWaylandLayerShellSurface() |
@@ -166,4 +170,47 @@ void QWaylandLayerShellSurface::attachPopup(QtWaylandClient::QWaylandShellSurfac |
166 | 170 | } |
167 | 171 | } |
168 | 172 |
|
| 173 | +bool QWaylandLayerShellSurface::resize(QtWaylandClient::QWaylandInputDevice *inputDevice, Qt::Edges edges) |
| 174 | +{ |
| 175 | + if (!m_ddeShellSurface) { |
| 176 | + m_ddeShellSurface.reset(TreeLandDDEShellManager::instance()->getDDEShellSurface(m_surface)); |
| 177 | + } |
| 178 | + |
| 179 | + if (TreeLandDDEShellManager::instance()->isActive() && m_ddeShellSurface) { |
| 180 | + m_ddeShellSurface->resize(inputDevice->wl_seat(), inputDevice->serial(), 1); |
| 181 | + return true; |
| 182 | + } |
| 183 | + |
| 184 | + return false; |
| 185 | +} |
| 186 | + |
| 187 | +TreeLandDDEShellManager::TreeLandDDEShellManager() |
| 188 | + : QWaylandClientExtensionTemplate<TreeLandDDEShellManager>(treeland_dde_shell_manager_v1_interface.version) |
| 189 | +{ |
| 190 | +} |
| 191 | + |
| 192 | +TreeLandDDEShellManager *TreeLandDDEShellManager::instance() |
| 193 | +{ |
| 194 | + static TreeLandDDEShellManager _instance; |
| 195 | + return &_instance; |
| 196 | +} |
| 197 | + |
| 198 | +DDEShellSurface *TreeLandDDEShellManager::getDDEShellSurface(struct ::wl_surface *surface) |
| 199 | +{ |
| 200 | + if (isActive()) |
| 201 | + return new DDEShellSurface(this->get_shell_surface(surface)); |
| 202 | + return nullptr; |
| 203 | +} |
| 204 | + |
| 205 | +DDEShellSurface::DDEShellSurface(struct ::treeland_dde_shell_surface_v1 *object) |
| 206 | + : QWaylandClientExtensionTemplate<DDEShellSurface>(treeland_dde_shell_surface_v1_interface.version) |
| 207 | + , treeland_dde_shell_surface_v1(object) |
| 208 | +{ |
| 209 | +} |
| 210 | + |
| 211 | +DDEShellSurface::~DDEShellSurface() |
| 212 | +{ |
| 213 | + destroy(); |
| 214 | +} |
| 215 | + |
169 | 216 | DS_END_NAMESPACE |
0 commit comments