diff --git a/plugins/windowsystem/windowsystem.cpp b/plugins/windowsystem/windowsystem.cpp index df4c55388..b73ac62ac 100644 --- a/plugins/windowsystem/windowsystem.cpp +++ b/plugins/windowsystem/windowsystem.cpp @@ -1,328 +1,328 @@ /* * Copyright 2019 Martin Flöser * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 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 14 of version 3 of the license. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "windowsystem.h" #include #include #include Q_DECLARE_METATYPE(NET::WindowType) namespace KWin { WindowSystem::WindowSystem() : QObject() , KWindowSystemPrivate() { } void WindowSystem::activateWindow(WId win, long int time) { Q_UNUSED(win) Q_UNUSED(time) // KWin cannot activate own windows } void WindowSystem::forceActiveWindow(WId win, long int time) { Q_UNUSED(win) Q_UNUSED(time) // KWin cannot activate own windows } WId WindowSystem::activeWindow() { // KWin internal should not use KWindowSystem to find active window return 0; } bool WindowSystem::allowedActionsSupported() { return false; } void WindowSystem::allowExternalProcessWindowActivation(int pid) { Q_UNUSED(pid) } bool WindowSystem::compositingActive() { // wayland is always composited return true; } void WindowSystem::connectNotify(const QMetaMethod &signal) { Q_UNUSED(signal) } QPoint WindowSystem::constrainViewportRelativePosition(const QPoint &pos) { Q_UNUSED(pos) return QPoint(); } int WindowSystem::currentDesktop() { // KWin internal should not use KWindowSystem to find current desktop return 0; } void WindowSystem::demandAttention(WId win, bool set) { Q_UNUSED(win) Q_UNUSED(set) } QString WindowSystem::desktopName(int desktop) { Q_UNUSED(desktop) return QString(); } QPoint WindowSystem::desktopToViewport(int desktop, bool absolute) { Q_UNUSED(desktop) Q_UNUSED(absolute) return QPoint(); } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) WId WindowSystem::groupLeader(WId window) { Q_UNUSED(window) return 0; } #endif bool WindowSystem::icccmCompliantMappingState() { return false; } QPixmap WindowSystem::icon(WId win, int width, int height, bool scale, int flags) { Q_UNUSED(win) Q_UNUSED(width) Q_UNUSED(height) Q_UNUSED(scale) Q_UNUSED(flags) return QPixmap(); } void WindowSystem::lowerWindow(WId win) { Q_UNUSED(win) } bool WindowSystem::mapViewport() { return false; } void WindowSystem::minimizeWindow(WId win) { Q_UNUSED(win) } void WindowSystem::unminimizeWindow(WId win) { Q_UNUSED(win) } int WindowSystem::numberOfDesktops() { // KWin internal should not use KWindowSystem to find number of desktops return 1; } void WindowSystem::raiseWindow(WId win) { Q_UNUSED(win) } QString WindowSystem::readNameProperty(WId window, long unsigned int atom) { Q_UNUSED(window) Q_UNUSED(atom) return QString(); } void WindowSystem::setBlockingCompositing(WId window, bool active) { Q_UNUSED(window) Q_UNUSED(active) } void WindowSystem::setCurrentDesktop(int desktop) { Q_UNUSED(desktop) // KWin internal should not use KWindowSystem to set current desktop } void WindowSystem::setDesktopName(int desktop, const QString &name) { Q_UNUSED(desktop) Q_UNUSED(name) // KWin internal should not use KWindowSystem to set desktop name } void WindowSystem::setExtendedStrut(WId win, int left_width, int left_start, int left_end, int right_width, int right_start, int right_end, int top_width, int top_start, int top_end, int bottom_width, int bottom_start, int bottom_end) { Q_UNUSED(win) Q_UNUSED(left_width) Q_UNUSED(left_start) Q_UNUSED(left_end) Q_UNUSED(right_width) Q_UNUSED(right_start) Q_UNUSED(right_end) Q_UNUSED(top_width) Q_UNUSED(top_start) Q_UNUSED(top_end) Q_UNUSED(bottom_width) Q_UNUSED(bottom_start) Q_UNUSED(bottom_end) } void WindowSystem::setStrut(WId win, int left, int right, int top, int bottom) { Q_UNUSED(win) Q_UNUSED(left) Q_UNUSED(right) Q_UNUSED(top) Q_UNUSED(bottom) } void WindowSystem::setIcons(WId win, const QPixmap &icon, const QPixmap &miniIcon) { Q_UNUSED(win) Q_UNUSED(icon) Q_UNUSED(miniIcon) } void WindowSystem::setOnActivities(WId win, const QStringList &activities) { Q_UNUSED(win) Q_UNUSED(activities) } void WindowSystem::setOnAllDesktops(WId win, bool b) { Q_UNUSED(win) Q_UNUSED(b) } void WindowSystem::setOnDesktop(WId win, int desktop) { Q_UNUSED(win) Q_UNUSED(desktop) } void WindowSystem::setShowingDesktop(bool showing) { Q_UNUSED(showing) // KWin should not use KWindowSystem to set showing desktop state } void WindowSystem::clearState(WId win, NET::States state) { // KWin's windows don't support state Q_UNUSED(win) Q_UNUSED(state) } void WindowSystem::setState(WId win, NET::States state) { // KWin's windows don't support state Q_UNUSED(win) Q_UNUSED(state) } void WindowSystem::setType(WId win, NET::WindowType windowType) { const auto windows = qApp->allWindows(); auto it = std::find_if(windows.begin(), windows.end(), [win] (QWindow *w) { return w->winId() == win; }); if (it == windows.end()) { return; } (*it)->setProperty("kwin_windowType", QVariant::fromValue(windowType)); } void WindowSystem::setUserTime(WId win, long int time) { Q_UNUSED(win) Q_UNUSED(time) } bool WindowSystem::showingDesktop() { // KWin should not use KWindowSystem for showing desktop state return false; } QList< WId > WindowSystem::stackingOrder() { // KWin should not use KWindowSystem for stacking order return {}; } -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) WId WindowSystem::transientFor(WId window) { Q_UNUSED(window) return 0; } #endif int WindowSystem::viewportToDesktop(const QPoint &pos) { Q_UNUSED(pos) return 0; } int WindowSystem::viewportWindowToDesktop(const QRect &r) { Q_UNUSED(r) return 0; } QList< WId > WindowSystem::windows() { return {}; } QRect WindowSystem::workArea(const QList< WId > &excludes, int desktop) { Q_UNUSED(excludes) Q_UNUSED(desktop) return {}; } QRect WindowSystem::workArea(int desktop) { Q_UNUSED(desktop) return {}; } } diff --git a/plugins/windowsystem/windowsystem.h b/plugins/windowsystem/windowsystem.h index f2abf5c43..1e97ab3d6 100644 --- a/plugins/windowsystem/windowsystem.h +++ b/plugins/windowsystem/windowsystem.h @@ -1,85 +1,94 @@ /* * Copyright 2019 Martin Flöser * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 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 14 of version 3 of the license. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include +// Compat with KF < 5.64 +#ifndef KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE +#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#define KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(x, y) 1 +#else +#define KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(x, y) 0 +#endif +#endif + namespace KWin { class WindowSystem : public QObject, public KWindowSystemPrivate { Q_OBJECT public: WindowSystem(); QList windows() override; QList stackingOrder() override; WId activeWindow() override; void activateWindow(WId win, long time) override; void forceActiveWindow(WId win, long time) override; void demandAttention(WId win, bool set) override; bool compositingActive() override; int currentDesktop() override; int numberOfDesktops() override; void setCurrentDesktop(int desktop) override; void setOnAllDesktops(WId win, bool b) override; void setOnDesktop(WId win, int desktop) override; void setOnActivities(WId win, const QStringList &activities) override; -#ifndef KWINDOWSYSTEM_NO_DEPRECATED +#if KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(5, 0) WId transientFor(WId window) override; WId groupLeader(WId window) override; #endif QPixmap icon(WId win, int width, int height, bool scale, int flags) override; void setIcons(WId win, const QPixmap &icon, const QPixmap &miniIcon) override; void setType(WId win, NET::WindowType windowType) override; void setState(WId win, NET::States state) override; void clearState(WId win, NET::States state) override; void minimizeWindow(WId win) override; void unminimizeWindow(WId win) override; void raiseWindow(WId win) override; void lowerWindow(WId win) override; bool icccmCompliantMappingState() override; QRect workArea(int desktop) override; QRect workArea(const QList &excludes, int desktop) override; QString desktopName(int desktop) override; void setDesktopName(int desktop, const QString &name) override; bool showingDesktop() override; void setShowingDesktop(bool showing) override; void setUserTime(WId win, long time) override; void setExtendedStrut(WId win, int left_width, int left_start, int left_end, int right_width, int right_start, int right_end, int top_width, int top_start, int top_end, int bottom_width, int bottom_start, int bottom_end) override; void setStrut(WId win, int left, int right, int top, int bottom) override; bool allowedActionsSupported() override; QString readNameProperty(WId window, unsigned long atom) override; void allowExternalProcessWindowActivation(int pid) override; void setBlockingCompositing(WId window, bool active) override; bool mapViewport() override; int viewportToDesktop(const QPoint &pos) override; int viewportWindowToDesktop(const QRect &r) override; QPoint desktopToViewport(int desktop, bool absolute) override; QPoint constrainViewportRelativePosition(const QPoint &pos) override; void connectNotify(const QMetaMethod &signal) override; }; }