Merge lp:~compiz-team/compiz-grid-plugin/oneiric.fix_862339 into lp:compiz-grid-plugin
- oneiric.fix_862339
- Merge into 0.9.5
Proposed by
Sam Spilsbury
Status: | Superseded |
---|---|
Proposed branch: | lp:~compiz-team/compiz-grid-plugin/oneiric.fix_862339 |
Merge into: | lp:compiz-grid-plugin |
Diff against target: |
676 lines (+253/-96) 4 files modified
CMakeLists.txt (+2/-0) grid.xml.in (+14/-14) src/grid.cpp (+212/-67) src/grid.h (+25/-15) |
To merge this branch: | bzr merge lp:~compiz-team/compiz-grid-plugin/oneiric.fix_862339 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Compiz Maintainers | Pending | ||
Review via email: mp+77516@code.launchpad.net |
This proposal has been superseded by a proposal from 2011-09-29.
Commit message
Description of the change
Fix bug 862339
To post a comment you must log in.
Unmerged revisions
- 91. By Sam Spilsbury
-
Ensure window placement is pixel perfect in the maximization case. Fixes LP#862339
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2009-12-17 12:22:47 +0000 |
3 | +++ CMakeLists.txt 2011-09-29 12:41:49 +0000 |
4 | @@ -2,4 +2,6 @@ |
5 | |
6 | include (CompizPlugin) |
7 | |
8 | +set (CMAKE_CXX_FLAGS -std=c++0x) |
9 | + |
10 | compiz_plugin(grid PLUGINDEPS composite opengl) |
11 | |
12 | === modified file 'grid.xml.in' |
13 | --- grid.xml.in 2010-09-28 22:30:57 +0000 |
14 | +++ grid.xml.in 2011-09-29 12:41:49 +0000 |
15 | @@ -84,7 +84,7 @@ |
16 | <option name="top_left_corner_action" type="int"> |
17 | <_short>Upper Left Corner</_short> |
18 | <_long>Action to be performed when window is dropped on the top left corner</_long> |
19 | - <default>7</default> |
20 | + <default>4</default> |
21 | <min>0</min> |
22 | <max>10</max> |
23 | <desc> |
24 | @@ -186,7 +186,7 @@ |
25 | <option name="top_right_corner_action" type="int"> |
26 | <_short>Upper Right Corner</_short> |
27 | <_long>Action to be performed when window is dropped on the top right corner</_long> |
28 | - <default>9</default> |
29 | + <default>6</default> |
30 | <min>0</min> |
31 | <max>10</max> |
32 | <desc> |
33 | @@ -339,7 +339,7 @@ |
34 | <option name="bottom_left_corner_action" type="int"> |
35 | <_short>Bottom Left Corner</_short> |
36 | <_long>Action to be performed when window is dropped on the bottom left corner</_long> |
37 | - <default>1</default> |
38 | + <default>4</default> |
39 | <min>0</min> |
40 | <max>10</max> |
41 | <desc> |
42 | @@ -390,7 +390,7 @@ |
43 | <option name="bottom_edge_action" type="int"> |
44 | <_short>Bottom Edge</_short> |
45 | <_long>Action to be performed when window is dropped on the bottom edge</_long> |
46 | - <default>2</default> |
47 | + <default>0</default> |
48 | <min>0</min> |
49 | <max>10</max> |
50 | <desc> |
51 | @@ -441,7 +441,7 @@ |
52 | <option name="bottom_right_corner_action" type="int"> |
53 | <_short>Bottom Right Corner</_short> |
54 | <_long>Action to be performed when window is dropped on the bottom right corner</_long> |
55 | - <default>3</default> |
56 | + <default>6</default> |
57 | <min>0</min> |
58 | <max>10</max> |
59 | <desc> |
60 | @@ -505,21 +505,21 @@ |
61 | <option name="left_edge_threshold" type="int"> |
62 | <_short>Left Edge</_short> |
63 | <_long>Maximum number of pixels from the left edge a window can be dropped</_long> |
64 | - <default>5</default> |
65 | + <default>15</default> |
66 | <min>0</min> |
67 | <max>500</max> |
68 | </option> |
69 | <option name="right_edge_threshold" type="int"> |
70 | <_short>Right Edge</_short> |
71 | <_long>Maximum number of pixels from the right edge a window can be dropped</_long> |
72 | - <default>5</default> |
73 | + <default>15</default> |
74 | <min>0</min> |
75 | <max>500</max> |
76 | </option> |
77 | <option name="top_edge_threshold" type="int"> |
78 | <_short>Top Edge</_short> |
79 | <_long>Maximum number of pixels from the top edge a window can be dropped</_long> |
80 | - <default>5</default> |
81 | + <default>20</default> |
82 | <min>0</min> |
83 | <max>500</max> |
84 | </option> |
85 | @@ -543,9 +543,9 @@ |
86 | <_short>Outline Color</_short> |
87 | <_long>Color of the resize indicator outline</_long> |
88 | <default> |
89 | - <red>0x2f2f</red> |
90 | - <green>0x2f2f</green> |
91 | - <blue>0x4f4f</blue> |
92 | + <red>0xfbfb</red> |
93 | + <green>0x8b8b</green> |
94 | + <blue>0x0</blue> |
95 | <alpha>0x9f9f</alpha> |
96 | </default> |
97 | </option> |
98 | @@ -553,9 +553,9 @@ |
99 | <_short>Fill Color</_short> |
100 | <_long>Fill color of the resize indicator</_long> |
101 | <default> |
102 | - <red>0x2f2f</red> |
103 | - <green>0x2f2f</green> |
104 | - <blue>0x4f4f</blue> |
105 | + <red>0xfbfb</red> |
106 | + <green>0x8b8b</green> |
107 | + <blue>0x0</blue> |
108 | <alpha>0x4f4f</alpha> |
109 | </default> |
110 | </option> |
111 | |
112 | === modified file 'src/grid.cpp' |
113 | --- src/grid.cpp 2011-09-24 06:59:55 +0000 |
114 | +++ src/grid.cpp 2011-09-29 12:41:49 +0000 |
115 | @@ -24,24 +24,26 @@ |
116 | |
117 | #include "grid.h" |
118 | |
119 | -static const GridProps gridProps[] = |
120 | +using namespace GridWindowType; |
121 | + |
122 | +static std::map <unsigned int, GridProps> gridProps; |
123 | + |
124 | +void |
125 | +GridScreen::handleCompizEvent(const char* plugin, |
126 | + const char* event, |
127 | + CompOption::Vector& o) |
128 | { |
129 | - {0,1, 1,1}, |
130 | - |
131 | - {0,1, 2,2}, |
132 | - {0,1, 1,2}, |
133 | - {1,1, 2,2}, |
134 | - |
135 | - {0,0, 2,1}, |
136 | - {0,0, 1,1}, |
137 | - {1,0, 2,1}, |
138 | - |
139 | - {0,0, 2,2}, |
140 | - {0,0, 1,2}, |
141 | - {1,0, 2,2}, |
142 | - |
143 | - {0,0, 1,1}, |
144 | -}; |
145 | + if (strcmp(event, "start_viewport_switch") == 0) |
146 | + { |
147 | + mSwitchingVp = true; |
148 | + } |
149 | + else if (strcmp(event, "end_viewport_switch") == 0) |
150 | + { |
151 | + mSwitchingVp = false; |
152 | + } |
153 | + |
154 | + screen->handleCompizEvent(plugin, event, o); |
155 | +} |
156 | |
157 | CompRect |
158 | GridScreen::slotToRect (CompWindow *w, |
159 | @@ -83,7 +85,7 @@ |
160 | void |
161 | GridScreen::getPaintRectangle (CompRect &cRect) |
162 | { |
163 | - if (edgeToGridType () != GridUnknown && optionGetDrawIndicator ()) |
164 | + if (typeToMask (edgeToGridType ()) != GridUnknown && optionGetDrawIndicator ()) |
165 | cRect = desiredSlot; |
166 | else |
167 | cRect.setGeometry (0, 0, 0, 0); |
168 | @@ -118,7 +120,7 @@ |
169 | GridScreen::initiateCommon (CompAction *action, |
170 | CompAction::State state, |
171 | CompOption::Vector &option, |
172 | - GridType where, |
173 | + unsigned int where, |
174 | bool resize, |
175 | bool key) |
176 | { |
177 | @@ -128,16 +130,27 @@ |
178 | xid = CompOption::getIntOptionNamed (option, "window"); |
179 | cw = screen->findWindow (xid); |
180 | |
181 | - if (where == GridUnknown || screen->otherGrabExist ("move", NULL)) |
182 | - return false; |
183 | - |
184 | if (cw) |
185 | { |
186 | XWindowChanges xwc; |
187 | + bool maximizeH = where & (GridBottom | GridTop | GridMaximize); |
188 | + bool maximizeV = where & (GridLeft | GridRight | GridMaximize); |
189 | + |
190 | + if (!(cw->actions () & CompWindowActionResizeMask)) |
191 | + return false; |
192 | + |
193 | + if (maximizeH && !(cw->actions () & CompWindowActionMaximizeHorzMask)) |
194 | + return false; |
195 | + |
196 | + if (maximizeV && !(cw->actions () & CompWindowActionMaximizeVertMask)) |
197 | + return false; |
198 | + |
199 | + if (where & GridUnknown) |
200 | + return false; |
201 | |
202 | GRID_WINDOW (cw); |
203 | |
204 | - if (gw->lastTarget != where) |
205 | + if (gw->lastTarget & ~(where)) |
206 | gw->resizeCount = 0; |
207 | else if (!key) |
208 | return false; |
209 | @@ -167,7 +180,7 @@ |
210 | cw->maximize (0); |
211 | } |
212 | |
213 | - if (where == GridMaximize && resize) |
214 | + if ((where & GridMaximize) && resize) |
215 | { |
216 | /* move the window to the correct output */ |
217 | if (cw == mGrabWindow) |
218 | @@ -209,7 +222,7 @@ |
219 | |
220 | if (desiredRect.y () == currentRect.y () && |
221 | desiredRect.height () == currentRect.height () && |
222 | - where != GridMaximize && gw->lastTarget == where) |
223 | + where & ~(GridMaximize) && gw->lastTarget & where) |
224 | { |
225 | int slotWidth25 = workarea.width () / 4; |
226 | int slotWidth33 = (workarea.width () / 3) + cw->border ().left; |
227 | @@ -322,12 +335,52 @@ |
228 | /* TODO: animate move+resize */ |
229 | if (resize) |
230 | { |
231 | - cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc); |
232 | - gw->isGridResized = true; |
233 | - gw->isGridMaximized = false; |
234 | - for (unsigned int i = 0; i < animations.size (); i++) |
235 | - animations.at (i).fadingOut = true; |
236 | + unsigned int valueMask = CWX | CWY | CWWidth | CWHeight; |
237 | gw->lastTarget = where; |
238 | + gw->currentSize = CompRect (wc.x, wc.y, wc.width, wc.height); |
239 | + |
240 | + /* Special case for left and right, actually vertically maximize |
241 | + * the window */ |
242 | + if (where & GridLeft || where & GridRight) |
243 | + { |
244 | + /* First restore the window to its original size */ |
245 | + XWindowChanges rwc; |
246 | + CompWindowExtents lb = gw->lastBorder; |
247 | + |
248 | + rwc.x = gw->originalSize.x (); |
249 | + rwc.y = gw->originalSize.y (); |
250 | + rwc.width = gw->originalSize.width (); |
251 | + rwc.height = gw->originalSize.height (); |
252 | + |
253 | + cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &rwc); |
254 | + |
255 | + gw->isGridMaximized = true; |
256 | + gw->isGridResized = false; |
257 | + |
258 | + gw->lastBorder = cw->border (); |
259 | + /* Maximize the window */ |
260 | + cw->maximize (CompWindowStateMaximizedVertMask); |
261 | + |
262 | + /* Adjust for any updated border extents */ |
263 | + xwc.x -= lb.left - cw->border ().left; |
264 | + xwc.y -= lb.top - cw->border ().top; |
265 | + xwc.width += (lb.left - cw->border ().left) + (lb.right - cw->border ().right); |
266 | + xwc.height += (lb.top - cw->border ().top) + (lb.bottom - cw->border ().bottom); |
267 | + |
268 | + /* Make window the size that we want */ |
269 | + cw->configureXWindow (valueMask, &xwc); |
270 | + } |
271 | + else |
272 | + { |
273 | + gw->isGridResized = true; |
274 | + gw->isGridMaximized = false; |
275 | + |
276 | + /* Make window the size that we want */ |
277 | + cw->configureXWindow (valueMask, &xwc); |
278 | + } |
279 | + |
280 | + for (unsigned int i = 0; i < animations.size (); i++) |
281 | + animations.at (i).fadingOut = true; |
282 | } |
283 | |
284 | /* This centers a window if it could not be resized to the desired |
285 | @@ -473,39 +526,72 @@ |
286 | return status; |
287 | } |
288 | |
289 | -GridType |
290 | +unsigned int |
291 | +GridScreen::typeToMask (int t) |
292 | +{ |
293 | + typedef struct { |
294 | + unsigned int mask; |
295 | + int type; |
296 | + } GridTypeMask; |
297 | + |
298 | + std::vector <GridTypeMask> type = |
299 | + { |
300 | + { GridWindowType::GridUnknown, 0 }, |
301 | + { GridWindowType::GridBottomLeft, 1 }, |
302 | + { GridWindowType::GridBottom, 2 }, |
303 | + { GridWindowType::GridBottomRight, 3 }, |
304 | + { GridWindowType::GridLeft, 4 }, |
305 | + { GridWindowType::GridCenter, 5 }, |
306 | + { GridWindowType::GridRight, 6 }, |
307 | + { GridWindowType::GridTopLeft, 7 }, |
308 | + { GridWindowType::GridTop, 8 }, |
309 | + { GridWindowType::GridTopRight, 9 }, |
310 | + { GridWindowType::GridMaximize, 10 } |
311 | + }; |
312 | + |
313 | + for (unsigned int i = 0; i < type.size (); i++) |
314 | + { |
315 | + GridTypeMask &tm = type[i]; |
316 | + if (tm.type == t) |
317 | + return tm.mask; |
318 | + } |
319 | + |
320 | + return GridWindowType::GridUnknown; |
321 | +} |
322 | + |
323 | +int |
324 | GridScreen::edgeToGridType () |
325 | { |
326 | - GridType ret; |
327 | + int ret; |
328 | |
329 | switch (edge) { |
330 | case Left: |
331 | - ret = (GridType) optionGetLeftEdgeAction (); |
332 | + ret = (int) optionGetLeftEdgeAction (); |
333 | break; |
334 | case Right: |
335 | - ret = (GridType) optionGetRightEdgeAction (); |
336 | + ret = (int) optionGetRightEdgeAction (); |
337 | break; |
338 | case Top: |
339 | - ret = (GridType) optionGetTopEdgeAction (); |
340 | + ret = (int) optionGetTopEdgeAction (); |
341 | break; |
342 | case Bottom: |
343 | - ret = (GridType) optionGetBottomEdgeAction (); |
344 | + ret = (int) optionGetBottomEdgeAction (); |
345 | break; |
346 | case TopLeft: |
347 | - ret = (GridType) optionGetTopLeftCornerAction (); |
348 | + ret = (int) optionGetTopLeftCornerAction (); |
349 | break; |
350 | case TopRight: |
351 | - ret = (GridType) optionGetTopRightCornerAction (); |
352 | + ret = (int) optionGetTopRightCornerAction (); |
353 | break; |
354 | case BottomLeft: |
355 | - ret = (GridType) optionGetBottomLeftCornerAction (); |
356 | + ret = (int) optionGetBottomLeftCornerAction (); |
357 | break; |
358 | case BottomRight: |
359 | - ret = (GridType) optionGetBottomRightCornerAction (); |
360 | + ret = (int) optionGetBottomRightCornerAction (); |
361 | break; |
362 | case NoEdge: |
363 | default: |
364 | - ret = GridUnknown; |
365 | + ret = -1; |
366 | break; |
367 | } |
368 | |
369 | @@ -571,7 +657,7 @@ |
370 | if (cScreen) |
371 | cScreen->damageRegion (desiredSlot); |
372 | |
373 | - initiateCommon (0, 0, o, edgeToGridType (), false, false); |
374 | + initiateCommon (0, 0, o, typeToMask (edgeToGridType ()), false, false); |
375 | |
376 | if (cScreen) |
377 | cScreen->damageRegion (desiredSlot); |
378 | @@ -589,7 +675,7 @@ |
379 | if (cScreen) |
380 | cScreen->damageRegion (desiredSlot); |
381 | |
382 | - check = initiateCommon (0, 0, o, edgeToGridType (), false, false); |
383 | + check = initiateCommon (NULL, 0, o, typeToMask (edgeToGridType ()), false, false); |
384 | |
385 | if (cScreen) |
386 | cScreen->damageRegion (desiredSlot); |
387 | @@ -646,21 +732,22 @@ |
388 | unsigned int state, |
389 | unsigned int mask) |
390 | { |
391 | - if (screen->grabExist ("move")) |
392 | + if (mask & (CompWindowGrabMoveMask | CompWindowGrabButtonMask)) |
393 | { |
394 | gScreen->o[0].value ().set ((int) window->id ()); |
395 | |
396 | screen->handleEventSetEnabled (gScreen, true); |
397 | gScreen->mGrabWindow = window; |
398 | pointerBufDx = pointerBufDy = 0; |
399 | + grabMask = mask; |
400 | |
401 | - if (!isGridResized && gScreen->optionGetSnapbackWindows ()) |
402 | + if (!isGridResized && !isGridMaximized && gScreen->optionGetSnapbackWindows ()) |
403 | /* Store size not including borders when grabbing with cursor */ |
404 | originalSize = gScreen->slotToRect(window, |
405 | window->serverBorderRect ()); |
406 | } |
407 | |
408 | - if (screen->grabExist ("resize")) |
409 | + if (mask & CompWindowGrabResizeMask) |
410 | { |
411 | isGridResized = false; |
412 | resizeCount = 0; |
413 | @@ -675,10 +762,11 @@ |
414 | if (window == gScreen->mGrabWindow) |
415 | { |
416 | gScreen->initiateCommon |
417 | - (0, 0, gScreen->o, gScreen->edgeToGridType (), true, |
418 | + (NULL, 0, gScreen->o, gScreen->typeToMask (gScreen->edgeToGridType ()), true, |
419 | gScreen->edge != gScreen->lastResizeEdge); |
420 | |
421 | screen->handleEventSetEnabled (gScreen, false); |
422 | + grabMask = 0; |
423 | gScreen->mGrabWindow = NULL; |
424 | gScreen->o[0].value ().set (0); |
425 | gScreen->cScreen->damageRegion (gScreen->desiredSlot); |
426 | @@ -695,17 +783,20 @@ |
427 | { |
428 | window->moveNotify (dx, dy, immediate); |
429 | |
430 | - if (isGridResized) |
431 | + if (isGridResized && !isGridMaximized && !GridScreen::get (screen)->mSwitchingVp) |
432 | { |
433 | - pointerBufDx += dx; |
434 | - pointerBufDy += dy; |
435 | + if (window->grabbed () && (grabMask & CompWindowGrabMoveMask)) |
436 | + { |
437 | + pointerBufDx += dx; |
438 | + pointerBufDy += dy; |
439 | + } |
440 | |
441 | /* Do not allow the window to be moved while it |
442 | * is resized */ |
443 | + dx = currentSize.x () - window->geometry ().x (); |
444 | + dy = currentSize.y () - window->geometry ().y (); |
445 | |
446 | - window->moveNotifySetEnabled (this, false); |
447 | - window->move (-dx, -dy); |
448 | - window->moveNotifySetEnabled (this, true); |
449 | + window->move (dx, dy); |
450 | } |
451 | } |
452 | |
453 | @@ -717,11 +808,50 @@ |
454 | lastTarget = GridUnknown; |
455 | else if (!(lastState & MAXIMIZE_STATE) && |
456 | window->state () & MAXIMIZE_STATE) |
457 | + { |
458 | lastTarget = GridMaximize; |
459 | + if (window->grabbed ()) |
460 | + { |
461 | + originalSize = gScreen->slotToRect (window, |
462 | + window->serverBorderRect ()); |
463 | + } |
464 | + } |
465 | |
466 | window->stateChangeNotify (lastState); |
467 | -} |
468 | - |
469 | +} |
470 | + |
471 | +void |
472 | +GridWindow::windowNotify (CompWindowNotify n) |
473 | +{ |
474 | + if (n == CompWindowNotifyFrameUpdate) |
475 | + { |
476 | + if (isGridMaximized && (window->state () & MAXIMIZE_STATE)) |
477 | + { |
478 | + unsigned int valueMask = 0; |
479 | + XWindowChanges xwc; |
480 | + |
481 | + int dw = (lastBorder.left + lastBorder.right) - |
482 | + (window->border ().left + window->border ().right); |
483 | + |
484 | + int dh = (lastBorder.top + lastBorder.bottom) - |
485 | + (window->border ().top + window->border ().bottom); |
486 | + |
487 | + if (dw != 0) |
488 | + valueMask |= CWWidth; |
489 | + if (dh != 0) |
490 | + valueMask |= CWHeight; |
491 | + |
492 | + xwc.width = window->serverGeometry ().width () + dw; |
493 | + xwc.height = window->serverGeometry ().height () + dh; |
494 | + |
495 | + window->configureXWindow (valueMask, &xwc); |
496 | + } |
497 | + |
498 | + lastBorder = window->border (); |
499 | + } |
500 | + |
501 | + window->windowNotify (n); |
502 | +} |
503 | bool |
504 | GridScreen::restoreWindow (CompAction *action, |
505 | CompAction::State state, |
506 | @@ -755,6 +885,7 @@ |
507 | xwc.width = gw->originalSize.width (); |
508 | xwc.height = gw->originalSize.height (); |
509 | cw->maximize (0); |
510 | + gw->currentSize = CompRect (); |
511 | cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc); |
512 | gw->pointerBufDx = 0; |
513 | gw->pointerBufDy = 0; |
514 | @@ -860,17 +991,30 @@ |
515 | glScreen (GLScreen::get (screen)), |
516 | centerCheck (false), |
517 | mGrabWindow (NULL), |
518 | - animating (false) |
519 | + animating (false), |
520 | + mSwitchingVp (false) |
521 | { |
522 | o.push_back (CompOption ("window", CompOption::TypeInt)); |
523 | |
524 | ScreenInterface::setHandler (screen, false); |
525 | + screen->handleCompizEventSetEnabled (this, true); |
526 | CompositeScreenInterface::setHandler (cScreen, false); |
527 | GLScreenInterface::setHandler (glScreen, false); |
528 | |
529 | edge = lastEdge = lastResizeEdge = NoEdge; |
530 | currentWorkarea = lastWorkarea = screen->getWorkareaForOutput |
531 | (screen->outputDeviceForPoint (pointerX, pointerY)); |
532 | + gridProps[GridUnknown] = GridProps {0,1, 1,1}; |
533 | + gridProps[GridBottomLeft] = GridProps {0,1, 2,2}; |
534 | + gridProps[GridBottom] = GridProps {0,1, 1,2}; |
535 | + gridProps[GridBottomRight] = GridProps {1,1, 2,2}; |
536 | + gridProps[GridLeft] = GridProps {0,0, 2,1}; |
537 | + gridProps[GridCenter] = GridProps{0,0, 1,1}; |
538 | + gridProps[GridRight] = GridProps {1,0, 2,1}; |
539 | + gridProps[GridTopLeft] = GridProps{0,0, 2,2}; |
540 | + gridProps[GridTop] = GridProps {0,0, 1,2}; |
541 | + gridProps[GridTopRight] = GridProps {0,0, 1,2}; |
542 | + gridProps[GridMaximize] = GridProps {0,0, 1,1}; |
543 | |
544 | animations.clear (); |
545 | |
546 | @@ -878,16 +1022,16 @@ |
547 | optionSet##opt##Initiate (boost::bind (&GridScreen::initiateCommon, this, \ |
548 | _1, _2, _3, where, resize, key)) |
549 | |
550 | - GRIDSET (PutCenterKey, GridCenter, true, true); |
551 | - GRIDSET (PutLeftKey, GridLeft, true, true); |
552 | - GRIDSET (PutRightKey, GridRight, true, true); |
553 | - GRIDSET (PutTopKey, GridTop, true, true); |
554 | - GRIDSET (PutBottomKey, GridBottom, true, true); |
555 | - GRIDSET (PutTopleftKey, GridTopLeft, true, true); |
556 | - GRIDSET (PutToprightKey, GridTopRight, true, true); |
557 | - GRIDSET (PutBottomleftKey, GridBottomLeft, true, true); |
558 | - GRIDSET (PutBottomrightKey, GridBottomRight, true, true); |
559 | - GRIDSET (PutMaximizeKey, GridMaximize, true, true); |
560 | + GRIDSET (PutCenterKey, GridWindowType::GridCenter, true, true); |
561 | + GRIDSET (PutLeftKey, GridWindowType::GridLeft, true, true); |
562 | + GRIDSET (PutRightKey, GridWindowType::GridRight, true, true); |
563 | + GRIDSET (PutTopKey, GridWindowType::GridTop, true, true); |
564 | + GRIDSET (PutBottomKey, GridWindowType::GridBottom, true, true); |
565 | + GRIDSET (PutTopleftKey, GridWindowType::GridTopLeft, true, true); |
566 | + GRIDSET (PutToprightKey, GridWindowType::GridTopRight, true, true); |
567 | + GRIDSET (PutBottomleftKey, GridWindowType::GridBottomLeft, true, true); |
568 | + GRIDSET (PutBottomrightKey, GridWindowType::GridBottomRight, true, true); |
569 | + GRIDSET (PutMaximizeKey, GridWindowType::GridMaximize, true, true); |
570 | |
571 | #undef GRIDSET |
572 | |
573 | @@ -905,10 +1049,11 @@ |
574 | gScreen (GridScreen::get (screen)), |
575 | isGridResized (false), |
576 | isGridMaximized (false), |
577 | + grabMask (0), |
578 | pointerBufDx (0), |
579 | pointerBufDy (0), |
580 | resizeCount (0), |
581 | - lastTarget (GridUnknown) |
582 | + lastTarget (GridWindowType::GridUnknown) |
583 | { |
584 | WindowInterface::setHandler (window); |
585 | } |
586 | |
587 | === modified file 'src/grid.h' |
588 | --- src/grid.h 2011-09-24 06:59:55 +0000 |
589 | +++ src/grid.h 2011-09-29 12:41:49 +0000 |
590 | @@ -32,20 +32,22 @@ |
591 | |
592 | #define SNAPOFF_THRESHOLD 50 |
593 | |
594 | -typedef enum |
595 | +namespace GridWindowType |
596 | { |
597 | - GridUnknown = 0, |
598 | - GridBottomLeft = 1, |
599 | - GridBottom = 2, |
600 | - GridBottomRight = 3, |
601 | - GridLeft = 4, |
602 | - GridCenter = 5, |
603 | - GridRight = 6, |
604 | - GridTopLeft = 7, |
605 | - GridTop = 8, |
606 | - GridTopRight = 9, |
607 | - GridMaximize = 10 |
608 | -} GridType; |
609 | + static const unsigned int GridUnknown = (1 << 0); |
610 | + static const unsigned int GridBottomLeft = (1 << 1); |
611 | + static const unsigned int GridBottom = (1 << 2); |
612 | + static const unsigned int GridBottomRight = (1 << 3); |
613 | + static const unsigned int GridLeft = (1 << 4); |
614 | + static const unsigned int GridCenter = (1 << 5); |
615 | + static const unsigned int GridRight = (1 << 6); |
616 | + static const unsigned int GridTopLeft = (1 << 7); |
617 | + static const unsigned int GridTop = (1 << 8); |
618 | + static const unsigned int GridTopRight = (1 << 9); |
619 | + static const unsigned int GridMaximize = (1 << 10); |
620 | +}; |
621 | + |
622 | +typedef unsigned int GridType; |
623 | |
624 | typedef struct _GridProps |
625 | { |
626 | @@ -106,12 +108,13 @@ |
627 | bool centerCheck; |
628 | CompWindow *mGrabWindow; |
629 | bool animating; |
630 | + bool mSwitchingVp; |
631 | |
632 | void getPaintRectangle (CompRect&); |
633 | void setCurrentRect (Animation&); |
634 | |
635 | bool initiateCommon (CompAction*, CompAction::State, |
636 | - CompOption::Vector&, GridType, bool, bool); |
637 | + CompOption::Vector&, unsigned int, bool, bool); |
638 | |
639 | void glPaintRectangle (const GLScreenPaintAttrib&, |
640 | const GLMatrix&, CompOutput *); |
641 | @@ -125,9 +128,11 @@ |
642 | |
643 | std::vector <Animation> animations; |
644 | |
645 | - GridType edgeToGridType (); |
646 | + int edgeToGridType (); |
647 | + unsigned int typeToMask (int); |
648 | |
649 | void handleEvent (XEvent *event); |
650 | + void handleCompizEvent (const char *plugin, const char *event, CompOption::Vector &options); |
651 | |
652 | bool restoreWindow (CompAction*, |
653 | CompAction::State, |
654 | @@ -158,10 +163,13 @@ |
655 | |
656 | bool isGridResized; |
657 | bool isGridMaximized; |
658 | + unsigned int grabMask; |
659 | int pointerBufDx; |
660 | int pointerBufDy; |
661 | int resizeCount; |
662 | + CompRect currentSize; |
663 | CompRect originalSize; |
664 | + CompWindowExtents lastBorder; |
665 | GridType lastTarget; |
666 | |
667 | void grabNotify (int, int, unsigned int, unsigned int); |
668 | @@ -171,6 +179,8 @@ |
669 | void moveNotify (int, int, bool); |
670 | |
671 | void stateChangeNotify (unsigned int); |
672 | + |
673 | + void windowNotify (CompWindowNotify n); |
674 | }; |
675 | |
676 | #define GRID_WINDOW(w) \ |