scripting: Rename Workspace.activeClient to activeWindow

Rename activeClient to activeWindow to make the property name more
accurate.
This commit is contained in:
Vlad Zahorodnii 2023-08-23 11:29:56 +03:00
parent 44937136cd
commit b39ca36d21
4 changed files with 18 additions and 18 deletions

View file

@ -52,7 +52,7 @@ FocusScope {
signal activated() signal activated()
function activateIndex(index) { function activateIndex(index) {
KWinComponents.Workspace.activeClient = windowsInstantiator.objectAt(index).window; KWinComponents.Workspace.activeWindow = windowsInstantiator.objectAt(index).window;
activated(); activated();
} }
@ -369,7 +369,7 @@ FocusScope {
} }
if (selectedItem) { if (selectedItem) {
handled = true; handled = true;
KWinComponents.Workspace.activeClient = selectedItem.window; KWinComponents.Workspace.activeWindow = selectedItem.window;
activated(); activated();
} }
break; break;

View file

@ -28,10 +28,10 @@ Item {
readonly property bool initialHidden: window.minimized || !presentOnCurrentDesktop readonly property bool initialHidden: window.minimized || !presentOnCurrentDesktop
readonly property bool activeHidden: { readonly property bool activeHidden: {
if (windowHeap.showOnly === "activeClass") { if (windowHeap.showOnly === "activeClass") {
if (!KWinComponents.Workspace.activeClient) { if (!KWinComponents.Workspace.activeWindow) {
return true; return true;
} else { } else {
return KWinComponents.Workspace.activeClient.resourceName !== window.resourceName; return KWinComponents.Workspace.activeWindow.resourceName !== window.resourceName;
} }
} else { } else {
return windowHeap.showOnly.length !== 0 return windowHeap.showOnly.length !== 0
@ -355,7 +355,7 @@ Item {
TapHandler { TapHandler {
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
onTapped: { onTapped: {
KWinComponents.Workspace.activeClient = thumb.window; KWinComponents.Workspace.activeWindow = thumb.window;
thumb.windowHeap.activated(); thumb.windowHeap.activated();
} }
onPressedChanged: { onPressedChanged: {

View file

@ -33,7 +33,7 @@ WorkspaceWrapper::WorkspaceWrapper(QObject *parent)
KWin::VirtualDesktopManager *vds = KWin::VirtualDesktopManager::self(); KWin::VirtualDesktopManager *vds = KWin::VirtualDesktopManager::self();
connect(ws, &Workspace::windowAdded, this, &WorkspaceWrapper::clientAdded); connect(ws, &Workspace::windowAdded, this, &WorkspaceWrapper::clientAdded);
connect(ws, &Workspace::windowRemoved, this, &WorkspaceWrapper::clientRemoved); 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::desktopCreated, this, &WorkspaceWrapper::desktopsChanged);
connect(vds, &VirtualDesktopManager::desktopRemoved, this, &WorkspaceWrapper::desktopsChanged); connect(vds, &VirtualDesktopManager::desktopRemoved, this, &WorkspaceWrapper::desktopsChanged);
connect(vds, &VirtualDesktopManager::layoutChanged, this, &WorkspaceWrapper::desktopLayoutChanged); connect(vds, &VirtualDesktopManager::layoutChanged, this, &WorkspaceWrapper::desktopLayoutChanged);
@ -69,7 +69,7 @@ void WorkspaceWrapper::setCurrentDesktop(VirtualDesktop *desktop)
VirtualDesktopManager::self()->setCurrent(desktop); VirtualDesktopManager::self()->setCurrent(desktop);
} }
Window *WorkspaceWrapper::activeClient() const Window *WorkspaceWrapper::activeWindow() const
{ {
return workspace()->activeWindow(); return workspace()->activeWindow();
} }
@ -86,7 +86,7 @@ QString WorkspaceWrapper::currentActivity() const
#endif #endif
} }
void WorkspaceWrapper::setCurrentActivity(QString activity) void WorkspaceWrapper::setCurrentActivity(const QString &activity)
{ {
#if KWIN_BUILD_ACTIVITIES #if KWIN_BUILD_ACTIVITIES
if (Workspace::self()->activities()) { if (Workspace::self()->activities()) {
@ -219,9 +219,9 @@ SLOTWRAPPER(slotSwitchDesktopDown, Down)
#undef SLOTWRAPPER #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 QSize WorkspaceWrapper::workspaceSize() const

View file

@ -30,7 +30,7 @@ class WorkspaceWrapper : public QObject
Q_OBJECT Q_OBJECT
Q_PROPERTY(QVector<KWin::VirtualDesktop *> desktops READ desktops NOTIFY desktopsChanged) Q_PROPERTY(QVector<KWin::VirtualDesktop *> desktops READ desktops NOTIFY desktopsChanged)
Q_PROPERTY(KWin::VirtualDesktop *currentDesktop READ currentDesktop WRITE setCurrentDesktop NOTIFY currentDesktopChanged) 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? // TODO: write and notify?
Q_PROPERTY(QSize desktopGridSize READ desktopGridSize NOTIFY desktopLayoutChanged) Q_PROPERTY(QSize desktopGridSize READ desktopGridSize NOTIFY desktopLayoutChanged)
Q_PROPERTY(int desktopGridWidth READ desktopGridWidth NOTIFY desktopLayoutChanged) Q_PROPERTY(int desktopGridWidth READ desktopGridWidth NOTIFY desktopLayoutChanged)
@ -70,7 +70,7 @@ private:
Q_SIGNALS: Q_SIGNALS:
void clientAdded(KWin::Window *client); void clientAdded(KWin::Window *client);
void clientRemoved(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. * This signal is emitted when a virtual desktop is added or removed.
*/ */
@ -175,12 +175,12 @@ protected:
explicit WorkspaceWrapper(QObject *parent = nullptr); explicit WorkspaceWrapper(QObject *parent = nullptr);
public: public:
#define GETTERSETTERDEF(rettype, getter, setter) \ Window *activeWindow() const;
rettype getter() const; \ void setActiveWindow(Window *window);
void setter(rettype val);
GETTERSETTERDEF(QString, currentActivity, setCurrentActivity) QString currentActivity() const;
GETTERSETTERDEF(KWin::Window *, activeClient, setActiveClient) void setCurrentActivity(const QString &activity);
#undef GETTERSETTERDEF
QSize desktopGridSize() const; QSize desktopGridSize() const;
int desktopGridWidth() const; int desktopGridWidth() const;
int desktopGridHeight() const; int desktopGridHeight() const;