blob: c51eba5d864cfedd176c149fef2b1d44dd8d81ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#include "TaskSwitcher.h"
TaskSwitcher::TaskSwitcher(const QString& kind) : m_kind(kind)
{
qDebug("TaskSwitcher::TaskSwitcher()");
}
TaskSwitcher::~TaskSwitcher()
{
qDebug("TaskSwitcher::~TaskSwitcher()");
}
bool TaskSwitcher::onKeyPress(int /*keycode*/)
{
if(m_applist.isEmpty()){
/* get list */
const QList<QWSWindow>& list = qwsServer->clientWindows();
QWSWindow* w;
for(QListIterator<QWSWindow> it(list); (w=it.current()); ++it){
if(w->isVisible()){
QString app = w->client()->identity();
qDebug("applist[%s]", app.latin1());
if(app != NULL && m_applist.contains(app) == false){
m_applist.append(app);
}
}
}
m_appit = m_applist.begin();
}
if(m_applist.count() > 1){
/* switch next */
next();
if(*m_appit == "launcher"){
next();
}
Global::execute(*m_appit);
} else if(m_applist.count() == 1
&& *m_appit != "launcher"){
Global::execute(*m_appit);
} else {
qDebug("no applications");
}
return(true);
}
bool TaskSwitcher::onModRelease(int /*keycode*/)
{
m_applist.clear();
return(false);
}
void TaskSwitcher::next()
{
++m_appit;
if(m_appit == m_applist.end()){
m_appit = m_applist.begin();
}
}
|