diff --git a/CMakeLists.txt b/CMakeLists.txt index 315caf2..6678f5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,35 +1,36 @@ project(kwayland-integration) set(PROJECT_VERSION "5.11.3") set(PROJECT_VERSION_MAJOR 5) cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) set(QT_MIN_VERSION "5.4.0") set(KF5_MIN_VERSION "5.24.0") find_package(ECM 0.0.11 REQUIRED NO_MODULE) include(FeatureSummary) # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core + Widgets ) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) # required frameworks find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS IdleTime WindowSystem ) find_package(KF5Wayland CONFIG REQUIRED) add_subdirectory(src) add_subdirectory(autotests) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/windowsystem/CMakeLists.txt b/src/windowsystem/CMakeLists.txt index 9cb5ad4..5ec90ef 100644 --- a/src/windowsystem/CMakeLists.txt +++ b/src/windowsystem/CMakeLists.txt @@ -1,22 +1,23 @@ set(wayland_plugin_SRCS logging.cpp plugin.cpp waylandintegration.cpp windoweffects.cpp windowsystem.cpp windowinfo.cpp ) add_library(KF5WindowSystemKWaylandPlugin MODULE ${wayland_plugin_SRCS}) target_link_libraries(KF5WindowSystemKWaylandPlugin KF5::WindowSystem KF5::WaylandClient + Qt5::Widgets ) install( TARGETS KF5WindowSystemKWaylandPlugin DESTINATION ${PLUGIN_INSTALL_DIR}/kf5/org.kde.kwindowsystem.platforms/ ) diff --git a/src/windowsystem/windoweffects.cpp b/src/windowsystem/windoweffects.cpp index 8421fb1..49d5278 100644 --- a/src/windowsystem/windoweffects.cpp +++ b/src/windowsystem/windoweffects.cpp @@ -1,178 +1,179 @@ /* * Copyright 2014 Martin Gräßlin * Copyright 2015 Marco Martin * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #include "windoweffects.h" #include "waylandintegration.h" #include +#include #include #include #include #include #include #include #include #include #include #include WindowEffects::WindowEffects() : QObject(), KWindowEffectsPrivate() { } WindowEffects::~WindowEffects() {} bool WindowEffects::isEffectAvailable(KWindowEffects::Effect effect) { switch (effect) { case KWindowEffects::BackgroundContrast: return WaylandIntegration::self()->waylandContrastManager() != nullptr; case KWindowEffects::BlurBehind: return WaylandIntegration::self()->waylandBlurManager() != nullptr; case KWindowEffects::Slide: return WaylandIntegration::self()->waylandSlideManager() != nullptr; default: return false; } } void WindowEffects::slideWindow(WId id, KWindowEffects::SlideFromLocation location, int offset) { if (!WaylandIntegration::self()->waylandSlideManager()) { return; } KWayland::Client::Surface *surface = KWayland::Client::Surface::fromQtWinId(id); if (surface) { if (location != KWindowEffects::SlideFromLocation::NoEdge) { auto slide = WaylandIntegration::self()->waylandSlideManager()->createSlide(surface, surface); KWayland::Client::Slide::Location convertedLoc; switch (location) { case KWindowEffects::SlideFromLocation::TopEdge: convertedLoc = KWayland::Client::Slide::Location::Top; break; case KWindowEffects::SlideFromLocation::LeftEdge: convertedLoc = KWayland::Client::Slide::Location::Left; break; case KWindowEffects::SlideFromLocation::RightEdge: convertedLoc = KWayland::Client::Slide::Location::Right; break; case KWindowEffects::SlideFromLocation::BottomEdge: default: convertedLoc = KWayland::Client::Slide::Location::Bottom; break; } slide->setLocation(convertedLoc); slide->setOffset(offset); slide->commit(); } else { WaylandIntegration::self()->waylandSlideManager()->removeSlide(surface); } surface->commit(KWayland::Client::Surface::CommitFlag::None); WaylandIntegration::self()->waylandConnection()->flush(); } } void WindowEffects::slideWindow(QWidget *widget, KWindowEffects::SlideFromLocation location) { slideWindow(widget->winId(), location, 0); } QList WindowEffects::windowSizes(const QList &ids) { Q_UNUSED(ids) QList sizes; return sizes; } void WindowEffects::presentWindows(WId controller, const QList &ids) { Q_UNUSED(controller) Q_UNUSED(ids) } void WindowEffects::presentWindows(WId controller, int desktop) { Q_UNUSED(controller) Q_UNUSED(desktop) } void WindowEffects::highlightWindows(WId controller, const QList &ids) { Q_UNUSED(controller) Q_UNUSED(ids) } void WindowEffects::enableBlurBehind(WId window, bool enable, const QRegion ®ion) { if (!WaylandIntegration::self()->waylandBlurManager()) { return; } KWayland::Client::Surface *surface = KWayland::Client::Surface::fromQtWinId(window); if (surface) { if (enable) { auto blur = WaylandIntegration::self()->waylandBlurManager()->createBlur(surface, surface); blur->setRegion(WaylandIntegration::self()->waylandCompositor()->createRegion(region, nullptr)); blur->commit(); } else { WaylandIntegration::self()->waylandBlurManager()->removeBlur(surface); } surface->commit(KWayland::Client::Surface::CommitFlag::None); WaylandIntegration::self()->waylandConnection()->flush(); } } void WindowEffects::enableBackgroundContrast(WId window, bool enable, qreal contrast, qreal intensity, qreal saturation, const QRegion ®ion) { if (!WaylandIntegration::self()->waylandContrastManager()) { return; } KWayland::Client::Surface *surface = KWayland::Client::Surface::fromQtWinId(window); if (surface) { if (enable) { auto backgroundContrast = WaylandIntegration::self()->waylandContrastManager()->createContrast(surface, surface); backgroundContrast->setRegion(WaylandIntegration::self()->waylandCompositor()->createRegion(region, nullptr)); backgroundContrast->setContrast(contrast); backgroundContrast->setIntensity(intensity); backgroundContrast->setSaturation(saturation); backgroundContrast->commit(); } else { WaylandIntegration::self()->waylandContrastManager()->removeContrast(surface); } surface->commit(KWayland::Client::Surface::CommitFlag::None); WaylandIntegration::self()->waylandConnection()->flush(); } } void WindowEffects::markAsDashboard(WId window) { Q_UNUSED(window) }