refactor: wrap currentActivity Property

This commit is contained in:
Mikhail Zolotukhin 2022-03-23 18:26:12 +03:00 committed by Genda
parent eb9d989a3a
commit 91a277ea1e
4 changed files with 14 additions and 6 deletions

View File

@ -42,6 +42,7 @@ void Workspace::wrapSignals()
};
wrapComplexSignal(SIGNAL(currentDesktopChanged(int, KWin::AbstractClient *)), SLOT(currentDesktopChangedTransformer(int, KWin::AbstractClient *)));
wrapSimpleSignal(SIGNAL(currentActivityChanged(const QString &)));
};
QRect Workspace::clientArea(ClientAreaOption option, int screen, int desktop)

View File

@ -38,6 +38,7 @@ public:
Workspace(const Workspace &);
BI_PROPERTY(int, currentDesktop, setCurrentDesktop);
BI_PROPERTY(QString, currentActivity, setCurrentActivity);
/**
* Returns the geometry a Client can use with the specified option.
@ -57,6 +58,12 @@ private Q_SLOTS:
Q_SIGNALS:
void currentDesktopChanged(int desktop, PlasmaApi::Client kwinClient);
/**
* Signal emitted whenever the current activity changed.
* @param id id of the new activity
*/
void currentActivityChanged(const QString &id);
private:
void wrapSignals();

View File

@ -67,7 +67,7 @@ export class DriverImpl implements Driver {
this.kwinApi.workspace.activeClient
? this.kwinApi.workspace.activeClient.screen
: 0,
this.kwinApi.workspace.currentActivity,
this.proxy.workspace().currentActivity,
this.proxy.workspace().currentDesktop,
this.qml.activityInfo,
this.kwinApi,
@ -107,7 +107,7 @@ export class DriverImpl implements Driver {
screensArr.push(
new DriverSurfaceImpl(
screen,
this.kwinApi.workspace.currentActivity,
this.proxy.workspace().currentActivity,
this.proxy.workspace().currentDesktop,
this.qml.activityInfo,
this.kwinApi,
@ -179,7 +179,7 @@ export class DriverImpl implements Driver {
const onScreenResized = (screen: number): void => {
const srf = new DriverSurfaceImpl(
screen,
this.kwinApi.workspace.currentActivity,
this.proxy.workspace().currentActivity,
this.proxy.workspace().currentDesktop,
this.qml.activityInfo,
this.kwinApi,

View File

@ -161,12 +161,12 @@ export class DriverWindowImpl implements DriverWindow {
public get surface(): DriverSurface {
let activity;
if (this.client.activities.length === 0) {
activity = this.kwinApi.workspace.currentActivity;
activity = this.proxy.workspace().currentActivity;
} else if (
this.client.activities.indexOf(this.kwinApi.workspace.currentActivity) >=
this.client.activities.indexOf(this.proxy.workspace().currentActivity) >=
0
) {
activity = this.kwinApi.workspace.currentActivity;
activity = this.proxy.workspace().currentActivity;
} else {
activity = this.client.activities[0];
}