[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.4/kdebase/workspace/plasma/generic/runners/windows
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2010-02-08 22:20:17
Message-ID: 1265667617.967956.25181.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1087379 by aseigo:
delay window info gathering to speed up apparent readiness
M +26 -2 windowsrunner.cpp
M +4 -0 windowsrunner.h
--- branches/KDE/4.4/kdebase/workspace/plasma/generic/runners/windows/windowsrunner.cpp #1087378:1087379
@@ -18,6 +18,8 @@
***************************************************************************/
#include "windowsrunner.h"
+#include <QTimer>
+
#include <KDebug>
#include <KIcon>
#include <KWindowSystem>
@@ -28,7 +30,9 @@
#endif
WindowsRunner::WindowsRunner(QObject* parent, const QVariantList& args)
- : AbstractRunner(parent, args)
+ : AbstractRunner(parent, args),
+ m_inSession(false),
+ m_ready(false)
{
Q_UNUSED(args)
setObjectName("Windows");
@@ -57,8 +61,12 @@
{
}
-void WindowsRunner::prepareForMatchSession()
+void WindowsRunner::gatherInfo()
{
+ if (!m_inSession) {
+ return;
+ }
+
foreach (const WId w, KWindowSystem::windows()) {
KWindowInfo info = KWindowSystem::windowInfo(w, NET::WMWindowType | NET::WMDesktop |
NET::WMState | NET::XAWMState |
@@ -79,13 +87,25 @@
m_icons.insert(w, QIcon(KWindowSystem::icon(w)));
}
}
+
for (int i=1; i<=KWindowSystem::numberOfDesktops(); i++) {
m_desktopNames << KWindowSystem::desktopName(i);
}
+
+ m_ready = true;
}
+void WindowsRunner::prepareForMatchSession()
+{
+ m_inSession = true;
+ m_ready = false;
+ QTimer::singleShot(0, this, SLOT(gatherInfo()));
+}
+
void WindowsRunner::matchSessionComplete()
{
+ m_inSession = false;
+ m_ready = false;
m_desktopNames.clear();
m_icons.clear();
m_windows.clear();
@@ -93,6 +113,10 @@
void WindowsRunner::match(Plasma::RunnerContext& context)
{
+ if (!m_ready) {
+ return;
+ }
+
QString term = context.query();
if (!context.singleRunnerQueryMode() && (term.length() < 3)) {
--- branches/KDE/4.4/kdebase/workspace/plasma/generic/runners/windows/windowsrunner.h #1087378:1087379
@@ -37,6 +37,7 @@
private Q_SLOTS:
void prepareForMatchSession();
void matchSessionComplete();
+ void gatherInfo();
private:
enum WindowAction {
@@ -57,6 +58,9 @@
QHash<WId, KWindowInfo> m_windows;
QHash<WId, QIcon> m_icons;
QStringList m_desktopNames;
+
+ bool m_inSession : 1;
+ bool m_ready : 1;
};
K_EXPORT_PLASMA_RUNNER(windows, WindowsRunner)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic