~ubuntu-branches/ubuntu/trusty/compiz/trusty

« back to all changes in this revision

Viewing changes to src/actions.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2013-08-22 06:58:07 UTC
  • mto: This revision was merged to the branch mainline in revision 3352.
  • Revision ID: package-import@ubuntu.com-20130822065807-17nlzez0d30y09so
Tags: upstream-0.9.10+13.10.20130822
ImportĀ upstreamĀ versionĀ 0.9.10+13.10.20130822

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
bool
35
35
CompScreenImpl::closeWin (CompAction         *action,
36
 
                      CompAction::State  state,
37
 
                      CompOption::Vector &options)
 
36
                          CompAction::State  state,
 
37
                          CompOption::Vector &options)
38
38
{
39
 
    CompWindow   *w;
40
 
    Window       xid;
41
 
    unsigned int time;
42
 
 
43
 
    xid  = CompOption::getIntOptionNamed (options, "window");
44
 
    time = CompOption::getIntOptionNamed (options, "time", CurrentTime);
45
 
 
46
 
    w = screen->findTopLevelWindow (xid);
 
39
    Window       xid  = CompOption::getIntOptionNamed (options, "window");
 
40
    unsigned int time = CompOption::getIntOptionNamed (options, "time", CurrentTime);
 
41
 
 
42
    CompWindow   *w   = screen->findTopLevelWindow (xid);
 
43
 
47
44
    if (w && (w->priv->actions  & CompWindowActionCloseMask))
48
45
        w->close (time);
49
46
 
52
49
 
53
50
bool
54
51
CompScreenImpl::unmaximizeWin (CompAction         *action,
55
 
                           CompAction::State  state,
56
 
                           CompOption::Vector &options)
 
52
                               CompAction::State  state,
 
53
                               CompOption::Vector &options)
57
54
{
58
 
    CompWindow *w;
59
 
    Window     xid;
60
 
 
61
 
    xid = CompOption::getIntOptionNamed (options, "window");
62
 
 
63
 
    w = screen->findTopLevelWindow (xid);
 
55
    Window     xid = CompOption::getIntOptionNamed (options, "window");
 
56
    CompWindow *w  = screen->findTopLevelWindow (xid);
 
57
 
64
58
    if (w)
65
59
        w->maximize (0);
66
60
 
72
66
                                         CompAction::State  state,
73
67
                                         CompOption::Vector &options)
74
68
{
75
 
    CompWindow *w;
76
 
    Window     xid;
77
 
 
78
 
    xid = CompOption::getIntOptionNamed (options, "window");
79
 
 
80
 
    w = screen->findTopLevelWindow (xid);
 
69
    Window     xid = CompOption::getIntOptionNamed (options, "window");
 
70
    CompWindow *w  = screen->findTopLevelWindow (xid);
 
71
 
81
72
    if (w)
82
73
    {
83
74
        if (w->priv->state & MAXIMIZE_STATE)
84
 
        {
85
75
            w->maximize (0);
86
 
        }
87
76
        else if (w->actions () & CompWindowActionMinimizeMask)
88
 
        {
89
77
            w->minimize ();
90
 
        }
91
78
    }
92
79
    return true;
93
80
}
94
81
 
95
82
bool
96
83
CompScreenImpl::minimizeWin (CompAction         *action,
97
 
                         CompAction::State  state,
98
 
                         CompOption::Vector &options)
 
84
                             CompAction::State  state,
 
85
                             CompOption::Vector &options)
99
86
{
100
 
    CompWindow *w;
101
 
    Window     xid;
102
 
 
103
 
    xid = CompOption::getIntOptionNamed (options, "window");
104
 
 
105
 
    w = screen->findTopLevelWindow (xid);
 
87
    Window     xid = CompOption::getIntOptionNamed (options, "window");
 
88
    CompWindow *w  = screen->findTopLevelWindow (xid);
 
89
 
106
90
    if (w && (w->actions () & CompWindowActionMinimizeMask))
107
91
        w->minimize ();
108
92
 
111
95
 
112
96
bool
113
97
CompScreenImpl::maximizeWin (CompAction         *action,
114
 
                         CompAction::State  state,
115
 
                         CompOption::Vector &options)
 
98
                             CompAction::State  state,
 
99
                             CompOption::Vector &options)
116
100
{
117
 
    CompWindow *w;
118
 
    Window     xid;
119
 
 
120
 
    xid = CompOption::getIntOptionNamed (options, "window");
121
 
 
122
 
    w = screen->findTopLevelWindow (xid);
 
101
    Window     xid = CompOption::getIntOptionNamed (options, "window");
 
102
    CompWindow *w  = screen->findTopLevelWindow (xid);
 
103
 
123
104
    if (w)
124
105
        w->maximize (MAXIMIZE_STATE);
125
106
 
128
109
 
129
110
bool
130
111
CompScreenImpl::maximizeWinHorizontally (CompAction         *action,
131
 
                                     CompAction::State  state,
132
 
                                     CompOption::Vector &options)
 
112
                                         CompAction::State  state,
 
113
                                         CompOption::Vector &options)
133
114
{
134
 
    CompWindow *w;
135
 
    Window     xid;
136
 
 
137
 
    xid = CompOption::getIntOptionNamed (options, "window");
138
 
 
139
 
    w = screen->findTopLevelWindow (xid);
 
115
    Window     xid = CompOption::getIntOptionNamed (options, "window");
 
116
    CompWindow *w  = screen->findTopLevelWindow (xid);
 
117
 
140
118
    if (w)
141
119
        w->maximize (w->state () | CompWindowStateMaximizedHorzMask);
142
120
 
145
123
 
146
124
bool
147
125
CompScreenImpl::maximizeWinVertically (CompAction         *action,
148
 
                                   CompAction::State  state,
149
 
                                   CompOption::Vector &options)
 
126
                                       CompAction::State  state,
 
127
                                       CompOption::Vector &options)
150
128
{
151
 
    CompWindow *w;
152
 
    Window     xid;
153
 
 
154
 
    xid = CompOption::getIntOptionNamed (options, "window");
155
 
 
156
 
    w = screen->findTopLevelWindow (xid);
 
129
    Window     xid = CompOption::getIntOptionNamed (options, "window");
 
130
    CompWindow *w  = screen->findTopLevelWindow (xid);
 
131
 
157
132
    if (w)
158
133
        w->maximize (w->state () | CompWindowStateMaximizedVertMask);
159
134
 
162
137
 
163
138
bool
164
139
CompScreenImpl::showDesktop (CompAction         *action,
165
 
                         CompAction::State  state,
166
 
                         CompOption::Vector &options)
 
140
                             CompAction::State  state,
 
141
                             CompOption::Vector &options)
167
142
{
168
143
    if (screen->showingDesktopMask() == 0)
169
144
        screen->enterShowDesktopMode ();
175
150
 
176
151
bool
177
152
CompScreenImpl::raiseWin (CompAction         *action,
178
 
                      CompAction::State  state,
179
 
                      CompOption::Vector &options)
 
153
                          CompAction::State  state,
 
154
                          CompOption::Vector &options)
180
155
{
181
 
    CompWindow *w;
182
 
    Window     xid;
183
 
 
184
 
    xid = CompOption::getIntOptionNamed (options, "window");
185
 
 
186
 
    w = screen->findTopLevelWindow (xid);
 
156
    Window     xid = CompOption::getIntOptionNamed (options, "window");
 
157
    CompWindow *w  = screen->findTopLevelWindow (xid);
 
158
 
187
159
    if (w)
188
160
        w->raise ();
189
161
 
192
164
 
193
165
bool
194
166
CompScreenImpl::lowerWin (CompAction         *action,
195
 
                      CompAction::State  state,
196
 
                      CompOption::Vector &options)
 
167
                          CompAction::State  state,
 
168
                          CompOption::Vector &options)
197
169
{
198
 
    CompWindow *w;
199
 
    Window     xid;
200
 
 
201
 
    xid = CompOption::getIntOptionNamed (options, "window");
202
 
 
203
 
    w = screen->findTopLevelWindow (xid);
 
170
    Window     xid = CompOption::getIntOptionNamed (options, "window");
 
171
    CompWindow *w  = screen->findTopLevelWindow (xid);
 
172
 
204
173
    if (w)
205
174
        w->lower ();
206
175
 
209
178
 
210
179
bool
211
180
CompScreenImpl::windowMenu (CompAction         *action,
212
 
                        CompAction::State  state,
213
 
                        CompOption::Vector &options)
 
181
                            CompAction::State  state,
 
182
                            CompOption::Vector &options)
