~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to libs/taskmanager/task_win.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************
 
2
 
 
3
Copyright (c) 2000-2001 Matthias Elter <elter@kde.org>
 
4
Copyright (c) 2001 Richard Moore <rich@kde.org>
 
5
 
 
6
Permission is hereby granted, free of charge, to any person obtaining a copy
 
7
of this software and associated documentation files (the "Software"), to deal
 
8
in the Software without restriction, including without limitation the rights
 
9
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
10
copies of the Software, and to permit persons to whom the Software is
 
11
furnished to do so, subject to the following conditions:
 
12
 
 
13
The above copyright notice and this permission notice shall be included in
 
14
all copies or substantial portions of the Software.
 
15
 
 
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
19
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 
20
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
21
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
22
 
 
23
******************************************************************/
 
24
#include "task_p.h"
 
25
 
 
26
#include <windows.h>
 
27
 
 
28
 
 
29
namespace TaskManager
 
30
{
 
31
 
 
32
bool Task::updateDemandsAttentionState( WId w )
 
33
{
 
34
    return false;
 
35
}
 
36
 
 
37
QString Task::className() const
 
38
{
 
39
    return QString();
 
40
}
 
41
 
 
42
QString Task::classClass() const
 
43
{
 
44
    return QString();
 
45
}
 
46
 
 
47
void Task::move()
 
48
{
 
49
    bool on_current = d->info.isOnCurrentDesktop();
 
50
 
 
51
    if (!on_current)
 
52
    {
 
53
        KWindowSystem::setCurrentDesktop(d->info.desktop());
 
54
        KWindowSystem::forceActiveWindow(d->win);
 
55
    }
 
56
 
 
57
    if (d->info.isMinimized())
 
58
    {
 
59
        KWindowSystem::unminimizeWindow(d->win);
 
60
    }
 
61
 
 
62
    QRect geom = d->info.geometry();
 
63
    QCursor::setPos(geom.center());
 
64
 
 
65
}
 
66
 
 
67
void Task::resize()
 
68
{
 
69
    bool on_current = d->info.isOnCurrentDesktop();
 
70
 
 
71
    if (!on_current)
 
72
    {
 
73
        KWindowSystem::setCurrentDesktop(d->info.desktop());
 
74
        KWindowSystem::forceActiveWindow(d->win);
 
75
    }
 
76
 
 
77
    if (d->info.isMinimized())
 
78
    {
 
79
        KWindowSystem::unminimizeWindow(d->win);
 
80
    }
 
81
 
 
82
    QRect geom = d->info.geometry();
 
83
    QCursor::setPos(geom.bottomRight());
 
84
}
 
85
 
 
86
void Task::setMaximized(bool maximize)
 
87
{
 
88
    KWindowInfo info = KWindowSystem::windowInfo(d->win, NET::WMState | NET::XAWMState | NET::WMDesktop);
 
89
    bool on_current = info.isOnCurrentDesktop();
 
90
 
 
91
    if (!on_current)
 
92
    {
 
93
        KWindowSystem::setCurrentDesktop(info.desktop());
 
94
    }
 
95
 
 
96
    if (info.isMinimized())
 
97
    {
 
98
        KWindowSystem::unminimizeWindow(d->win);
 
99
    }
 
100
 
 
101
    if (!on_current)
 
102
    {
 
103
        KWindowSystem::forceActiveWindow(d->win);
 
104
    }
 
105
}
 
106
 
 
107
void Task::restore()
 
108
{
 
109
    KWindowInfo info = KWindowSystem::windowInfo(d->win, NET::WMState | NET::XAWMState | NET::WMDesktop);
 
110
    bool on_current = info.isOnCurrentDesktop();
 
111
 
 
112
    if (!on_current)
 
113
    {
 
114
        KWindowSystem::setCurrentDesktop(info.desktop());
 
115
    }
 
116
 
 
117
    if( info.isMinimized())
 
118
    {
 
119
        KWindowSystem::unminimizeWindow(d->win);
 
120
    }
 
121
 
 
122
    if (!on_current)
 
123
    {
 
124
        KWindowSystem::forceActiveWindow( d->win );
 
125
    }
 
126
}
 
127
 
 
128
void Task::close()
 
129
{
 
130
    PostMessage( d->win, WM_CLOSE, 0, 0 );
 
131
}
 
132
 
 
133
void Task::toDesktop(int desk)
 
134
{
 
135
    if (desk == KWindowSystem::currentDesktop()) {
 
136
        KWindowSystem::forceActiveWindow(d->win);
 
137
    }
 
138
}
 
139
 
 
140
void Task::setAlwaysOnTop(bool stay)
 
141
{
 
142
    Q_UNUSED(stay);
 
143
}
 
144
 
 
145
void Task::setKeptBelowOthers(bool below)
 
146
{
 
147
    Q_UNUSED(below);
 
148
}
 
149
 
 
150
void Task::setFullScreen(bool fullscreen)
 
151
{
 
152
    Q_UNUSED(fullscreen);
 
153
}
 
154
 
 
155
void Task::setShaded(bool shade)
 
156
{
 
157
    Q_UNUSED(shade);
 
158
}
 
159
 
 
160
void Task::publishIconGeometry(QRect rect)
 
161
{
 
162
    if (rect == d->iconGeometry)
 
163
    {
 
164
        return;
 
165
    }
 
166
 
 
167
    d->iconGeometry = rect;
 
168
}
 
169
 
 
170
void Task::refreshActivities()
 
171
{
 
172
    return;
 
173
}
 
174
 
 
175
} // TaskManager namespace