mirror of
https://invent.kde.org/plasma/layer-shell-qt.git
synced 2025-07-14 11:04:20 -04:00
Compare commits
6 Commits
v5.91.0
...
work/fuf/q
Author | SHA1 | Date | |
---|---|---|---|
b8a9938c0d | |||
f1e50306f8 | |||
078f36f8f3 | |||
7d3194034c | |||
e3098a660a | |||
d379bc8d8e |
@ -4,7 +4,7 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(layershellqt)
|
||||
set(PROJECT_VERSION "5.91.0")
|
||||
set(PROJECT_VERSION "6.0.80")
|
||||
set(PROJECT_VERSION_MAJOR 6)
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
@ -30,6 +30,7 @@ include(FeatureSummary)
|
||||
include(GenerateExportHeader)
|
||||
include(KDEClangFormat)
|
||||
include(ECMQtDeclareLoggingCategory)
|
||||
include(ECMQmlModule)
|
||||
|
||||
|
||||
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient Qml)
|
||||
|
@ -1,9 +1,10 @@
|
||||
# SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleix.pol_gonzalez@mercedes-benz.com>
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
qt_add_qml_module(LayerShellQtQml
|
||||
ecm_add_qml_module(LayerShellQtQml
|
||||
URI "org.kde.layershell"
|
||||
VERSION 1.0
|
||||
SOURCES layershellqtplugin.cpp)
|
||||
target_link_libraries(LayerShellQtQml PRIVATE Qt::Qml LayerShellQtInterface)
|
||||
|
||||
ecm_finalize_qml_module(LayerShellQtQml DESTINATION ${KDE_INSTALL_QMLDIR})
|
@ -16,6 +16,31 @@
|
||||
|
||||
#include <QGuiApplication>
|
||||
|
||||
namespace
|
||||
{
|
||||
template<typename T>
|
||||
concept QWaylandWindowNewV6Type = requires(T t) { t.sendRecursiveExposeEvent(); };
|
||||
|
||||
template<typename T>
|
||||
concept QWaylandWindowOldV6Type = requires(T t) { t.handleExpose(QRect()); } && !requires(T t) { t.sendRecursiveExposeEvent(); };
|
||||
|
||||
class ExposeHelper
|
||||
{
|
||||
public:
|
||||
template<QWaylandWindowOldV6Type T>
|
||||
[[maybe_unused]] ExposeHelper(T *window, const QSize &pendingSize)
|
||||
{
|
||||
window->handleExpose(QRect(QPoint(), pendingSize));
|
||||
}
|
||||
|
||||
template<QWaylandWindowNewV6Type T>
|
||||
[[maybe_unused]] ExposeHelper(T *window, [[maybe_unused]] const QSize &pendingSize)
|
||||
{
|
||||
window->sendRecursiveExposeEvent();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace LayerShellQt
|
||||
{
|
||||
QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell, QtWaylandClient::QWaylandWindow *window)
|
||||
@ -92,7 +117,7 @@ void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial, uint
|
||||
if (!m_configured) {
|
||||
m_configured = true;
|
||||
window()->resizeFromApplyConfigure(m_pendingSize);
|
||||
window()->handleExpose(QRect(QPoint(), m_pendingSize));
|
||||
ExposeHelper helper(window(), m_pendingSize);
|
||||
} else {
|
||||
// Later configures are resizes, so we have to queue them up for a time when we
|
||||
// are not painting to the window.
|
||||
@ -119,6 +144,7 @@ void QWaylandLayerSurface::applyConfigure()
|
||||
void QWaylandLayerSurface::setAnchor(uint anchor)
|
||||
{
|
||||
set_anchor(anchor);
|
||||
setWindowGeometry(window()->windowContentGeometry());
|
||||
}
|
||||
|
||||
void QWaylandLayerSurface::setExclusiveZone(int32_t zone)
|
||||
@ -144,8 +170,8 @@ void QWaylandLayerSurface::setLayer(uint32_t layer)
|
||||
|
||||
void QWaylandLayerSurface::setWindowGeometry(const QRect &geometry)
|
||||
{
|
||||
const bool horizontallyConstrained = m_interface->anchors() & (Window::AnchorLeft & Window::AnchorRight);
|
||||
const bool verticallyConstrained = m_interface->anchors() & (Window::AnchorTop & Window::AnchorBottom);
|
||||
const bool horizontallyConstrained = m_interface->anchors().testFlags({Window::AnchorLeft, Window::AnchorRight});
|
||||
const bool verticallyConstrained = m_interface->anchors().testFlags({Window::AnchorTop, Window::AnchorBottom});
|
||||
|
||||
QSize size = geometry.size();
|
||||
if (horizontallyConstrained) {
|
||||
|
Reference in New Issue
Block a user