8#include "../qwaylandlayershellintegration_p.h"
10#include <layershellqt_logging.h>
15#include <QtWaylandClient/private/qwaylandwindow_p.h>
17using namespace LayerShellQt;
19class LayerShellQt::WindowPrivate
28 QString scope = QStringLiteral(
"window");
29 Window::Anchors anchors = {Window::AnchorTop | Window::AnchorBottom | Window::AnchorLeft | Window::AnchorRight};
30 int32_t exclusionZone = 0;
31 Window::Anchor exclusiveEdge = Window::AnchorNone;
32 Window::KeyboardInteractivity keyboardInteractivity = Window::KeyboardInteractivityOnDemand;
33 Window::Layer layer = Window::LayerTop;
35 Window::ScreenConfiguration screenConfiguration = Window::ScreenFromQWindow;
36 bool closeOnDismissed =
true;
43 s_map.remove(d->parentWindow);
46void Window::setAnchors(Anchors anchors)
48 if (d->anchors != anchors) {
59void Window::setExclusiveZone(int32_t zone)
61 if (d->exclusionZone != zone) {
62 d->exclusionZone = zone;
63 Q_EMIT exclusionZoneChanged();
67int32_t Window::exclusionZone()
const
69 return d->exclusionZone;
72void Window::setExclusiveEdge(Window::Anchor edge)
74 if (d->exclusiveEdge == edge) {
78 d->exclusiveEdge = edge;
79 Q_EMIT exclusiveEdgeChanged();
82Window::Anchor Window::exclusiveEdge()
const
84 return d->exclusiveEdge;
87void Window::setMargins(
const QMargins &margins)
89 if (d->margins != margins) {
100void Window::setKeyboardInteractivity(KeyboardInteractivity interactivity)
102 if (d->keyboardInteractivity != interactivity) {
103 d->keyboardInteractivity = interactivity;
104 Q_EMIT keyboardInteractivityChanged();
108Window::KeyboardInteractivity Window::keyboardInteractivity()
const
110 return d->keyboardInteractivity;
113void Window::setLayer(Layer layer)
115 if (d->layer != layer) {
121void Window::setScope(
const QString &scope)
132Window::Layer Window::layer()
const
137Window::ScreenConfiguration Window::screenConfiguration()
const
139 return d->screenConfiguration;
142void Window::setScreenConfiguration(Window::ScreenConfiguration screenConfiguration)
144 d->screenConfiguration = screenConfiguration;
147bool Window::closeOnDismissed()
const
149 return d->closeOnDismissed;
152void Window::setCloseOnDismissed(
bool close)
154 d->closeOnDismissed =
close;
159 , d(new WindowPrivate(
window))
161 s_map.insert(d->parentWindow,
this);
165 auto waylandWindow =
dynamic_cast<QtWaylandClient::QWaylandWindow *
>(
window->handle());
166 if (!waylandWindow) {
167 qCWarning(LAYERSHELLQT) <<
window <<
"is not a wayland window. Not creating zwlr_layer_surface";
171 static QWaylandLayerShellIntegration *shellIntegration =
nullptr;
172 if (!shellIntegration) {
173 shellIntegration =
new QWaylandLayerShellIntegration();
174 if (!shellIntegration->initialize(waylandWindow->display())) {
175 delete shellIntegration;
176 shellIntegration =
nullptr;
177 qCWarning(LAYERSHELLQT) <<
"Failed to initialize layer-shell integration, possibly because compositor does not support the layer-shell protocol";
182 waylandWindow->setShellIntegration(shellIntegration);
191 auto layerShellWindow = s_map.value(window);
192 if (layerShellWindow) {
193 return layerShellWindow;
195 return new Window(window);
KIOCORE_EXPORT TransferJob * get(const QUrl &url, LoadType reload=NoReload, JobFlags flags=DefaultFlags)
T qobject_cast(QObject *object)