Add isOnDesktop() overload that takes VirtualDesktop
int-based desktop ids are unreliable, but VirtualDesktop are not. So far virtual desktop objects aren't used widely in kwin, but it's a good start.
This commit is contained in:
parent
a7cb034513
commit
ec8a9f7cf7
2 changed files with 8 additions and 2 deletions
|
@ -691,14 +691,19 @@ QMargins Toplevel::frameMargins() const
|
|||
return QMargins();
|
||||
}
|
||||
|
||||
bool Toplevel::isOnDesktop(VirtualDesktop *desktop) const
|
||||
{
|
||||
return isOnAllDesktops() || desktops().contains(desktop);
|
||||
}
|
||||
|
||||
bool Toplevel::isOnDesktop(int d) const
|
||||
{
|
||||
return isOnAllDesktops() || desktops().contains(VirtualDesktopManager::self()->desktopForX11Id(d));
|
||||
return isOnDesktop(VirtualDesktopManager::self()->desktopForX11Id(d));
|
||||
}
|
||||
|
||||
bool Toplevel::isOnCurrentDesktop() const
|
||||
{
|
||||
return isOnDesktop(VirtualDesktopManager::self()->current());
|
||||
return isOnDesktop(VirtualDesktopManager::self()->currentDesktop());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -409,6 +409,7 @@ public:
|
|||
virtual int desktop() const = 0;
|
||||
virtual QVector<VirtualDesktop *> desktops() const = 0;
|
||||
virtual QStringList activities() const = 0;
|
||||
bool isOnDesktop(VirtualDesktop *desktop) const;
|
||||
bool isOnDesktop(int d) const;
|
||||
bool isOnActivity(const QString &activity) const;
|
||||
bool isOnCurrentDesktop() const;
|
||||
|
|
Loading…
Reference in a new issue