Compare commits

..

13 Commits

Author SHA1 Message Date
6e9391e734 Update version for new release 6.3.91 2025-05-29 14:24:55 +05:30
8b54edb695 update version for new release 2025-05-15 15:14:19 +05:30
ffa33fef9f Update Qt version requirement to 6.8.0
GIT_SILENT
2025-05-15 14:20:07 +05:30
3522070454 Update Frameworks version requirement to 6.14.0
GIT_SILENT
2025-05-15 14:20:07 +05:30
80d5e3c935 Expose setDesiredSize to the C++ API
Making it possible for clients to call setDesiredSize directly,

The idea is that under Wayland, the panel calls this intead of setGeometry,
not trying to set an abosulute geometry that might cause the panel sized wrongly,
but just sets an hint which will ensure the panel won't overlap another one

used by https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5437

CCBUG:489703
2025-04-30 17:23:48 +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
11 changed files with 71 additions and 159 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.1.90")
set(PROJECT_VERSION "6.3.91")
set(PROJECT_VERSION_MAJOR 6)
set(CMAKE_C_STANDARD 99)
set(QT_MIN_VERSION "6.7.0")
set(KF6_MIN_VERSION "6.5.0")
set(QT_MIN_VERSION "6.8.0")
set(KF6_MIN_VERSION "6.14.0")
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
set(CMAKE_CXX_STANDARD 20)
@ -32,9 +32,13 @@ include(KDEClangFormat)
include(ECMQtDeclareLoggingCategory)
include(ECMQmlModule)
include(KDEGitCommitHooks)
include(ECMGenerateQDoc)
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)
@ -56,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

@ -68,8 +68,6 @@ generate_export_header(LayerShellQtInterface
EXPORT_FILE_NAME LayerShellQt/layershellqt_export.h
)
ecm_generate_qdoc(LayerShellQtInterface layershellqt.qdocconf)
install(TARGETS layer-shell
LIBRARY DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/wayland-shell-integration)

View File

