mirror of
https://invent.kde.org/plasma/layer-shell-qt.git
synced 2025-11-23 10:12:42 -05:00
Compare commits
6 Commits
work/zzag/
...
v6.1.4
| Author | SHA1 | Date | |
|---|---|---|---|
| 2851951f97 | |||
| 5a6d22d792 | |||
| cac5b2eebb | |||
| 21fd8ca8af | |||
| da9fe6c72e | |||
| f1a7f99a4a |
@ -7,6 +7,3 @@ include:
|
|||||||
- /gitlab-templates/reuse-lint.yml
|
- /gitlab-templates/reuse-lint.yml
|
||||||
- /gitlab-templates/linux-qt6.yml
|
- /gitlab-templates/linux-qt6.yml
|
||||||
- /gitlab-templates/freebsd-qt6.yml
|
- /gitlab-templates/freebsd-qt6.yml
|
||||||
- /gitlab-templates/xml-lint.yml
|
|
||||||
- /gitlab-templates/yaml-lint.yml
|
|
||||||
- /gitlab-templates/linux-qt6-next.yml
|
|
||||||
|
|||||||
@ -2,11 +2,11 @@
|
|||||||
# SPDX-License-Identifier: CC0-1.0
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
Dependencies:
|
Dependencies:
|
||||||
- 'on': ['@all']
|
- 'on': ['@all']
|
||||||
'require':
|
'require':
|
||||||
'frameworks/extra-cmake-modules': '@latest-kf6'
|
'frameworks/extra-cmake-modules': '@latest-kf6'
|
||||||
'third-party/wayland': '@latest'
|
'third-party/wayland': '@latest'
|
||||||
'third-party/wayland-protocols': '@latest'
|
'third-party/wayland-protocols': '@latest'
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
require-passing-tests-on: ['Linux', 'FreeBSD', 'Windows']
|
require-passing-tests-on: ['Linux', 'FreeBSD', 'Windows']
|
||||||
|
|||||||
@ -4,13 +4,13 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
project(layershellqt)
|
project(layershellqt)
|
||||||
set(PROJECT_VERSION "6.5.80")
|
set(PROJECT_VERSION "6.1.4")
|
||||||
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.6.0")
|
||||||
set(KF6_MIN_VERSION "6.18.0")
|
set(KF6_MIN_VERSION "6.2.0")
|
||||||
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
|
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
@ -34,11 +34,6 @@ include(ECMQmlModule)
|
|||||||
include(KDEGitCommitHooks)
|
include(KDEGitCommitHooks)
|
||||||
|
|
||||||
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient Qml)
|
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient Qml)
|
||||||
|
|
||||||
if (Qt6WaylandClient_VERSION VERSION_GREATER_EQUAL "6.10.0")
|
|
||||||
find_package(Qt6WaylandClientPrivate ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(WaylandScanner REQUIRED)
|
find_package(WaylandScanner REQUIRED)
|
||||||
find_package(Wayland 1.3 COMPONENTS Client Server)
|
find_package(Wayland 1.3 COMPONENTS Client Server)
|
||||||
find_package(WaylandProtocols REQUIRED)
|
find_package(WaylandProtocols REQUIRED)
|
||||||
@ -60,8 +55,8 @@ kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
|
|||||||
|
|
||||||
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
|
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
|
||||||
|
|
||||||
ecm_set_disabled_deprecation_versions(QT 6.8.1
|
ecm_set_disabled_deprecation_versions(QT 6.5
|
||||||
KF 6.9.0
|
KF 5.240
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
# SPDX-License-Identifier: CC0-1.0
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
maintainer:
|
maintainer:
|
||||||
- vladz
|
- vladz
|
||||||
description: Layer Shell Qt
|
description: Layer Shell Qt
|
||||||
platforms:
|
platforms:
|
||||||
- name: Linux
|
- name: Linux
|
||||||
|
|||||||
@ -4,18 +4,10 @@
|
|||||||
remove_definitions(-DQT_NO_SIGNALS_SLOTS_KEYWORDS)
|
remove_definitions(-DQT_NO_SIGNALS_SLOTS_KEYWORDS)
|
||||||
|
|
||||||
add_library(LayerShellQtInterface)
|
add_library(LayerShellQtInterface)
|
||||||
|
qt6_generate_wayland_protocol_client_sources(LayerShellQtInterface FILES
|
||||||
qt6_extract_metatypes(LayerShellQtInterface)
|
${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml
|
||||||
|
${WaylandProtocols_DATADIR}/staging/xdg-activation/xdg-activation-v1.xml
|
||||||
if (Qt6_VERSION VERSION_GREATER_EQUAL "6.8.0")
|
${CMAKE_CURRENT_SOURCE_DIR}/wlr-layer-shell-unstable-v1.xml
|
||||||
set(private_code_option "PRIVATE_CODE")
|
|
||||||
endif()
|
|
||||||
qt6_generate_wayland_protocol_client_sources(LayerShellQtInterface
|
|
||||||
${private_code_option}
|
|
||||||
FILES
|
|
||||||
${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml
|
|
||||||
${WaylandProtocols_DATADIR}/staging/xdg-activation/xdg-activation-v1.xml
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/wlr-layer-shell-unstable-v1.xml
|
|
||||||
)
|
)
|
||||||
|
|
||||||
ecm_qt_declare_logging_category(LayerShellQtInterface
|
ecm_qt_declare_logging_category(LayerShellQtInterface
|
||||||
|
|||||||
@ -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)
|
|
||||||
};
|
|
||||||
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
#include <layershellqt_logging.h>
|
#include <layershellqt_logging.h>
|
||||||
|
|
||||||
#include <QPlatformSurfaceEvent>
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
@ -17,49 +16,6 @@
|
|||||||
|
|
||||||
using namespace LayerShellQt;
|
using namespace LayerShellQt;
|
||||||
|
|
||||||
Margin::Margin()
|
|
||||||
: m_value(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Margin::Margin(int pixels)
|
|
||||||
: m_value(pixels)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Margin::Margin(qreal percents)
|
|
||||||
: m_value(percents)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Margin Margin::fromPixels(int pixels)
|
|
||||||
{
|
|
||||||
return Margin(pixels);
|
|
||||||
}
|
|
||||||
|
|
||||||
Margin Margin::fromPercents(qreal percents)
|
|
||||||
{
|
|
||||||
return Margin(percents);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<int> Margin::pixels() const
|
|
||||||
{
|
|
||||||
if (std::holds_alternative<int>(m_value)) {
|
|
||||||
return std::get<int>(m_value);
|
|
||||||
} else {
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<qreal> Margin::percents() const
|
|
||||||
{
|
|
||||||
if (std::holds_alternative<qreal>(m_value)) {
|
|
||||||
return std::get<qreal>(m_value);
|
|
||||||
} else {
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class LayerShellQt::WindowPrivate
|
class LayerShellQt::WindowPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -75,14 +31,9 @@ public:
|
|||||||
Window::Anchor exclusiveEdge = Window::AnchorNone;
|
Window::Anchor exclusiveEdge = Window::AnchorNone;
|
||||||
Window::KeyboardInteractivity keyboardInteractivity = Window::KeyboardInteractivityOnDemand;
|
Window::KeyboardInteractivity keyboardInteractivity = Window::KeyboardInteractivityOnDemand;
|
||||||
Window::Layer layer = Window::LayerTop;
|
Window::Layer layer = Window::LayerTop;
|
||||||
Margin leftMargin;
|
QMargins margins;
|
||||||
Margin topMargin;
|
|
||||||
Margin rightMargin;
|
|
||||||
Margin bottomMargin;
|
|
||||||
QSize desiredSize = QSize(0, 0);
|
|
||||||
Window::ScreenConfiguration screenConfiguration = Window::ScreenFromQWindow;
|
Window::ScreenConfiguration screenConfiguration = Window::ScreenFromQWindow;
|
||||||
bool closeOnDismissed = true;
|
bool closeOnDismissed = true;
|
||||||
bool activateOnShow = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static QMap<QWindow *, Window *> s_map;
|
static QMap<QWindow *, Window *> s_map;
|
||||||
@ -135,89 +86,15 @@ Window::Anchor Window::exclusiveEdge() const
|
|||||||
|
|
||||||
void Window::setMargins(const QMargins &margins)
|
void Window::setMargins(const QMargins &margins)
|
||||||
{
|
{
|
||||||
setLeftMargin(Margin::fromPixels(margins.left()));
|
if (d->margins != margins) {
|
||||||
setTopMargin(Margin::fromPixels(margins.top()));
|
d->margins = margins;
|
||||||
setRightMargin(Margin::fromPixels(margins.right()));
|
Q_EMIT marginsChanged();
|
||||||
setBottomMargin(Margin::fromPixels(margins.bottom()));
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QMargins Window::margins() const
|
QMargins Window::margins() const
|
||||||
{
|
{
|
||||||
return QMargins(d->leftMargin.pixels().value_or(0),
|
return d->margins;
|
||||||
d->topMargin.pixels().value_or(0),
|
|
||||||
d->rightMargin.pixels().value_or(0),
|
|
||||||
d->bottomMargin.pixels().value_or(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Window::setLeftMargin(Margin margin)
|
|
||||||
{
|
|
||||||
if (d->leftMargin != margin) {
|
|
||||||
d->leftMargin = margin;
|
|
||||||
Q_EMIT leftMarginChanged();
|
|
||||||
Q_EMIT marginsChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Margin Window::leftMargin() const
|
|
||||||
{
|
|
||||||
return d->leftMargin;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Window::setTopMargin(Margin margin)
|
|
||||||
{
|
|
||||||
if (d->topMargin != margin) {
|
|
||||||
d->topMargin = margin;
|
|
||||||
Q_EMIT topMarginChanged();
|
|
||||||
Q_EMIT marginsChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Margin Window::topMargin() const
|
|
||||||
{
|
|
||||||
return d->topMargin;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Window::setRightMargin(Margin margin)
|
|
||||||
{
|
|
||||||
if (d->rightMargin != margin) {
|
|
||||||
d->rightMargin = margin;
|
|
||||||
Q_EMIT rightMarginChanged();
|
|
||||||
Q_EMIT marginsChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Margin Window::rightMargin() const
|
|
||||||
{
|
|
||||||
return d->rightMargin;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Window::setBottomMargin(Margin margin)
|
|
||||||
{
|
|
||||||
if (d->bottomMargin != margin) {
|
|
||||||
d->bottomMargin = margin;
|
|
||||||
Q_EMIT bottomMarginChanged();
|
|
||||||
Q_EMIT marginsChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Margin Window::bottomMargin() const
|
|
||||||
{
|
|
||||||
return d->bottomMargin;
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
||||||
@ -277,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,6 +178,7 @@ void Window::initializeShell()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
waylandWindow->setShellIntegration(shellIntegration);
|
waylandWindow->setShellIntegration(shellIntegration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,34 +18,6 @@ namespace LayerShellQt
|
|||||||
{
|
{
|
||||||
class WindowPrivate;
|
class WindowPrivate;
|
||||||
|
|
||||||
/**
|
|
||||||
* The Margin type provides a way to specify how far a layer surface should be away from a screen edge.
|
|
||||||
*
|
|
||||||
* A margin can have an absolute value or a percent value. An absolute value indicates the distance
|
|
||||||
* in pixels. A percent value indicates the distance as a percentage of the output size, for example
|
|
||||||
* this can be used to tell the compositor that the surface should be one third of the output height from
|
|
||||||
* a screen edge, etc.
|
|
||||||
*/
|
|
||||||
class LAYERSHELLQT_EXPORT Margin
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static Margin fromPixels(int pixels);
|
|
||||||
static Margin fromPercents(qreal percents);
|
|
||||||
|
|
||||||
Margin();
|
|
||||||
|
|
||||||
std::optional<int> pixels() const;
|
|
||||||
std::optional<qreal> percents() const;
|
|
||||||
|
|
||||||
auto operator<=>(const Margin &other) const = default;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Margin(int pixels);
|
|
||||||
Margin(qreal percents);
|
|
||||||
|
|
||||||
std::variant<int, qreal> m_value;
|
|
||||||
};
|
|
||||||
|
|
||||||
class LAYERSHELLQT_EXPORT Window : public QObject
|
class LAYERSHELLQT_EXPORT Window : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -56,7 +28,6 @@ class LAYERSHELLQT_EXPORT Window : public QObject
|
|||||||
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(ScreenConfiguration screenConfiguration READ screenConfiguration WRITE setScreenConfiguration)
|
||||||
Q_PROPERTY(bool activateOnShow READ activateOnShow WRITE setActivateOnShow)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~Window() override;
|
~Window() override;
|
||||||
@ -68,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.
|
||||||
@ -115,21 +86,6 @@ public:
|
|||||||
void setMargins(const QMargins &margins);
|
void setMargins(const QMargins &margins);
|
||||||
QMargins margins() const;
|
QMargins margins() const;
|
||||||
|
|
||||||
void setLeftMargin(Margin margin);
|
|
||||||
Margin leftMargin() const;
|
|
||||||
|
|
||||||
void setTopMargin(Margin margin);
|
|
||||||
Margin topMargin() const;
|
|
||||||
|
|
||||||
void setRightMargin(Margin margin);
|
|
||||||
Margin rightMargin() const;
|
|
||||||
|
|
||||||
void setBottomMargin(Margin margin);
|
|
||||||
Margin bottomMargin() const;
|
|
||||||
|
|
||||||
void setDesiredSize(const QSize &size);
|
|
||||||
QSize desiredSize() const;
|
|
||||||
|
|
||||||
void setKeyboardInteractivity(KeyboardInteractivity interactivity);
|
void setKeyboardInteractivity(KeyboardInteractivity interactivity);
|
||||||
KeyboardInteractivity keyboardInteractivity() const;
|
KeyboardInteractivity keyboardInteractivity() const;
|
||||||
|
|
||||||
@ -158,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
|
||||||
@ -178,24 +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 leftMarginChanged();
|
|
||||||
void topMarginChanged();
|
|
||||||
void rightMarginChanged();
|
|
||||||
void bottomMarginChanged();
|
|
||||||
void desiredSizeChanged();
|
|
||||||
void keyboardInteractivityChanged();
|
void keyboardInteractivityChanged();
|
||||||
void layerChanged();
|
void layerChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initializeShell();
|
|
||||||
|
|
||||||
Window(QWindow *window);
|
Window(QWindow *window);
|
||||||
QScopedPointer<WindowPrivate> d;
|
QScopedPointer<WindowPrivate> d;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -44,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());
|
||||||
@ -60,30 +56,9 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
|
|||||||
setExclusiveEdge(m_interface->exclusiveEdge());
|
setExclusiveEdge(m_interface->exclusiveEdge());
|
||||||
});
|
});
|
||||||
|
|
||||||
setLeftMargin(m_interface->leftMargin());
|
setMargins(m_interface->margins());
|
||||||
connect(m_interface, &Window::leftMarginChanged, this, [this]() {
|
connect(m_interface, &Window::marginsChanged, this, [this]() {
|
||||||
setLeftMargin(m_interface->leftMargin());
|
setMargins(m_interface->margins());
|
||||||
});
|
|
||||||
|
|
||||||
setTopMargin(m_interface->topMargin());
|
|
||||||
connect(m_interface, &Window::topMarginChanged, this, [this]() {
|
|
||||||
setTopMargin(m_interface->topMargin());
|
|
||||||
});
|
|
||||||
|
|
||||||
setRightMargin(m_interface->rightMargin());
|
|
||||||
connect(m_interface, &Window::rightMarginChanged, this, [this]() {
|
|
||||||
setRightMargin(m_interface->rightMargin());
|
|
||||||
});
|
|
||||||
|
|
||||||
setBottomMargin(m_interface->bottomMargin());
|
|
||||||
connect(m_interface, &Window::bottomMarginChanged, this, [this]() {
|
|
||||||
setBottomMargin(m_interface->bottomMargin());
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(m_interface, &Window::desiredSizeChanged, this, [this]() {
|
|
||||||
if (!m_interface->desiredSize().isNull()) {
|
|
||||||
setDesiredSize(m_interface->desiredSize());
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
setKeyboardInteractivity(m_interface->keyboardInteractivity());
|
setKeyboardInteractivity(m_interface->keyboardInteractivity());
|
||||||
@ -91,11 +66,7 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
|
|||||||
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()
|
||||||
@ -139,7 +110,9 @@ void QWaylandLayerSurface::attachPopup(QtWaylandClient::QWaylandShellSurface *po
|
|||||||
|
|
||||||
void QWaylandLayerSurface::applyConfigure()
|
void QWaylandLayerSurface::applyConfigure()
|
||||||
{
|
{
|
||||||
|
m_configuring = true;
|
||||||
window()->resizeFromApplyConfigure(m_pendingSize);
|
window()->resizeFromApplyConfigure(m_pendingSize);
|
||||||
|
m_configuring = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandLayerSurface::setDesiredSize(const QSize &size)
|
void QWaylandLayerSurface::setDesiredSize(const QSize &size)
|
||||||
@ -174,68 +147,9 @@ void QWaylandLayerSurface::setExclusiveEdge(uint32_t edge)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandLayerSurface::setLeftMargin(const Margin &margin)
|
void QWaylandLayerSurface::setMargins(const QMargins &margins)
|
||||||
{
|
{
|
||||||
if (zwlr_layer_surface_v1_get_version(object()) >= 6) {
|
set_margin(margins.top(), margins.right(), margins.bottom(), margins.left());
|
||||||
if (const auto pixels = margin.pixels()) {
|
|
||||||
set_left_margin_absolute(*pixels);
|
|
||||||
} else if (const auto percents = margin.percents()) {
|
|
||||||
set_left_margin_percents(wl_fixed_from_double(*percents));
|
|
||||||
} else {
|
|
||||||
qCWarning(LAYERSHELLQT) << "Unspecified left margin for" << m_window->window();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const QMargins margins = m_interface->margins();
|
|
||||||
set_margin(margins.top(), margins.right(), margins.bottom(), margins.left());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QWaylandLayerSurface::setTopMargin(const Margin &margin)
|
|
||||||
{
|
|
||||||
if (zwlr_layer_surface_v1_get_version(object()) >= 6) {
|
|
||||||
if (const auto pixels = margin.pixels()) {
|
|
||||||
set_top_margin_absolute(*pixels);
|
|
||||||
} else if (const auto percents = margin.percents()) {
|
|
||||||
set_top_margin_percents(wl_fixed_from_double(*percents));
|
|
||||||
} else {
|
|
||||||
qCWarning(LAYERSHELLQT) << "Unspecified top margin for" << m_window->window();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const QMargins margins = m_interface->margins();
|
|
||||||
set_margin(margins.top(), margins.right(), margins.bottom(), margins.left());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QWaylandLayerSurface::setRightMargin(const Margin &margin)
|
|
||||||
{
|
|
||||||
if (zwlr_layer_surface_v1_get_version(object()) >= 6) {
|
|
||||||
if (const auto pixels = margin.pixels()) {
|
|
||||||
set_right_margin_absolute(*pixels);
|
|
||||||
} else if (const auto percents = margin.percents()) {
|
|
||||||
set_right_margin_percents(wl_fixed_from_double(*percents));
|
|
||||||
} else {
|
|
||||||
qCWarning(LAYERSHELLQT) << "Unspecified right margin for" << m_window->window();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const QMargins margins = m_interface->margins();
|
|
||||||
set_margin(margins.top(), margins.right(), margins.bottom(), margins.left());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QWaylandLayerSurface::setBottomMargin(const Margin &margin)
|
|
||||||
{
|
|
||||||
if (zwlr_layer_surface_v1_get_version(object()) >= 6) {
|
|
||||||
if (const auto pixels = margin.pixels()) {
|
|
||||||
set_bottom_margin_absolute(*pixels);
|
|
||||||
} else if (const auto percents = margin.percents()) {
|
|
||||||
set_bottom_margin_percents(wl_fixed_from_double(*percents));
|
|
||||||
} else {
|
|
||||||
qCWarning(LAYERSHELLQT) << "Unspecified bottom margin for" << m_window->window();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const QMargins margins = m_interface->margins();
|
|
||||||
set_margin(margins.top(), margins.right(), margins.bottom(), margins.left());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandLayerSurface::setKeyboardInteractivity(uint32_t interactivity)
|
void QWaylandLayerSurface::setKeyboardInteractivity(uint32_t interactivity)
|
||||||
@ -249,11 +163,13 @@ void QWaylandLayerSurface::setLayer(uint32_t layer)
|
|||||||
set_layer(layer);
|
set_layer(layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandLayerSurface::setWindowSize(const QSize &size)
|
void QWaylandLayerSurface::setWindowGeometry(const QRect &geometry)
|
||||||
{
|
{
|
||||||
if (m_interface->desiredSize().isNull()) {
|
if (m_configuring) {
|
||||||
setDesiredSize(size);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setDesiredSize(geometry.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWaylandLayerSurface::requestActivate()
|
bool QWaylandLayerSurface::requestActivate()
|
||||||
@ -266,10 +182,6 @@ 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();
|
||||||
@ -285,23 +197,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;
|
||||||
@ -323,6 +218,11 @@ void QWaylandLayerSurface::requestXdgActivationToken(quint32 serial)
|
|||||||
|
|
||||||
void QWaylandLayerSurface::sendExpose()
|
void QWaylandLayerSurface::sendExpose()
|
||||||
{
|
{
|
||||||
window()->updateExposure();
|
#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0)
|
||||||
|
window()->handleExpose(QRect(QPoint(), m_pendingSize));
|
||||||
|
#else
|
||||||
|
window()->sendRecursiveExposeEvent();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,6 @@
|
|||||||
namespace LayerShellQt
|
namespace LayerShellQt
|
||||||
{
|
{
|
||||||
|
|
||||||
class Margin;
|
|
||||||
class Window;
|
class Window;
|
||||||
|
|
||||||
class LAYERSHELLQT_EXPORT QWaylandLayerSurface : public QtWaylandClient::QWaylandShellSurface, public QtWayland::zwlr_layer_surface_v1
|
class LAYERSHELLQT_EXPORT QWaylandLayerSurface : public QtWaylandClient::QWaylandShellSurface, public QtWayland::zwlr_layer_surface_v1
|
||||||
@ -39,18 +38,14 @@ public:
|
|||||||
void setAnchor(uint32_t anchor);
|
void setAnchor(uint32_t anchor);
|
||||||
void setExclusiveZone(int32_t zone);
|
void setExclusiveZone(int32_t zone);
|
||||||
void setExclusiveEdge(uint32_t edge);
|
void setExclusiveEdge(uint32_t edge);
|
||||||
void setLeftMargin(const Margin &margin);
|
void setMargins(const QMargins &margins);
|
||||||
void setTopMargin(const Margin &margin);
|
|
||||||
void setRightMargin(const Margin &margin);
|
|
||||||
void setBottomMargin(const Margin &margin);
|
|
||||||
void setKeyboardInteractivity(uint32_t interactivity);
|
void setKeyboardInteractivity(uint32_t interactivity);
|
||||||
void setLayer(uint32_t layer);
|
void setLayer(uint32_t layer);
|
||||||
|
|
||||||
void applyConfigure() override;
|
void applyConfigure() override;
|
||||||
void setWindowSize(const QSize &size) override;
|
void setWindowGeometry(const QRect &geometry) override;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
@ -66,6 +61,7 @@ private:
|
|||||||
QString m_activationToken;
|
QString m_activationToken;
|
||||||
|
|
||||||
bool m_configured = false;
|
bool m_configured = false;
|
||||||
|
bool m_configuring = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
THIS SOFTWARE.
|
THIS SOFTWARE.
|
||||||
</copyright>
|
</copyright>
|
||||||
|
|
||||||
<interface name="zwlr_layer_shell_v1" version="6">
|
<interface name="zwlr_layer_shell_v1" version="5">
|
||||||
<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="6">
|
<interface name="zwlr_layer_surface_v1" version="5">
|
||||||
<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
|
||||||
@ -403,83 +403,5 @@
|
|||||||
</description>
|
</description>
|
||||||
<arg name="edge" type="uint"/>
|
<arg name="edge" type="uint"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
<!-- Version 6 additions -->
|
|
||||||
|
|
||||||
<request name="set_left_margin_absolute" since="6">
|
|
||||||
<description summary="set left margin in absolute pixels">
|
|
||||||
Sets the left margin in absolute pixels.
|
|
||||||
|
|
||||||
The left margin specified in percents will be overwritten.
|
|
||||||
</description>
|
|
||||||
<arg name="margin" type="int"/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<request name="set_left_margin_percents" since="6">
|
|
||||||
<description summary="set the left margin proportional to area width">
|
|
||||||
Sets the left margin as a percentage of the area width. The
|
|
||||||
margin value is a number between 0 and 1.
|
|
||||||
|
|
||||||
The left margin specified in absolute values will be overwritten.
|
|
||||||
</description>
|
|
||||||
<arg name="margin" type="fixed"/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<request name="set_top_margin_absolute" since="6">
|
|
||||||
<description summary="set top margin in absolute pixels">
|
|
||||||
Sets the top margin in absolute pixels.
|
|
||||||
|
|
||||||
The top margin specified in percents will be overwritten.
|
|
||||||
</description>
|
|
||||||
<arg name="margin" type="int"/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<request name="set_top_margin_percents" since="6">
|
|
||||||
<description summary="set the top margin proportional to area width">
|
|
||||||
Sets the top margin as a percentage of the area width. The
|
|
||||||
margin value is a number between 0 and 1.
|
|
||||||
|
|
||||||
The top margin specified in absolute values will be overwritten.
|
|
||||||
</description>
|
|
||||||
<arg name="margin" type="fixed"/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<request name="set_right_margin_absolute" since="6">
|
|
||||||
<description summary="set right margin in absolute pixels">
|
|
||||||
Sets the right margin in absolute pixels.
|
|
||||||
|
|
||||||
The right margin specified in percents will be overwritten.
|
|
||||||
</description>
|
|
||||||
<arg name="margin" type="int"/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<request name="set_right_margin_percents" since="6">
|
|
||||||
<description summary="set the right margin proportional to area width">
|
|
||||||
Sets the right margin as a percentage of the area width. The
|
|
||||||
margin value is a number between 0 and 1.
|
|
||||||
|
|
||||||
The right margin specified in absolute values will be overwritten.
|
|
||||||
</description>
|
|
||||||
<arg name="margin" type="fixed"/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<request name="set_bottom_margin_absolute" since="6">
|
|
||||||
<description summary="set bottom margin in absolute pixels">
|
|
||||||
Sets the bottom margin in absolute pixels.
|
|
||||||
|
|
||||||
The bottom margin specified in percents will be overwritten.
|
|
||||||
</description>
|
|
||||||
<arg name="margin" type="int"/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<request name="set_bottom_margin_percents" since="6">
|
|
||||||
<description summary="set the bottom margin proportional to area width">
|
|
||||||
Sets the bottom margin as a percentage of the area width. The
|
|
||||||
margin value is a number between 0 and 1.
|
|
||||||
|
|
||||||
The bottom margin specified in absolute values will be overwritten.
|
|
||||||
</description>
|
|
||||||
<arg name="margin" type="fixed"/>
|
|
||||||
</request>
|
|
||||||
</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