Compare commits

...

21 Commits

Author SHA1 Message Date
4c40fddf04 update description from kwin 2025-04-25 15:26:50 +02:00
29a4489c72 rename the api to setAnchorRect 2025-04-25 15:26:50 +02:00
94c82f2ed1 update docs 2025-04-25 15:26:50 +02:00
5c987fb03e -1 is forbidden now 2025-04-25 15:26:50 +02:00
b40888ac2a Add set_accomodate_exclusive_zones call
Add a new method that tells the surface whether to accomodate
exclusive zones set by other surfaces or not.
right until now this was possible by setting the eclusive zone of
this surface to the value of -1.
Besides being a magic number, it makes impossible for this surface to
set an exclusive zone by itself if we want to ignore other exclusive zones
2025-04-25 15:26:50 +02:00
b37ac92e9f CI: Add linux-qt6-next build 2025-02-12 07:28:37 +01:00
c8c8e3e983 Add xml/yaml linting 2025-02-01 09:52:29 +01:00
72d40f696e Fix build with Qt 6.10
The private parts have been extracted into a separate CMake config file, which we need to search for now

See https://bugreports.qt.io/browse/QTBUG-87776
2025-01-29 15:34:52 +01:00
ac333b19c7 update version for new release 2025-01-09 12:46:54 +00:00
c85d6e7baa update version for new release 2025-01-09 11:01:05 +00:00
e534206172 Update Frameworks version requirement to 6.10.0
GIT_SILENT
2025-01-09 10:29:52 +00:00
edb8f67b1b It compiles without deprecated methods 2024-12-18 13:24:21 +01:00
1796255496 update version for new release 2024-10-03 13:11:32 +01:00
2dbd1d6eb7 Update Frameworks version requirement to 6.5.0
GIT_SILENT
2024-09-12 11:08:45 +01:00
0d11058c8f update version for new release 2024-09-12 10:50:16 +01:00
a5fbaa5975 Reformat CMake code for better readability 2024-08-14 11:08:41 +02:00
6f8a3f5d42 Generate wayland code with PRIVATE_CODE 2024-08-14 10:47:07 +02:00
303f68cf10 Update Qt version requirement to 6.7.0
GIT_SILENT
2024-08-02 10:15:46 +01:00
368cf2dd37 Port to QWaylandWindow::updateExposure() 2024-07-05 09:49:38 +03:00
16a1debdca Port to QWaylandShellSurface::setWindowSize() 2024-06-26 13:01:50 +03:00
c4987c01c7 update version for new release 2024-05-24 16:14:22 +01:00
11 changed files with 131 additions and 24 deletions

View File

@ -7,3 +7,6 @@ include:
- /gitlab-templates/reuse-lint.yml
- /gitlab-templates/linux-qt6.yml
- /gitlab-templates/freebsd-qt6.yml
- /gitlab-templates/xml-lint.yml
- /gitlab-templates/yaml-lint.yml
- /gitlab-templates/linux-qt6-next.yml

View File

@ -2,11 +2,11 @@
# SPDX-License-Identifier: CC0-1.0
Dependencies:
- 'on': ['@all']
'require':
- 'on': ['@all']
'require':
'frameworks/extra-cmake-modules': '@latest-kf6'
'third-party/wayland': '@latest'
'third-party/wayland-protocols': '@latest'
Options:
require-passing-tests-on: ['Linux', 'FreeBSD', 'Windows']
require-passing-tests-on: ['Linux', 'FreeBSD', 'Windows']

View File

