mirror of
https://invent.kde.org/plasma/layer-shell-qt.git
synced 2025-07-14 02:54:31 -04:00
Compare commits
19 Commits
work/david
...
v6.3.91
Author | SHA1 | Date | |
---|---|---|---|
6e9391e734 | |||
8b54edb695 | |||
ffa33fef9f | |||
3522070454 | |||
80d5e3c935 | |||
b37ac92e9f | |||
c8c8e3e983 | |||
72d40f696e | |||
ac333b19c7 | |||
c85d6e7baa | |||
e534206172 | |||
edb8f67b1b | |||
1796255496 | |||
2dbd1d6eb7 | |||
0d11058c8f | |||
a5fbaa5975 | |||
6f8a3f5d42 | |||
303f68cf10 | |||
368cf2dd37 |
@ -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
|
||||
|
@ -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']
|
||||
|
@ -4,13 +4,13 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(layershellqt)
|
||||
set(PROJECT_VERSION "6.1.80")
|
||||
set(PROJECT_VERSION "6.3.91")
|
||||
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.8.0")
|
||||
set(KF6_MIN_VERSION "6.14.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)
|
||||
|
@ -2,7 +2,7 @@
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
maintainer:
|
||||
- vladz
|
||||
- vladz
|
||||
description: Layer Shell Qt
|
||||
platforms:
|
||||
- name: Linux
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -86,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;
|
||||
|
||||
@ -127,6 +130,7 @@ Q_SIGNALS:
|
||||
void exclusionZoneChanged();
|
||||
void exclusiveEdgeChanged();
|
||||
void marginsChanged();
|
||||
void desiredSizeChanged();
|
||||
void keyboardInteractivityChanged();
|
||||
void layerChanged();
|
||||
|
||||
|
@ -12,15 +12,12 @@
|
||||
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
|
||||
#include <QtWaylandClient/private/qwaylandwindow_p.h>
|
||||
|
||||
#include <QPlatformSurfaceEvent>
|
||||
|
||||
namespace LayerShellQt
|
||||
{
|
||||
QWaylandLayerShellIntegration::QWaylandLayerShellIntegration()
|
||||
: QWaylandShellIntegrationTemplate<QWaylandLayerShellIntegration>(5)
|
||||
, m_xdgActivation(new QWaylandXdgActivationV1)
|
||||
{
|
||||
qGuiApp->installEventFilter(this);
|
||||
}
|
||||
|
||||
QWaylandLayerShellIntegration::~QWaylandLayerShellIntegration()
|
||||
@ -35,29 +32,4 @@ QtWaylandClient::QWaylandShellSurface *QWaylandLayerShellIntegration::createShel
|
||||
return new QWaylandLayerSurface(this, window);
|
||||
}
|
||||
|
||||
bool QWaylandLayerShellIntegration::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::PlatformSurface && static_cast<QPlatformSurfaceEvent *>(event)->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) {
|
||||
QWindow *window = qobject_cast<QWindow *>(watched);
|
||||
if (!window) {
|
||||
return false;
|
||||
}
|
||||
auto child = static_cast<QtWaylandClient::QWaylandWindow *>(window->handle());
|
||||
auto maybeSetParent = [child]() {
|
||||
auto transientParent = child->window()->transientParent();
|
||||
if (!transientParent) {
|
||||
return;
|
||||
}
|
||||
if (auto layerParent = qobject_cast<QWaylandLayerSurface *>(static_cast<QtWaylandClient::QWaylandWindow *>(transientParent->handle())->shellSurface())) {
|
||||
if (auto topevel = child->surfaceRole<xdg_toplevel>()) {
|
||||
layerParent->set_parent_of(topevel);
|
||||
}
|
||||
}
|
||||
};
|
||||
maybeSetParent();
|
||||
connect(window, &QWindow::transientParentChanged, child, maybeSetParent);
|
||||
connect(child, &QtWaylandClient::QWaylandWindow::surfaceRoleCreated, this, maybeSetParent);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ public:
|
||||
QtWaylandClient::QWaylandShellSurface *createShellSurface(QtWaylandClient::QWaylandWindow *window) override;
|
||||
|
||||
private:
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
QScopedPointer<QWaylandXdgActivationV1> m_xdgActivation;
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
||||
@ -231,8 +249,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
|
||||
}
|
||||
|
||||
|
@ -403,11 +403,5 @@
|
||||
</description>
|
||||
<arg name="edge" type="uint"/>
|
||||
</request>
|
||||
|
||||
<request name="set_parent_of">
|
||||
<description summary="assign this layer_surface as an xdg_toplevel parent">
|
||||
</description>
|
||||
<arg name="toplevel" type="object" interface="xdg_toplevel" />
|
||||
</request>
|
||||
</interface>
|
||||
</protocol>
|
||||
|
Reference in New Issue
Block a user