From b39ca36d21175b205e2e04813718ef3a5f786b13 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 23 Aug 2023 11:29:56 +0300 Subject: [PATCH] scripting: Rename Workspace.activeClient to activeWindow Rename activeClient to activeWindow to make the property name more accurate. --- src/plugins/private/qml/WindowHeap.qml | 4 ++-- src/plugins/private/qml/WindowHeapDelegate.qml | 6 +++--- src/scripting/workspace_wrapper.cpp | 10 +++++----- src/scripting/workspace_wrapper.h | 16 ++++++++-------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/plugins/private/qml/WindowHeap.qml b/src/plugins/private/qml/WindowHeap.qml index 7d0c807efe..b1af749f90 100644 --- a/src/plugins/private/qml/WindowHeap.qml +++ b/src/plugins/private/qml/WindowHeap.qml @@ -52,7 +52,7 @@ FocusScope { signal activated() function activateIndex(index) { - KWinComponents.Workspace.activeClient = windowsInstantiator.objectAt(index).window; + KWinComponents.Workspace.activeWindow = windowsInstantiator.objectAt(index).window; activated(); } @@ -369,7 +369,7 @@ FocusScope { } if (selectedItem) { handled = true; - KWinComponents.Workspace.activeClient = selectedItem.window; + KWinComponents.Workspace.activeWindow = selectedItem.window; activated(); } break; diff --git a/src/plugins/private/qml/WindowHeapDelegate.qml b/src/plugins/private/qml/WindowHeapDelegate.qml index b74057b4b6..ebeb7c54b2 100644 --- a/src/plugins/private/qml/WindowHeapDelegate.qml +++ b/src/plugins/private/qml/WindowHeapDelegate.qml @@ -28,10 +28,10 @@ Item { readonly property bool initialHidden: window.minimized || !presentOnCurrentDesktop readonly property bool activeHidden: { if (windowHeap.showOnly === "activeClass") { - if (!KWinComponents.Workspace.activeClient) { + if (!KWinComponents.Workspace.activeWindow) { return true; } else { - return KWinComponents.Workspace.activeClient.resourceName !== window.resourceName; + return KWinComponents.Workspace.activeWindow.resourceName !== window.resourceName; } } else { return windowHeap.showOnly.length !== 0 @@ -355,7 +355,7 @@ Item { TapHandler { acceptedButtons: Qt.LeftButton onTapped: { - KWinComponents.Workspace.activeClient = thumb.window; + KWinComponents.Workspace.activeWindow = thumb.window; thumb.windowHeap.activated(); } onPressedChanged: { diff --git a/src/scripting/workspace_wrapper.cpp b/src/scripting/workspace_wrapper.cpp index e5049dddb2..731cb9a343 100644 --- a/src/scripting/workspace_wrapper.cpp +++ b/src/scripting/workspace_wrapper.cpp @@ -33,7 +33,7 @@ WorkspaceWrapper::WorkspaceWrapper(QObject *parent) KWin::VirtualDesktopManager *vds = KWin::VirtualDesktopManager::self(); connect(ws, &Workspace::windowAdded, this, &WorkspaceWrapper::clientAdded); connect(ws, &Workspace::windowRemoved, this, &WorkspaceWrapper::clientRemoved); - connect(ws, &Workspace::windowActivated, this, &WorkspaceWrapper::clientActivated); + connect(ws, &Workspace::windowActivated, this, &WorkspaceWrapper::windowActivated); connect(vds, &VirtualDesktopManager::desktopCreated, this, &WorkspaceWrapper::desktopsChanged); connect(vds, &VirtualDesktopManager::desktopRemoved, this, &WorkspaceWrapper::desktopsChanged); connect(vds, &VirtualDesktopManager::layoutChanged, this, &WorkspaceWrapper::desktopLayoutChanged); @@ -69,7 +69,7 @@ void WorkspaceWrapper::setCurrentDesktop(VirtualDesktop *desktop) VirtualDesktopManager::self()->setCurrent(desktop); } -Window *WorkspaceWrapper::activeClient() const +Window *WorkspaceWrapper::activeWindow() const { return workspace()->activeWindow(); } @@ -86,7 +86,7 @@ QString WorkspaceWrapper::currentActivity() const #endif } -void WorkspaceWrapper::setCurrentActivity(QString activity) +void WorkspaceWrapper::setCurrentActivity(const QString &activity) { #if KWIN_BUILD_ACTIVITIES if (Workspace::self()->activities()) { @@ -219,9 +219,9 @@ SLOTWRAPPER(slotSwitchDesktopDown, Down) #undef SLOTWRAPPER -void WorkspaceWrapper::setActiveClient(KWin::Window *client) +void WorkspaceWrapper::setActiveWindow(KWin::Window *window) { - KWin::Workspace::self()->activateWindow(client); + KWin::Workspace::self()->activateWindow(window); } QSize WorkspaceWrapper::workspaceSize() const diff --git a/src/scripting/workspace_wrapper.h b/src/scripting/workspace_wrapper.h index 29ddf470ba..eb272d33ee 100644 --- a/src/scripting/workspace_wrapper.h +++ b/src/scripting/workspace_wrapper.h @@ -30,7 +30,7 @@ class WorkspaceWrapper : public QObject Q_OBJECT Q_PROPERTY(QVector desktops READ desktops NOTIFY desktopsChanged) Q_PROPERTY(KWin::VirtualDesktop *currentDesktop READ currentDesktop WRITE setCurrentDesktop NOTIFY currentDesktopChanged) - Q_PROPERTY(KWin::Window *activeClient READ activeClient WRITE setActiveClient NOTIFY clientActivated) + Q_PROPERTY(KWin::Window *activeWindow READ activeWindow WRITE setActiveWindow NOTIFY windowActivated) // TODO: write and notify? Q_PROPERTY(QSize desktopGridSize READ desktopGridSize NOTIFY desktopLayoutChanged) Q_PROPERTY(int desktopGridWidth READ desktopGridWidth NOTIFY desktopLayoutChanged) @@ -70,7 +70,7 @@ private: Q_SIGNALS: void clientAdded(KWin::Window *client); void clientRemoved(KWin::Window *client); - void clientActivated(KWin::Window *client); + void windowActivated(KWin::Window *window); /** * This signal is emitted when a virtual desktop is added or removed. */ @@ -175,12 +175,12 @@ protected: explicit WorkspaceWrapper(QObject *parent = nullptr); public: -#define GETTERSETTERDEF(rettype, getter, setter) \ - rettype getter() const; \ - void setter(rettype val); - GETTERSETTERDEF(QString, currentActivity, setCurrentActivity) - GETTERSETTERDEF(KWin::Window *, activeClient, setActiveClient) -#undef GETTERSETTERDEF + Window *activeWindow() const; + void setActiveWindow(Window *window); + + QString currentActivity() const; + void setCurrentActivity(const QString &activity); + QSize desktopGridSize() const; int desktopGridWidth() const; int desktopGridHeight() const;