@ -4,13 +4,13 @@
cmake_minimum_required(VERSION 3.16)
project(layershellqt)
set(PROJECT_VERSION "6.0.90")
set(PROJECT_VERSION "6.3.80")
set(PROJECT_VERSION_MAJOR 6)
set(CMAKE_C_STANDARD 99)
set(QT_MIN_VERSION "6.6.0")
set(KF6_MIN_VERSION "6.2.0")
set(QT_MIN_VERSION "6.7.0")
set(KF6_MIN_VERSION "6.10.0")
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
set(CMAKE_CXX_STANDARD 20)
@ -34,6 +34,11 @@ include(ECMQmlModule)
include(KDEGitCommitHooks)
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(Wayland 1.3 COMPONENTS Client Server)
find_package(WaylandProtocols REQUIRED)
@ -55,8 +60,8 @@ kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
ecm_set_disabled_deprecation_versions(QT 6.5
KF 5.240
ecm_set_disabled_deprecation_versions(QT 6.8.1
KF 6.9.0
)
add_subdirectory(src)

View File

@ -2,7 +2,7 @@
# SPDX-License-Identifier: CC0-1.0
maintainer:
- vladz
- vladz
description: Layer Shell Qt
platforms:
- name: Linux

View File

@ -4,10 +4,16 @@
remove_definitions(-DQT_NO_SIGNALS_SLOTS_KEYWORDS)
add_library(LayerShellQtInterface)
qt6_generate_wayland_protocol_client_sources(LayerShellQtInterface 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
if (Qt6_VERSION VERSION_GREATER_EQUAL "6.8.0")
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

View File

@ -34,6 +34,7 @@ public:
QMargins margins;
Window::ScreenConfiguration screenConfiguration = Window::ScreenFromQWindow;
bool closeOnDismissed = true;
Window::AnchorRect anchorRect = Window::AnchorRectWorkArea;
};
static QMap<QWindow *, Window *> s_map;
@ -84,6 +85,21 @@ Window::Anchor Window::exclusiveEdge() const
return d->exclusiveEdge;
}
Window::AnchorRect Window::anchorRect() const
{
return d->anchorRect;
}
void Window::setAnchorRect(Window::AnchorRect anchorRect)
{
if (d->anchorRect == anchorRect) {
return;
}
d->anchorRect = anchorRect;
Q_EMIT anchorRectChanged();
}
void Window::setMargins(const QMargins &margins)
{
if (d->margins != margins) {

View File

@ -25,6 +25,7 @@ class LAYERSHELLQT_EXPORT Window : public QObject
Q_PROPERTY(QString scope READ scope WRITE setScope)
Q_PROPERTY(QMargins margins READ margins WRITE setMargins NOTIFY marginsChanged)
Q_PROPERTY(qint32 exclusionZone READ exclusionZone WRITE setExclusiveZone NOTIFY exclusionZoneChanged)
Q_PROPERTY(AnchorRect anchorRect READ anchorRect WRITE setAnchorRect NOTIFY anchorRectChanged)
Q_PROPERTY(Layer layer READ layer WRITE setLayer NOTIFY layerChanged)
Q_PROPERTY(KeyboardInteractivity keyboardInteractivity READ keyboardInteractivity WRITE setKeyboardInteractivity NOTIFY keyboardInteractivityChanged)
Q_PROPERTY(ScreenConfiguration screenConfiguration READ screenConfiguration WRITE setScreenConfiguration)
@ -42,6 +43,12 @@ public:
Q_ENUM(Anchor);
Q_DECLARE_FLAGS(Anchors, Anchor)
/**
* This enum is used to choose between anchoring to work area or screen area
*/
enum AnchorRect { AnchorRectWorkArea = 0, AnchorRectFullArea = 1 };
Q_ENUM(AnchorRect);
/**
* This enum type is used to specify the layer where a surface can be put in.
*/
@ -83,6 +90,9 @@ public:
void setExclusiveEdge(Window::Anchor edge);
Window::Anchor exclusiveEdge() const;
AnchorRect anchorRect() const;
void setAnchorRect(AnchorRect anchorRect);
void setMargins(const QMargins &margins);
QMargins margins() const;
@ -126,6 +136,7 @@ Q_SIGNALS:
void anchorsChanged();
void exclusionZoneChanged();
void exclusiveEdgeChanged();
void anchorRectChanged();
void marginsChanged();
void keyboardInteractivityChanged();
void layerChanged();

View File

@ -15,7 +15,7 @@
namespace LayerShellQt
{
QWaylandLayerShellIntegration::QWaylandLayerShellIntegration()
: QWaylandShellIntegrationTemplate<QWaylandLayerShellIntegration>(5)
: QWaylandShellIntegrationTemplate<QWaylandLayerShellIntegration>(6)
, m_xdgActivation(new QWaylandXdgActivationV1)
{
}

View File

@ -56,6 +56,11 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
setExclusiveEdge(m_interface->exclusiveEdge());
});
setAnchorRect(m_interface->anchorRect());
connect(m_interface, &Window::anchorRectChanged, this, [this]() {
setAnchorRect(m_interface->anchorRect());
});
setMargins(m_interface->margins());
connect(m_interface, &Window::marginsChanged, this, [this]() {
setMargins(m_interface->margins());
@ -110,9 +115,13 @@ void QWaylandLayerSurface::attachPopup(QtWaylandClient::QWaylandShellSurface *po
void QWaylandLayerSurface::applyConfigure()
{
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
m_configuring = true;
#endif
window()->resizeFromApplyConfigure(m_pendingSize);
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
m_configuring = false;
#endif
}
void QWaylandLayerSurface::setDesiredSize(const QSize &size)
@ -147,6 +156,13 @@ void QWaylandLayerSurface::setExclusiveEdge(uint32_t edge)
}
}
void QWaylandLayerSurface::setAnchorRect(int32_t anchorRect)
{
if (zwlr_layer_surface_v1_get_version(object()) >= ZWLR_LAYER_SURFACE_V1_SET_ANCHOR_RECT_SINCE_VERSION) {
set_anchor_rect(anchorRect);
}
}
void QWaylandLayerSurface::setMargins(const QMargins &margins)
{
set_margin(margins.top(), margins.right(), margins.bottom(), margins.left());
@ -163,6 +179,7 @@ void QWaylandLayerSurface::setLayer(uint32_t layer)
set_layer(layer);
}
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
void QWaylandLayerSurface::setWindowGeometry(const QRect &geometry)
{
if (m_configuring) {
@ -171,6 +188,12 @@ void QWaylandLayerSurface::setWindowGeometry(const QRect &geometry)
setDesiredSize(geometry.size());
}
#else
void QWaylandLayerSurface::setWindowSize(const QSize &size)
{
setDesiredSize(size);
}
#endif
bool QWaylandLayerSurface::requestActivate()
{
@ -220,8 +243,10 @@ void QWaylandLayerSurface::sendExpose()
{
#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0)
window()->handleExpose(QRect(QPoint(), m_pendingSize));
#else
#elif QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
window()->sendRecursiveExposeEvent();
#else
window()->updateExposure();
#endif
}

View File

@ -8,6 +8,7 @@
#ifndef _LAYERSURFACE_H
#define _LAYERSURFACE_H
#include <cstdint>
#include <wayland-client.h>
#include "qwaylandlayershellintegration_p.h"
@ -38,12 +39,17 @@ public:
void setAnchor(uint32_t anchor);
void setExclusiveZone(int32_t zone);
void setExclusiveEdge(uint32_t edge);
void setAnchorRect(int32_t anchorRect);
void setMargins(const QMargins &margins);
void setKeyboardInteractivity(uint32_t interactivity);
void setLayer(uint32_t layer);
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;
#endif
bool requestActivate() override;
void setXdgActivationToken(const QString &token) override;
@ -61,7 +67,9 @@ private:
QString m_activationToken;
bool m_configured = false;
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
bool m_configuring = false;
#endif
};
}

View File

@ -25,7 +25,7 @@
THIS SOFTWARE.
</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">
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
@ -100,7 +100,7 @@
</request>
</interface>
<interface name="zwlr_layer_surface_v1" version="5">
<interface name="zwlr_layer_surface_v1" version="6">
<description summary="layer metadata interface">
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
@ -168,21 +168,25 @@
Surfaces that do not wish to have an exclusive zone may instead specify
how they should interact with surfaces that do. If set to zero, the
surface indicates that it would like to be moved to avoid occluding
surfaces with a positive exclusive zone. If set to -1, the surface
indicates that it would not like to be moved to accommodate for other
surfaces, and the compositor should extend it all the way to the edges
it is anchored to.
surfaces with a positive exclusive zone.
For example, a panel might set its exclusive zone to 10, so that
maximized shell surfaces are not shown on top of it. A notification
might set its exclusive zone to 0, so that it is moved to avoid
occluding the panel, but shell surfaces are shown underneath it. A
wallpaper or lock screen might set their exclusive zone to -1, so that
they stretch below or over the panel.
occluding the panel, but shell surfaces are shown underneath it.
The default value is 0.
Exclusive zone is double-buffered, see wl_surface.commit.
Since version 6 It must be a value of 0 or more, otherwise the error
invalid_exclusive_zone will be triggered.
Until version 5 if set to -1, the surface indicates that it would not
like to be moved to accommodate for other surfaces, and the compositor
should extend it all the way to the edges it is anchored to.
A wallpaper or lock screen might set their exclusive zone to -1, so that
they stretch below or over the panel.
</description>
<arg name="zone" type="int"/>
</request>
@ -368,6 +372,7 @@
<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_zone" value="5" summary="exclusive zone value is invalid, since version 6 it can't be less than zero"/>
</enum>
<enum name="anchor" bitfield="true">
@ -403,5 +408,33 @@
</description>
<arg name="edge" type="uint"/>
</request>
<!-- Version 6 additions -->
<enum name="anchor_rect">
<entry name="full_area" value="0" summary="the full area anchor rect">
<description summary="the full area anchor rect">
Place the layer_surface_v1 relative to the full output area.
</description>
</entry>
<entry name="work_area" value="1" summary="the work area anchor rect">
<description summary="the work area anchor rect">
Place the layer_surface_v1 relative to the output area while taking
the exclusive zone of other surfaces into account.
</description>
</entry>
</enum>
<request name="set_anchor_rect" since="6">
<description summary="set the anchor rect">
Set the anchor rectangle relative to which the anchors are applied.
By default, the layer_surface_v1 is anchored to the 'work_area'.
Anchor rect is double-buffered, see wl_surface.commit.
</description>
<arg name="rect" type="uint" enum="anchor_rect"/>
</request>
</interface>
</protocol>