Merge lp:~smspillaz/compiz-grid-plugin/oneiric.maybe_fix_corruption_placement into lp:compiz-grid-plugin

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
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.

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
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2009-12-17 12:22:47 +0000
+++ CMakeLists.txt 2011-10-03 00:29:23 +0000
@@ -2,4 +2,6 @@
22
3include (CompizPlugin)3include (CompizPlugin)
44
5set (CMAKE_CXX_FLAGS -std=c++0x)
6
5compiz_plugin(grid PLUGINDEPS composite opengl)7compiz_plugin(grid PLUGINDEPS composite opengl)
68
=== modified file 'grid.xml.in'
--- grid.xml.in 2010-09-28 22:30:57 +0000
+++ grid.xml.in 2011-10-03 00:29:23 +0000
@@ -84,7 +84,7 @@
84 <option name="top_left_corner_action" type="int">84 <option name="top_left_corner_action" type="int">
85 <_short>Upper Left Corner</_short>85 <_short>Upper Left Corner</_short>
86 <_long>Action to be performed when window is dropped on the top left corner</_long>86 <_long>Action to be performed when window is dropped on the top left corner</_long>
87 <default>7</default>87 <default>4</default>
88 <min>0</min>88 <min>0</min>
89 <max>10</max>89 <max>10</max>
90 <desc>90 <desc>
@@ -186,7 +186,7 @@
186 <option name="top_right_corner_action" type="int">186 <option name="top_right_corner_action" type="int">
187 <_short>Upper Right Corner</_short>187 <_short>Upper Right Corner</_short>
188 <_long>Action to be performed when window is dropped on the top right corner</_long>188 <_long>Action to be performed when window is dropped on the top right corner</_long>
189 <default>9</default>189 <default>6</default>
190 <min>0</min>190 <min>0</min>
191 <max>10</max>191 <max>10</max>
192 <desc>192 <desc>
@@ -339,7 +339,7 @@
339 <option name="bottom_left_corner_action" type="int">339 <option name="bottom_left_corner_action" type="int">
340 <_short>Bottom Left Corner</_short>340 <_short>Bottom Left Corner</_short>
341 <_long>Action to be performed when window is dropped on the bottom left corner</_long>341 <_long>Action to be performed when window is dropped on the bottom left corner</_long>
342 <default>1</default>342 <default>4</default>
343 <min>0</min>343 <min>0</min>
344 <max>10</max>344 <max>10</max>
345 <desc>345 <desc>
@@ -390,7 +390,7 @@
390 <option name="bottom_edge_action" type="int">390 <option name="bottom_edge_action" type="int">
391 <_short>Bottom Edge</_short>391 <_short>Bottom Edge</_short>
392 <_long>Action to be performed when window is dropped on the bottom edge</_long>392 <_long>Action to be performed when window is dropped on the bottom edge</_long>
393 <default>2</default>393 <default>0</default>
394 <min>0</min>394 <min>0</min>
395 <max>10</max>395 <max>10</max>
396 <desc>396 <desc>
@@ -441,7 +441,7 @@
441 <option name="bottom_right_corner_action" type="int">441 <option name="bottom_right_corner_action" type="int">
442 <_short>Bottom Right Corner</_short>442 <_short>Bottom Right Corner</_short>
443 <_long>Action to be performed when window is dropped on the bottom right corner</_long>443 <_long>Action to be performed when window is dropped on the bottom right corner</_long>
444 <default>3</default>444 <default>6</default>
445 <min>0</min>445 <min>0</min>
446 <max>10</max>446 <max>10</max>
447 <desc>447 <desc>
@@ -505,21 +505,21 @@
505 <option name="left_edge_threshold" type="int">505 <option name="left_edge_threshold" type="int">
506 <_short>Left Edge</_short>506 <_short>Left Edge</_short>
507 <_long>Maximum number of pixels from the left edge a window can be dropped</_long>507 <_long>Maximum number of pixels from the left edge a window can be dropped</_long>
508 <default>5</default>508 <default>15</default>
509 <min>0</min>509 <min>0</min>
510 <max>500</max>510 <max>500</max>
511 </option>511 </option>
512 <option name="right_edge_threshold" type="int">512 <option name="right_edge_threshold" type="int">
513 <_short>Right Edge</_short>513 <_short>Right Edge</_short>
514 <_long>Maximum number of pixels from the right edge a window can be dropped</_long>514 <_long>Maximum number of pixels from the right edge a window can be dropped</_long>
515 <default>5</default>515 <default>15</default>
516 <min>0</min>516 <min>0</min>
517 <max>500</max>517 <max>500</max>
518 </option>518 </option>
519 <option name="top_edge_threshold" type="int">519 <option name="top_edge_threshold" type="int">
520 <_short>Top Edge</_short>520 <_short>Top Edge</_short>
521 <_long>Maximum number of pixels from the top edge a window can be dropped</_long>521 <_long>Maximum number of pixels from the top edge a window can be dropped</_long>
522 <default>5</default>522 <default>20</default>
523 <min>0</min>523 <min>0</min>
524 <max>500</max>524 <max>500</max>
525 </option>525 </option>
@@ -543,9 +543,9 @@
543 <_short>Outline Color</_short>543 <_short>Outline Color</_short>
544 <_long>Color of the resize indicator outline</_long>544 <_long>Color of the resize indicator outline</_long>
545 <default>545 <default>
546 <red>0x2f2f</red>546 <red>0xfbfb</red>
547 <green>0x2f2f</green>547 <green>0x8b8b</green>
548 <blue>0x4f4f</blue>548 <blue>0x0</blue>
549 <alpha>0x9f9f</alpha>549 <alpha>0x9f9f</alpha>
550 </default>550 </default>
551 </option>551 </option>
@@ -553,9 +553,9 @@
553 <_short>Fill Color</_short>553 <_short>Fill Color</_short>
554 <_long>Fill color of the resize indicator</_long>554 <_long>Fill color of the resize indicator</_long>
555 <default>555 <default>
556 <red>0x2f2f</red>556 <red>0xfbfb</red>
557 <green>0x2f2f</green>557 <green>0x8b8b</green>
558 <blue>0x4f4f</blue>558 <blue>0x0</blue>
559 <alpha>0x4f4f</alpha>559 <alpha>0x4f4f</alpha>
560 </default>560 </default>
561 </option>561 </option>
562562
=== modified file 'src/grid.cpp'
--- src/grid.cpp 2011-09-29 15:54:11 +0000
+++ src/grid.cpp 2011-10-03 00:29:23 +0000
@@ -24,24 +24,26 @@
2424
25#include "grid.h"25#include "grid.h"
2626
27static const GridProps gridProps[] =27using namespace GridWindowType;
28
29static std::map <unsigned int, GridProps> gridProps;
30
31void
32GridScreen::handleCompizEvent(const char* plugin,
33 const char* event,
34 CompOption::Vector& o)
28{35{
29 {0,1, 1,1},36 if (strcmp(event, "start_viewport_switch") == 0)
3037 {
31 {0,1, 2,2},38 mSwitchingVp = true;
32 {0,1, 1,2},39 }
33 {1,1, 2,2},40 else if (strcmp(event, "end_viewport_switch") == 0)
3441 {
35 {0,0, 2,1},42 mSwitchingVp = false;
36 {0,0, 1,1},43 }
37 {1,0, 2,1},44
3845 screen->handleCompizEvent(plugin, event, o);
39 {0,0, 2,2},46}
40 {0,0, 1,2},
41 {1,0, 2,2},
42
43 {0,0, 1,1},
44};
4547
46CompRect48CompRect
47GridScreen::slotToRect (CompWindow *w,49GridScreen::slotToRect (CompWindow *w,
@@ -83,7 +85,7 @@
83void85void
84GridScreen::getPaintRectangle (CompRect &cRect)86GridScreen::getPaintRectangle (CompRect &cRect)
85{87{
86 if (edgeToGridType () != GridUnknown && optionGetDrawIndicator ())88 if (typeToMask (edgeToGridType ()) != GridUnknown && optionGetDrawIndicator ())
87 cRect = desiredSlot;89 cRect = desiredSlot;
88 else90 else
89 cRect.setGeometry (0, 0, 0, 0);91 cRect.setGeometry (0, 0, 0, 0);
@@ -118,8 +120,14 @@
118GridScreen::initiateCommon (CompAction *action,120GridScreen::initiateCommon (CompAction *action,
119 CompAction::State state,121 CompAction::State state,
120 CompOption::Vector &option,122 CompOption::Vector &option,
123<<<<<<< TREE
121 GridType where,124 GridType where,
122 bool resize)125 bool resize)
126=======
127 unsigned int where,
128 bool resize,
129 bool key)
130>>>>>>> MERGE-SOURCE
123{131{
124 Window xid;132 Window xid;
125 CompWindow *cw = 0;133 CompWindow *cw = 0;
@@ -127,16 +135,27 @@
127 xid = CompOption::getIntOptionNamed (option, "window");135 xid = CompOption::getIntOptionNamed (option, "window");
128 cw = screen->findWindow (xid);136 cw = screen->findWindow (xid);
129137
130 if (where == GridUnknown || screen->otherGrabExist ("move", NULL))
131 return false;
132
133 if (cw)138 if (cw)
134 {139 {
135 XWindowChanges xwc;140 XWindowChanges xwc;
141 bool maximizeH = where & (GridBottom | GridTop | GridMaximize);
142 bool maximizeV = where & (GridLeft | GridRight | GridMaximize);
143
144 if (!(cw->actions () & CompWindowActionResizeMask))
145 return false;
146
147 if (maximizeH && !(cw->actions () & CompWindowActionMaximizeHorzMask))
148 return false;
149
150 if (maximizeV && !(cw->actions () & CompWindowActionMaximizeVertMask))
151 return false;
152
153 if (where & GridUnknown)
154 return false;
136155
137 GRID_WINDOW (cw);156 GRID_WINDOW (cw);
138157
139 if (gw->lastTarget != where)158 if (gw->lastTarget & ~(where))
140 gw->resizeCount = 0;159 gw->resizeCount = 0;
141160
142 props = gridProps[where];161 props = gridProps[where];
@@ -164,7 +183,7 @@
164 cw->maximize (0);183 cw->maximize (0);
165 }184 }
166185
167 if (where == GridMaximize && resize)186 if ((where & GridMaximize) && resize)
168 {187 {
169 /* move the window to the correct output */188 /* move the window to the correct output */
170 if (cw == mGrabWindow)189 if (cw == mGrabWindow)
@@ -198,7 +217,13 @@
198 desiredSlot.setWidth (workarea.width () / props.numCellsX);217 desiredSlot.setWidth (workarea.width () / props.numCellsX);
199218
200 /* Adjust for constraints and decorations */219 /* Adjust for constraints and decorations */
201 desiredRect = constrainSize (cw, desiredSlot);220 if (where & ~(GridMaximize | GridLeft | GridRight))
221 {
222 desiredRect = constrainSize (cw, desiredSlot);
223 }
224 else
225 desiredRect = slotToRect (cw, desiredSlot);
226
202 /* Get current rect not including decorations */227 /* Get current rect not including decorations */
203 currentRect.setGeometry (cw->serverX (), cw->serverY (),228 currentRect.setGeometry (cw->serverX (), cw->serverY (),
204 cw->serverWidth (),229 cw->serverWidth (),
@@ -206,7 +231,7 @@
206231
207 if (desiredRect.y () == currentRect.y () &&232 if (desiredRect.y () == currentRect.y () &&
208 desiredRect.height () == currentRect.height () &&233 desiredRect.height () == currentRect.height () &&
209 where != GridMaximize && gw->lastTarget == where)234 where & ~(GridMaximize | GridLeft | GridRight) && gw->lastTarget & where)
210 {235 {
211 int slotWidth25 = workarea.width () / 4;236 int slotWidth25 = workarea.width () / 4;
212 int slotWidth33 = (workarea.width () / 3) + cw->border ().left;237 int slotWidth33 = (workarea.width () / 3) + cw->border ().left;
@@ -319,12 +344,71 @@
319 /* TODO: animate move+resize */344 /* TODO: animate move+resize */
320 if (resize)345 if (resize)
321 {346 {
347<<<<<<< TREE
322 cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc);348 cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc);
323 gw->isGridResized = true;349 gw->isGridResized = true;
324 gw->isGridMaximized = false;350 gw->isGridMaximized = false;
325 for (unsigned int i = 0; i < animations.size (); i++)351 for (unsigned int i = 0; i < animations.size (); i++)
326 animations.at (i).fadingOut = true;352 animations.at (i).fadingOut = true;
327 gw->lastTarget = where;353 gw->lastTarget = where;
354=======
355 unsigned int valueMask = CWX | CWY | CWWidth | CWHeight;
356 gw->lastTarget = where;
357 gw->currentSize = CompRect (wc.x, wc.y, wc.width, wc.height);
358 CompWindowExtents lastBorder = gw->window->border ();
359
360 gw->sizeHintsFlags = 0;
361
362 /* Special case for left and right, actually vertically maximize
363 * the window */
364 if (where & GridLeft || where & GridRight)
365 {
366 /* First restore the window to its original size */
367 XWindowChanges rwc;
368
369 rwc.x = gw->originalSize.x ();
370 rwc.y = gw->originalSize.y ();
371 rwc.width = gw->originalSize.width ();
372 rwc.height = gw->originalSize.height ();
373
374 cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &rwc);
375
376 gw->isGridMaximized = true;
377 gw->isGridResized = false;
378
379 /* Maximize the window */
380 cw->maximize (CompWindowStateMaximizedVertMask);
381
382 /* Be evil */
383 if (cw->sizeHints ().flags & PResizeInc)
384 {
385 gw->sizeHintsFlags |= PResizeInc;
386 gw->window->sizeHints ().flags &= ~(PResizeInc);
387 }
388 }
389 else
390 {
391 gw->isGridResized = true;
392 gw->isGridMaximized = false;
393 }
394
395 int dw = (lastBorder.left + lastBorder.right) -
396 (gw->window->border ().left +
397 gw->window->border ().right);
398
399 int dh = (lastBorder.top + lastBorder.bottom) -
400 (gw->window->border ().top +
401 gw->window->border ().bottom);
402
403 xwc.width += dw;
404 xwc.height += dh;
405
406 /* Make window the size that we want */
407 cw->configureXWindow (valueMask, &xwc);
408
409 for (unsigned int i = 0; i < animations.size (); i++)
410 animations.at (i).fadingOut = true;
411>>>>>>> MERGE-SOURCE
328 }412 }
329413
330 /* This centers a window if it could not be resized to the desired414 /* This centers a window if it could not be resized to the desired
@@ -452,39 +536,72 @@
452 return status;536 return status;
453}537}
454538
455GridType539unsigned int
540GridScreen::typeToMask (int t)
541{
542 typedef struct {
543 unsigned int mask;
544 int type;
545 } GridTypeMask;
546
547 std::vector <GridTypeMask> type =
548 {
549 { GridWindowType::GridUnknown, 0 },
550 { GridWindowType::GridBottomLeft, 1 },
551 { GridWindowType::GridBottom, 2 },
552 { GridWindowType::GridBottomRight, 3 },
553 { GridWindowType::GridLeft, 4 },
554 { GridWindowType::GridCenter, 5 },
555 { GridWindowType::GridRight, 6 },
556 { GridWindowType::GridTopLeft, 7 },
557 { GridWindowType::GridTop, 8 },
558 { GridWindowType::GridTopRight, 9 },
559 { GridWindowType::GridMaximize, 10 }
560 };
561
562 for (unsigned int i = 0; i < type.size (); i++)
563 {
564 GridTypeMask &tm = type[i];
565 if (tm.type == t)
566 return tm.mask;
567 }
568
569 return GridWindowType::GridUnknown;
570}
571
572int
456GridScreen::edgeToGridType ()573GridScreen::edgeToGridType ()
457{574{
458 GridType ret;575 int ret;
459576
460 switch (edge) {577 switch (edge) {
461 case Left:578 case Left:
462 ret = (GridType) optionGetLeftEdgeAction ();579 ret = (int) optionGetLeftEdgeAction ();
463 break;580 break;
464 case Right:581 case Right:
465 ret = (GridType) optionGetRightEdgeAction ();582 ret = (int) optionGetRightEdgeAction ();
466 break;583 break;
467 case Top:584 case Top:
468 ret = (GridType) optionGetTopEdgeAction ();585 ret = (int) optionGetTopEdgeAction ();
469 break;586 break;
470 case Bottom:587 case Bottom:
471 ret = (GridType) optionGetBottomEdgeAction ();588 ret = (int) optionGetBottomEdgeAction ();
472 break;589 break;
473 case TopLeft:590 case TopLeft:
474 ret = (GridType) optionGetTopLeftCornerAction ();591 ret = (int) optionGetTopLeftCornerAction ();
475 break;592 break;
476 case TopRight:593 case TopRight:
477 ret = (GridType) optionGetTopRightCornerAction ();594 ret = (int) optionGetTopRightCornerAction ();
478 break;595 break;
479 case BottomLeft:596 case BottomLeft:
480 ret = (GridType) optionGetBottomLeftCornerAction ();597 ret = (int) optionGetBottomLeftCornerAction ();
481 break;598 break;
482 case BottomRight:599 case BottomRight:
483 ret = (GridType) optionGetBottomRightCornerAction ();600 ret = (int) optionGetBottomRightCornerAction ();
484 break;601 break;
485 case NoEdge:602 case NoEdge:
486 default:603 default:
487 ret = GridUnknown;604 ret = -1;
488 break;605 break;
489 }606 }
490607
@@ -548,7 +665,11 @@
548 if (cScreen)665 if (cScreen)
549 cScreen->damageRegion (desiredSlot);666 cScreen->damageRegion (desiredSlot);
550667
668<<<<<<< TREE
551 initiateCommon (0, 0, o, edgeToGridType (), false);669 initiateCommon (0, 0, o, edgeToGridType (), false);
670=======
671 initiateCommon (0, 0, o, typeToMask (edgeToGridType ()), false, false);
672>>>>>>> MERGE-SOURCE
552673
553 if (cScreen)674 if (cScreen)
554 cScreen->damageRegion (desiredSlot);675 cScreen->damageRegion (desiredSlot);
@@ -566,7 +687,11 @@
566 if (cScreen)687 if (cScreen)
567 cScreen->damageRegion (desiredSlot);688 cScreen->damageRegion (desiredSlot);
568689
690<<<<<<< TREE
569 initiateCommon (0, 0, o, edgeToGridType (), false);691 initiateCommon (0, 0, o, edgeToGridType (), false);
692=======
693 check = initiateCommon (NULL, 0, o, typeToMask (edgeToGridType ()), false, false);
694>>>>>>> MERGE-SOURCE
570695
571 if (cScreen)696 if (cScreen)
572 cScreen->damageRegion (desiredSlot);697 cScreen->damageRegion (desiredSlot);
@@ -614,12 +739,27 @@
614}739}
615740
616void741void
742GridWindow::validateResizeRequest (unsigned int &xwcm,
743 XWindowChanges *xwc,
744 unsigned int source)
745{
746 window->validateResizeRequest (xwcm, xwc, source);
747
748 /* Don't allow non-pagers to change
749 * the size of the window, the user
750 * specified this size, thank-you */
751 if (isGridMaximized)
752 if (source != ClientTypePager)
753 xwcm = 0;
754}
755
756void
617GridWindow::grabNotify (int x,757GridWindow::grabNotify (int x,
618 int y,758 int y,
619 unsigned int state,759 unsigned int state,
620 unsigned int mask)760 unsigned int mask)
621{761{
622 if (screen->grabExist ("move"))762 if (mask & (CompWindowGrabMoveMask | CompWindowGrabButtonMask))
623 {763 {
624 gScreen->o.push_back (CompOption ("window", CompOption::TypeInt));764 gScreen->o.push_back (CompOption ("window", CompOption::TypeInt));
625 gScreen->o[0].value ().set ((int) window->id ());765 gScreen->o[0].value ().set ((int) window->id ());
@@ -627,14 +767,15 @@
627 screen->handleEventSetEnabled (gScreen, true);767 screen->handleEventSetEnabled (gScreen, true);
628 gScreen->mGrabWindow = window;768 gScreen->mGrabWindow = window;
629 pointerBufDx = pointerBufDy = 0;769 pointerBufDx = pointerBufDy = 0;
770 grabMask = mask;
630771
631 if (!isGridResized && gScreen->optionGetSnapbackWindows ())772 if (!isGridResized && !isGridMaximized && gScreen->optionGetSnapbackWindows ())
632 /* Store size not including borders when grabbing with cursor */773 /* Store size not including borders when grabbing with cursor */
633 originalSize = gScreen->slotToRect(window,774 originalSize = gScreen->slotToRect(window,
634 window->serverBorderRect ());775 window->serverBorderRect ());
635 }776 }
636777
637 if (screen->grabExist ("resize"))778 if (mask & CompWindowGrabResizeMask)
638 {779 {
639 isGridResized = false;780 isGridResized = false;
640 resizeCount = 0;781 resizeCount = 0;
@@ -649,9 +790,15 @@
649 if (window == gScreen->mGrabWindow)790 if (window == gScreen->mGrabWindow)
650 {791 {
651 gScreen->initiateCommon792 gScreen->initiateCommon
793<<<<<<< TREE
652 (0, 0, gScreen->o, gScreen->edgeToGridType (), true);794 (0, 0, gScreen->o, gScreen->edgeToGridType (), true);
795=======
796 (NULL, 0, gScreen->o, gScreen->typeToMask (gScreen->edgeToGridType ()), true,
797 gScreen->edge != gScreen->lastResizeEdge);
798>>>>>>> MERGE-SOURCE
653799
654 screen->handleEventSetEnabled (gScreen, false);800 screen->handleEventSetEnabled (gScreen, false);
801 grabMask = 0;
655 gScreen->mGrabWindow = NULL;802 gScreen->mGrabWindow = NULL;
656 gScreen->cScreen->damageRegion (gScreen->desiredSlot);803 gScreen->cScreen->damageRegion (gScreen->desiredSlot);
657 }804 }
@@ -666,6 +813,7 @@
666{813{
667 window->moveNotify (dx, dy, immediate);814 window->moveNotify (dx, dy, immediate);
668815
816<<<<<<< TREE
669 if (isGridResized)817 if (isGridResized)
670 {818 {
671 pointerBufDx += dx;819 pointerBufDx += dx;
@@ -678,8 +826,48 @@
678 window->move (-dx, -dy);826 window->move (-dx, -dy);
679 window->moveNotifySetEnabled (this, true);827 window->moveNotifySetEnabled (this, true);
680 }828 }
681}829=======
682830 if (isGridResized && !isGridMaximized && !GridScreen::get (screen)->mSwitchingVp)
831 {
832 if (window->grabbed () && (grabMask & CompWindowGrabMoveMask))
833 {
834 pointerBufDx += dx;
835 pointerBufDy += dy;
836 }
837
838 /* Do not allow the window to be moved while it
839 * is resized */
840 dx = currentSize.x () - window->geometry ().x ();
841 dy = currentSize.y () - window->geometry ().y ();
842
843 window->move (dx, dy);
844 }
845>>>>>>> MERGE-SOURCE
846}
847
848<<<<<<< TREE
849=======
850void
851GridWindow::stateChangeNotify (unsigned int lastState)
852{
853 if (lastState & MAXIMIZE_STATE &&
854 !(window->state () & MAXIMIZE_STATE))
855 lastTarget = GridUnknown;
856 else if (!(lastState & MAXIMIZE_STATE) &&
857 window->state () & MAXIMIZE_STATE)
858 {
859 lastTarget = GridMaximize;
860 if (window->grabbed ())
861 {
862 originalSize = gScreen->slotToRect (window,
863 window->serverBorderRect ());
864 }
865 }
866
867 window->stateChangeNotify (lastState);
868}
869
870>>>>>>> MERGE-SOURCE
683bool871bool
684GridScreen::restoreWindow (CompAction *action,872GridScreen::restoreWindow (CompAction *action,
685 CompAction::State state,873 CompAction::State state,
@@ -697,7 +885,10 @@
697 return false;885 return false;
698886
699 if (gw->isGridMaximized & !(cw->state () & MAXIMIZE_STATE))887 if (gw->isGridMaximized & !(cw->state () & MAXIMIZE_STATE))
700 gw->isGridMaximized = false;888 {
889 gw->window->sizeHints ().flags |= gw->sizeHintsFlags;
890 gw->isGridMaximized = false;
891 }
701 else892 else
702 {893 {
703 if (cw == mGrabWindow)894 if (cw == mGrabWindow)
@@ -713,6 +904,7 @@
713 xwc.width = gw->originalSize.width ();904 xwc.width = gw->originalSize.width ();
714 xwc.height = gw->originalSize.height ();905 xwc.height = gw->originalSize.height ();
715 cw->maximize (0);906 cw->maximize (0);
907 gw->currentSize = CompRect ();
716 cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc);908 cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc);
717 gw->pointerBufDx = 0;909 gw->pointerBufDx = 0;
718 gw->pointerBufDy = 0;910 gw->pointerBufDy = 0;
@@ -818,16 +1010,29 @@
818 glScreen (GLScreen::get (screen)),1010 glScreen (GLScreen::get (screen)),
819 centerCheck (false),1011 centerCheck (false),
820 mGrabWindow (NULL),1012 mGrabWindow (NULL),
821 animating (false)1013 animating (false),
1014 mSwitchingVp (false)
822{1015{
8231016
824 ScreenInterface::setHandler (screen, false);1017 ScreenInterface::setHandler (screen, false);
1018 screen->handleCompizEventSetEnabled (this, true);
825 CompositeScreenInterface::setHandler (cScreen, false);1019 CompositeScreenInterface::setHandler (cScreen, false);
826 GLScreenInterface::setHandler (glScreen, false);1020 GLScreenInterface::setHandler (glScreen, false);
8271021
828 edge = lastEdge = NoEdge;1022 edge = lastEdge = NoEdge;
829 currentWorkarea = lastWorkarea = screen->getWorkareaForOutput1023 currentWorkarea = lastWorkarea = screen->getWorkareaForOutput
830 (screen->outputDeviceForPoint (pointerX, pointerY));1024 (screen->outputDeviceForPoint (pointerX, pointerY));
1025 gridProps[GridUnknown] = GridProps {0,1, 1,1};
1026 gridProps[GridBottomLeft] = GridProps {0,1, 2,2};
1027 gridProps[GridBottom] = GridProps {0,1, 1,2};
1028 gridProps[GridBottomRight] = GridProps {1,1, 2,2};
1029 gridProps[GridLeft] = GridProps {0,0, 2,1};
1030 gridProps[GridCenter] = GridProps{0,0, 1,1};
1031 gridProps[GridRight] = GridProps {1,0, 2,1};
1032 gridProps[GridTopLeft] = GridProps{0,0, 2,2};
1033 gridProps[GridTop] = GridProps {0,0, 1,2};
1034 gridProps[GridTopRight] = GridProps {0,0, 1,2};
1035 gridProps[GridMaximize] = GridProps {0,0, 1,1};
8311036
832 animations.clear ();1037 animations.clear ();
8331038
@@ -835,6 +1040,7 @@
835 optionSet##opt##Initiate (boost::bind (&GridScreen::initiateCommon, this, \1040 optionSet##opt##Initiate (boost::bind (&GridScreen::initiateCommon, this, \
836 _1, _2, _3, where, resize))1041 _1, _2, _3, where, resize))
8371042
1043<<<<<<< TREE
838 GRIDSET (PutCenterKey, GridCenter, true);1044 GRIDSET (PutCenterKey, GridCenter, true);
839 GRIDSET (PutLeftKey, GridLeft, true);1045 GRIDSET (PutLeftKey, GridLeft, true);
840 GRIDSET (PutRightKey, GridRight, true);1046 GRIDSET (PutRightKey, GridRight, true);
@@ -845,6 +1051,18 @@
845 GRIDSET (PutBottomleftKey, GridBottomLeft, true);1051 GRIDSET (PutBottomleftKey, GridBottomLeft, true);
846 GRIDSET (PutBottomrightKey, GridBottomRight, true);1052 GRIDSET (PutBottomrightKey, GridBottomRight, true);
847 GRIDSET (PutMaximizeKey, GridMaximize, true);1053 GRIDSET (PutMaximizeKey, GridMaximize, true);
1054=======
1055 GRIDSET (PutCenterKey, GridWindowType::GridCenter, true, true);
1056 GRIDSET (PutLeftKey, GridWindowType::GridLeft, true, true);
1057 GRIDSET (PutRightKey, GridWindowType::GridRight, true, true);
1058 GRIDSET (PutTopKey, GridWindowType::GridTop, true, true);
1059 GRIDSET (PutBottomKey, GridWindowType::GridBottom, true, true);
1060 GRIDSET (PutTopleftKey, GridWindowType::GridTopLeft, true, true);
1061 GRIDSET (PutToprightKey, GridWindowType::GridTopRight, true, true);
1062 GRIDSET (PutBottomleftKey, GridWindowType::GridBottomLeft, true, true);
1063 GRIDSET (PutBottomrightKey, GridWindowType::GridBottomRight, true, true);
1064 GRIDSET (PutMaximizeKey, GridWindowType::GridMaximize, true, true);
1065>>>>>>> MERGE-SOURCE
8481066
849#undef GRIDSET1067#undef GRIDSET
8501068
@@ -862,9 +1080,10 @@
862 gScreen (GridScreen::get (screen)),1080 gScreen (GridScreen::get (screen)),
863 isGridResized (false),1081 isGridResized (false),
864 isGridMaximized (false),1082 isGridMaximized (false),
1083 grabMask (0),
865 pointerBufDx (0),1084 pointerBufDx (0),
866 pointerBufDy (0),1085 pointerBufDy (0),
867 resizeCount (0),1086 resizeCount (0),
868 lastTarget (GridUnknown)1087 lastTarget (GridUnknown)
869{1088{
870 WindowInterface::setHandler (window);1089 WindowInterface::setHandler (window);
8711090
=== modified file 'src/grid.h'
--- src/grid.h 2011-09-29 15:54:11 +0000
+++ src/grid.h 2011-10-03 00:29:23 +0000
@@ -32,20 +32,22 @@
3232
33#define SNAPOFF_THRESHOLD 5033#define SNAPOFF_THRESHOLD 50
3434
35typedef enum35namespace GridWindowType
36{36{
37 GridUnknown = 0,37 static const unsigned int GridUnknown = (1 << 0);
38 GridBottomLeft = 1,38 static const unsigned int GridBottomLeft = (1 << 1);
39 GridBottom = 2,39 static const unsigned int GridBottom = (1 << 2);
40 GridBottomRight = 3,40 static const unsigned int GridBottomRight = (1 << 3);
41 GridLeft = 4,41 static const unsigned int GridLeft = (1 << 4);
42 GridCenter = 5,42 static const unsigned int GridCenter = (1 << 5);
43 GridRight = 6,43 static const unsigned int GridRight = (1 << 6);
44 GridTopLeft = 7,44 static const unsigned int GridTopLeft = (1 << 7);
45 GridTop = 8,45 static const unsigned int GridTop = (1 << 8);
46 GridTopRight = 9,46 static const unsigned int GridTopRight = (1 << 9);
47 GridMaximize = 1047 static const unsigned int GridMaximize = (1 << 10);
48} GridType;48};
49
50typedef unsigned int GridType;
4951
50typedef struct _GridProps52typedef struct _GridProps
51{53{
@@ -106,12 +108,17 @@
106 bool centerCheck;108 bool centerCheck;
107 CompWindow *mGrabWindow;109 CompWindow *mGrabWindow;
108 bool animating;110 bool animating;
111 bool mSwitchingVp;
109112
110 void getPaintRectangle (CompRect&);113 void getPaintRectangle (CompRect&);
111 void setCurrentRect (Animation&);114 void setCurrentRect (Animation&);
112115
113 bool initiateCommon (CompAction*, CompAction::State,116 bool initiateCommon (CompAction*, CompAction::State,
117<<<<<<< TREE
114 CompOption::Vector&, GridType, bool);118 CompOption::Vector&, GridType, bool);
119=======
120 CompOption::Vector&, unsigned int, bool, bool);
121>>>>>>> MERGE-SOURCE
115122
116 void glPaintRectangle (const GLScreenPaintAttrib&,123 void glPaintRectangle (const GLScreenPaintAttrib&,
117 const GLMatrix&, CompOutput *);124 const GLMatrix&, CompOutput *);
@@ -125,9 +132,11 @@
125132
126 std::vector <Animation> animations;133 std::vector <Animation> animations;
127134
128 GridType edgeToGridType ();135 int edgeToGridType ();
136 unsigned int typeToMask (int);
129137
130 void handleEvent (XEvent *event);138 void handleEvent (XEvent *event);
139 void handleCompizEvent (const char *plugin, const char *event, CompOption::Vector &options);
131140
132 bool restoreWindow (CompAction*,141 bool restoreWindow (CompAction*,
133 CompAction::State,142 CompAction::State,
@@ -157,17 +166,28 @@
157166
158 bool isGridResized;167 bool isGridResized;
159 bool isGridMaximized;168 bool isGridMaximized;
169 unsigned int grabMask;
160 int pointerBufDx;170 int pointerBufDx;
161 int pointerBufDy;171 int pointerBufDy;
162 int resizeCount;172 int resizeCount;
173 CompRect currentSize;
163 CompRect originalSize;174 CompRect originalSize;
164 GridType lastTarget;175 GridType lastTarget;
176 unsigned int sizeHintsFlags;
165177
166 void grabNotify (int, int, unsigned int, unsigned int);178 void grabNotify (int, int, unsigned int, unsigned int);
167179
168 void ungrabNotify ();180 void ungrabNotify ();
169181
170 void moveNotify (int, int, bool);182 void moveNotify (int, int, bool);
183<<<<<<< TREE
184=======
185
186 void stateChangeNotify (unsigned int);
187 void validateResizeRequest (unsigned int &valueMask,
188 XWindowChanges *xwc,
189 unsigned int source);
190>>>>>>> MERGE-SOURCE
171};191};
172192
173#define GRID_WINDOW(w) \193#define GRID_WINDOW(w) \

Subscribers

People subscribed via source and target branches