Skip to content

Commit d37f344

Browse files
committed
tmp
1 parent 8de5c6a commit d37f344

File tree

7 files changed

+113
-4
lines changed

7 files changed

+113
-4
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ include(KDEGitCommitHooks)
5555
find_package(Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui Concurrent Quick WaylandClient DBus LinguistTools Sql)
5656
find_package(Dtk${DTK_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui)
5757
find_package(WaylandProtocols REQUIRED)
58+
find_package(TreelandProtocols REQUIRED)
5859
find_package(PkgConfig REQUIRED)
5960

6061
add_subdirectory(frame)

frame/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ set_target_properties(dde-shell-frame PROPERTIES
8383
qt_generate_wayland_protocol_client_sources(dde-shell-frame FILES
8484
${CMAKE_CURRENT_SOURCE_DIR}/layershell/protocol/wlr-layer-shell-unstable-v1.xml
8585
${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml
86+
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-dde-shell-v1.xml
8687
)
8788

8889
set_target_properties(dde-shell-frame PROPERTIES

frame/layershell/qwaylandlayershellsurface.cpp

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111

1212
#include <QLoggingCategory>
1313

14+
#include <QtWaylandClient/private/qwaylandinputdevice_p.h>
1415
#include <QtWaylandClient/private/qwaylandscreen_p.h>
1516
#include <QtWaylandClient/private/qwaylandsurface_p.h>
1617
#include <QtWaylandClient/private/qwaylandwindow_p.h>
18+
#include <private/qwaylandnativeinterface_p.h>
1719

1820
Q_LOGGING_CATEGORY(layershellsurface, "dde.shell.layershell.surface")
1921

@@ -45,7 +47,8 @@ QWaylandLayerShellSurface::QWaylandLayerShellSurface(QtWayland::zwlr_layer_shell
4547
}
4648
}
4749

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()));
4952

5053
set_layer(m_dlayerShellWindow->layer());
5154
connect(m_dlayerShellWindow, &DLayerShellWindow::layerChanged, this, [this, window](){
@@ -80,6 +83,7 @@ QWaylandLayerShellSurface::QWaylandLayerShellSurface(QtWayland::zwlr_layer_shell
8083
if (m_requestSize.isValid()) {
8184
set_size(m_requestSize.width(), m_requestSize.height());
8285
}
86+
m_ddeShellSurface.reset(TreeLandDDEShellManager::instance()->getDDEShellSurface(m_surface));
8387
}
8488

8589
QWaylandLayerShellSurface::~QWaylandLayerShellSurface()
@@ -166,4 +170,47 @@ void QWaylandLayerShellSurface::attachPopup(QtWaylandClient::QWaylandShellSurfac
166170
}
167171
}
168172

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+
169216
DS_END_NAMESPACE

frame/layershell/qwaylandlayershellsurface_p.h

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111
#include <qwayland-wlr-layer-shell-unstable-v1.h>
1212
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
1313

14-
DS_BEGIN_NAMESPACE
14+
#include "qwayland-treeland-dde-shell-v1.h"
15+
#include <QtWaylandClient/QWaylandClientExtension>
1516

17+
DS_BEGIN_NAMESPACE
18+
class DDEShellSurface;
1619
class QWaylandLayerShellSurface : public QtWaylandClient::QWaylandShellSurface, public QtWayland::zwlr_layer_surface_v1
1720
{
1821
Q_OBJECT
@@ -28,6 +31,7 @@ class QWaylandLayerShellSurface : public QtWaylandClient::QWaylandShellSurface,
2831
void applyConfigure() override;
2932
void setWindowGeometry(const QRect &geometry) override;
3033
void attachPopup(QWaylandShellSurface *popup) override;
34+
bool resize(QtWaylandClient::QWaylandInputDevice *, Qt::Edges) override;
3135

3236
private:
3337
void zwlr_layer_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height) override;
@@ -37,10 +41,33 @@ class QWaylandLayerShellSurface : public QtWaylandClient::QWaylandShellSurface,
3741
bool anchorsSizeConflict() const;
3842
void trySetAnchorsAndSize();
3943

44+
struct ::wl_surface *m_surface;
45+
QScopedPointer<DDEShellSurface> m_ddeShellSurface;
4046
DLayerShellWindow* m_dlayerShellWindow;
4147
QSize m_pendingSize;
4248
QSize m_requestSize;
4349
bool m_configured = false;
4450
};
4551

52+
class TreeLandDDEShellManager : public QWaylandClientExtensionTemplate<TreeLandDDEShellManager>, public QtWayland::treeland_dde_shell_manager_v1
53+
{
54+
Q_OBJECT
55+
56+
private:
57+
explicit TreeLandDDEShellManager();
58+
59+
public:
60+
static TreeLandDDEShellManager *instance();
61+
DDEShellSurface *getDDEShellSurface(struct ::wl_surface *surface);
62+
};
63+
64+
class DDEShellSurface : public QWaylandClientExtensionTemplate<DDEShellSurface>, public QtWayland::treeland_dde_shell_surface_v1
65+
{
66+
Q_OBJECT
67+
68+
public:
69+
explicit DDEShellSurface(struct ::treeland_dde_shell_surface_v1 *object);
70+
~DDEShellSurface() override;
71+
};
72+
4673
DS_END_NAMESPACE

panels/dock/dockpanel.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ void DockPanel::setHideMode(const HideMode& mode)
240240
Q_EMIT hideStateChanged(hideState());
241241
}
242242

