Simplify Toplevel::isOnDesktop() and Toplevel::isOnAllDesktops()

Wayland- and X11-specific code paths are not needed.

If the window is on all virtual desktops, Toplevel::desktops() will be
an empty list.

If the window is on a particular virtual desktop, Toplevel::desktops()
will contain that desktop. On X11, the desktops list can have at most
only one item.
This commit is contained in:
Vlad Zahorodnii 2021-08-12 20:26:26 +03:00
parent 724f9a5db0
commit a7cb034513
2 changed files with 2 additions and 11 deletions

View file

@ -693,11 +693,7 @@ QMargins Toplevel::frameMargins() const
bool Toplevel::isOnDesktop(int d) const
{
return (kwinApp()->operationMode() == Application::OperationModeWaylandOnly ||
kwinApp()->operationMode() == Application::OperationModeXwayland
? desktops().contains(VirtualDesktopManager::self()->desktopForX11Id(d))
: desktop() == d
) || isOnAllDesktops();
return isOnAllDesktops() || desktops().contains(VirtualDesktopManager::self()->desktopForX11Id(d));
}
bool Toplevel::isOnCurrentDesktop() const

View file

@ -923,12 +923,7 @@ const EffectWindowImpl* Toplevel::effectWindow() const
inline bool Toplevel::isOnAllDesktops() const
{
return kwinApp()->operationMode() == Application::OperationModeWaylandOnly ||
kwinApp()->operationMode() == Application::OperationModeXwayland
//Wayland
? desktops().isEmpty()
//X11
: desktop() == NET::OnAllDesktops;
return desktops().isEmpty();
}
inline bool Toplevel::isOnAllActivities() const