mirror of
https://invent.kde.org/plasma/layer-shell-qt.git
synced 2026-03-03 10:20:17 -05:00
Compare commits
1 Commits
v6.6.2
...
work/zzag/
| Author | SHA1 | Date | |
|---|---|---|---|
| da2eb1586c |
@ -4,13 +4,13 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
project(layershellqt)
|
project(layershellqt)
|
||||||
set(PROJECT_VERSION "6.6.2")
|
set(PROJECT_VERSION "6.3.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.10.0")
|
set(QT_MIN_VERSION "6.7.0")
|
||||||
set(KF6_MIN_VERSION "6.22.0")
|
set(KF6_MIN_VERSION "6.10.0")
|
||||||
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
|
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
@ -32,7 +32,6 @@ 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)
|
||||||
|
|
||||||
|
|||||||
@ -5,8 +5,6 @@ remove_definitions(-DQT_NO_SIGNALS_SLOTS_KEYWORDS)
|
|||||||
|
|
||||||
add_library(LayerShellQtInterface)
|
add_library(LayerShellQtInterface)
|
||||||
|
|
||||||
qt6_extract_metatypes(LayerShellQtInterface)
|
|
||||||
|
|
||||||
if (Qt6_VERSION VERSION_GREATER_EQUAL "6.8.0")
|
if (Qt6_VERSION VERSION_GREATER_EQUAL "6.8.0")
|
||||||
set(private_code_option "PRIVATE_CODE")
|
set(private_code_option "PRIVATE_CODE")
|
||||||
endif()
|
endif()
|
||||||
@ -64,12 +62,10 @@ ecm_generate_headers(LayerShellQt_HEADERS
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
ecm_generate_export_header(LayerShellQtInterface
|
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,8 +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
|
SOURCES layershellqtplugin.cpp)
|
||||||
GENERATE_PLUGIN_SOURCE)
|
|
||||||
target_link_libraries(LayerShellQtQml PRIVATE Qt::Qml LayerShellQtInterface)
|
target_link_libraries(LayerShellQtQml PRIVATE Qt::Qml LayerShellQtInterface)
|
||||||
|
|
||||||
ecm_finalize_qml_module(LayerShellQtQml DESTINATION ${KDE_INSTALL_QMLDIR})
|
ecm_finalize_qml_module(LayerShellQtQml DESTINATION ${KDE_INSTALL_QMLDIR})
|
||||||
51
src/declarative/layershellqtplugin.cpp
Normal file
51
src/declarative/layershellqtplugin.cpp
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* 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 "../interfaces/window.h"
|
||||||
|
#include <QQmlExtensionPlugin>
|
||||||
|
#include <qqml.h>
|
||||||
|
|
||||||
|
QML_DECLARE_TYPEINFO(LayerShellQt::Window, QML_HAS_ATTACHED_PROPERTIES)
|
||||||
|
|
||||||
|
class ExtQMargins
|
||||||
|
{
|
||||||
|
QMargins m_margins;
|
||||||
|
Q_GADGET
|
||||||
|
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)
|
||||||
|
QML_FOREIGN(QMargins)
|
||||||
|
QML_EXTENDED(ExtQMargins)
|
||||||
|
public:
|
||||||
|
ExtQMargins(const QMargins &margins);
|
||||||
|
int left() const { return m_margins.left(); }
|
||||||
|
void setLeft(int left) { m_margins.setLeft(left); }
|
||||||
|
|
||||||
|
int right() const { return m_margins.right(); }
|
||||||
|
void setRight(int right) { m_margins.setRight(right); }
|
||||||
|
|
||||||
|
int top() const { return m_margins.top(); }
|
||||||
|
void setTop(int top) { m_margins.setTop(top); }
|
||||||
|
|
||||||
|
int bottom() const { return m_margins.bottom(); }
|
||||||
|
void setBottom(int bottom) { m_margins.setBottom(bottom); }
|
||||||
|
};
|
||||||
|
|
||||||
|
class Plugin : public QQmlExtensionPlugin
|
||||||
|
{
|
||||||
|
Q_PLUGIN_METADATA(IID "org.kde.layershellqt")
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
void registerTypes(const char *uri) override
|
||||||
|
{
|
||||||
|
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.layershell"));
|
||||||
|
qmlRegisterType<LayerShellQt::Window>(uri, 1, 0, "Window");
|
||||||
|
qmlRegisterExtendedUncreatableType<QMargins, ExtQMargins>(uri, 1, 0, "ExtQMargins", QStringLiteral("Only created from C++"));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "layershellqtplugin.moc"
|
||||||
@ -1,19 +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 "../interfaces/window.h"
|
|
||||||
#include <qqml.h>
|
|
||||||
|
|
||||||
QML_DECLARE_TYPEINFO(LayerShellQt::Window, QML_HAS_ATTACHED_PROPERTIES)
|
|
||||||
|
|
||||||
class WindowForeign
|
|
||||||
{
|
|
||||||
Q_GADGET
|
|
||||||
QML_NAMED_ELEMENT(Window)
|
|
||||||
QML_FOREIGN(LayerShellQt::Window)
|
|
||||||
QML_UNCREATABLE("")
|
|
||||||
QML_ATTACHED(LayerShellQt::Window)
|
|
||||||
};
|
|
||||||
@ -5,9 +5,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#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>
|
||||||
@ -21,4 +18,3 @@ 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,9 +8,7 @@
|
|||||||
#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
|
||||||
@ -21,11 +19,9 @@ 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
|
||||||
|
|||||||
@ -9,9 +9,7 @@
|
|||||||
|
|
||||||
#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>
|
#include <QtWaylandClient/private/qwaylandwindow_p.h>
|
||||||
@ -34,11 +32,8 @@ public:
|
|||||||
Window::KeyboardInteractivity keyboardInteractivity = Window::KeyboardInteractivityOnDemand;
|
Window::KeyboardInteractivity keyboardInteractivity = Window::KeyboardInteractivityOnDemand;
|
||||||
Window::Layer layer = Window::LayerTop;
|
Window::Layer layer = Window::LayerTop;
|
||||||
QMargins margins;
|
QMargins margins;
|
||||||
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;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static QMap<QWindow *, Window *> s_map;
|
static QMap<QWindow *, Window *> s_map;
|
||||||
@ -102,21 +97,6 @@ QMargins Window::margins() const
|
|||||||
return d->margins;
|
return d->margins;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setDesiredSize(const QSize &size)
|
|
||||||
{
|
|
||||||
if (size == d->desiredSize) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
d->desiredSize = size;
|
|
||||||
Q_EMIT desiredSizeChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
QSize Window::desiredSize() const
|
|
||||||
{
|
|
||||||
return d->desiredSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Window::setKeyboardInteractivity(KeyboardInteractivity interactivity)
|
void Window::setKeyboardInteractivity(KeyboardInteractivity interactivity)
|
||||||
{
|
{
|
||||||
if (d->keyboardInteractivity != interactivity) {
|
if (d->keyboardInteractivity != interactivity) {
|
||||||
@ -154,73 +134,14 @@ 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
|
||||||
{
|
{
|
||||||
if (wantsToBeOnActiveScreen()) {
|
return d->screenConfiguration;
|
||||||
return ScreenFromCompositor;
|
|
||||||
} else {
|
|
||||||
// If an explicit screen is set, it's quite inaccurate but it should be fine.
|
|
||||||
return ScreenFromQWindow;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setScreenConfiguration(ScreenConfiguration screenConfiguration)
|
void Window::setScreenConfiguration(Window::ScreenConfiguration screenConfiguration)
|
||||||
{
|
{
|
||||||
static std::once_flag deprecationFlag;
|
d->screenConfiguration = screenConfiguration;
|
||||||
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
|
||||||
@ -233,50 +154,17 @@ void Window::setCloseOnDismissed(bool close)
|
|||||||
d->closeOnDismissed = close;
|
d->closeOnDismissed = close;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Window::activateOnShow() const
|
|
||||||
{
|
|
||||||
return d->activateOnShow;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Window::setActivateOnShow(bool activateOnShow)
|
|
||||||
{
|
|
||||||
d->activateOnShow = activateOnShow;
|
|
||||||
}
|
|
||||||
|
|
||||||
Window::Window(QWindow *window)
|
Window::Window(QWindow *window)
|
||||||
: QObject(window)
|
: QObject(window)
|
||||||
, d(new WindowPrivate(window))
|
, d(new WindowPrivate(window))
|
||||||
{
|
{
|
||||||
s_map.insert(d->parentWindow, this);
|
s_map.insert(d->parentWindow, this);
|
||||||
window->installEventFilter(this);
|
|
||||||
if (window->isVisible()) {
|
|
||||||
qCWarning(LAYERSHELLQT) << d->parentWindow << "already has a shell integration. Call QWindow::close() first and show it again.";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window->handle()) {
|
window->create();
|
||||||
initializeShell();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Window::eventFilter(QObject *watched, QEvent *event)
|
auto waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow *>(window->handle());
|
||||||
{
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
auto waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow *>(d->parentWindow->handle());
|
|
||||||
if (!waylandWindow) {
|
if (!waylandWindow) {
|
||||||
qCWarning(LAYERSHELLQT) << d->parentWindow << "is not a wayland window. Not creating zwlr_layer_surface";
|
qCWarning(LAYERSHELLQT) << window << "is not a wayland window. Not creating zwlr_layer_surface";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,6 +178,7 @@ void Window::initializeShell()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
waylandWindow->setShellIntegration(shellIntegration);
|
waylandWindow->setShellIntegration(shellIntegration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,12 +27,7 @@ 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(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)
|
Q_PROPERTY(ScreenConfiguration screenConfiguration READ screenConfiguration WRITE setScreenConfiguration)
|
||||||
#endif
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~Window() override;
|
~Window() override;
|
||||||
@ -44,8 +39,8 @@ public:
|
|||||||
AnchorLeft = 4, ///< The left edge of the anchor rectangle
|
AnchorLeft = 4, ///< The left edge of the anchor rectangle
|
||||||
AnchorRight = 8, ///< The right edge of the anchor rectangle
|
AnchorRight = 8, ///< The right edge of the anchor rectangle
|
||||||
};
|
};
|
||||||
|
Q_ENUM(Anchor);
|
||||||
Q_DECLARE_FLAGS(Anchors, Anchor)
|
Q_DECLARE_FLAGS(Anchors, Anchor)
|
||||||
Q_FLAG(Anchors)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This enum type is used to specify the layer where a surface can be put in.
|
* This enum type is used to specify the layer where a surface can be put in.
|
||||||
@ -68,6 +63,17 @@ 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;
|
||||||
|
|
||||||
@ -80,57 +86,14 @@ public:
|
|||||||
void setMargins(const QMargins &margins);
|
void setMargins(const QMargins &margins);
|
||||||
QMargins margins() const;
|
QMargins margins() const;
|
||||||
|
|
||||||
void setDesiredSize(const QSize &size);
|
|
||||||
QSize desiredSize() const;
|
|
||||||
|
|
||||||
void setKeyboardInteractivity(KeyboardInteractivity interactivity);
|
void setKeyboardInteractivity(KeyboardInteractivity interactivity);
|
||||||
KeyboardInteractivity keyboardInteractivity() const;
|
KeyboardInteractivity keyboardInteractivity() const;
|
||||||
|
|
||||||
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.
|
||||||
@ -151,18 +114,6 @@ public:
|
|||||||
void setCloseOnDismissed(bool close);
|
void setCloseOnDismissed(bool close);
|
||||||
bool closeOnDismissed() const;
|
bool closeOnDismissed() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the window should requestActivate on show.
|
|
||||||
*
|
|
||||||
* Normally, you want this enabled but in case of e.g. a desktop window, this can be disabled.
|
|
||||||
*
|
|
||||||
* It does nothing when KeyboardInteractivity is KeyboardInteractivityNone.
|
|
||||||
*
|
|
||||||
* The default is true.
|
|
||||||
*/
|
|
||||||
void setActivateOnShow(bool activateOnShow);
|
|
||||||
bool activateOnShow() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the LayerShell Window for a given Qt Window
|
* Gets the LayerShell Window for a given Qt Window
|
||||||
* Ownership is not transferred
|
* Ownership is not transferred
|
||||||
@ -171,22 +122,15 @@ 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();
|
||||||
void exclusiveEdgeChanged();
|
void exclusiveEdgeChanged();
|
||||||
void marginsChanged();
|
void marginsChanged();
|
||||||
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;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
namespace LayerShellQt
|
namespace LayerShellQt
|
||||||
{
|
{
|
||||||
QWaylandLayerShellIntegration::QWaylandLayerShellIntegration()
|
QWaylandLayerShellIntegration::QWaylandLayerShellIntegration()
|
||||||
: QWaylandShellIntegrationTemplate<QWaylandLayerShellIntegration>(5)
|
: QWaylandShellIntegrationTemplate<QWaylandLayerShellIntegration>(6)
|
||||||
, m_xdgActivation(new QWaylandXdgActivationV1)
|
, m_xdgActivation(new QWaylandXdgActivationV1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@
|
|||||||
#include "qwaylandlayersurface_p.h"
|
#include "qwaylandlayersurface_p.h"
|
||||||
#include "qwaylandxdgactivationv1_p.h"
|
#include "qwaylandxdgactivationv1_p.h"
|
||||||
|
|
||||||
#include <QtWaylandClient/private/qwaylandinputdevice_p.h>
|
|
||||||
#include <QtWaylandClient/private/qwaylandscreen_p.h>
|
#include <QtWaylandClient/private/qwaylandscreen_p.h>
|
||||||
#include <QtWaylandClient/private/qwaylandsurface_p.h>
|
#include <QtWaylandClient/private/qwaylandsurface_p.h>
|
||||||
#include <QtWaylandClient/private/qwaylandwindow_p.h>
|
#include <QtWaylandClient/private/qwaylandwindow_p.h>
|
||||||
@ -27,13 +26,8 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
|
|||||||
, m_window(window)
|
, m_window(window)
|
||||||
{
|
{
|
||||||
wl_output *output = nullptr;
|
wl_output *output = nullptr;
|
||||||
if (!m_interface->wantsToBeOnActiveScreen()) {
|
if (m_interface->screenConfiguration() == Window::ScreenFromQWindow) {
|
||||||
QScreen *desiredScreen = m_interface->screen();
|
auto waylandScreen = dynamic_cast<QtWaylandClient::QWaylandScreen *>(window->window()->screen()->handle());
|
||||||
if (!desiredScreen) {
|
|
||||||
desiredScreen = window->window()->screen();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto waylandScreen = dynamic_cast<QtWaylandClient::QWaylandScreen *>(desiredScreen->handle());
|
|
||||||
// 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) {
|
||||||
@ -50,11 +44,7 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
|
|||||||
setAnchor(m_interface->anchors());
|
setAnchor(m_interface->anchors());
|
||||||
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()) {
|
setDesiredSize(m_window->windowContentGeometry().size());
|
||||||
setDesiredSize(m_window->windowContentGeometry().size());
|
|
||||||
} else {
|
|
||||||
setDesiredSize(m_interface->desiredSize());
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
setExclusiveZone(m_interface->exclusionZone());
|
setExclusiveZone(m_interface->exclusionZone());
|
||||||
@ -71,22 +61,12 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
|
|||||||
setMargins(m_interface->margins());
|
setMargins(m_interface->margins());
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_interface, &Window::desiredSizeChanged, this, [this]() {
|
|
||||||
if (!m_interface->desiredSize().isNull()) {
|
|
||||||
setDesiredSize(m_interface->desiredSize());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
setKeyboardInteractivity(m_interface->keyboardInteractivity());
|
setKeyboardInteractivity(m_interface->keyboardInteractivity());
|
||||||
connect(m_interface, &Window::keyboardInteractivityChanged, this, [this]() {
|
connect(m_interface, &Window::keyboardInteractivityChanged, this, [this]() {
|
||||||
setKeyboardInteractivity(m_interface->keyboardInteractivity());
|
setKeyboardInteractivity(m_interface->keyboardInteractivity());
|
||||||
});
|
});
|
||||||
|
|
||||||
if (m_interface->desiredSize().isNull()) {
|
setDesiredSize(window->windowContentGeometry().size());
|
||||||
setDesiredSize(window->windowContentGeometry().size());
|
|
||||||
} else {
|
|
||||||
setDesiredSize(m_interface->desiredSize());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandLayerSurface::~QWaylandLayerSurface()
|
QWaylandLayerSurface::~QWaylandLayerSurface()
|
||||||
@ -94,6 +74,11 @@ QWaylandLayerSurface::~QWaylandLayerSurface()
|
|||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QWaylandLayerSurface::isExposed() const
|
||||||
|
{
|
||||||
|
return m_configured && !m_waitingForRearrange;
|
||||||
|
}
|
||||||
|
|
||||||
void QWaylandLayerSurface::zwlr_layer_surface_v1_closed()
|
void QWaylandLayerSurface::zwlr_layer_surface_v1_closed()
|
||||||
{
|
{
|
||||||
if (m_interface->closeOnDismissed()) {
|
if (m_interface->closeOnDismissed()) {
|
||||||
@ -101,6 +86,15 @@ void QWaylandLayerSurface::zwlr_layer_surface_v1_closed()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QWaylandLayerSurface::zwlr_layer_surface_v1_rearranged(uint32_t serial)
|
||||||
|
{
|
||||||
|
qDebug() << serial << m_arrangeSerial;
|
||||||
|
if (m_arrangeSerial == serial) {
|
||||||
|
qDebug() << "unset rearrange";
|
||||||
|
m_waitingForRearrange = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height)
|
void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height)
|
||||||
{
|
{
|
||||||
ack_configure(serial);
|
ack_configure(serial);
|
||||||
@ -109,7 +103,6 @@ void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial, uint
|
|||||||
if (!m_configured) {
|
if (!m_configured) {
|
||||||
m_configured = true;
|
m_configured = true;
|
||||||
applyConfigure();
|
applyConfigure();
|
||||||
sendExpose();
|
|
||||||
} 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.
|
||||||
@ -130,7 +123,14 @@ void QWaylandLayerSurface::attachPopup(QtWaylandClient::QWaylandShellSurface *po
|
|||||||
|
|
||||||
void QWaylandLayerSurface::applyConfigure()
|
void QWaylandLayerSurface::applyConfigure()
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
|
||||||
|
m_configuring = true;
|
||||||
|
#endif
|
||||||
window()->resizeFromApplyConfigure(m_pendingSize);
|
window()->resizeFromApplyConfigure(m_pendingSize);
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
|
||||||
|
m_configuring = false;
|
||||||
|
#endif
|
||||||
|
window()->updateExposure();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandLayerSurface::setDesiredSize(const QSize &size)
|
void QWaylandLayerSurface::setDesiredSize(const QSize &size)
|
||||||
@ -146,6 +146,16 @@ void QWaylandLayerSurface::setDesiredSize(const QSize &size)
|
|||||||
effectiveSize.setHeight(0);
|
effectiveSize.setHeight(0);
|
||||||
}
|
}
|
||||||
set_size(effectiveSize.width(), effectiveSize.height());
|
set_size(effectiveSize.width(), effectiveSize.height());
|
||||||
|
|
||||||
|
static quint32 token = 0;
|
||||||
|
m_waitingForRearrange = true;
|
||||||
|
m_arrangeSerial = ++token;
|
||||||
|
set_arrange_token(m_arrangeSerial);
|
||||||
|
window()->updateExposure();
|
||||||
|
if (!window()->isExposed()) {
|
||||||
|
window()->commit(); // FIXME: ugly
|
||||||
|
}
|
||||||
|
qDebug() << "request reposition" << m_arrangeSerial;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandLayerSurface::setAnchor(uint anchor)
|
void QWaylandLayerSurface::setAnchor(uint anchor)
|
||||||
@ -181,12 +191,21 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
setDesiredSize(geometry.size());
|
||||||
|
}
|
||||||
|
#else
|
||||||
void QWaylandLayerSurface::setWindowSize(const QSize &size)
|
void QWaylandLayerSurface::setWindowSize(const QSize &size)
|
||||||
{
|
{
|
||||||
if (m_interface->desiredSize().isNull()) {
|
setDesiredSize(size);
|
||||||
setDesiredSize(size);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool QWaylandLayerSurface::requestActivate()
|
bool QWaylandLayerSurface::requestActivate()
|
||||||
{
|
{
|
||||||
@ -198,15 +217,11 @@ bool QWaylandLayerSurface::requestActivate()
|
|||||||
activation->activate(m_activationToken, window()->wlSurface());
|
activation->activate(m_activationToken, window()->wlSurface());
|
||||||
m_activationToken = {};
|
m_activationToken = {};
|
||||||
return true;
|
return true;
|
||||||
} else if (const auto token = qEnvironmentVariable("XDG_ACTIVATION_TOKEN"); !token.isEmpty()) {
|
|
||||||
activation->activate(token, window()->wlSurface());
|
|
||||||
qunsetenv("XDG_ACTIVATION_TOKEN");
|
|
||||||
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 wlWindow = focusWindow ? static_cast<QtWaylandClient::QWaylandWindow *>(focusWindow->handle()) : window();
|
||||||
if (const auto seat = wlWindow->display()->lastInputDevice()) {
|
if (const auto seat = wlWindow->display()->lastInputDevice()) {
|
||||||
const auto tokenProvider = activation->requestXdgActivationToken(wlWindow->display(), wlWindow->wlSurface(), seat->serial(), QString());
|
const auto tokenProvider = activation->requestXdgActivationToken(wlWindow->display(), wlWindow->wlSurface(), 0, 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, window()->wlSurface());
|
||||||
});
|
});
|
||||||
@ -217,23 +232,6 @@ bool QWaylandLayerSurface::requestActivate()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWaylandLayerSurface::requestActivateOnShow()
|
|
||||||
{
|
|
||||||
if (!m_interface->activateOnShow()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_interface->keyboardInteractivity() == Window::KeyboardInteractivityNone) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_window->window()->property("_q_showWithoutActivating").toBool()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return requestActivate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QWaylandLayerSurface::setXdgActivationToken(const QString &token)
|
void QWaylandLayerSurface::setXdgActivationToken(const QString &token)
|
||||||
{
|
{
|
||||||
m_activationToken = token;
|
m_activationToken = token;
|
||||||
@ -255,6 +253,13 @@ void QWaylandLayerSurface::requestXdgActivationToken(quint32 serial)
|
|||||||
|
|
||||||
void QWaylandLayerSurface::sendExpose()
|
void QWaylandLayerSurface::sendExpose()
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0)
|
||||||
|
window()->handleExpose(QRect(QPoint(), m_pendingSize));
|
||||||
|
#elif QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
|
||||||
|
window()->sendRecursiveExposeEvent();
|
||||||
|
#else
|
||||||
window()->updateExposure();
|
window()->updateExposure();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,10 +28,7 @@ public:
|
|||||||
QWaylandLayerSurface(QWaylandLayerShellIntegration *shell, QtWaylandClient::QWaylandWindow *window);
|
QWaylandLayerSurface(QWaylandLayerShellIntegration *shell, QtWaylandClient::QWaylandWindow *window);
|
||||||
~QWaylandLayerSurface() override;
|
~QWaylandLayerSurface() override;
|
||||||
|
|
||||||
bool isExposed() const override
|
bool isExposed() const override;
|
||||||
{
|
|
||||||
return m_configured;
|
|
||||||
}
|
|
||||||
void attachPopup(QtWaylandClient::QWaylandShellSurface *popup) override;
|
void attachPopup(QtWaylandClient::QWaylandShellSurface *popup) override;
|
||||||
|
|
||||||
void setDesiredSize(const QSize &size);
|
void setDesiredSize(const QSize &size);
|
||||||
@ -43,10 +40,13 @@ public:
|
|||||||
void setLayer(uint32_t layer);
|
void setLayer(uint32_t layer);
|
||||||
|
|
||||||
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;
|
|
||||||
void setXdgActivationToken(const QString &token) override;
|
void setXdgActivationToken(const QString &token) override;
|
||||||
void requestXdgActivationToken(quint32 serial) override;
|
void requestXdgActivationToken(quint32 serial) override;
|
||||||
|
|
||||||
@ -54,6 +54,7 @@ private:
|
|||||||
void sendExpose();
|
void sendExpose();
|
||||||
void zwlr_layer_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height) override;
|
void zwlr_layer_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height) override;
|
||||||
void zwlr_layer_surface_v1_closed() override;
|
void zwlr_layer_surface_v1_closed() override;
|
||||||
|
void zwlr_layer_surface_v1_rearranged(uint32_t token) override;
|
||||||
|
|
||||||
QWaylandLayerShellIntegration *m_shell;
|
QWaylandLayerShellIntegration *m_shell;
|
||||||
LayerShellQt::Window *m_interface;
|
LayerShellQt::Window *m_interface;
|
||||||
@ -62,6 +63,11 @@ private:
|
|||||||
QString m_activationToken;
|
QString m_activationToken;
|
||||||
|
|
||||||
bool m_configured = false;
|
bool m_configured = false;
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
|
||||||
|
bool m_configuring = false;
|
||||||
|
#endif
|
||||||
|
quint32 m_arrangeSerial = 0;
|
||||||
|
bool m_waitingForRearrange = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
THIS SOFTWARE.
|
THIS SOFTWARE.
|
||||||
</copyright>
|
</copyright>
|
||||||
|
|
||||||
<interface name="zwlr_layer_shell_v1" version="5">
|
<interface name="zwlr_layer_shell_v1" version="6">
|
||||||
<description summary="create surfaces that are layers of the desktop">
|
<description summary="create surfaces that are layers of the desktop">
|
||||||
Clients can use this interface to assign the surface_layer role to
|
Clients can use this interface to assign the surface_layer role to
|
||||||
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
||||||
@ -100,7 +100,7 @@
|
|||||||
</request>
|
</request>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
<interface name="zwlr_layer_surface_v1" version="5">
|
<interface name="zwlr_layer_surface_v1" version="6">
|
||||||
<description summary="layer metadata interface">
|
<description summary="layer metadata interface">
|
||||||
An interface that may be implemented by a wl_surface, for surfaces that
|
An interface that may be implemented by a wl_surface, for surfaces that
|
||||||
are designed to be rendered as a layer of a stacked desktop-like
|
are designed to be rendered as a layer of a stacked desktop-like
|
||||||
@ -203,85 +203,21 @@
|
|||||||
<arg name="left" type="int"/>
|
<arg name="left" type="int"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
<enum name="keyboard_interactivity">
|
|
||||||
<description summary="types of keyboard interaction possible for a layer shell surface">
|
|
||||||
Types of keyboard interaction possible for layer shell surfaces. The
|
|
||||||
rationale for this is twofold: (1) some applications are not interested
|
|
||||||
in keyboard events and not allowing them to be focused can improve the
|
|
||||||
desktop experience; (2) some applications will want to take exclusive
|
|
||||||
keyboard focus.
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<entry name="none" value="0">
|
|
||||||
<description summary="no keyboard focus is possible">
|
|
||||||
This value indicates that this surface is not interested in keyboard
|
|
||||||
events and the compositor should never assign it the keyboard focus.
|
|
||||||
|
|
||||||
This is the default value, set for newly created layer shell surfaces.
|
|
||||||
|
|
||||||
This is useful for e.g. desktop widgets that display information or
|
|
||||||
only have interaction with non-keyboard input devices.
|
|
||||||
</description>
|
|
||||||
</entry>
|
|
||||||
<entry name="exclusive" value="1">
|
|
||||||
<description summary="request exclusive keyboard focus">
|
|
||||||
Request exclusive keyboard focus if this surface is above the shell surface layer.
|
|
||||||
|
|
||||||
For the top and overlay layers, the seat will always give
|
|
||||||
exclusive keyboard focus to the top-most layer which has keyboard
|
|
||||||
interactivity set to exclusive. If this layer contains multiple
|
|
||||||
surfaces with keyboard interactivity set to exclusive, the compositor
|
|
||||||
determines the one receiving keyboard events in an implementation-
|
|
||||||
defined manner. In this case, no guarantee is made when this surface
|
|
||||||
will receive keyboard focus (if ever).
|
|
||||||
|
|
||||||
For the bottom and background layers, the compositor is allowed to use
|
|
||||||
normal focus semantics.
|
|
||||||
|
|
||||||
This setting is mainly intended for applications that need to ensure
|
|
||||||
they receive all keyboard events, such as a lock screen or a password
|
|
||||||
prompt.
|
|
||||||
</description>
|
|
||||||
</entry>
|
|
||||||
<entry name="on_demand" value="2" since="4">
|
|
||||||
<description summary="request regular keyboard focus semantics">
|
|
||||||
This requests the compositor to allow this surface to be focused and
|
|
||||||
unfocused by the user in an implementation-defined manner. The user
|
|
||||||
should be able to unfocus this surface even regardless of the layer
|
|
||||||
it is on.
|
|
||||||
|
|
||||||
Typically, the compositor will want to use its normal mechanism to
|
|
||||||
manage keyboard focus between layer shell surfaces with this setting
|
|
||||||
and regular toplevels on the desktop layer (e.g. click to focus).
|
|
||||||
Nevertheless, it is possible for a compositor to require a special
|
|
||||||
interaction to focus or unfocus layer shell surfaces (e.g. requiring
|
|
||||||
a click even if focus follows the mouse normally, or providing a
|
|
||||||
keybinding to switch focus between layers).
|
|
||||||
|
|
||||||
This setting is mainly intended for desktop shell components (e.g.
|
|
||||||
panels) that allow keyboard interaction. Using this option can allow
|
|
||||||
implementing a desktop shell that can be fully usable without the
|
|
||||||
mouse.
|
|
||||||
</description>
|
|
||||||
</entry>
|
|
||||||
</enum>
|
|
||||||
|
|
||||||
<request name="set_keyboard_interactivity">
|
<request name="set_keyboard_interactivity">
|
||||||
<description summary="requests keyboard events">
|
<description summary="requests keyboard events">
|
||||||
Set how keyboard events are delivered to this surface. By default,
|
Set to 1 to request that the seat send keyboard events to this layer
|
||||||
layer shell surfaces do not receive keyboard events; this request can
|
surface. For layers below the shell surface layer, the seat will use
|
||||||
be used to change this.
|
normal focus semantics. For layers above the shell surface layers, the
|
||||||
|
seat will always give exclusive keyboard focus to the top-most layer
|
||||||
This setting is inherited by child surfaces set by the get_popup
|
which has keyboard interactivity set to true.
|
||||||
request.
|
|
||||||
|
|
||||||
Layer surfaces receive pointer, touch, and tablet events normally. If
|
Layer surfaces receive pointer, touch, and tablet events normally. If
|
||||||
you do not want to receive them, set the input region on your surface
|
you do not want to receive them, set the input region on your surface
|
||||||
to an empty region.
|
to an empty region.
|
||||||
|
|
||||||
Keyboard interactivity is double-buffered, see wl_surface.commit.
|
Events is double-buffered, see wl_surface.commit.
|
||||||
</description>
|
</description>
|
||||||
<arg name="keyboard_interactivity" type="uint" enum="keyboard_interactivity"/>
|
<arg name="keyboard_interactivity" type="uint"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
<request name="get_popup">
|
<request name="get_popup">
|
||||||
@ -366,7 +302,6 @@
|
|||||||
<entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/>
|
<entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/>
|
||||||
<entry name="invalid_size" value="1" summary="size is invalid"/>
|
<entry name="invalid_size" value="1" summary="size is invalid"/>
|
||||||
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
|
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
|
||||||
<entry name="invalid_keyboard_interactivity" value="3" summary="keyboard interactivity is invalid"/>
|
|
||||||
<entry name="invalid_exclusive_edge" value="4" summary="exclusive edge is invalid given the surface anchors"/>
|
<entry name="invalid_exclusive_edge" value="4" summary="exclusive edge is invalid given the surface anchors"/>
|
||||||
</enum>
|
</enum>
|
||||||
|
|
||||||
@ -403,5 +338,13 @@
|
|||||||
</description>
|
</description>
|
||||||
<arg name="edge" type="uint"/>
|
<arg name="edge" type="uint"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
|
<request name="set_arrange_token" since="6">
|
||||||
|
<arg name="token" type="uint"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="rearranged" since="6">
|
||||||
|
<arg name="token" type="uint"/>
|
||||||
|
</event>
|
||||||
</interface>
|
</interface>
|
||||||
</protocol>
|
</protocol>
|
||||||
|
|||||||
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -53,7 +53,7 @@ int main(int argc, char **argv)
|
|||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
|
||||||
const auto layerMetaEnum = QMetaEnum::fromType<Window::Layer>();
|
const auto layerMetaEnum = QMetaEnum::fromType<Window::Layer>();
|
||||||
const auto anchorMetaEnum = QMetaEnum::fromType<Window::Anchors>();
|
const auto anchorMetaEnum = QMetaEnum::fromType<Window::Anchor>();
|
||||||
|
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
QCommandLineOption marginsOption(QStringLiteral("margins"), QStringLiteral("Window margins"), QStringLiteral("pixels"), QStringLiteral("0"));
|
QCommandLineOption marginsOption(QStringLiteral("margins"), QStringLiteral("Window margins"), QStringLiteral("pixels"), QStringLiteral("0"));
|
||||||
|
|||||||
Reference in New Issue
Block a user