243-
Position DockPanel::position()
243+
Position DockPanel::position() const
244244
{
245245
return SETTINGS->position();
246246
}
@@ -330,6 +330,26 @@ void DockPanel::openDockSettings() const
330330
.call();
331331
}
332332

333+
void DockPanel::startSystemResize() const
334+
{
335+
Qt::Edge edge;
336+
switch (position()) {
337+
case Position::Top:
338+
edge = Qt::BottomEdge;
339+
break;
340+
case Position::Bottom:
341+
edge = Qt::TopEdge;
342+
break;
343+
case Position::Left:
344+
edge = Qt::RightEdge;
345+
break;
346+
case Position::Right:
347+
edge = Qt::LeftEdge;
348+
break;
349+
}
350+
window()->startSystemResize(edge);
351+
}
352+
333353
void DockPanel::launcherVisibleChanged(bool visible)
334354
{
335355
if (visible == m_launcherShown) return;

panels/dock/dockpanel.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class DockPanel : public DS_NAMESPACE::DPanel, public QDBusContext
6060
HideMode hideMode();
6161
void setHideMode(const HideMode& mode);
6262

63-
Position position();
63+
Position position() const;
6464
void setPosition(const Position& position);
6565

6666
ItemAlignment itemAlignment();
@@ -75,6 +75,7 @@ class DockPanel : public DS_NAMESPACE::DPanel, public QDBusContext
7575
bool debugMode() const;
7676

7777
Q_INVOKABLE void openDockSettings() const;
78+
Q_INVOKABLE void startSystemResize() const;
7879

7980
bool showInPrimary() const;
8081
void setShowInPrimary(bool newShowInPrimary);

panels/dock/package/main.qml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ Window {
4242
height: Panel.position == Dock.Left || Panel.position == Dock.Right ? -1 : dockSize
4343
color: "transparent"
4444
flags: Qt.WindowDoesNotAcceptFocus
45+
maximumHeight: useColumnLayout ? Screen.height : Dock.MAX_DOCK_SIZE
46+
minimumHeight: useColumnLayout? Screen.height : Dock.MIN_DOCK_SIZE
47+
maximumWidth: useColumnLayout ? Dock.MAX_DOCK_SIZE : Screen.width
48+
minimumWidth: useColumnLayout ? Dock.MIN_DOCK_SIZE : Screen.width
49+
50+
Binding {
51+
target: dock
52+
property: "dockSize"
53+
value: useColumnLayout? width : height
54+
}
4555

4656
function blendColorAlpha(fallback) {
4757
var appearance = DS.applet("org.deepin.ds.dde-appearance")
@@ -375,6 +385,8 @@ Window {
375385
}
376386

377387
onPressed: function(mouse) {
388+
Panel.startSystemResize()
389+
return
378390
dock.isDragging = true
379391
oldMousePos = mapToGlobal(mouse.x, mouse.y)
380392
oldDockSize = dockSize

0 commit comments

Comments
 (0)