mirror of
https://invent.kde.org/plasma/layer-shell-qt.git
synced 2025-11-23 10:12:42 -05:00
Compare commits
19 Commits
v5.90.0
...
work/mart/
| Author | SHA1 | Date | |
|---|---|---|---|
| d33befa740 | |||
| feeea2fec6 | |||
| b80f22e22f | |||
| 74cc364ffe | |||
| f90e942ad0 | |||
| 2334a96555 | |||
| a1d225f6ef | |||
| 8d16787360 | |||
| 856843a22f | |||
| 7d3194034c | |||
| e3098a660a | |||
| d379bc8d8e | |||
| 715e629dd8 | |||
| 8ae3b0aef8 | |||
| 6f0bca5593 | |||
| d1ab27dd53 | |||
| 4569e78e25 | |||
| ddb0490592 | |||
| 3c116e7550 |
@ -4,12 +4,12 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
project(layershellqt)
|
project(layershellqt)
|
||||||
set(PROJECT_VERSION "5.90.0")
|
set(PROJECT_VERSION "5.91.90")
|
||||||
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.5.0")
|
set(QT_MIN_VERSION "6.6.0")
|
||||||
set(KF6_MIN_VERSION "5.240.0")
|
set(KF6_MIN_VERSION "5.240.0")
|
||||||
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
|
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
|
||||||
|
|
||||||
@ -30,6 +30,7 @@ include(FeatureSummary)
|
|||||||
include(GenerateExportHeader)
|
include(GenerateExportHeader)
|
||||||
include(KDEClangFormat)
|
include(KDEClangFormat)
|
||||||
include(ECMQtDeclareLoggingCategory)
|
include(ECMQtDeclareLoggingCategory)
|
||||||
|
include(ECMQmlModule)
|
||||||
|
|
||||||
|
|
||||||
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient Qml)
|
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient Qml)
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
# SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleix.pol_gonzalez@mercedes-benz.com>
|
# SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleix.pol_gonzalez@mercedes-benz.com>
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
qt_add_qml_module(LayerShellQtQml
|
ecm_add_qml_module(LayerShellQtQml
|
||||||
URI "org.kde.layershell"
|
URI "org.kde.layershell"
|
||||||
VERSION 1.0
|
VERSION 1.0
|
||||||
SOURCES layershellqtplugin.cpp)
|
SOURCES layershellqtplugin.cpp)
|
||||||
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})
|
||||||
@ -6,9 +6,6 @@
|
|||||||
|
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
#include "../qwaylandlayershellintegration_p.h"
|
#include "../qwaylandlayershellintegration_p.h"
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
|
|
||||||
#include "../qwaylandlayersurface_p.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <layershellqt_logging.h>
|
#include <layershellqt_logging.h>
|
||||||
|
|
||||||
@ -30,8 +27,9 @@ public:
|
|||||||
QWindow *parentWindow;
|
QWindow *parentWindow;
|
||||||
QString scope = QStringLiteral("window");
|
QString scope = QStringLiteral("window");
|
||||||
Window::Anchors anchors = {Window::AnchorTop | Window::AnchorBottom | Window::AnchorLeft | Window::AnchorRight};
|
Window::Anchors anchors = {Window::AnchorTop | Window::AnchorBottom | Window::AnchorLeft | Window::AnchorRight};
|
||||||
int32_t exclusionZone = 0;
|
QSize exclusionZone;
|
||||||
Window::KeyboardInteractivity keyboardInteractivity = Window::KeyboardInteractivityNone;
|
Window::Anchor exclusiveEdge = Window::AnchorNone;
|
||||||
|
Window::KeyboardInteractivity keyboardInteractivity = Window::KeyboardInteractivityOnDemand;
|
||||||
Window::Layer layer = Window::LayerTop;
|
Window::Layer layer = Window::LayerTop;
|
||||||
QMargins margins;
|
QMargins margins;
|
||||||
Window::ScreenConfiguration screenConfiguration = Window::ScreenFromQWindow;
|
Window::ScreenConfiguration screenConfiguration = Window::ScreenFromQWindow;
|
||||||
@ -58,7 +56,7 @@ Window::Anchors Window::anchors() const
|
|||||||
return d->anchors;
|
return d->anchors;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setExclusiveZone(int32_t zone)
|
void Window::setExclusiveZone(const QSize &zone)
|
||||||
{
|
{
|
||||||
if (d->exclusionZone != zone) {
|
if (d->exclusionZone != zone) {
|
||||||
d->exclusionZone = zone;
|
d->exclusionZone = zone;
|
||||||
@ -66,7 +64,7 @@ void Window::setExclusiveZone(int32_t zone)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Window::exclusionZone() const
|
QSize Window::exclusionZone() const
|
||||||
{
|
{
|
||||||
return d->exclusionZone;
|
return d->exclusionZone;
|
||||||
}
|
}
|
||||||
@ -141,21 +139,6 @@ void Window::setCloseOnDismissed(bool close)
|
|||||||
d->closeOnDismissed = close;
|
d->closeOnDismissed = close;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
|
|
||||||
void Window::attachPopup(QWindow *window, xdg_popup *popup)
|
|
||||||
{
|
|
||||||
auto waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow *>(window->handle());
|
|
||||||
if (!waylandWindow) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto shellSurface = dynamic_cast<QWaylandLayerSurface *>(waylandWindow->shellSurface());
|
|
||||||
if (shellSurface) {
|
|
||||||
shellSurface->get_popup(popup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Window::Window(QWindow *window)
|
Window::Window(QWindow *window)
|
||||||
: QObject(window)
|
: QObject(window)
|
||||||
, d(new WindowPrivate(window))
|
, d(new WindowPrivate(window))
|
||||||
|
|||||||
@ -14,10 +14,6 @@
|
|||||||
|
|
||||||
#include "layershellqt_export.h"
|
#include "layershellqt_export.h"
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
|
|
||||||
struct xdg_popup;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace LayerShellQt
|
namespace LayerShellQt
|
||||||
{
|
{
|
||||||
class WindowPrivate;
|
class WindowPrivate;
|
||||||
@ -28,7 +24,7 @@ class LAYERSHELLQT_EXPORT Window : public QObject
|
|||||||
Q_PROPERTY(Anchors anchors READ anchors WRITE setAnchors NOTIFY anchorsChanged)
|
Q_PROPERTY(Anchors anchors READ anchors WRITE setAnchors NOTIFY anchorsChanged)
|
||||||
Q_PROPERTY(QString scope READ scope WRITE setScope)
|
Q_PROPERTY(QString scope READ scope WRITE setScope)
|
||||||
Q_PROPERTY(QMargins margins READ margins WRITE setMargins NOTIFY marginsChanged)
|
Q_PROPERTY(QMargins margins READ margins WRITE setMargins NOTIFY marginsChanged)
|
||||||
Q_PROPERTY(qint32 exclusionZone READ exclusionZone WRITE setExclusiveZone NOTIFY exclusionZoneChanged)
|
Q_PROPERTY(QSize 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(ScreenConfiguration screenConfiguration READ screenConfiguration WRITE setScreenConfiguration)
|
||||||
@ -37,6 +33,7 @@ public:
|
|||||||
~Window() override;
|
~Window() override;
|
||||||
|
|
||||||
enum Anchor {
|
enum Anchor {
|
||||||
|
AnchorNone = 0,
|
||||||
AnchorTop = 1, ///< The top edge of the anchor rectangle
|
AnchorTop = 1, ///< The top edge of the anchor rectangle
|
||||||
AnchorBottom = 2, ///< The bottom edge of the anchor rectangle
|
AnchorBottom = 2, ///< The bottom edge of the anchor rectangle
|
||||||
AnchorLeft = 4, ///< The left edge of the anchor rectangle
|
AnchorLeft = 4, ///< The left edge of the anchor rectangle
|
||||||
@ -80,8 +77,8 @@ public:
|
|||||||
void setAnchors(Anchors anchor);
|
void setAnchors(Anchors anchor);
|
||||||
Anchors anchors() const;
|
Anchors anchors() const;
|
||||||
|
|
||||||
void setExclusiveZone(int32_t zone);
|
void setExclusiveZone(const QSize &zone);
|
||||||
int32_t exclusionZone() const;
|
QSize exclusionZone() const;
|
||||||
|
|
||||||
void setMargins(const QMargins &margins);
|
void setMargins(const QMargins &margins);
|
||||||
QMargins margins() const;
|
QMargins margins() const;
|
||||||
@ -120,15 +117,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
static Window *get(QWindow *window);
|
static Window *get(QWindow *window);
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0)
|
|
||||||
static void attachPopup(QWindow *window, xdg_popup *popup);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static Window *qmlAttachedProperties(QObject *object);
|
static Window *qmlAttachedProperties(QObject *object);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void anchorsChanged();
|
void anchorsChanged();
|
||||||
void exclusionZoneChanged();
|
void exclusionZoneChanged();
|
||||||
|
void exclusiveEdgeChanged();
|
||||||
void marginsChanged();
|
void marginsChanged();
|
||||||
void keyboardInteractivityChanged();
|
void keyboardInteractivityChanged();
|
||||||
void layerChanged();
|
void layerChanged();
|
||||||
|
|||||||
@ -100,7 +100,6 @@ void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial, uint
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
|
|
||||||
void QWaylandLayerSurface::attachPopup(QtWaylandClient::QWaylandShellSurface *popup)
|
void QWaylandLayerSurface::attachPopup(QtWaylandClient::QWaylandShellSurface *popup)
|
||||||
{
|
{
|
||||||
std::any anyRole = popup->surfaceRole();
|
std::any anyRole = popup->surfaceRole();
|
||||||
@ -111,7 +110,6 @@ void QWaylandLayerSurface::attachPopup(QtWaylandClient::QWaylandShellSurface *po
|
|||||||
qCWarning(LAYERSHELLQT) << "Cannot attach popup of unknown type";
|
qCWarning(LAYERSHELLQT) << "Cannot attach popup of unknown type";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void QWaylandLayerSurface::applyConfigure()
|
void QWaylandLayerSurface::applyConfigure()
|
||||||
{
|
{
|
||||||
@ -121,11 +119,12 @@ void QWaylandLayerSurface::applyConfigure()
|
|||||||
void QWaylandLayerSurface::setAnchor(uint anchor)
|
void QWaylandLayerSurface::setAnchor(uint anchor)
|
||||||
{
|
{
|
||||||
set_anchor(anchor);
|
set_anchor(anchor);
|
||||||
|
setWindowGeometry(window()->windowContentGeometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandLayerSurface::setExclusiveZone(int32_t zone)
|
void QWaylandLayerSurface::setExclusiveZone(const QSize &zone)
|
||||||
{
|
{
|
||||||
set_exclusive_zone(zone);
|
set_exclusive_zone(zone.width(), zone.height());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandLayerSurface::setMargins(const QMargins &margins)
|
void QWaylandLayerSurface::setMargins(const QMargins &margins)
|
||||||
@ -146,8 +145,8 @@ void QWaylandLayerSurface::setLayer(uint32_t layer)
|
|||||||
|
|
||||||
void QWaylandLayerSurface::setWindowGeometry(const QRect &geometry)
|
void QWaylandLayerSurface::setWindowGeometry(const QRect &geometry)
|
||||||
{
|
{
|
||||||
const bool horizontallyConstrained = m_interface->anchors() & (Window::AnchorLeft & Window::AnchorRight);
|
const bool horizontallyConstrained = m_interface->anchors().testFlags({Window::AnchorLeft, Window::AnchorRight});
|
||||||
const bool verticallyConstrained = m_interface->anchors() & (Window::AnchorTop & Window::AnchorBottom);
|
const bool verticallyConstrained = m_interface->anchors().testFlags({Window::AnchorTop, Window::AnchorBottom});
|
||||||
|
|
||||||
QSize size = geometry.size();
|
QSize size = geometry.size();
|
||||||
if (horizontallyConstrained) {
|
if (horizontallyConstrained) {
|
||||||
|
|||||||
@ -32,12 +32,10 @@ public:
|
|||||||
{
|
{
|
||||||
return m_configured;
|
return m_configured;
|
||||||
}
|
}
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
|
|
||||||
void attachPopup(QtWaylandClient::QWaylandShellSurface *popup) override;
|
void attachPopup(QtWaylandClient::QWaylandShellSurface *popup) override;
|
||||||
#endif
|
|
||||||
|
|
||||||
void setAnchor(uint32_t anchor);
|
void setAnchor(uint32_t anchor);
|
||||||
void setExclusiveZone(int32_t zone);
|
void setExclusiveZone(const QSize &zone);
|
||||||
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);
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
THIS SOFTWARE.
|
THIS SOFTWARE.
|
||||||
</copyright>
|
</copyright>
|
||||||
|
|
||||||
<interface name="zwlr_layer_shell_v1" version="4">
|
<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="4">
|
<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
|
||||||
@ -184,7 +184,8 @@
|
|||||||
|
|
||||||
Exclusive zone is double-buffered, see wl_surface.commit.
|
Exclusive zone is double-buffered, see wl_surface.commit.
|
||||||
</description>
|
</description>
|
||||||
<arg name="zone" type="int"/>
|
<arg name="horizontal_zone" type="int"/>
|
||||||
|
<arg name="vertical_zone" type="int"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
<request name="set_margin">
|
<request name="set_margin">
|
||||||
@ -386,5 +387,6 @@
|
|||||||
</description>
|
</description>
|
||||||
<arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/>
|
<arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
</interface>
|
</interface>
|
||||||
</protocol>
|
</protocol>
|
||||||
|
|||||||
Reference in New Issue
Block a user