Compare commits

..

1 Commits

Author SHA1 Message Date
Nicolas Fella
cccb302d6b Run layershellqt-test automatically 2026-05-31 17:00:53 +02:00
4 changed files with 6 additions and 46 deletions

View File

@@ -36,7 +36,9 @@ include(ECMGenerateExportHeader)
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient Qml)
find_package(Qt6WaylandClientPrivate ${QT_MIN_VERSION} REQUIRED NO_MODULE)
if (Qt6WaylandClient_VERSION VERSION_GREATER_EQUAL "6.10.0")
find_package(Qt6WaylandClientPrivate ${QT_MIN_VERSION} REQUIRED NO_MODULE)
endif()
find_package(WaylandScanner REQUIRED)
find_package(Wayland 1.3 COMPONENTS Client Server)

View File

@@ -104,11 +104,7 @@ void QWaylandLayerSurface::zwlr_layer_surface_v1_closed()
void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height)
{
ack_configure(serial);
#if QT_VERSION < QT_VERSION_CHECK(6, 13, 0)
m_pendingSize = QSize(width, height);
#else
m_pendingSize = QSizeF(width, height) / compositorToClientScale();
#endif
if (!m_configured) {
m_configured = true;
@@ -137,7 +133,6 @@ void QWaylandLayerSurface::applyConfigure()
window()->resizeFromApplyConfigure(m_pendingSize);
}
#if QT_VERSION < QT_VERSION_CHECK(6, 13, 0)
void QWaylandLayerSurface::setDesiredSize(const QSize &size)
{
const bool horizontallyConstrained = m_interface->anchors().testFlags({Window::AnchorLeft, Window::AnchorRight});
@@ -152,22 +147,6 @@ void QWaylandLayerSurface::setDesiredSize(const QSize &size)
}
set_size(effectiveSize.width(), effectiveSize.height());
}
#else
void QWaylandLayerSurface::setDesiredSize(const QSizeF &size)
{
const bool horizontallyConstrained = m_interface->anchors().testFlags({Window::AnchorLeft, Window::AnchorRight});
const bool verticallyConstrained = m_interface->anchors().testFlags({Window::AnchorTop, Window::AnchorBottom});
QSize effectiveSize = (size * clientToCompositorScale()).toSize();
if (horizontallyConstrained) {
effectiveSize.setWidth(0);
}
if (verticallyConstrained) {
effectiveSize.setHeight(0);
}
set_size(effectiveSize.width(), effectiveSize.height());
}
#endif
void QWaylandLayerSurface::setAnchor(uint anchor)
{
@@ -176,7 +155,7 @@ void QWaylandLayerSurface::setAnchor(uint anchor)
void QWaylandLayerSurface::setExclusiveZone(int32_t zone)
{
set_exclusive_zone(std::round(zone * clientToCompositorScale()));
set_exclusive_zone(zone);
}
void QWaylandLayerSurface::setExclusiveEdge(uint32_t edge)
@@ -188,14 +167,7 @@ void QWaylandLayerSurface::setExclusiveEdge(uint32_t edge)
void QWaylandLayerSurface::setMargins(const QMargins &margins)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 13, 0)
set_margin(margins.top(), margins.right(), margins.bottom(), margins.left());
#else
set_margin(std::round(margins.top() * clientToCompositorScale()),
std::round(margins.right() * clientToCompositorScale()),
std::round(margins.bottom() * clientToCompositorScale()),
std::round(margins.left() * clientToCompositorScale()));
#endif
}
void QWaylandLayerSurface::setKeyboardInteractivity(uint32_t interactivity)
@@ -209,11 +181,7 @@ void QWaylandLayerSurface::setLayer(uint32_t layer)
set_layer(layer);
}
#if QT_VERSION < QT_VERSION_CHECK(6, 13, 0)
void QWaylandLayerSurface::setWindowSize(const QSize &size)
#else
void QWaylandLayerSurface::setWindowSize(const QSizeF &size)
#endif
{
if (m_interface->desiredSize().isNull()) {
setDesiredSize(size);

View File

@@ -34,11 +34,7 @@ public:
}
void attachPopup(QtWaylandClient::QWaylandShellSurface *popup) override;
#if QT_VERSION < QT_VERSION_CHECK(6, 13, 0)
void setDesiredSize(const QSize &size);
#else
void setDesiredSize(const QSizeF &size);
#endif
void setAnchor(uint32_t anchor);
void setExclusiveZone(int32_t zone);
void setExclusiveEdge(uint32_t edge);
@@ -47,11 +43,7 @@ public:
void setLayer(uint32_t layer);
void applyConfigure() override;
#if QT_VERSION < QT_VERSION_CHECK(6, 13, 0)
void setWindowSize(const QSize &size) override;
#else
void setWindowSize(const QSizeF &size) override;
#endif
bool requestActivate() override;
bool requestActivateOnShow() override;
@@ -66,11 +58,7 @@ private:
QWaylandLayerShellIntegration *m_shell;
LayerShellQt::Window *m_interface;
QtWaylandClient::QWaylandWindow *m_window;
#if QT_VERSION < QT_VERSION_CHECK(6, 13, 0)
QSize m_pendingSize;
#else
QSizeF m_pendingSize;
#endif
QString m_activationToken;
bool m_configured = false;

View File

@@ -3,3 +3,5 @@
add_executable(layershellqt-test main.cpp)
target_link_libraries(layershellqt-test PRIVATE LayerShellQtInterface Qt::Qml Qt::Gui)
add_test(NAME layershellqt-test COMMAND layershellqt-test)