214
183
{
215
 
    CompWindow *w;
216
 
    Window     xid;
217
 
 
218
 
    xid = CompOption::getIntOptionNamed (options, "window");
219
 
 
220
 
    w = screen->findTopLevelWindow (xid);
 
184
    Window     xid = CompOption::getIntOptionNamed (options, "window");
 
185
    CompWindow *w  = screen->findTopLevelWindow (xid);
 
186
 
221
187
    if (w && screen->grabsEmpty ())
222
188
    {
223
 
        int  x, y, button;
224
 
        Time time;
225
 
 
226
 
        time   = CompOption::getIntOptionNamed (options, "time", CurrentTime);
227
 
        button = CompOption::getIntOptionNamed (options, "button", 0);
228
 
        x      = CompOption::getIntOptionNamed (options, "x",
229
 
                                                w->geometry ().x ());
230
 
        y      = CompOption::getIntOptionNamed (options, "y",
231
 
                                                w->geometry ().y ());
 
189
        Time time  = CompOption::getIntOptionNamed (options, "time", CurrentTime);
 
190
        int button = CompOption::getIntOptionNamed (options, "button", 0);
 
191
        int x      = CompOption::getIntOptionNamed (options, "x",
 
192
                                                    w->geometry ().x ());
 
193
        int y      = CompOption::getIntOptionNamed (options, "y",
 
194
                                                    w->geometry ().y ());
232
195
 
233
196
        screen->toolkitAction (Atoms::toolkitActionWindowMenu,
234
197
                               time, w->id (), button, x, y);
239
202
 
240
203
bool
241
204
CompScreenImpl::toggleWinMaximized (CompAction         *action,
242
 
                                CompAction::State  state,
243
 
                                CompOption::Vector &options)
 
205
                                    CompAction::State  state,
 
206
                                    CompOption::Vector &options)
244
207
{
245
 
    CompWindow *w;
246
 
    Window     xid;
247
 
 
248
 
    xid = CompOption::getIntOptionNamed (options, "window");
249
 
 
250
 
    w = screen->findTopLevelWindow (xid);
 
208
    Window     xid = CompOption::getIntOptionNamed (options, "window");
 
209
    CompWindow *w  = screen->findTopLevelWindow (xid);
 
210
 
251
211
    if (w)
252
212
    {
253
213
        if ((w->priv->state & MAXIMIZE_STATE) == MAXIMIZE_STATE)
261
221
 
262
222
bool
263
223
CompScreenImpl::toggleWinMaximizedHorizontally (CompAction         *action,
264
 
                                            CompAction::State  state,
265
 
                                            CompOption::Vector &options)
 
224
                                                CompAction::State  state,
 
225
                                                CompOption::Vector &options)
266
226
{
267
 
    CompWindow *w;
268
 
    Window     xid;
269
 
 
270
 
    xid = CompOption::getIntOptionNamed (options, "window");
271
 
 
272
 
    w = screen->findTopLevelWindow (xid);
 
227
    Window     xid = CompOption::getIntOptionNamed (options, "window");
 
228
    CompWindow *w  = screen->findTopLevelWindow (xid);
 
229
 
273
230
    if (w)
274
231
        w->maximize (w->priv->state ^ CompWindowStateMaximizedHorzMask);
275
232
 
278
235
 
279
236
bool
280
237
CompScreenImpl::toggleWinMaximizedVertically (CompAction         *action,
281
 
                                          CompAction::State  state,
282
 
                                          CompOption::Vector &options)
 
238
                                              CompAction::State  state,
 
239
                                              CompOption::Vector &options)
283
240
{
284
 
    CompWindow *w;
285
 
    Window     xid;
286
 
 
287
 
    xid = CompOption::getIntOptionNamed (options, "window");
288
 
 
289
 
    w = screen->findTopLevelWindow (xid);
 
241
    Window     xid = CompOption::getIntOptionNamed (options, "window");
 
242
    CompWindow *w = screen->findTopLevelWindow (xid);
 
243
 
290
244
    if (w)
291
245
        w->maximize (w->priv->state ^ CompWindowStateMaximizedVertMask);
292
246
 
295
249
 
296
250
bool
297
251
CompScreenImpl::shadeWin (CompAction         *action,
298
 
                      CompAction::State  state,
299
 
                      CompOption::Vector &options)
 
252
                          CompAction::State  state,
 
253
                          CompOption::Vector &options)
300
254
{
301
 
    CompWindow *w;
302
 
    Window     xid;
303
 
 
304
 
    xid = CompOption::getIntOptionNamed (options, "window");
305
 
 
306
 
    w = screen->findTopLevelWindow (xid);
 
255
    Window     xid = CompOption::getIntOptionNamed (options, "window");
 
256
    CompWindow *w  = screen->findTopLevelWindow (xid);
 
257
 
307
258
    if (w && (w->priv->actions & CompWindowActionShadeMask))
308
259
    {
309
260
        w->priv->state ^= CompWindowStateShadedMask;