Merge lp:~smspillaz/compiz-grid-plugin/oneiric.maybe_fix_corruption_placement into lp:compiz-grid-plugin
- oneiric.maybe_fix_corruption_placement
- Merge into 0.9.5
Proposed by
Sam Spilsbury
Status: | Superseded |
---|---|
Proposed branch: | lp:~smspillaz/compiz-grid-plugin/oneiric.maybe_fix_corruption_placement |
Merge into: | lp:compiz-grid-plugin |
Diff against target: |
739 lines (+313/-72) (has conflicts) 4 files modified
CMakeLists.txt (+2/-0) grid.xml.in (+14/-14) src/grid.cpp (+263/-44) src/grid.h (+34/-14) Text conflict in src/grid.cpp Text conflict in src/grid.h |
To merge this branch: | bzr merge lp:~smspillaz/compiz-grid-plugin/oneiric.maybe_fix_corruption_placement |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Compiz Maintainers | Pending | ||
Review via email: mp+77848@code.launchpad.net |
This proposal has been superseded by a proposal from 2011-10-03.
Commit message
Description of the change
To post a comment you must log in.
Unmerged revisions
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-10-03 00:29:23 +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-10-03 00:29:23 +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-29 15:54:11 +0000 |
114 | +++ src/grid.cpp 2011-10-03 00:29:23 +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,8 +120,14 @@ |
169 | GridScreen::initiateCommon (CompAction *action, |
170 | CompAction::State state, |
171 | CompOption::Vector &option, |
172 | +<<<<<<< TREE |
173 | GridType where, |
174 | bool resize) |
175 | +======= |
176 | + unsigned int where, |
177 | + bool resize, |
178 | + bool key) |
179 | +>>>>>>> MERGE-SOURCE |
180 | { |
181 | Window xid; |
182 | CompWindow *cw = 0; |
183 | @@ -127,16 +135,27 @@ |
184 | xid = CompOption::getIntOptionNamed (option, "window"); |
185 | cw = screen->findWindow (xid); |
186 | |
187 | - if (where == GridUnknown || screen->otherGrabExist ("move", NULL)) |
188 | - return false; |
189 | - |
190 | if (cw) |
191 | { |
192 | XWindowChanges xwc; |
193 | + bool maximizeH = where & (GridBottom | GridTop | GridMaximize); |
194 | + bool maximizeV = where & (GridLeft | GridRight | GridMaximize); |
195 | + |
196 | + if (!(cw->actions () & CompWindowActionResizeMask)) |
197 | + return false; |
198 | + |
199 | + if (maximizeH && !(cw->actions () & CompWindowActionMaximizeHorzMask)) |
200 | + return false; |
201 | + |
202 | + if (maximizeV && !(cw->actions () & CompWindowActionMaximizeVertMask)) |
203 | + return false; |
204 | + |
205 | + if (where & GridUnknown) |
206 | + return false; |
207 | |
208 | GRID_WINDOW (cw); |
209 | |
210 | - if (gw->lastTarget != where) |
211 | + if (gw->lastTarget & ~(where)) |
212 | gw->resizeCount = 0; |
213 | |
214 | props = gridProps[where]; |
215 | @@ -164,7 +183,7 @@ |
216 | cw->maximize (0); |
217 | } |
218 | |
219 | - if (where == GridMaximize && resize) |
220 | + if ((where & GridMaximize) && resize) |
221 | { |
222 | /* move the window to the correct output */ |
223 | if (cw == mGrabWindow) |
224 | @@ -198,7 +217,13 @@ |
225 | desiredSlot.setWidth (workarea.width () / props.numCellsX); |
226 | |
227 | /* Adjust for constraints and decorations */ |
228 | - desiredRect = constrainSize (cw, desiredSlot); |
229 | + if (where & ~(GridMaximize | GridLeft | GridRight)) |
230 | + { |
231 | + desiredRect = constrainSize (cw, desiredSlot); |
232 | + } |
233 | + else |
234 | + desiredRect = slotToRect (cw, desiredSlot); |
235 | + |
236 | /* Get current rect not including decorations */ |
237 | currentRect.setGeometry (cw->serverX (), cw->serverY (), |
238 | cw->serverWidth (), |
239 | @@ -206,7 +231,7 @@ |
240 | |
241 | if (desiredRect.y () == currentRect.y () && |
242 | desiredRect.height () == currentRect.height () && |
243 | - where != GridMaximize && gw->lastTarget == where) |
244 | + where & ~(GridMaximize | GridLeft | GridRight) && gw->lastTarget & where) |
245 | { |
246 | int slotWidth25 = workarea.width () / 4; |
247 | int slotWidth33 = (workarea.width () / 3) + cw->border ().left; |
248 | @@ -319,12 +344,71 @@ |
249 | /* TODO: animate move+resize */ |
250 | if (resize) |
251 | { |
252 | +<<<<<<< TREE |
253 | cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc); |
254 | gw->isGridResized = true; |
255 | gw->isGridMaximized = false; |
256 | for (unsigned int i = 0; i < animations.size (); i++) |
257 | animations.at (i).fadingOut = true; |
258 | gw->lastTarget = where; |
259 | +======= |
260 | + unsigned int valueMask = CWX | CWY | CWWidth | CWHeight; |
261 | + gw->lastTarget = where; |
262 | + gw->currentSize = CompRect (wc.x, wc.y, wc.width, wc.height); |
263 | + CompWindowExtents lastBorder = gw->window->border (); |
264 | + |
265 | + gw->sizeHintsFlags = 0; |
266 | + |
267 | + /* Special case for left and right, actually vertically maximize |
268 | + * the window */ |
269 | + if (where & GridLeft || where & GridRight) |
270 | + { |
271 | + /* First restore the window to its original size */ |
272 | + XWindowChanges rwc; |
273 | + |
274 | + rwc.x = gw->originalSize.x (); |
275 | + rwc.y = gw->originalSize.y (); |
276 | + rwc.width = gw->originalSize.width (); |
277 | + rwc.height = gw->originalSize.height (); |
278 | + |
279 | + cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &rwc); |
280 | + |
281 | + gw->isGridMaximized = true; |
282 | + gw->isGridResized = false; |
283 | + |
284 | + /* Maximize the window */ |
285 | + cw->maximize (CompWindowStateMaximizedVertMask); |
286 | + |
287 | + /* Be evil */ |
288 | + if (cw->sizeHints ().flags & PResizeInc) |
289 | + { |
290 | + gw->sizeHintsFlags |= PResizeInc; |
291 | + gw->window->sizeHints ().flags &= ~(PResizeInc); |
292 | + } |
293 | + } |
294 | + else |
295 | + { |
296 | + gw->isGridResized = true; |
297 | + gw->isGridMaximized = false; |
298 | + } |
299 | + |
300 | + int dw = (lastBorder.left + lastBorder.right) - |
301 | + (gw->window->border ().left + |
302 | + gw->window->border ().right); |
303 | + |
304 | + int dh = (lastBorder.top + lastBorder.bottom) - |
305 | + (gw->window->border ().top + |
306 | + gw->window->border ().bottom); |
307 | + |
308 | + xwc.width += dw; |
309 | + xwc.height += dh; |
310 | + |
311 | + /* Make window the size that we want */ |
312 | + cw->configureXWindow (valueMask, &xwc); |
313 | + |
314 | + for (unsigned int i = 0; i < animations.size (); i++) |
315 | + animations.at (i).fadingOut = true; |
316 | +>>>>>>> MERGE-SOURCE |
317 | } |
318 | |
319 | /* This centers a window if it could not be resized to the desired |
320 | @@ -452,39 +536,72 @@ |
321 | return status; |
322 | } |
323 | |
324 | -GridType |
325 | +unsigned int |
326 | +GridScreen::typeToMask (int t) |
327 | +{ |
328 | + typedef struct { |
329 | + unsigned int mask; |
330 | + int type; |
331 | + } GridTypeMask; |
332 | + |
333 | + std::vector <GridTypeMask> type = |
334 | + { |
335 | + { GridWindowType::GridUnknown, 0 }, |
336 | + { GridWindowType::GridBottomLeft, 1 }, |
337 | + { GridWindowType::GridBottom, 2 }, |
338 | + { GridWindowType::GridBottomRight, 3 }, |
339 | + { GridWindowType::GridLeft, 4 }, |
340 | + { GridWindowType::GridCenter, 5 }, |
341 | + { GridWindowType::GridRight, 6 }, |
342 | + { GridWindowType::GridTopLeft, 7 }, |
343 | + { GridWindowType::GridTop, 8 }, |
344 | + { GridWindowType::GridTopRight, 9 }, |
345 | + { GridWindowType::GridMaximize, 10 } |
346 | + }; |
347 | + |
348 | + for (unsigned int i = 0; i < type.size (); i++) |
349 | + { |
350 | + GridTypeMask &tm = type[i]; |
351 | + if (tm.type == t) |
352 | + return tm.mask; |
353 | + } |
354 | + |
355 | + return GridWindowType::GridUnknown; |
356 | +} |
357 | + |
358 | +int |
359 | GridScreen::edgeToGridType () |
360 | { |
361 | - GridType ret; |
362 | + int ret; |
363 | |
364 | switch (edge) { |
365 | case Left: |
366 | - ret = (GridType) optionGetLeftEdgeAction (); |
367 | + ret = (int) optionGetLeftEdgeAction (); |
368 | break; |
369 | case Right: |
370 | - ret = (GridType) optionGetRightEdgeAction (); |
371 | + ret = (int) optionGetRightEdgeAction (); |
372 | break; |
373 | case Top: |
374 | - ret = (GridType) optionGetTopEdgeAction (); |
375 | + ret = (int) optionGetTopEdgeAction (); |
376 | break; |
377 | case Bottom: |
378 | - ret = (GridType) optionGetBottomEdgeAction (); |
379 | + ret = (int) optionGetBottomEdgeAction (); |
380 | break; |
381 | case TopLeft: |
382 | - ret = (GridType) optionGetTopLeftCornerAction (); |
383 | + ret = (int) optionGetTopLeftCornerAction (); |
384 | break; |
385 | case TopRight: |
386 | - ret = (GridType) optionGetTopRightCornerAction (); |
387 | + ret = (int) optionGetTopRightCornerAction (); |
388 | break; |
389 | case BottomLeft: |
390 | - ret = (GridType) optionGetBottomLeftCornerAction (); |
391 | + ret = (int) optionGetBottomLeftCornerAction (); |
392 | break; |
393 | case BottomRight: |
394 | - ret = (GridType) optionGetBottomRightCornerAction (); |
395 | + ret = (int) optionGetBottomRightCornerAction (); |
396 | break; |
397 | case NoEdge: |
398 | default: |
399 | - ret = GridUnknown; |
400 | + ret = -1; |
401 | break; |
402 | } |
403 | |
404 | @@ -548,7 +665,11 @@ |
405 | if (cScreen) |
406 | cScreen->damageRegion (desiredSlot); |
407 | |
408 | +<<<<<<< TREE |
409 | initiateCommon (0, 0, o, edgeToGridType (), false); |
410 | +======= |
411 | + initiateCommon (0, 0, o, typeToMask (edgeToGridType ()), false, false); |
412 | +>>>>>>> MERGE-SOURCE |
413 | |
414 | if (cScreen) |
415 | cScreen->damageRegion (desiredSlot); |
416 | @@ -566,7 +687,11 @@ |
417 | if (cScreen) |
418 | cScreen->damageRegion (desiredSlot); |
419 | |
420 | +<<<<<<< TREE |
421 | initiateCommon (0, 0, o, edgeToGridType (), false); |
422 | +======= |
423 | + check = initiateCommon (NULL, 0, o, typeToMask (edgeToGridType ()), false, false); |
424 | +>>>>>>> MERGE-SOURCE |
425 | |
426 | if (cScreen) |
427 | cScreen->damageRegion (desiredSlot); |
428 | @@ -614,12 +739,27 @@ |
429 | } |
430 | |
431 | void |
432 | +GridWindow::validateResizeRequest (unsigned int &xwcm, |
433 | + XWindowChanges *xwc, |
434 | + unsigned int source) |
435 | +{ |
436 | + window->validateResizeRequest (xwcm, xwc, source); |
437 | + |
438 | + /* Don't allow non-pagers to change |
439 | + * the size of the window, the user |
440 | + * specified this size, thank-you */ |
441 | + if (isGridMaximized) |
442 | + if (source != ClientTypePager) |
443 | + xwcm = 0; |
444 | +} |
445 | + |
446 | +void |
447 | GridWindow::grabNotify (int x, |
448 | int y, |
449 | unsigned int state, |
450 | unsigned int mask) |
451 | { |
452 | - if (screen->grabExist ("move")) |
453 | + if (mask & (CompWindowGrabMoveMask | CompWindowGrabButtonMask)) |
454 | { |
455 | gScreen->o.push_back (CompOption ("window", CompOption::TypeInt)); |
456 | gScreen->o[0].value ().set ((int) window->id ()); |
457 | @@ -627,14 +767,15 @@ |
458 | screen->handleEventSetEnabled (gScreen, true); |
459 | gScreen->mGrabWindow = window; |
460 | pointerBufDx = pointerBufDy = 0; |
461 | + grabMask = mask; |
462 | |
463 | - if (!isGridResized && gScreen->optionGetSnapbackWindows ()) |
464 | + if (!isGridResized && !isGridMaximized && gScreen->optionGetSnapbackWindows ()) |
465 | /* Store size not including borders when grabbing with cursor */ |
466 | originalSize = gScreen->slotToRect(window, |
467 | window->serverBorderRect ()); |
468 | } |
469 | |
470 | - if (screen->grabExist ("resize")) |
471 | + if (mask & CompWindowGrabResizeMask) |
472 | { |
473 | isGridResized = false; |
474 | resizeCount = 0; |
475 | @@ -649,9 +790,15 @@ |
476 | if (window == gScreen->mGrabWindow) |
477 | { |
478 | gScreen->initiateCommon |
479 | +<<<<<<< TREE |
480 | (0, 0, gScreen->o, gScreen->edgeToGridType (), true); |
481 | +======= |
482 | + (NULL, 0, gScreen->o, gScreen->typeToMask (gScreen->edgeToGridType ()), true, |
483 | + gScreen->edge != gScreen->lastResizeEdge); |
484 | +>>>>>>> MERGE-SOURCE |
485 | |
486 | screen->handleEventSetEnabled (gScreen, false); |
487 | + grabMask = 0; |
488 | gScreen->mGrabWindow = NULL; |
489 | gScreen->cScreen->damageRegion (gScreen->desiredSlot); |
490 | } |
491 | @@ -666,6 +813,7 @@ |
492 | { |
493 | window->moveNotify (dx, dy, immediate); |
494 | |
495 | +<<<<<<< TREE |
496 | if (isGridResized) |
497 | { |
498 | pointerBufDx += dx; |
499 | @@ -678,8 +826,48 @@ |
500 | window->move (-dx, -dy); |
501 | window->moveNotifySetEnabled (this, true); |
502 | } |
503 | -} |
504 | - |
505 | +======= |
506 | + if (isGridResized && !isGridMaximized && !GridScreen::get (screen)->mSwitchingVp) |
507 | + { |
508 | + if (window->grabbed () && (grabMask & CompWindowGrabMoveMask)) |
509 | + { |
510 | + pointerBufDx += dx; |
511 | + pointerBufDy += dy; |
512 | + } |
513 | + |
514 | + /* Do not allow the window to be moved while it |
515 | + * is resized */ |
516 | + dx = currentSize.x () - window->geometry ().x (); |
517 | + dy = currentSize.y () - window->geometry ().y (); |
518 | + |
519 | + window->move (dx, dy); |
520 | + } |
521 | +>>>>>>> MERGE-SOURCE |
522 | +} |
523 | + |
524 | +<<<<<<< TREE |
525 | +======= |
526 | +void |
527 | +GridWindow::stateChangeNotify (unsigned int lastState) |
528 | +{ |
529 | + if (lastState & MAXIMIZE_STATE && |
530 | + !(window->state () & MAXIMIZE_STATE)) |
531 | + lastTarget = GridUnknown; |
532 | + else if (!(lastState & MAXIMIZE_STATE) && |
533 | + window->state () & MAXIMIZE_STATE) |
534 | + { |
535 | + lastTarget = GridMaximize; |
536 | + if (window->grabbed ()) |
537 | + { |
538 | + originalSize = gScreen->slotToRect (window, |
539 | + window->serverBorderRect ()); |
540 | + } |
541 | + } |
542 | + |
543 | + window->stateChangeNotify (lastState); |
544 | +} |
545 | + |
546 | +>>>>>>> MERGE-SOURCE |
547 | bool |
548 | GridScreen::restoreWindow (CompAction *action, |
549 | CompAction::State state, |
550 | @@ -697,7 +885,10 @@ |
551 | return false; |
552 | |
553 | if (gw->isGridMaximized & !(cw->state () & MAXIMIZE_STATE)) |
554 | - gw->isGridMaximized = false; |
555 | + { |
556 | + gw->window->sizeHints ().flags |= gw->sizeHintsFlags; |
557 | + gw->isGridMaximized = false; |
558 | + } |
559 | else |
560 | { |
561 | if (cw == mGrabWindow) |
562 | @@ -713,6 +904,7 @@ |
563 | xwc.width = gw->originalSize.width (); |
564 | xwc.height = gw->originalSize.height (); |
565 | cw->maximize (0); |
566 | + gw->currentSize = CompRect (); |
567 | cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc); |
568 | gw->pointerBufDx = 0; |
569 | gw->pointerBufDy = 0; |
570 | @@ -818,16 +1010,29 @@ |
571 | glScreen (GLScreen::get (screen)), |
572 | centerCheck (false), |
573 | mGrabWindow (NULL), |
574 | - animating (false) |
575 | + animating (false), |
576 | + mSwitchingVp (false) |
577 | { |
578 | |
579 | ScreenInterface::setHandler (screen, false); |
580 | + screen->handleCompizEventSetEnabled (this, true); |
581 | CompositeScreenInterface::setHandler (cScreen, false); |
582 | GLScreenInterface::setHandler (glScreen, false); |
583 | |
584 | edge = lastEdge = NoEdge; |
585 | currentWorkarea = lastWorkarea = screen->getWorkareaForOutput |
586 | (screen->outputDeviceForPoint (pointerX, pointerY)); |
587 | + gridProps[GridUnknown] = GridProps {0,1, 1,1}; |
588 | + gridProps[GridBottomLeft] = GridProps {0,1, 2,2}; |
589 | + gridProps[GridBottom] = GridProps {0,1, 1,2}; |
590 | + gridProps[GridBottomRight] = GridProps {1,1, 2,2}; |
591 | + gridProps[GridLeft] = GridProps {0,0, 2,1}; |
592 | + gridProps[GridCenter] = GridProps{0,0, 1,1}; |
593 | + gridProps[GridRight] = GridProps {1,0, 2,1}; |
594 | + gridProps[GridTopLeft] = GridProps{0,0, 2,2}; |
595 | + gridProps[GridTop] = GridProps {0,0, 1,2}; |
596 | + gridProps[GridTopRight] = GridProps {0,0, 1,2}; |
597 | + gridProps[GridMaximize] = GridProps {0,0, 1,1}; |
598 | |
599 | animations.clear (); |
600 | |
601 | @@ -835,6 +1040,7 @@ |
602 | optionSet##opt##Initiate (boost::bind (&GridScreen::initiateCommon, this, \ |
603 | _1, _2, _3, where, resize)) |
604 | |
605 | +<<<<<<< TREE |
606 | GRIDSET (PutCenterKey, GridCenter, true); |
607 | GRIDSET (PutLeftKey, GridLeft, true); |
608 | GRIDSET (PutRightKey, GridRight, true); |
609 | @@ -845,6 +1051,18 @@ |
610 | GRIDSET (PutBottomleftKey, GridBottomLeft, true); |
611 | GRIDSET (PutBottomrightKey, GridBottomRight, true); |
612 | GRIDSET (PutMaximizeKey, GridMaximize, true); |
613 | +======= |
614 | + GRIDSET (PutCenterKey, GridWindowType::GridCenter, true, true); |
615 | + GRIDSET (PutLeftKey, GridWindowType::GridLeft, true, true); |
616 | + GRIDSET (PutRightKey, GridWindowType::GridRight, true, true); |
617 | + GRIDSET (PutTopKey, GridWindowType::GridTop, true, true); |
618 | + GRIDSET (PutBottomKey, GridWindowType::GridBottom, true, true); |
619 | + GRIDSET (PutTopleftKey, GridWindowType::GridTopLeft, true, true); |
620 | + GRIDSET (PutToprightKey, GridWindowType::GridTopRight, true, true); |
621 | + GRIDSET (PutBottomleftKey, GridWindowType::GridBottomLeft, true, true); |
622 | + GRIDSET (PutBottomrightKey, GridWindowType::GridBottomRight, true, true); |
623 | + GRIDSET (PutMaximizeKey, GridWindowType::GridMaximize, true, true); |
624 | +>>>>>>> MERGE-SOURCE |
625 | |
626 | #undef GRIDSET |
627 | |
628 | @@ -862,9 +1080,10 @@ |
629 | gScreen (GridScreen::get (screen)), |
630 | isGridResized (false), |
631 | isGridMaximized (false), |
632 | + grabMask (0), |
633 | pointerBufDx (0), |
634 | pointerBufDy (0), |
635 | - resizeCount (0), |
636 | + resizeCount (0), |
637 | lastTarget (GridUnknown) |
638 | { |
639 | WindowInterface::setHandler (window); |
640 | |
641 | === modified file 'src/grid.h' |
642 | --- src/grid.h 2011-09-29 15:54:11 +0000 |
643 | +++ src/grid.h 2011-10-03 00:29:23 +0000 |
644 | @@ -32,20 +32,22 @@ |
645 | |
646 | #define SNAPOFF_THRESHOLD 50 |
647 | |
648 | -typedef enum |
649 | +namespace GridWindowType |
650 | { |
651 | - GridUnknown = 0, |
652 | - GridBottomLeft = 1, |
653 | - GridBottom = 2, |
654 | - GridBottomRight = 3, |
655 | - GridLeft = 4, |
656 | - GridCenter = 5, |
657 | - GridRight = 6, |
658 | - GridTopLeft = 7, |
659 | - GridTop = 8, |
660 | - GridTopRight = 9, |
661 | - GridMaximize = 10 |
662 | -} GridType; |
663 | + static const unsigned int GridUnknown = (1 << 0); |
664 | + static const unsigned int GridBottomLeft = (1 << 1); |
665 | + static const unsigned int GridBottom = (1 << 2); |
666 | + static const unsigned int GridBottomRight = (1 << 3); |
667 | + static const unsigned int GridLeft = (1 << 4); |
668 | + static const unsigned int GridCenter = (1 << 5); |
669 | + static const unsigned int GridRight = (1 << 6); |
670 | + static const unsigned int GridTopLeft = (1 << 7); |
671 | + static const unsigned int GridTop = (1 << 8); |
672 | + static const unsigned int GridTopRight = (1 << 9); |
673 | + static const unsigned int GridMaximize = (1 << 10); |
674 | +}; |
675 | + |
676 | +typedef unsigned int GridType; |
677 | |
678 | typedef struct _GridProps |
679 | { |
680 | @@ -106,12 +108,17 @@ |
681 | bool centerCheck; |
682 | CompWindow *mGrabWindow; |
683 | bool animating; |
684 | + bool mSwitchingVp; |
685 | |
686 | void getPaintRectangle (CompRect&); |
687 | void setCurrentRect (Animation&); |
688 | |
689 | bool initiateCommon (CompAction*, CompAction::State, |
690 | +<<<<<<< TREE |
691 | CompOption::Vector&, GridType, bool); |
692 | +======= |
693 | + CompOption::Vector&, unsigned int, bool, bool); |
694 | +>>>>>>> MERGE-SOURCE |
695 | |
696 | void glPaintRectangle (const GLScreenPaintAttrib&, |
697 | const GLMatrix&, CompOutput *); |
698 | @@ -125,9 +132,11 @@ |
699 | |
700 | std::vector <Animation> animations; |
701 | |
702 | - GridType edgeToGridType (); |
703 | + int edgeToGridType (); |
704 | + unsigned int typeToMask (int); |
705 | |
706 | void handleEvent (XEvent *event); |
707 | + void handleCompizEvent (const char *plugin, const char *event, CompOption::Vector &options); |
708 | |
709 | bool restoreWindow (CompAction*, |
710 | CompAction::State, |
711 | @@ -157,17 +166,28 @@ |
712 | |
713 | bool isGridResized; |
714 | bool isGridMaximized; |
715 | + unsigned int grabMask; |
716 | int pointerBufDx; |
717 | int pointerBufDy; |
718 | int resizeCount; |
719 | + CompRect currentSize; |
720 | CompRect originalSize; |
721 | GridType lastTarget; |
722 | + unsigned int sizeHintsFlags; |
723 | |
724 | void grabNotify (int, int, unsigned int, unsigned int); |
725 | |
726 | void ungrabNotify (); |
727 | |
728 | void moveNotify (int, int, bool); |
729 | +<<<<<<< TREE |
730 | +======= |
731 | + |
732 | + void stateChangeNotify (unsigned int); |
733 | + void validateResizeRequest (unsigned int &valueMask, |
734 | + XWindowChanges *xwc, |
735 | + unsigned int source); |
736 | +>>>>>>> MERGE-SOURCE |
737 | }; |
738 | |
739 | #define GRID_WINDOW(w) \ |