mirror of
https://github.com/Bismuth-Forge/bismuth.git
synced 2024-09-17 11:37:10 +03:00
refactor: wrap clientList api call
This commit is contained in:
parent
8ec6b95161
commit
0387c0f486
@ -58,6 +58,22 @@ QRect Workspace::clientArea(ClientAreaOption option, int screen, int desktop)
|
|||||||
BI_METHOD_IMPL_WRAP(QRect, "clientArea(ClientAreaOption, int, int)", Q_ARG(ClientAreaOption, option), Q_ARG(int, screen), Q_ARG(int, desktop));
|
BI_METHOD_IMPL_WRAP(QRect, "clientArea(ClientAreaOption, int, int)", Q_ARG(ClientAreaOption, option), Q_ARG(int, screen), Q_ARG(int, desktop));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::vector<PlasmaApi::Client> Workspace::clientList() const
|
||||||
|
{
|
||||||
|
auto apiCall = [&]() -> QList<KWin::AbstractClient *> {
|
||||||
|
BI_METHOD_IMPL_WRAP(QList<KWin::AbstractClient *>, "clientList()", QGenericArgument(nullptr));
|
||||||
|
};
|
||||||
|
|
||||||
|
auto apiCallRes = apiCall();
|
||||||
|
|
||||||
|
auto result = std::vector<PlasmaApi::Client>(apiCallRes.size());
|
||||||
|
for (auto clientPtr : apiCallRes) {
|
||||||
|
result.push_back(Client(reinterpret_cast<QObject *>(clientPtr)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void Workspace::currentDesktopChangedTransformer(int desktop, KWin::AbstractClient *kwinClient)
|
void Workspace::currentDesktopChangedTransformer(int desktop, KWin::AbstractClient *kwinClient)
|
||||||
{
|
{
|
||||||
// Since we don't know the KWin internal implementation we have to use reinterpret_cast
|
// Since we don't know the KWin internal implementation we have to use reinterpret_cast
|
||||||
|
@ -55,6 +55,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
Q_INVOKABLE QRect clientArea(ClientAreaOption, int screen, int desktop);
|
Q_INVOKABLE QRect clientArea(ClientAreaOption, int screen, int desktop);
|
||||||
|
|
||||||
|
Q_INVOKABLE std::vector<PlasmaApi::Client> clientList() const;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void currentDesktopChangedTransformer(int desktop, KWin::AbstractClient *kwinClient);
|
void currentDesktopChangedTransformer(int desktop, KWin::AbstractClient *kwinClient);
|
||||||
void clientAddedTransformer(KWin::AbstractClient *);
|
void clientAddedTransformer(KWin::AbstractClient *);
|
||||||
|
Loading…
Reference in New Issue
Block a user