@ -13,18 +13,12 @@
namespace LayerShellQt
{
/*!
* \class LayerShellQt::Shell
* \inmodule LayerShellQt
* \inheaderfile LayerShellQt/Shell
*
/**
* Sets the right environment so the shells created from now on use wlr-layer-shell.
*/
class LAYERSHELLQT_EXPORT Shell
{
public:
/*!
* Sets the right environment so the shells created from now on use wlr-layer-shell.
*/
static void useLayerShell();
};

View File

@ -32,6 +32,7 @@ public:
Window::KeyboardInteractivity keyboardInteractivity = Window::KeyboardInteractivityOnDemand;
Window::Layer layer = Window::LayerTop;
QMargins margins;
QSize desiredSize = QSize(0, 0);
Window::ScreenConfiguration screenConfiguration = Window::ScreenFromQWindow;
bool closeOnDismissed = true;
};
@ -97,6 +98,21 @@ QMargins Window::margins() const
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)
{
if (d->keyboardInteractivity != interactivity) {

View File

@ -18,18 +18,10 @@ namespace LayerShellQt
{
class WindowPrivate;
/*!
* \class LayerShellQt::Window
* \inmodule LayerShellQt
* \inheaderfile LayerShellQt/Window
*
* \brief A window.
*/
class LAYERSHELLQT_EXPORT Window : public QObject
{
Q_OBJECT
Q_PROPERTY(Anchors anchors READ anchors WRITE setAnchors NOTIFY anchorsChanged)
/*! \property LayerShellQt::Window::scope */
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)
@ -40,24 +32,17 @@ class LAYERSHELLQT_EXPORT Window : public QObject
public:
~Window() override;
/*!
* \value AnchorNone
* \value AnchorTop The top edge of the anchor rectangle
* \value AnchorBottom The bottom edge of the anchor rectangle
* \value AnchorLeft The left edge of the anchor rectangle
* \value AnchorRight The right edge of the anchor rectangle
*/
enum Anchor {
AnchorNone = 0,
AnchorTop = 1,
AnchorBottom = 2,
AnchorLeft = 4,
AnchorRight = 8,
AnchorTop = 1, ///< The top edge of the anchor rectangle
AnchorBottom = 2, ///< The bottom edge of the anchor rectangle
AnchorLeft = 4, ///< The left edge of the anchor rectangle
AnchorRight = 8, ///< The right edge of the anchor rectangle
};
Q_ENUM(Anchor);
Q_DECLARE_FLAGS(Anchors, Anchor)
/*!
/**
* This enum type is used to specify the layer where a surface can be put in.
*/
enum Layer {
@ -68,7 +53,7 @@ public:
};
Q_ENUM(Layer)
/*!
/**
* This enum type is used to specify how the layer surface handles keyboard focus.
*/
enum KeyboardInteractivity {
@ -78,7 +63,7 @@ public:
};
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.
@ -101,6 +86,9 @@ public:
void setMargins(const QMargins &margins);
QMargins margins() const;
void setDesiredSize(const QSize &size);
QSize desiredSize() const;
void setKeyboardInteractivity(KeyboardInteractivity interactivity);
KeyboardInteractivity keyboardInteractivity() const;
@ -110,7 +98,7 @@ public:
void setScreenConfiguration(ScreenConfiguration screenConfiguration);
ScreenConfiguration screenConfiguration() const;
/*!
/**
* Sets a string based identifier for this window.
* This may be used by a compositor to determine stacking
* order within a given layer.
@ -118,17 +106,9 @@ public:
* May also be referred to as a role
*/
void setScope(const QString &scope);
/*!
* A string based identifier for this window.
* This may be used by a compositor to determine stacking
* order within a given layer.
*
* May also be referred to as a role
*/
QString scope() const;
/*!
/**
* Whether the QWindow should be closed when the layer surface is dismissed by the compositor.
* For example, if the associated screen has been removed.
*
@ -137,7 +117,7 @@ public:
void setCloseOnDismissed(bool close);
bool closeOnDismissed() const;
/*!
/**
* Gets the LayerShell Window for a given Qt Window
* Ownership is not transferred
*/
@ -150,6 +130,7 @@ Q_SIGNALS:
void exclusionZoneChanged();
void exclusiveEdgeChanged();
void marginsChanged();
void desiredSizeChanged();
void keyboardInteractivityChanged();
void layerChanged();

View File

@ -1,72 +0,0 @@
/*!
\module LayerShellQt
\title LayerShellQt C++ Classes
\cmakepackage LayerShellQt
\cmaketargetitem LayerShellQt::Interface
*/
/*!
\namespace LayerShellQt
\inmodule LayerShellQt
Stuff
*/
/*!
\qmlmodule org.kde.layershell
\title LayerShellQt QML Types
*/
/*!
\qmltype Window
\inqmlmodule org.kde.layershell
\nativetype LayerShellQt::Window
*/
/*!
\qmlproperty string Window::scope
A scope.
*/
/*!
\qmlproperty int Window::margins.top
\qmlproperty int Window::margins.bottom
\qmlproperty int Window::margins.left
\qmlproperty int Window::margins.right
Margins
*/
/*!
\qmlproperty int Window::exclusionZone
*/
/*!
\page layershellqt-index.html
\title LayerShellQt
Layer Shell
\section1 Using the Module
\include {module-use.qdocinc} {using the c++ api}
\section2 Building with CMake
\include {module-use.qdocinc} {building with cmake} {Widgets}
\section1 API Reference
\list
\li \l{LayerShellQt C++ Classes}
\li \l{LayerShellQt QML Types}
\endlist
\section1 Licenses
TODO
*/

View File

@ -1,30 +0,0 @@
include($KDE_DOCS/global/qt-module-defaults.qdocconf)
project = LayerShellQt
description = Qt component to allow applications to make use of the Wayland wl-layer-shell protocol
documentationinheaders = true
headerdirs = .
headers.fileextensions = "*.qdoc *.h"
outputdir = doc/html
outputformats = HTML
depends += \
qtcore
qhp.projects = LayerShellQt
qhp.LayerShellQt.file = layershellqt.qhp
qhp.LayerShellQt.namespace = org.kde.layershellqt.$QT_VERSION_TAG
qhp.LayerShellQt.virtualFolder = layershellqt
qhp.LayerShellQt.indexTitle = LayerShellQt
qhp.LayerShellQt.indexRoot =
qhp.LayerShellQt.subprojects = classes
qhp.LayerShellQt.subprojects.classes.title = C++ Classes
qhp.LayerShellQt.subprojects.classes.indexTitle = LayerShellQt C++ Classes
qhp.LayerShellQt.subprojects.classes.selectors = class fake:headerfile
qhp.LayerShellQt.subprojects.classes.sortPages = true

View File

@ -44,7 +44,11 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
setAnchor(m_interface->anchors());
connect(m_interface, &Window::anchorsChanged, this, [this]() {
setAnchor(m_interface->anchors());
setDesiredSize(m_window->windowContentGeometry().size());
if (m_interface->desiredSize().isNull()) {
setDesiredSize(m_window->windowContentGeometry().size());
} else {
setDesiredSize(m_interface->desiredSize());
}
});
setExclusiveZone(m_interface->exclusionZone());
@ -61,12 +65,22 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
setMargins(m_interface->margins());
});
connect(m_interface, &Window::desiredSizeChanged, this, [this]() {
if (!m_interface->desiredSize().isNull()) {
setDesiredSize(m_interface->desiredSize());
}
});
setKeyboardInteractivity(m_interface->keyboardInteractivity());
connect(m_interface, &Window::keyboardInteractivityChanged, this, [this]() {
setKeyboardInteractivity(m_interface->keyboardInteractivity());
});
setDesiredSize(window->windowContentGeometry().size());
if (m_interface->desiredSize().isNull()) {
setDesiredSize(window->windowContentGeometry().size());
} else {
setDesiredSize(m_interface->desiredSize());
}
}
QWaylandLayerSurface::~QWaylandLayerSurface()
@ -174,12 +188,16 @@ void QWaylandLayerSurface::setWindowGeometry(const QRect &geometry)
return;
}
setDesiredSize(geometry.size());
if (m_interface->desiredSize().isNull()) {
setDesiredSize(geometry.size());
}
}
#else
void QWaylandLayerSurface::setWindowSize(const QSize &size)
{
setDesiredSize(size);
if (m_interface->desiredSize().isNull()) {
setDesiredSize(size);
}
}
#endif