chore: wrap more workspace signals

This commit is contained in:
Mikhail Zolotukhin 2022-03-25 22:14:15 +03:00 committed by Genda
parent 6aa60fabce
commit ecdfeeafe4
2 changed files with 69 additions and 1 deletions

View File

@ -41,8 +41,17 @@ void Workspace::wrapSignals()
connect(m_kwinImpl, implNormSignature, this, thisNormSignature);
};
wrapComplexSignal(SIGNAL(currentDesktopChanged(int, KWin::AbstractClient *)), SLOT(currentDesktopChangedTransformer(int, KWin::AbstractClient *)));
wrapSimpleSignal(SIGNAL(numberScreensChanged(int count)));
wrapSimpleSignal(SIGNAL(screenResized(int screen)));
wrapSimpleSignal(SIGNAL(currentActivityChanged(const QString &)));
wrapComplexSignal(SIGNAL(currentDesktopChanged(int, KWin::AbstractClient *)), SLOT(currentDesktopChangedTransformer(int, KWin::AbstractClient *)));
wrapComplexSignal(SIGNAL(clientAdded(KWin::AbstractClient *)), SLOT(clientAddedTransformer(KWin::AbstractClient *)));
wrapComplexSignal(SIGNAL(clientRemoved(KWin::AbstractClient *)), SLOT(clientRemovedTransformer(KWin::AbstractClient *)));
wrapComplexSignal(SIGNAL(clientMinimized(KWin::AbstractClient *)), SLOT(clientMinimizedTransformer(KWin::AbstractClient *)));
wrapComplexSignal(SIGNAL(clientUnminimized(KWin::AbstractClient *)), SLOT(clientUnminimizedTransformer(KWin::AbstractClient *)));
wrapComplexSignal(SIGNAL(clientMaximizeSet(KWin::AbstractClient *, bool h, bool v)),
SLOT(clientMaximizeSetTransformer(KWin::AbstractClient *, bool h, bool v)));
};
QRect Workspace::clientArea(ClientAreaOption option, int screen, int desktop)
@ -57,4 +66,34 @@ void Workspace::currentDesktopChangedTransformer(int desktop, KWin::AbstractClie
Q_EMIT currentDesktopChanged(desktop, clientWrapper);
};
void Workspace::clientAddedTransformer(KWin::AbstractClient *kwinClient)
{
auto clientWrapper = Client(reinterpret_cast<QObject *>(kwinClient));
Q_EMIT clientAdded(clientWrapper);
}
void Workspace::clientRemovedTransformer(KWin::AbstractClient *kwinClient)
{
auto clientWrapper = Client(reinterpret_cast<QObject *>(kwinClient));
Q_EMIT clientRemoved(clientWrapper);
}
void Workspace::clientMinimizedTransformer(KWin::AbstractClient *kwinClient)
{
auto clientWrapper = Client(reinterpret_cast<QObject *>(kwinClient));
Q_EMIT clientMinimized(clientWrapper);
}
void Workspace::clientUnminimizedTransformer(KWin::AbstractClient *kwinClient)
{
auto clientWrapper = Client(reinterpret_cast<QObject *>(kwinClient));
Q_EMIT clientUnminimized(clientWrapper);
}
void Workspace::clientMaximizeSetTransformer(KWin::AbstractClient *kwinClient, bool h, bool v)
{
auto clientWrapper = Client(reinterpret_cast<QObject *>(kwinClient));
Q_EMIT clientMaximizeSet(clientWrapper, h, v);
}
}

View File

@ -57,16 +57,45 @@ public:
private Q_SLOTS:
void currentDesktopChangedTransformer(int desktop, KWin::AbstractClient *kwinClient);
void clientAddedTransformer(KWin::AbstractClient *);
void clientRemovedTransformer(KWin::AbstractClient *);
void clientMinimizedTransformer(KWin::AbstractClient *);
void clientUnminimizedTransformer(KWin::AbstractClient *);
void clientMaximizeSetTransformer(KWin::AbstractClient *, bool h, bool v);
Q_SIGNALS:
void currentDesktopChanged(int desktop, PlasmaApi::Client kwinClient);
/**
* Signal emitted when the number of screens changes.
* @param count The new number of screens
*/
void numberScreensChanged(int count);
/**
* This signal is emitted when the size of @p screen changes.
* Don't forget to fetch an updated client area.
*
* @deprecated Use QScreen::geometryChanged signal instead.
*/
void screenResized(int screen);
/**
* Signal emitted whenever the current activity changed.
* @param id id of the new activity
*/
void currentActivityChanged(const QString &id);
void clientAdded(PlasmaApi::Client client);
void clientRemoved(PlasmaApi::Client client);
void clientMinimized(PlasmaApi::Client client);
void clientUnminimized(PlasmaApi::Client client);
void clientMaximizeSet(PlasmaApi::Client client, bool h, bool v);
private:
void wrapSignals();