Compare commits

..

9 Commits

6 changed files with 16 additions and 43 deletions

View File

@ -4,13 +4,13 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
project(layershellqt) project(layershellqt)
set(PROJECT_VERSION "6.1.80") set(PROJECT_VERSION "6.2.2")
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.6.0") set(QT_MIN_VERSION "6.7.0")
set(KF6_MIN_VERSION "6.2.0") set(KF6_MIN_VERSION "6.5.0")
set(KDE_COMPILERSETTINGS_LEVEL "5.82") set(KDE_COMPILERSETTINGS_LEVEL "5.82")
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)

View File

@ -4,10 +4,16 @@
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
${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml if (Qt6_VERSION VERSION_GREATER_EQUAL "6.8.0")
${WaylandProtocols_DATADIR}/staging/xdg-activation/xdg-activation-v1.xml set(private_code_option "PRIVATE_CODE")
${CMAKE_CURRENT_SOURCE_DIR}/wlr-layer-shell-unstable-v1.xml 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

View File

@ -12,15 +12,12 @@
#include <QtWaylandClient/private/qwaylanddisplay_p.h> #include <QtWaylandClient/private/qwaylanddisplay_p.h>
#include <QtWaylandClient/private/qwaylandwindow_p.h> #include <QtWaylandClient/private/qwaylandwindow_p.h>
#include <QPlatformSurfaceEvent>
namespace LayerShellQt namespace LayerShellQt
{ {
QWaylandLayerShellIntegration::QWaylandLayerShellIntegration() QWaylandLayerShellIntegration::QWaylandLayerShellIntegration()
: QWaylandShellIntegrationTemplate<QWaylandLayerShellIntegration>(5) : QWaylandShellIntegrationTemplate<QWaylandLayerShellIntegration>(5)
, m_xdgActivation(new QWaylandXdgActivationV1) , m_xdgActivation(new QWaylandXdgActivationV1)
{ {
qGuiApp->installEventFilter(this);
} }
QWaylandLayerShellIntegration::~QWaylandLayerShellIntegration() QWaylandLayerShellIntegration::~QWaylandLayerShellIntegration()
@ -35,29 +32,4 @@ QtWaylandClient::QWaylandShellSurface *QWaylandLayerShellIntegration::createShel
return new QWaylandLayerSurface(this, window); 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;
}
} }

View File

@ -32,7 +32,6 @@ public:
QtWaylandClient::QWaylandShellSurface *createShellSurface(QtWaylandClient::QWaylandWindow *window) override; QtWaylandClient::QWaylandShellSurface *createShellSurface(QtWaylandClient::QWaylandWindow *window) override;
private: private:
bool eventFilter(QObject *watched, QEvent *event) override;
QScopedPointer<QWaylandXdgActivationV1> m_xdgActivation; QScopedPointer<QWaylandXdgActivationV1> m_xdgActivation;
}; };

View File

@ -231,8 +231,10 @@ void QWaylandLayerSurface::sendExpose()
{ {
#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 7, 0)
window()->handleExpose(QRect(QPoint(), m_pendingSize)); window()->handleExpose(QRect(QPoint(), m_pendingSize));
#else #elif QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
window()->sendRecursiveExposeEvent(); window()->sendRecursiveExposeEvent();
#else
window()->updateExposure();
#endif #endif
} }

View File

@ -403,11 +403,5 @@
</description> </description>
<arg name="edge" type="uint"/> <arg name="edge" type="uint"/>
</request> </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> </interface>
</protocol> </protocol>