mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-24 17:33:50 +03:00
make xwindowinterface checks lighter
--use the windowsTracker in order to check a window validity. No need to check again and again in the window type is valid
This commit is contained in:
parent
8a8eb632b7
commit
c45aa3f56c
@ -70,7 +70,7 @@ Tracker::Schemes *AbstractWindowInterface::schemesTracker()
|
||||
return m_schemesTracker;
|
||||
}
|
||||
|
||||
Tracker::Windows *AbstractWindowInterface::windowsTracker()
|
||||
Tracker::Windows *AbstractWindowInterface::windowsTracker() const
|
||||
{
|
||||
return m_windowsTracker;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "schemecolors.h"
|
||||
#include "tasktools.h"
|
||||
#include "windowinfowrap.h"
|
||||
#include "tracker/windows.h"
|
||||
#include "../liblatte2/types.h"
|
||||
#include "../liblatte2/extras.h"
|
||||
|
||||
@ -110,7 +111,7 @@ public:
|
||||
|
||||
Latte::Corona *corona();
|
||||
Tracker::Schemes *schemesTracker();
|
||||
Tracker::Windows *windowsTracker();
|
||||
Tracker::Windows *windowsTracker() const;
|
||||
|
||||
signals:
|
||||
void activeWindowChanged(WindowId wid);
|
||||
|
@ -316,6 +316,15 @@ LastActiveWindow *Windows::lastActiveWindow(Latte::View *view)
|
||||
return m_views[view]->lastActiveWindow();
|
||||
}
|
||||
|
||||
bool Windows::isValidFor(WindowId wid) const
|
||||
{
|
||||
if (!m_windows.contains(wid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_windows[wid].isValid();
|
||||
}
|
||||
|
||||
QIcon Windows::iconFor(WindowId wid)
|
||||
{
|
||||
if (!m_windows.contains(wid)) {
|
||||
|
@ -67,6 +67,7 @@ public:
|
||||
SchemeColors *touchingWindowScheme(Latte::View *view) const;
|
||||
LastActiveWindow *lastActiveWindow(Latte::View *view);
|
||||
|
||||
bool isValidFor(WindowId wid) const;
|
||||
QIcon iconFor(WindowId wid);
|
||||
QString appNameFor(WindowId wid);
|
||||
|
||||
|
@ -395,6 +395,8 @@ AppData WaylandInterface::appDataFor(WindowId wid) const
|
||||
|
||||
const AppData &data = appDataFromUrl(windowUrlFromMetadata(window->appId(),
|
||||
window->pid(), rulesConfig));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
KWayland::Client::PlasmaWindow *WaylandInterface::windowFor(WindowId wid) const
|
||||
|
@ -449,6 +449,10 @@ void XWindowInterface::requestToggleMaximized(WindowId wid) const
|
||||
|
||||
bool XWindowInterface::isValidWindow(WindowId wid) const
|
||||
{
|
||||
if (windowsTracker()->isValidFor(wid)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const KWindowInfo winfo{wid.value<WId>(), NET::WMWindowType};
|
||||
|
||||
return isValidWindow(winfo);
|
||||
@ -456,6 +460,10 @@ bool XWindowInterface::isValidWindow(WindowId wid) const
|
||||
|
||||
bool XWindowInterface::isValidWindow(const KWindowInfo &winfo) const
|
||||
{
|
||||
if (windowsTracker()->isValidFor(winfo.win())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
constexpr auto types = NET::DockMask | NET::MenuMask | NET::SplashMask | NET::PopupMenuMask | NET::NormalMask | NET::DialogMask;
|
||||
NET::WindowType winType = winfo.windowType(types);
|
||||
const auto winClass = KWindowInfo(winfo.win(), 0, NET::WM2WindowClass).windowClassName();
|
||||
|
Loading…
Reference in New Issue
Block a user