27
27
28
28
#include < wayland-client.h>
29
29
30
- #include < Shell >
30
+ #include < layershellwindow.h >
31
31
#include < tlogger.h>
32
32
33
33
#include " waylandwindow.h"
@@ -46,11 +46,11 @@ WaylandBackend::WaylandBackend() : WmBackend() {
46
46
d->parent = this ;
47
47
d->accessibility = new WaylandAccessibility (this );
48
48
49
- LayerShellQt::Shell::useLayerShell ();
49
+ // LayerShellQt::Shell::useLayerShell();
50
+ qputenv (" QT_WAYLAND_SHELL_INTEGRATION" , " tdesktopenvironment-layer-shell" );
50
51
51
52
d->display = reinterpret_cast <wl_display*>(qApp->platformNativeInterface ()->nativeResourceForIntegration (" display" ));
52
53
53
-
54
54
wl_registry_listener listener = {
55
55
[](void * data, wl_registry * registry, quint32 name, const char * interface, quint32 version) {
56
56
if (strcmp (interface, zwlr_foreign_toplevel_manager_v1_interface.name ) == 0 ) {
@@ -144,29 +144,31 @@ void WaylandBackend::setSystemWindow(QWidget* widget) {
144
144
}
145
145
146
146
void WaylandBackend::setSystemWindow (QWidget* widget, DesktopWm::SystemWindowType windowType) {
147
- // TODO: Implement
148
147
widget->show ();
149
- LayerShellQt::Window * layerWindow = LayerShellQt::Window::get (widget->windowHandle ());
150
- layerWindow->setKeyboardInteractivity (LayerShellQt::Window::KeyboardInteractivityOnDemand );
148
+ LayerShellWindow * layerWindow = LayerShellWindow::forWindow (widget->windowHandle ());
149
+ layerWindow->setKeyboardInteractivity (LayerShellWindow::OnDemand );
151
150
152
151
switch (windowType) {
153
152
case DesktopWm::SystemWindowTypeSkipTaskbarOnly:
154
153
break ;
155
154
case DesktopWm::SystemWindowTypeDesktop:
156
- layerWindow->setLayer (LayerShellQt::Window::LayerBackground);
157
- // layerWindow->setAnchors(static_cast<LayerShellQt::Window::Anchors>(LayerShellQt::Window::AnchorLeft | LayerShellQt::Window::AnchorBottom | LayerShellQt::Window::AnchorRight | LayerShellQt::Window::AnchorTop));
155
+ layerWindow->setLayer (LayerShellWindow::Background);
156
+ layerWindow->setExclusiveZone (-1 );
157
+ layerWindow->setKeyboardInteractivity (LayerShellWindow::None);
158
158
break ;
159
159
case DesktopWm::SystemWindowTypeTaskbar:
160
- layerWindow->setLayer (LayerShellQt::Window::LayerTop );
161
- // layerWindow->setAnchors(LayerShellQt::Window ::AnchorTop);
160
+ layerWindow->setLayer (LayerShellWindow::Top );
161
+ layerWindow->setAnchors (LayerShellWindow ::AnchorTop);
162
162
break ;
163
163
case DesktopWm::SystemWindowTypeNotification:
164
- layerWindow->setLayer (LayerShellQt::Window::LayerOverlay );
164
+ layerWindow->setLayer (LayerShellWindow::Overlay );
165
165
layerWindow->setExclusiveZone (0 );
166
166
break ;
167
167
case DesktopWm::SystemWindowTypeMenu:
168
- layerWindow->setLayer (LayerShellQt::Window::LayerOverlay);
169
- layerWindow->setAnchors (static_cast <LayerShellQt::Window::Anchors>(LayerShellQt::Window::AnchorLeft | LayerShellQt::Window::AnchorTop | LayerShellQt::Window::AnchorBottom));
168
+ layerWindow->setLayer (LayerShellWindow::Overlay);
169
+ layerWindow->setExclusiveZone (-1 );
170
+ layerWindow->setAnchors (static_cast <LayerShellWindow::Anchors>(LayerShellWindow::AnchorLeft | LayerShellWindow::AnchorTop | LayerShellWindow::AnchorBottom));
171
+ // layerWindow->setAnchors(LayerShellWindow::AnchorRight);
170
172
break ;
171
173
}
172
174
}
@@ -177,27 +179,25 @@ void WaylandBackend::blurWindow(QWidget* widget) {
177
179
178
180
void WaylandBackend::setScreenMarginForWindow (QWidget* widget, QScreen* screen, Qt::Edge edge, int width) {
179
181
// TODO: Implement
182
+ LayerShellWindow* layerWindow = LayerShellWindow::forWindow (widget->windowHandle ());
180
183
181
- // QTimer::singleShot(1000, [ = ] {
182
- // LayerShellQt::Window::get(widget->windowHandle())->setExclusiveZone(20);
183
- // LayerShellQt::Window::Anchors anchors;
184
- // switch (edge) {
185
- // case Qt::TopEdge:
186
- // anchors = static_cast<LayerShellQt::Window::Anchors>(LayerShellQt::Window::AnchorLeft | LayerShellQt::Window::AnchorRight | LayerShellQt::Window::AnchorTop);
187
- // break;
188
- // case Qt::LeftEdge:
189
- // anchors = static_cast<LayerShellQt::Window::Anchors>(LayerShellQt::Window::AnchorLeft | LayerShellQt::Window::AnchorTop | LayerShellQt::Window::AnchorBottom);
190
- // break;
191
- // case Qt::RightEdge:
192
- // anchors = LayerShellQt::Window::AnchorRight;
193
- // break;
194
- // case Qt::BottomEdge:
195
- // anchors = LayerShellQt::Window::AnchorBottom;
196
- // break;
197
- // }
198
- // LayerShellQt::Window::get(widget->windowHandle())->setAnchors(anchors);
199
- // });
200
-
184
+ layerWindow->setExclusiveZone (width);
185
+ LayerShellWindow::Anchors anchors;
186
+ switch (edge) {
187
+ case Qt::TopEdge:
188
+ anchors = LayerShellWindow::AnchorTop;
189
+ break ;
190
+ case Qt::LeftEdge:
191
+ anchors = LayerShellWindow::AnchorLeft;
192
+ break ;
193
+ case Qt::RightEdge:
194
+ anchors = LayerShellWindow::AnchorRight;
195
+ break ;
196
+ case Qt::BottomEdge:
197
+ anchors = LayerShellWindow::AnchorBottom;
198
+ break ;
199
+ }
200
+ layerWindow->setAnchors (anchors);
201
201
}
202
202
203
203
void WaylandBackend::setScreenOff (bool screenOff) {
0 commit comments