mirror of
https://invent.kde.org/plasma/layer-shell-qt.git
synced 2026-02-19 20:13:06 -05:00
Compare commits
13 Commits
v6.5.1
...
work/david
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a0c6c6f7f | |||
| dd76feea81 | |||
| 430ad3630f | |||
| 68df285294 | |||
| 94ac4be08f | |||
| df03deab5c | |||
| 44fe89b1b6 | |||
| 58f549d136 | |||
| 9ddf87a444 | |||
| b9e1260949 | |||
| cb79d3f60a | |||
| 2b8544f5a0 | |||
| e4b5bdbf1b |
@ -4,13 +4,13 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
project(layershellqt)
|
project(layershellqt)
|
||||||
set(PROJECT_VERSION "6.4.90")
|
set(PROJECT_VERSION "6.6.80")
|
||||||
set(PROJECT_VERSION_MAJOR 6)
|
set(PROJECT_VERSION_MAJOR 6)
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 99)
|
set(CMAKE_C_STANDARD 99)
|
||||||
|
|
||||||
set(QT_MIN_VERSION "6.9.0")
|
set(QT_MIN_VERSION "6.10.0")
|
||||||
set(KF6_MIN_VERSION "6.18.0")
|
set(KF6_MIN_VERSION "6.22.0")
|
||||||
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
|
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
@ -32,6 +32,7 @@ include(KDEClangFormat)
|
|||||||
include(ECMQtDeclareLoggingCategory)
|
include(ECMQtDeclareLoggingCategory)
|
||||||
include(ECMQmlModule)
|
include(ECMQmlModule)
|
||||||
include(KDEGitCommitHooks)
|
include(KDEGitCommitHooks)
|
||||||
|
include(ECMGenerateExportHeader)
|
||||||
|
|
||||||
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient Qml)
|
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient Qml)
|
||||||
|
|
||||||
|
|||||||
@ -64,10 +64,12 @@ ecm_generate_headers(LayerShellQt_HEADERS
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
generate_export_header(LayerShellQtInterface
|
ecm_generate_export_header(LayerShellQtInterface
|
||||||
BASE_NAME LayerShellQtInterface
|
BASE_NAME LayerShellQtInterface
|
||||||
EXPORT_MACRO_NAME LAYERSHELLQT_EXPORT
|
EXPORT_MACRO_NAME LAYERSHELLQT_EXPORT
|
||||||
EXPORT_FILE_NAME LayerShellQt/layershellqt_export.h
|
EXPORT_FILE_NAME LayerShellQt/layershellqt_export.h
|
||||||
|
VERSION ${LAYERSHELLQT_VERSION}
|
||||||
|
DEPRECATION_VERSIONS 6.6
|
||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS layer-shell
|
install(TARGETS layer-shell
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
ecm_add_qml_module(LayerShellQtQml
|
ecm_add_qml_module(LayerShellQtQml
|
||||||
URI "org.kde.layershell"
|
URI "org.kde.layershell"
|
||||||
VERSION 1.0
|
VERSION 1.0
|
||||||
SOURCES types.h types.cpp
|
SOURCES types.h
|
||||||
GENERATE_PLUGIN_SOURCE)
|
GENERATE_PLUGIN_SOURCE)
|
||||||
target_link_libraries(LayerShellQtQml PRIVATE Qt::Qml LayerShellQtInterface)
|
target_link_libraries(LayerShellQtQml PRIVATE Qt::Qml LayerShellQtInterface)
|
||||||
|
|
||||||
|
|||||||
@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2023 Aleix Pol Gonzalez <aleix.pol_gonzalez@mercedes-benz.com>
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 8, 1)
|
|
||||||
int QQmlMarginsValueType::left() const
|
|
||||||
{
|
|
||||||
return m.left();
|
|
||||||
}
|
|
||||||
|
|
||||||
int QQmlMarginsValueType::top() const
|
|
||||||
{
|
|
||||||
return m.top();
|
|
||||||
}
|
|
||||||
|
|
||||||
int QQmlMarginsValueType::right() const
|
|
||||||
{
|
|
||||||
return m.right();
|
|
||||||
}
|
|
||||||
|
|
||||||
int QQmlMarginsValueType::bottom() const
|
|
||||||
{
|
|
||||||
return m.bottom();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQmlMarginsValueType::setLeft(int left)
|
|
||||||
{
|
|
||||||
m.setLeft(left);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQmlMarginsValueType::setTop(int top)
|
|
||||||
{
|
|
||||||
m.setTop(top);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQmlMarginsValueType::setRight(int right)
|
|
||||||
{
|
|
||||||
m.setRight(right);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QQmlMarginsValueType::setBottom(int bottom)
|
|
||||||
{
|
|
||||||
m.setBottom(bottom);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@ -17,39 +17,3 @@ class WindowForeign
|
|||||||
QML_UNCREATABLE("")
|
QML_UNCREATABLE("")
|
||||||
QML_ATTACHED(LayerShellQt::Window)
|
QML_ATTACHED(LayerShellQt::Window)
|
||||||
};
|
};
|
||||||
|
|
||||||
// available upstream since https://invent.kde.org/qt/qt/qtdeclarative/-/commit/a398101f715bfc447aa889fc9c58b13bfe75ab47
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 8, 1)
|
|
||||||
struct Q_QML_EXPORT QQmlMarginsValueType {
|
|
||||||
QMargins m;
|
|
||||||
Q_PROPERTY(int left READ left WRITE setLeft FINAL)
|
|
||||||
Q_PROPERTY(int right READ right WRITE setRight FINAL)
|
|
||||||
Q_PROPERTY(int top READ top WRITE setTop FINAL)
|
|
||||||
Q_PROPERTY(int bottom READ bottom WRITE setBottom FINAL)
|
|
||||||
Q_GADGET
|
|
||||||
QML_ANONYMOUS
|
|
||||||
QML_FOREIGN(QMargins)
|
|
||||||
QML_EXTENDED(QQmlMarginsValueType)
|
|
||||||
QML_STRUCTURED_VALUE
|
|
||||||
|
|
||||||
public:
|
|
||||||
QQmlMarginsValueType() = default;
|
|
||||||
Q_INVOKABLE QQmlMarginsValueType(const QMarginsF &margins)
|
|
||||||
: m(margins.toMargins())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
int left() const;
|
|
||||||
int right() const;
|
|
||||||
int top() const;
|
|
||||||
int bottom() const;
|
|
||||||
void setLeft(int);
|
|
||||||
void setRight(int);
|
|
||||||
void setTop(int);
|
|
||||||
void setBottom(int);
|
|
||||||
|
|
||||||
operator QMargins() const
|
|
||||||
{
|
|
||||||
return m;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|||||||
@ -5,6 +5,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "shell.h"
|
#include "shell.h"
|
||||||
|
|
||||||
|
#if LAYERSHELLQTINTERFACE_BUILD_DEPRECATED_SINCE(6, 6)
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <layershellqt_logging.h>
|
#include <layershellqt_logging.h>
|
||||||
#include <qglobal.h>
|
#include <qglobal.h>
|
||||||
@ -18,3 +21,4 @@ void Shell::useLayerShell()
|
|||||||
qCDebug(LAYERSHELLQT) << "Unable to set QT_WAYLAND_SHELL_INTEGRATION=layer-shell";
|
qCDebug(LAYERSHELLQT) << "Unable to set QT_WAYLAND_SHELL_INTEGRATION=layer-shell";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@ -8,7 +8,9 @@
|
|||||||
#define LAYERSHELLQTSHELL_H
|
#define LAYERSHELLQTSHELL_H
|
||||||
|
|
||||||
#include "layershellqt_export.h"
|
#include "layershellqt_export.h"
|
||||||
#include "window.h"
|
|
||||||
|
#if LAYERSHELLQTINTERFACE_ENABLE_DEPRECATED_SINCE(6, 6)
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace LayerShellQt
|
namespace LayerShellQt
|
||||||
@ -19,9 +21,11 @@ namespace LayerShellQt
|
|||||||
class LAYERSHELLQT_EXPORT Shell
|
class LAYERSHELLQT_EXPORT Shell
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
LAYERSHELLQTINTERFACE_DEPRECATED_VERSION(6, 6, "Calling useLayerShell is not needed since Qt 6.5")
|
||||||
static void useLayerShell();
|
static void useLayerShell();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -7,13 +7,14 @@
|
|||||||
#include "window.h"
|
#include "window.h"
|
||||||
#include "../qwaylandlayershellintegration_p.h"
|
#include "../qwaylandlayershellintegration_p.h"
|
||||||
|
|
||||||
|
#include <QtWaylandClient/private/qwaylandclientshellapi_p.h>
|
||||||
#include <layershellqt_logging.h>
|
#include <layershellqt_logging.h>
|
||||||
|
|
||||||
|
#include <QPlatformSurfaceEvent>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <mutex>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
#include <QtWaylandClient/private/qwaylandwindow_p.h>
|
|
||||||
|
|
||||||
using namespace LayerShellQt;
|
using namespace LayerShellQt;
|
||||||
|
|
||||||
class LayerShellQt::WindowPrivate
|
class LayerShellQt::WindowPrivate
|
||||||
@ -33,7 +34,8 @@ public:
|
|||||||
Window::Layer layer = Window::LayerTop;
|
Window::Layer layer = Window::LayerTop;
|
||||||
QMargins margins;
|
QMargins margins;
|
||||||
QSize desiredSize = QSize(0, 0);
|
QSize desiredSize = QSize(0, 0);
|
||||||
Window::ScreenConfiguration screenConfiguration = Window::ScreenFromQWindow;
|
QPointer<QScreen> screen;
|
||||||
|
bool wantsToBeOnActiveScreen = false;
|
||||||
bool closeOnDismissed = true;
|
bool closeOnDismissed = true;
|
||||||
bool activateOnShow = true;
|
bool activateOnShow = true;
|
||||||
};
|
};
|
||||||
@ -151,14 +153,73 @@ Window::Layer Window::layer() const
|
|||||||
return d->layer;
|
return d->layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LAYERSHELLQTINTERFACE_BUILD_DEPRECATED_SINCE(6, 6)
|
||||||
Window::ScreenConfiguration Window::screenConfiguration() const
|
Window::ScreenConfiguration Window::screenConfiguration() const
|
||||||
{
|
{
|
||||||
return d->screenConfiguration;
|
if (wantsToBeOnActiveScreen()) {
|
||||||
|
return ScreenFromCompositor;
|
||||||
|
} else {
|
||||||
|
// If an explicit screen is set, it's quite inaccurate but it should be fine.
|
||||||
|
return ScreenFromQWindow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setScreenConfiguration(Window::ScreenConfiguration screenConfiguration)
|
void Window::setScreenConfiguration(ScreenConfiguration screenConfiguration)
|
||||||
{
|
{
|
||||||
d->screenConfiguration = screenConfiguration;
|
static std::once_flag deprecationFlag;
|
||||||
|
std::call_once(deprecationFlag, []() {
|
||||||
|
qWarning() << "LayerShellQt.Window.screenConfiguration is deprecated use screen and wantsToBeOnActiveScreen instead";
|
||||||
|
});
|
||||||
|
|
||||||
|
if (screenConfiguration == ScreenFromCompositor) {
|
||||||
|
setWantsToBeOnActiveScreen(true);
|
||||||
|
} else {
|
||||||
|
setWantsToBeOnActiveScreen(false);
|
||||||
|
setScreen(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void Window::setWantsToBeOnActiveScreen(bool set)
|
||||||
|
{
|
||||||
|
if (d->wantsToBeOnActiveScreen == set) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
d->wantsToBeOnActiveScreen = set;
|
||||||
|
|
||||||
|
if (d->wantsToBeOnActiveScreen && d->screen) {
|
||||||
|
d->screen = nullptr;
|
||||||
|
Q_EMIT screenChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_EMIT wantsToBeOnActiveScreenChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Window::wantsToBeOnActiveScreen() const
|
||||||
|
{
|
||||||
|
return d->wantsToBeOnActiveScreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window::setScreen(QScreen *screen)
|
||||||
|
{
|
||||||
|
if (d->screen == screen) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
d->screen = screen;
|
||||||
|
|
||||||
|
if (d->screen && d->wantsToBeOnActiveScreen) {
|
||||||
|
d->wantsToBeOnActiveScreen = false;
|
||||||
|
Q_EMIT wantsToBeOnActiveScreenChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_EMIT screenChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
QScreen *Window::screen() const
|
||||||
|
{
|
||||||
|
return d->screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Window::closeOnDismissed() const
|
bool Window::closeOnDismissed() const
|
||||||
@ -186,27 +247,53 @@ Window::Window(QWindow *window)
|
|||||||
, d(new WindowPrivate(window))
|
, d(new WindowPrivate(window))
|
||||||
{
|
{
|
||||||
s_map.insert(d->parentWindow, this);
|
s_map.insert(d->parentWindow, this);
|
||||||
|
window->installEventFilter(this);
|
||||||
window->create();
|
if (window->isVisible()) {
|
||||||
|
qCWarning(LAYERSHELLQT) << d->parentWindow << "already has a shell integration. Call QWindow::close() first and show it again.";
|
||||||
auto waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow *>(window->handle());
|
|
||||||
if (!waylandWindow) {
|
|
||||||
qCWarning(LAYERSHELLQT) << window << "is not a wayland window. Not creating zwlr_layer_surface";
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (window->handle()) {
|
||||||
|
initializeShell();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Window::eventFilter(QObject *watched, QEvent *event)
|
||||||
|
{
|
||||||
|
auto window = qobject_cast<QWindow *>(watched);
|
||||||
|
if (!window) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (event->type() == QEvent::PlatformSurface) {
|
||||||
|
if (auto pse = static_cast<QPlatformSurfaceEvent *>(event); pse->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) {
|
||||||
|
initializeShell();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window::initializeShell()
|
||||||
|
{
|
||||||
|
// FIXME
|
||||||
|
// auto waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow *>(d->parentWindow->handle());
|
||||||
|
// if (!waylandWindow) {
|
||||||
|
// qCWarning(LAYERSHELLQT) << d->parentWindow << "is not a wayland window. Not creating zwlr_layer_surface";
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
static QWaylandLayerShellIntegration *shellIntegration = nullptr;
|
static QWaylandLayerShellIntegration *shellIntegration = nullptr;
|
||||||
if (!shellIntegration) {
|
if (!shellIntegration) {
|
||||||
shellIntegration = new QWaylandLayerShellIntegration();
|
shellIntegration = new QWaylandLayerShellIntegration();
|
||||||
if (!shellIntegration->initialize(waylandWindow->display())) {
|
// Why does it take a display that is unused
|
||||||
|
if (!shellIntegration->initialize(nullptr)) {
|
||||||
delete shellIntegration;
|
delete shellIntegration;
|
||||||
shellIntegration = nullptr;
|
shellIntegration = nullptr;
|
||||||
qCWarning(LAYERSHELLQT) << "Failed to initialize layer-shell integration, possibly because compositor does not support the layer-shell protocol";
|
qCWarning(LAYERSHELLQT) << "Failed to initialize layer-shell integration, possibly because compositor does not support the layer-shell protocol";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// FIXME this is relevant when the plugin is not the default shell integration
|
||||||
waylandWindow->setShellIntegration(shellIntegration);
|
// Something like QWaylandShellIntegration::assignToWindow(QPlatformWindow *)?
|
||||||
|
// waylandWindow->setShellIntegration(shellIntegration);
|
||||||
}
|
}
|
||||||
|
|
||||||
Window *Window::get(QWindow *window)
|
Window *Window::get(QWindow *window)
|
||||||
|
|||||||
@ -27,8 +27,12 @@ class LAYERSHELLQT_EXPORT Window : public QObject
|
|||||||
Q_PROPERTY(qint32 exclusionZone READ exclusionZone WRITE setExclusiveZone NOTIFY exclusionZoneChanged)
|
Q_PROPERTY(qint32 exclusionZone READ exclusionZone WRITE setExclusiveZone NOTIFY exclusionZoneChanged)
|
||||||
Q_PROPERTY(Layer layer READ layer WRITE setLayer NOTIFY layerChanged)
|
Q_PROPERTY(Layer layer READ layer WRITE setLayer NOTIFY layerChanged)
|
||||||
Q_PROPERTY(KeyboardInteractivity keyboardInteractivity READ keyboardInteractivity WRITE setKeyboardInteractivity NOTIFY keyboardInteractivityChanged)
|
Q_PROPERTY(KeyboardInteractivity keyboardInteractivity READ keyboardInteractivity WRITE setKeyboardInteractivity NOTIFY keyboardInteractivityChanged)
|
||||||
Q_PROPERTY(ScreenConfiguration screenConfiguration READ screenConfiguration WRITE setScreenConfiguration)
|
|
||||||
Q_PROPERTY(bool activateOnShow READ activateOnShow WRITE setActivateOnShow)
|
Q_PROPERTY(bool activateOnShow READ activateOnShow WRITE setActivateOnShow)
|
||||||
|
Q_PROPERTY(bool wantsToBeOnActiveScreen READ wantsToBeOnActiveScreen WRITE setWantsToBeOnActiveScreen NOTIFY wantsToBeOnActiveScreenChanged)
|
||||||
|
Q_PROPERTY(QScreen *screen READ screen WRITE setScreen NOTIFY screenChanged)
|
||||||
|
#if LAYERSHELLQTINTERFACE_ENABLE_DEPRECATED_SINCE(6, 6)
|
||||||
|
Q_PROPERTY(ScreenConfiguration screenConfiguration READ screenConfiguration WRITE setScreenConfiguration)
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~Window() override;
|
~Window() override;
|
||||||
@ -64,17 +68,6 @@ public:
|
|||||||
};
|
};
|
||||||
Q_ENUM(KeyboardInteractivity)
|
Q_ENUM(KeyboardInteractivity)
|
||||||
|
|
||||||
/**
|
|
||||||
* This enum type is used to specify which screen to place the surface on.
|
|
||||||
* ScreenFromQWindow (the default) reads QWindow::screen() while ScreenFromCompositor
|
|
||||||
* passes nil and lets the compositor decide.
|
|
||||||
*/
|
|
||||||
enum ScreenConfiguration {
|
|
||||||
ScreenFromQWindow = 0,
|
|
||||||
ScreenFromCompositor = 1,
|
|
||||||
};
|
|
||||||
Q_ENUM(ScreenConfiguration)
|
|
||||||
|
|
||||||
void setAnchors(Anchors anchor);
|
void setAnchors(Anchors anchor);
|
||||||
Anchors anchors() const;
|
Anchors anchors() const;
|
||||||
|
|
||||||
@ -96,8 +89,48 @@ public:
|
|||||||
void setLayer(Layer layer);
|
void setLayer(Layer layer);
|
||||||
Layer layer() const;
|
Layer layer() const;
|
||||||
|
|
||||||
|
#if LAYERSHELLQTINTERFACE_ENABLE_DEPRECATED_SINCE(6, 6)
|
||||||
|
/**
|
||||||
|
* This enum type is used to specify which screen to place the surface on.
|
||||||
|
* ScreenFromQWindow (the default) reads QWindow::screen() while ScreenFromCompositor
|
||||||
|
* passes nil and lets the compositor decide.
|
||||||
|
*/
|
||||||
|
LAYERSHELLQTINTERFACE_DEPRECATED_VERSION(6, 6, "Use wantsToBeOnActiveScreen and screen instead")
|
||||||
|
enum ScreenConfiguration {
|
||||||
|
ScreenFromQWindow = 0,
|
||||||
|
ScreenFromCompositor = 1,
|
||||||
|
};
|
||||||
|
Q_ENUM(ScreenConfiguration)
|
||||||
|
|
||||||
|
LAYERSHELLQTINTERFACE_DEPRECATED_VERSION(6, 6, "Use wantsToBeOnActiveScreen and screen instead")
|
||||||
void setScreenConfiguration(ScreenConfiguration screenConfiguration);
|
void setScreenConfiguration(ScreenConfiguration screenConfiguration);
|
||||||
|
LAYERSHELLQTINTERFACE_DEPRECATED_VERSION(6, 6, "Use wantsToBeOnActiveScreen and screen instead")
|
||||||
ScreenConfiguration screenConfiguration() const;
|
ScreenConfiguration screenConfiguration() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the layer shell surface should be placed on the active screen based on @a set.
|
||||||
|
*
|
||||||
|
* The active screen depends on the compositor policies.
|
||||||
|
*
|
||||||
|
* If the screen() is @c null and the wantsToBeOnActiveScreen() is @c false, then the
|
||||||
|
* QWindow::screen() will be used to decide what screen the layer shell surface should be placed on.
|
||||||
|
*
|
||||||
|
* The screen() will be reset if @a set is @c true.
|
||||||
|
*/
|
||||||
|
void setWantsToBeOnActiveScreen(bool set);
|
||||||
|
bool wantsToBeOnActiveScreen() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that the layer shell surface should be placed on the specified @a screen.
|
||||||
|
*
|
||||||
|
* If the screen() is @c null and the wantsToBeOnActiveScreen() is @c false, then the
|
||||||
|
* QWindow::screen() will be used to decide what screen the layer shell surface should be placed on.
|
||||||
|
*
|
||||||
|
* The wantsToBeOnActiveScreen() will be reset to @c false after calling this function.
|
||||||
|
*/
|
||||||
|
void setScreen(QScreen *screen);
|
||||||
|
QScreen *screen() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a string based identifier for this window.
|
* Sets a string based identifier for this window.
|
||||||
@ -138,6 +171,8 @@ public:
|
|||||||
|
|
||||||
static Window *qmlAttachedProperties(QObject *object);
|
static Window *qmlAttachedProperties(QObject *object);
|
||||||
|
|
||||||
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void anchorsChanged();
|
void anchorsChanged();
|
||||||
void exclusionZoneChanged();
|
void exclusionZoneChanged();
|
||||||
@ -146,8 +181,12 @@ Q_SIGNALS:
|
|||||||
void desiredSizeChanged();
|
void desiredSizeChanged();
|
||||||
void keyboardInteractivityChanged();
|
void keyboardInteractivityChanged();
|
||||||
void layerChanged();
|
void layerChanged();
|
||||||
|
void wantsToBeOnActiveScreenChanged();
|
||||||
|
void screenChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void initializeShell();
|
||||||
|
|
||||||
Window(QWindow *window);
|
Window(QWindow *window);
|
||||||
QScopedPointer<WindowPrivate> d;
|
QScopedPointer<WindowPrivate> d;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -9,9 +9,6 @@
|
|||||||
#include "qwaylandlayersurface_p.h"
|
#include "qwaylandlayersurface_p.h"
|
||||||
#include "qwaylandxdgactivationv1_p.h"
|
#include "qwaylandxdgactivationv1_p.h"
|
||||||
|
|
||||||
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
|
|
||||||
#include <QtWaylandClient/private/qwaylandwindow_p.h>
|
|
||||||
|
|
||||||
namespace LayerShellQt
|
namespace LayerShellQt
|
||||||
{
|
{
|
||||||
QWaylandLayerShellIntegration::QWaylandLayerShellIntegration()
|
QWaylandLayerShellIntegration::QWaylandLayerShellIntegration()
|
||||||
|
|||||||
@ -10,11 +10,10 @@
|
|||||||
#include "qwaylandlayersurface_p.h"
|
#include "qwaylandlayersurface_p.h"
|
||||||
#include "qwaylandxdgactivationv1_p.h"
|
#include "qwaylandxdgactivationv1_p.h"
|
||||||
|
|
||||||
#include <QtWaylandClient/private/qwaylandscreen_p.h>
|
|
||||||
#include <QtWaylandClient/private/qwaylandsurface_p.h>
|
|
||||||
#include <QtWaylandClient/private/qwaylandwindow_p.h>
|
|
||||||
|
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
|
#include <QScreen>
|
||||||
|
#include <qpa/qplatformwindow.h>
|
||||||
|
#include <qpa/qplatformwindow_p.h> // private native interface
|
||||||
|
|
||||||
namespace LayerShellQt
|
namespace LayerShellQt
|
||||||
{
|
{
|
||||||
@ -22,12 +21,19 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
|
|||||||
: QtWaylandClient::QWaylandShellSurface(window)
|
: QtWaylandClient::QWaylandShellSurface(window)
|
||||||
, QtWayland::zwlr_layer_surface_v1()
|
, QtWayland::zwlr_layer_surface_v1()
|
||||||
, m_shell(shell)
|
, m_shell(shell)
|
||||||
, m_interface(Window::get(window->window()))
|
// FIXME reverse lookup would a QWindow getter make sense, also below a bunch
|
||||||
|
// QWindow * QWaylandShellSurface::window
|
||||||
|
, m_interface(Window::get(platformWindow()->window()))
|
||||||
, m_window(window)
|
, m_window(window)
|
||||||
{
|
{
|
||||||
wl_output *output = nullptr;
|
wl_output *output = nullptr;
|
||||||
if (m_interface->screenConfiguration() == Window::ScreenFromQWindow) {
|
if (!m_interface->wantsToBeOnActiveScreen()) {
|
||||||
auto waylandScreen = dynamic_cast<QtWaylandClient::QWaylandScreen *>(window->window()->screen()->handle());
|
QScreen *desiredScreen = m_interface->screen();
|
||||||
|
if (!desiredScreen) {
|
||||||
|
desiredScreen = platformWindow()->window()->screen();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto waylandScreen = platformWindow()->window()->screen()->nativeInterface<QNativeInterface::QWaylandScreen>();
|
||||||
// Qt will always assign a screen to a window, but if the compositor has no screens available a dummy QScreen object is created
|
// Qt will always assign a screen to a window, but if the compositor has no screens available a dummy QScreen object is created
|
||||||
// this will not cast to a QWaylandScreen
|
// this will not cast to a QWaylandScreen
|
||||||
if (!waylandScreen) {
|
if (!waylandScreen) {
|
||||||
@ -36,7 +42,7 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
|
|||||||
output = waylandScreen->output();
|
output = waylandScreen->output();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
init(shell->get_layer_surface(window->waylandSurface()->object(), output, m_interface->layer(), m_interface->scope()));
|
init(shell->get_layer_surface(wlSurface(), output, m_interface->layer(), m_interface->scope()));
|
||||||
connect(m_interface, &Window::layerChanged, this, [this]() {
|
connect(m_interface, &Window::layerChanged, this, [this]() {
|
||||||
setLayer(m_interface->layer());
|
setLayer(m_interface->layer());
|
||||||
});
|
});
|
||||||
@ -45,7 +51,7 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
|
|||||||
connect(m_interface, &Window::anchorsChanged, this, [this]() {
|
connect(m_interface, &Window::anchorsChanged, this, [this]() {
|
||||||
setAnchor(m_interface->anchors());
|
setAnchor(m_interface->anchors());
|
||||||
if (m_interface->desiredSize().isNull()) {
|
if (m_interface->desiredSize().isNull()) {
|
||||||
setDesiredSize(m_window->windowContentGeometry().size());
|
setDesiredSize(m_lastContentGeometry.size());
|
||||||
} else {
|
} else {
|
||||||
setDesiredSize(m_interface->desiredSize());
|
setDesiredSize(m_interface->desiredSize());
|
||||||
}
|
}
|
||||||
@ -77,12 +83,22 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (m_interface->desiredSize().isNull()) {
|
if (m_interface->desiredSize().isNull()) {
|
||||||
setDesiredSize(window->windowContentGeometry().size());
|
// FIXME QWaylandWindow should call setWindowContentGeometry when creating the shell surface
|
||||||
|
// / Does a setWindowContentGeometry call arrive early enough?
|
||||||
|
// setDesiredSize(window->windowContentGeometry().size());
|
||||||
} else {
|
} else {
|
||||||
setDesiredSize(m_interface->desiredSize());
|
setDesiredSize(m_interface->desiredSize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QWaylandLayerSurface::setContentGeometry(const QRect &rect)
|
||||||
|
{
|
||||||
|
m_lastContentGeometry = rect;
|
||||||
|
if (m_interface->desiredSize().isNull()) {
|
||||||
|
setDesiredSize(rect.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QWaylandLayerSurface::~QWaylandLayerSurface()
|
QWaylandLayerSurface::~QWaylandLayerSurface()
|
||||||
{
|
{
|
||||||
destroy();
|
destroy();
|
||||||
@ -91,7 +107,7 @@ QWaylandLayerSurface::~QWaylandLayerSurface()
|
|||||||
void QWaylandLayerSurface::zwlr_layer_surface_v1_closed()
|
void QWaylandLayerSurface::zwlr_layer_surface_v1_closed()
|
||||||
{
|
{
|
||||||
if (m_interface->closeOnDismissed()) {
|
if (m_interface->closeOnDismissed()) {
|
||||||
window()->window()->close();
|
platformWindow()->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +123,7 @@ void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial, uint
|
|||||||
} else {
|
} else {
|
||||||
// Later configures are resizes, so we have to queue them up for a time when we
|
// Later configures are resizes, so we have to queue them up for a time when we
|
||||||
// are not painting to the window.
|
// are not painting to the window.
|
||||||
window()->applyConfigureWhenPossible();
|
applyConfigureWhenPossible();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,13 +140,7 @@ void QWaylandLayerSurface::attachPopup(QtWaylandClient::QWaylandShellSurface *po
|
|||||||
|
|
||||||
void QWaylandLayerSurface::applyConfigure()
|
void QWaylandLayerSurface::applyConfigure()
|
||||||
{
|
{
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
|
resizeFromApplyConfigure(m_pendingSize);
|
||||||
m_configuring = true;
|
|
||||||
#endif
|
|
||||||
window()->resizeFromApplyConfigure(m_pendingSize);
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
|
|
||||||
m_configuring = false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandLayerSurface::setDesiredSize(const QSize &size)
|
void QWaylandLayerSurface::setDesiredSize(const QSize &size)
|
||||||
@ -181,25 +191,12 @@ void QWaylandLayerSurface::setLayer(uint32_t layer)
|
|||||||
set_layer(layer);
|
set_layer(layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
|
|
||||||
void QWaylandLayerSurface::setWindowGeometry(const QRect &geometry)
|
|
||||||
{
|
|
||||||
if (m_configuring) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_interface->desiredSize().isNull()) {
|
|
||||||
setDesiredSize(geometry.size());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void QWaylandLayerSurface::setWindowSize(const QSize &size)
|
void QWaylandLayerSurface::setWindowSize(const QSize &size)
|
||||||
{
|
{
|
||||||
if (m_interface->desiredSize().isNull()) {
|
if (m_interface->desiredSize().isNull()) {
|
||||||
setDesiredSize(size);
|
setDesiredSize(size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool QWaylandLayerSurface::requestActivate()
|
bool QWaylandLayerSurface::requestActivate()
|
||||||
{
|
{
|
||||||
@ -208,20 +205,21 @@ bool QWaylandLayerSurface::requestActivate()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!m_activationToken.isEmpty()) {
|
if (!m_activationToken.isEmpty()) {
|
||||||
activation->activate(m_activationToken, window()->wlSurface());
|
activation->activate(m_activationToken, wlSurface());
|
||||||
m_activationToken = {};
|
m_activationToken = {};
|
||||||
return true;
|
return true;
|
||||||
} else if (const auto token = qEnvironmentVariable("XDG_ACTIVATION_TOKEN"); !token.isEmpty()) {
|
} else if (const auto token = qEnvironmentVariable("XDG_ACTIVATION_TOKEN"); !token.isEmpty()) {
|
||||||
activation->activate(token, window()->wlSurface());
|
activation->activate(token, wlSurface());
|
||||||
qunsetenv("XDG_ACTIVATION_TOKEN");
|
qunsetenv("XDG_ACTIVATION_TOKEN");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
const auto focusWindow = QGuiApplication::focusWindow();
|
const auto focusWindow = QGuiApplication::focusWindow();
|
||||||
const auto wlWindow = focusWindow ? static_cast<QtWaylandClient::QWaylandWindow *>(focusWindow->handle()) : window();
|
const auto waylandApp = qGuiApp->nativeInterface<QNativeInterface::QWaylandApplication>();
|
||||||
if (const auto seat = wlWindow->display()->lastInputDevice()) {
|
const auto surface = focusWindow ? focusWindow->nativeInterface<QNativeInterface::Private::QWaylandWindow>()->surface() : wlSurface();
|
||||||
const auto tokenProvider = activation->requestXdgActivationToken(wlWindow->display(), wlWindow->wlSurface(), 0, QString());
|
if (const auto seat = waylandApp->lastInputSeat()) {
|
||||||
|
const auto tokenProvider = activation->requestXdgActivationToken(seat, surface, waylandApp->lastInputSerial(), QString());
|
||||||
connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, [this](const QString &token) {
|
connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, [this](const QString &token) {
|
||||||
m_shell->activation()->activate(token, window()->wlSurface());
|
m_shell->activation()->activate(token, wlSurface());
|
||||||
});
|
});
|
||||||
connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater);
|
connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater);
|
||||||
return true;
|
return true;
|
||||||
@ -240,7 +238,7 @@ bool QWaylandLayerSurface::requestActivateOnShow()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_window->window()->property("_q_showWithoutActivating").toBool()) {
|
if (platformWindow()->window()->property("_q_showWithoutActivating").toBool()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,23 +256,21 @@ void QWaylandLayerSurface::requestXdgActivationToken(quint32 serial)
|
|||||||
if (!activation->isActive()) {
|
if (!activation->isActive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto tokenProvider = activation->requestXdgActivationToken(window()->display(), window()->wlSurface(), serial, QString());
|
const auto waylandApp = qGuiApp->nativeInterface<QNativeInterface::QWaylandApplication>();
|
||||||
|
auto tokenProvider = activation->requestXdgActivationToken(waylandApp->lastInputSeat(), wlSurface(), serial, QString());
|
||||||
|
|
||||||
connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, [this](const QString &token) {
|
connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, [this](const QString &token) {
|
||||||
Q_EMIT window()->xdgActivationTokenCreated(token);
|
// FIXME No way to do this without knowing QWaylandWindow because QPlatofrmWindow is not QObject
|
||||||
|
// But we wanted to make a better API as well or alternatively the signal needs to be on QWaylandShellSurface as well
|
||||||
|
// Q_EMIT window()->xdgActivationTokenCreated(token);
|
||||||
|
// QMetaObject::invokeMethod(window(), "xdgActivationTokenCreated", token);
|
||||||
});
|
});
|
||||||
connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater);
|
connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandLayerSurface::sendExpose()
|
void QWaylandLayerSurface::sendExpose()
|
||||||
{
|
{
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0)
|
// FIXME No way to call this, needs wrapper in QWaylandShellSurface
|
||||||
window()->handleExpose(QRect(QPoint(), m_pendingSize));
|
// window()->updateExposure();
|
||||||
#elif QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
|
|
||||||
window()->sendRecursiveExposeEvent();
|
|
||||||
#else
|
|
||||||
window()->updateExposure();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
#ifndef _LAYERSURFACE_H
|
#ifndef _LAYERSURFACE_H
|
||||||
#define _LAYERSURFACE_H
|
#define _LAYERSURFACE_H
|
||||||
|
|
||||||
|
#include <QRect>
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
|
|
||||||
#include "qwaylandlayershellintegration_p.h"
|
#include "qwaylandlayershellintegration_p.h"
|
||||||
@ -41,13 +42,9 @@ public:
|
|||||||
void setMargins(const QMargins &margins);
|
void setMargins(const QMargins &margins);
|
||||||
void setKeyboardInteractivity(uint32_t interactivity);
|
void setKeyboardInteractivity(uint32_t interactivity);
|
||||||
void setLayer(uint32_t layer);
|
void setLayer(uint32_t layer);
|
||||||
|
void setContentGeometry(const QRect &rect) override;
|
||||||
void applyConfigure() override;
|
void applyConfigure() override;
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
|
|
||||||
void setWindowGeometry(const QRect &geometry) override;
|
|
||||||
#else
|
|
||||||
void setWindowSize(const QSize &size) override;
|
void setWindowSize(const QSize &size) override;
|
||||||
#endif
|
|
||||||
|
|
||||||
bool requestActivate() override;
|
bool requestActivate() override;
|
||||||
bool requestActivateOnShow() override;
|
bool requestActivateOnShow() override;
|
||||||
@ -64,11 +61,9 @@ private:
|
|||||||
QtWaylandClient::QWaylandWindow *m_window;
|
QtWaylandClient::QWaylandWindow *m_window;
|
||||||
QSize m_pendingSize;
|
QSize m_pendingSize;
|
||||||
QString m_activationToken;
|
QString m_activationToken;
|
||||||
|
QRect m_lastContentGeometry;
|
||||||
|
|
||||||
bool m_configured = false;
|
bool m_configured = false;
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
|
|
||||||
bool m_configuring = false;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,8 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "qwaylandxdgactivationv1_p.h"
|
#include "qwaylandxdgactivationv1_p.h"
|
||||||
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
|
|
||||||
#include <QtWaylandClient/private/qwaylandinputdevice_p.h>
|
|
||||||
|
|
||||||
QWaylandXdgActivationV1::QWaylandXdgActivationV1()
|
QWaylandXdgActivationV1::QWaylandXdgActivationV1()
|
||||||
: QWaylandClientExtensionTemplate<QWaylandXdgActivationV1>(1)
|
: QWaylandClientExtensionTemplate<QWaylandXdgActivationV1>(1)
|
||||||
@ -19,10 +17,8 @@ QWaylandXdgActivationV1::~QWaylandXdgActivationV1()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandXdgActivationTokenV1 *QWaylandXdgActivationV1::requestXdgActivationToken(QtWaylandClient::QWaylandDisplay *display,
|
QWaylandXdgActivationTokenV1 *
|
||||||
struct ::wl_surface *surface,
|
QWaylandXdgActivationV1::requestXdgActivationToken(::wl_seat *seat, struct ::wl_surface *surface, std::optional<uint32_t> serial, const QString &app_id)
|
||||||
std::optional<uint32_t> serial,
|
|
||||||
const QString &app_id)
|
|
||||||
{
|
{
|
||||||
auto wl = get_activation_token();
|
auto wl = get_activation_token();
|
||||||
auto provider = new QWaylandXdgActivationTokenV1;
|
auto provider = new QWaylandXdgActivationTokenV1;
|
||||||
@ -34,8 +30,8 @@ QWaylandXdgActivationTokenV1 *QWaylandXdgActivationV1::requestXdgActivationToken
|
|||||||
if (!app_id.isEmpty()) {
|
if (!app_id.isEmpty()) {
|
||||||
provider->set_app_id(app_id);
|
provider->set_app_id(app_id);
|
||||||
}
|
}
|
||||||
if (serial && display->lastInputDevice()) {
|
if (serial && seat) {
|
||||||
provider->set_serial(*serial, display->lastInputDevice()->wl_seat());
|
provider->set_serial(*serial, seat);
|
||||||
}
|
}
|
||||||
provider->commit();
|
provider->commit();
|
||||||
return provider;
|
return provider;
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public:
|
|||||||
~QWaylandXdgActivationV1() override;
|
~QWaylandXdgActivationV1() override;
|
||||||
|
|
||||||
QWaylandXdgActivationTokenV1 *
|
QWaylandXdgActivationTokenV1 *
|
||||||
requestXdgActivationToken(QtWaylandClient::QWaylandDisplay *display, struct ::wl_surface *surface, std::optional<uint32_t> serial, const QString &app_id);
|
requestXdgActivationToken(::wl_seat *seat, struct ::wl_surface *surface, std::optional<uint32_t> serial, const QString &app_id);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QWAYLANDXDGACTIVATIONV1_P_H
|
#endif // QWAYLANDXDGACTIVATIONV1_P_H
|
||||||
|
|||||||
42
tests/become-layershell.qml
Normal file
42
tests/become-layershell.qml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2025 Aleix Pol i Gonzalez <aleixpol@kde.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import org.kde.layershell 1.0 as LayerShell
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
Button {
|
||||||
|
text: "Convert"
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
win.close()
|
||||||
|
win.LayerShell.Window.anchors = LayerShell.Window.AnchorLeft;
|
||||||
|
win.LayerShell.Window.layer = LayerShell.Window.LayerTop;
|
||||||
|
win.LayerShell.Window.exclusionZone = -1;
|
||||||
|
win.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Window {
|
||||||
|
id: win
|
||||||
|
|
||||||
|
width: 100
|
||||||
|
height: 100
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: "red"
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: "top"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
visible: true
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user