Merge lp:~compiz-team/compiz-grid-plugin/oneiric.fix_862339 into lp:compiz-grid-plugin

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

Description of the change

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
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2009-12-17 12:22:47 +0000
+++ CMakeLists.txt 2011-09-29 12:41:49 +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-09-29 12:41:49 +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-24 06:59:55 +0000
+++ src/grid.cpp 2011-09-29 12:41:49 +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,7 +120,7 @@
118GridScreen::initiateCommon (CompAction *action,120GridScreen::initiateCommon (CompAction *action,
119 CompAction::State state,121 CompAction::State state,
120 CompOption::Vector &option,122 CompOption::Vector &option,
121 GridType where,123 unsigned int where,
122 bool resize,124 bool resize,
123 bool key)125 bool key)
124{126{
@@ -128,16 +130,27 @@
128 xid = CompOption::getIntOptionNamed (option, "window");130 xid = CompOption::getIntOptionNamed (option, "window");
129 cw = screen->findWindow (xid);131 cw = screen->findWindow (xid);
130132
131 if (where == GridUnknown || screen->otherGrabExist ("move", NULL))
132 return false;
133
134 if (cw)133 if (cw)
135 {134 {
136 XWindowChanges xwc;135 XWindowChanges xwc;
136 bool maximizeH = where & (GridBottom | GridTop | GridMaximize);
137 bool maximizeV = where & (GridLeft | GridRight | GridMaximize);
138
139 if (!(cw->actions () & CompWindowActionResizeMask))
140 return false;
141
142 if (maximizeH && !(cw->actions () & CompWindowActionMaximizeHorzMask))
143 return false;
144
145 if (maximizeV && !(cw->actions () & CompWindowActionMaximizeVertMask))
146 return false;
147
148 if (where & GridUnknown)
149 return false;
137150
138 GRID_WINDOW (cw);151 GRID_WINDOW (cw);
139152
140 if (gw->lastTarget != where)153 if (gw->lastTarget & ~(where))
141 gw->resizeCount = 0;154 gw->resizeCount = 0;
142 else if (!key)155 else if (!key)
143 return false;156 return false;
@@ -167,7 +180,7 @@
167 cw->maximize (0);180 cw->maximize (0);
168 }181 }
169182
170 if (where == GridMaximize && resize)183 if ((where & GridMaximize) && resize)
171 {184 {
172 /* move the window to the correct output */185 /* move the window to the correct output */
173 if (cw == mGrabWindow)186 if (cw == mGrabWindow)
@@ -209,7 +222,7 @@
209222
210 if (desiredRect.y () == currentRect.y () &&223 if (desiredRect.y () == currentRect.y () &&
211 desiredRect.height () == currentRect.height () &&224 desiredRect.height () == currentRect.height () &&
212 where != GridMaximize && gw->lastTarget == where)225 where & ~(GridMaximize) && gw->lastTarget & where)
213 {226 {
214 int slotWidth25 = workarea.width () / 4;227 int slotWidth25 = workarea.width () / 4;
215 int slotWidth33 = (workarea.width () / 3) + cw->border ().left;228 int slotWidth33 = (workarea.width () / 3) + cw->border ().left;
@@ -322,12 +335,52 @@
322 /* TODO: animate move+resize */335 /* TODO: animate move+resize */
323 if (resize)336 if (resize)
324 {337 {
325 cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc);338 unsigned int valueMask = CWX | CWY | CWWidth | CWHeight;
326 gw->isGridResized = true;
327 gw->isGridMaximized = false;
328 for (unsigned int i = 0; i < animations.size (); i++)
329 animations.at (i).fadingOut = true;
330 gw->lastTarget = where;339 gw->lastTarget = where;
340 gw->currentSize = CompRect (wc.x, wc.y, wc.width, wc.height);
341
342 /* Special case for left and right, actually vertically maximize
343 * the window */
344 if (where & GridLeft || where & GridRight)
345 {
346 /* First restore the window to its original size */
347 XWindowChanges rwc;
348 CompWindowExtents lb = gw->lastBorder;
349
350 rwc.x = gw->originalSize.x ();
351 rwc.y = gw->originalSize.y ();
352 rwc.width = gw->originalSize.width ();
353 rwc.height = gw->originalSize.height ();
354
355 cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &rwc);
356
357 gw->isGridMaximized = true;
358 gw->isGridResized = false;
359
360 gw->lastBorder = cw->border ();
361 /* Maximize the window */
362 cw->maximize (CompWindowStateMaximizedVertMask);
363
364 /* Adjust for any updated border extents */
365 xwc.x -= lb.left - cw->border ().left;
366 xwc.y -= lb.top - cw->border ().top;
367 xwc.width += (lb.left - cw->border ().left) + (lb.right - cw->border ().right);
368 xwc.height += (lb.top - cw->border ().top) + (lb.bottom - cw->border ().bottom);
369
370 /* Make window the size that we want */
371 cw->configureXWindow (valueMask, &xwc);
372 }
373 else
374 {
375 gw->isGridResized = true;
376 gw->isGridMaximized = false;
377
378 /* Make window the size that we want */
379 cw->configureXWindow (valueMask, &xwc);
380 }
381
382 for (unsigned int i = 0; i < animations.size (); i++)
383 animations.at (i).fadingOut = true;
331 }384 }
332385
333 /* This centers a window if it could not be resized to the desired386 /* This centers a window if it could not be resized to the desired
@@ -473,39 +526,72 @@
473 return status;526 return status;
474}527}
475528
476GridType529unsigned int
530GridScreen::typeToMask (int t)
531{
532 typedef struct {
533 unsigned int mask;
534 int type;
535 } GridTypeMask;
536
537 std::vector <GridTypeMask> type =
538 {
539 { GridWindowType::GridUnknown, 0 },
540 { GridWindowType::GridBottomLeft, 1 },
541 { GridWindowType::GridBottom, 2 },
542 { GridWindowType::GridBottomRight, 3 },
543 { GridWindowType::GridLeft, 4 },
544 { GridWindowType::GridCenter, 5 },
545 { GridWindowType::GridRight, 6 },
546 { GridWindowType::GridTopLeft, 7 },
547 { GridWindowType::GridTop, 8 },
548 { GridWindowType::GridTopRight, 9 },
549 { GridWindowType::GridMaximize, 10 }
550 };
551
552 for (unsigned int i = 0; i < type.size (); i++)
553 {
554 GridTypeMask &tm = type[i];
555 if (tm.type == t)
556 return tm.mask;
557 }
558
559 return GridWindowType::GridUnknown;
560}
561
562int
477GridScreen::edgeToGridType ()563GridScreen::edgeToGridType ()
478{564{
479 GridType ret;565 int ret;
480566
481 switch (edge) {567 switch (edge) {
482 case Left:568 case Left:
483 ret = (GridType) optionGetLeftEdgeAction ();569 ret = (int) optionGetLeftEdgeAction ();
484 break;570 break;
485 case Right:571 case Right:
486 ret = (GridType) optionGetRightEdgeAction ();572 ret = (int) optionGetRightEdgeAction ();
487 break;573 break;
488 case Top:574 case Top:
489 ret = (GridType) optionGetTopEdgeAction ();575 ret = (int) optionGetTopEdgeAction ();
490 break;576 break;
491 case Bottom:577 case Bottom:
492 ret = (GridType) optionGetBottomEdgeAction ();578 ret = (int) optionGetBottomEdgeAction ();
493 break;579 break;
494 case TopLeft:580 case TopLeft:
495 ret = (GridType) optionGetTopLeftCornerAction ();581 ret = (int) optionGetTopLeftCornerAction ();
496 break;582 break;
497 case TopRight:583 case TopRight:
498 ret = (GridType) optionGetTopRightCornerAction ();584 ret = (int) optionGetTopRightCornerAction ();
499 break;585 break;
500 case BottomLeft:586 case BottomLeft:
501 ret = (GridType) optionGetBottomLeftCornerAction ();587 ret = (int) optionGetBottomLeftCornerAction ();
502 break;588 break;
503 case BottomRight:589 case BottomRight:
504 ret = (GridType) optionGetBottomRightCornerAction ();590 ret = (int) optionGetBottomRightCornerAction ();
505 break;591 break;
506 case NoEdge:592 case NoEdge:
507 default:593 default:
508 ret = GridUnknown;594 ret = -1;
509 break;595 break;
510 }596 }
511597
@@ -571,7 +657,7 @@
571 if (cScreen)657 if (cScreen)
572 cScreen->damageRegion (desiredSlot);658 cScreen->damageRegion (desiredSlot);
573659
574 initiateCommon (0, 0, o, edgeToGridType (), false, false);660 initiateCommon (0, 0, o, typeToMask (edgeToGridType ()), false, false);
575661
576 if (cScreen)662 if (cScreen)
577 cScreen->damageRegion (desiredSlot);663 cScreen->damageRegion (desiredSlot);
@@ -589,7 +675,7 @@
589 if (cScreen)675 if (cScreen)
590 cScreen->damageRegion (desiredSlot);676 cScreen->damageRegion (desiredSlot);
591677
592 check = initiateCommon (0, 0, o, edgeToGridType (), false, false);678 check = initiateCommon (NULL, 0, o, typeToMask (edgeToGridType ()), false, false);
593679
594 if (cScreen)680 if (cScreen)
595 cScreen->damageRegion (desiredSlot);681 cScreen->damageRegion (desiredSlot);
@@ -646,21 +732,22 @@
646 unsigned int state,732 unsigned int state,
647 unsigned int mask)733 unsigned int mask)
648{734{
649 if (screen->grabExist ("move"))735 if (mask & (CompWindowGrabMoveMask | CompWindowGrabButtonMask))
650 {736 {
651 gScreen->o[0].value ().set ((int) window->id ());737 gScreen->o[0].value ().set ((int) window->id ());
652738
653 screen->handleEventSetEnabled (gScreen, true);739 screen->handleEventSetEnabled (gScreen, true);
654 gScreen->mGrabWindow = window;740 gScreen->mGrabWindow = window;
655 pointerBufDx = pointerBufDy = 0;741 pointerBufDx = pointerBufDy = 0;
742 grabMask = mask;
656743
657 if (!isGridResized && gScreen->optionGetSnapbackWindows ())744 if (!isGridResized && !isGridMaximized && gScreen->optionGetSnapbackWindows ())
658 /* Store size not including borders when grabbing with cursor */745 /* Store size not including borders when grabbing with cursor */
659 originalSize = gScreen->slotToRect(window,746 originalSize = gScreen->slotToRect(window,
660 window->serverBorderRect ());747 window->serverBorderRect ());
661 }748 }
662749
663 if (screen->grabExist ("resize"))750 if (mask & CompWindowGrabResizeMask)
664 {751 {
665 isGridResized = false;752 isGridResized = false;
666 resizeCount = 0;753 resizeCount = 0;
@@ -675,10 +762,11 @@
675 if (window == gScreen->mGrabWindow)762 if (window == gScreen->mGrabWindow)
676 {763 {
677 gScreen->initiateCommon764 gScreen->initiateCommon
678 (0, 0, gScreen->o, gScreen->edgeToGridType (), true,765 (NULL, 0, gScreen->o, gScreen->typeToMask (gScreen->edgeToGridType ()), true,
679 gScreen->edge != gScreen->lastResizeEdge);766 gScreen->edge != gScreen->lastResizeEdge);
680767
681 screen->handleEventSetEnabled (gScreen, false);768 screen->handleEventSetEnabled (gScreen, false);
769 grabMask = 0;
682 gScreen->mGrabWindow = NULL;770 gScreen->mGrabWindow = NULL;
683 gScreen->o[0].value ().set (0);771 gScreen->o[0].value ().set (0);
684 gScreen->cScreen->damageRegion (gScreen->desiredSlot);772 gScreen->cScreen->damageRegion (gScreen->desiredSlot);
@@ -695,17 +783,20 @@
695{783{
696 window->moveNotify (dx, dy, immediate);784 window->moveNotify (dx, dy, immediate);
697785
698 if (isGridResized)786 if (isGridResized && !isGridMaximized && !GridScreen::get (screen)->mSwitchingVp)
699 {787 {
700 pointerBufDx += dx;788 if (window->grabbed () && (grabMask & CompWindowGrabMoveMask))
701 pointerBufDy += dy;789 {
790 pointerBufDx += dx;
791 pointerBufDy += dy;
792 }
702793
703 /* Do not allow the window to be moved while it794 /* Do not allow the window to be moved while it
704 * is resized */795 * is resized */
796 dx = currentSize.x () - window->geometry ().x ();
797 dy = currentSize.y () - window->geometry ().y ();
705798
706 window->moveNotifySetEnabled (this, false);799 window->move (dx, dy);
707 window->move (-dx, -dy);
708 window->moveNotifySetEnabled (this, true);
709 }800 }
710}801}
711802
@@ -717,11 +808,50 @@
717 lastTarget = GridUnknown;808 lastTarget = GridUnknown;
718 else if (!(lastState & MAXIMIZE_STATE) &&809 else if (!(lastState & MAXIMIZE_STATE) &&
719 window->state () & MAXIMIZE_STATE)810 window->state () & MAXIMIZE_STATE)
811 {
720 lastTarget = GridMaximize;812 lastTarget = GridMaximize;
813 if (window->grabbed ())
814 {
815 originalSize = gScreen->slotToRect (window,
816 window->serverBorderRect ());
817 }
818 }
721819
722 window->stateChangeNotify (lastState);820 window->stateChangeNotify (lastState);
723} 821}
724822
823void
824GridWindow::windowNotify (CompWindowNotify n)
825{
826 if (n == CompWindowNotifyFrameUpdate)
827 {
828 if (isGridMaximized && (window->state () & MAXIMIZE_STATE))
829 {
830 unsigned int valueMask = 0;
831 XWindowChanges xwc;
832
833 int dw = (lastBorder.left + lastBorder.right) -
834 (window->border ().left + window->border ().right);
835
836 int dh = (lastBorder.top + lastBorder.bottom) -
837 (window->border ().top + window->border ().bottom);
838
839 if (dw != 0)
840 valueMask |= CWWidth;
841 if (dh != 0)
842 valueMask |= CWHeight;
843
844 xwc.width = window->serverGeometry ().width () + dw;
845 xwc.height = window->serverGeometry ().height () + dh;
846
847 window->configureXWindow (valueMask, &xwc);
848 }
849
850 lastBorder = window->border ();
851 }
852
853 window->windowNotify (n);
854}
725bool855bool
726GridScreen::restoreWindow (CompAction *action,856GridScreen::restoreWindow (CompAction *action,
727 CompAction::State state,857 CompAction::State state,
@@ -755,6 +885,7 @@
755 xwc.width = gw->originalSize.width ();885 xwc.width = gw->originalSize.width ();
756 xwc.height = gw->originalSize.height ();886 xwc.height = gw->originalSize.height ();
757 cw->maximize (0);887 cw->maximize (0);
888 gw->currentSize = CompRect ();
758 cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc);889 cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc);
759 gw->pointerBufDx = 0;890 gw->pointerBufDx = 0;
760 gw->pointerBufDy = 0;891 gw->pointerBufDy = 0;
@@ -860,17 +991,30 @@
860 glScreen (GLScreen::get (screen)),991 glScreen (GLScreen::get (screen)),
861 centerCheck (false),992 centerCheck (false),
862 mGrabWindow (NULL),993 mGrabWindow (NULL),
863 animating (false)994 animating (false),
995 mSwitchingVp (false)
864{996{
865 o.push_back (CompOption ("window", CompOption::TypeInt));997 o.push_back (CompOption ("window", CompOption::TypeInt));
866998
867 ScreenInterface::setHandler (screen, false);999 ScreenInterface::setHandler (screen, false);
1000 screen->handleCompizEventSetEnabled (this, true);
868 CompositeScreenInterface::setHandler (cScreen, false);1001 CompositeScreenInterface::setHandler (cScreen, false);
869 GLScreenInterface::setHandler (glScreen, false);1002 GLScreenInterface::setHandler (glScreen, false);
8701003
871 edge = lastEdge = lastResizeEdge = NoEdge;1004 edge = lastEdge = lastResizeEdge = NoEdge;
872 currentWorkarea = lastWorkarea = screen->getWorkareaForOutput1005 currentWorkarea = lastWorkarea = screen->getWorkareaForOutput
873 (screen->outputDeviceForPoint (pointerX, pointerY));1006 (screen->outputDeviceForPoint (pointerX, pointerY));
1007 gridProps[GridUnknown] = GridProps {0,1, 1,1};
1008 gridProps[GridBottomLeft] = GridProps {0,1, 2,2};
1009 gridProps[GridBottom] = GridProps {0,1, 1,2};
1010 gridProps[GridBottomRight] = GridProps {1,1, 2,2};
1011 gridProps[GridLeft] = GridProps {0,0, 2,1};
1012 gridProps[GridCenter] = GridProps{0,0, 1,1};
1013 gridProps[GridRight] = GridProps {1,0, 2,1};
1014 gridProps[GridTopLeft] = GridProps{0,0, 2,2};
1015 gridProps[GridTop] = GridProps {0,0, 1,2};
1016 gridProps[GridTopRight] = GridProps {0,0, 1,2};
1017 gridProps[GridMaximize] = GridProps {0,0, 1,1};
8741018
875 animations.clear ();1019 animations.clear ();
8761020
@@ -878,16 +1022,16 @@
878 optionSet##opt##Initiate (boost::bind (&GridScreen::initiateCommon, this, \1022 optionSet##opt##Initiate (boost::bind (&GridScreen::initiateCommon, this, \
879 _1, _2, _3, where, resize, key))1023 _1, _2, _3, where, resize, key))
8801024
881 GRIDSET (PutCenterKey, GridCenter, true, true);1025 GRIDSET (PutCenterKey, GridWindowType::GridCenter, true, true);
882 GRIDSET (PutLeftKey, GridLeft, true, true);1026 GRIDSET (PutLeftKey, GridWindowType::GridLeft, true, true);
883 GRIDSET (PutRightKey, GridRight, true, true);1027 GRIDSET (PutRightKey, GridWindowType::GridRight, true, true);
884 GRIDSET (PutTopKey, GridTop, true, true);1028 GRIDSET (PutTopKey, GridWindowType::GridTop, true, true);
885 GRIDSET (PutBottomKey, GridBottom, true, true);1029 GRIDSET (PutBottomKey, GridWindowType::GridBottom, true, true);
886 GRIDSET (PutTopleftKey, GridTopLeft, true, true);1030 GRIDSET (PutTopleftKey, GridWindowType::GridTopLeft, true, true);
887 GRIDSET (PutToprightKey, GridTopRight, true, true);1031 GRIDSET (PutToprightKey, GridWindowType::GridTopRight, true, true);
888 GRIDSET (PutBottomleftKey, GridBottomLeft, true, true);1032 GRIDSET (PutBottomleftKey, GridWindowType::GridBottomLeft, true, true);
889 GRIDSET (PutBottomrightKey, GridBottomRight, true, true);1033 GRIDSET (PutBottomrightKey, GridWindowType::GridBottomRight, true, true);
890 GRIDSET (PutMaximizeKey, GridMaximize, true, true);1034 GRIDSET (PutMaximizeKey, GridWindowType::GridMaximize, true, true);
8911035
892#undef GRIDSET1036#undef GRIDSET
8931037
@@ -905,10 +1049,11 @@
905 gScreen (GridScreen::get (screen)),1049 gScreen (GridScreen::get (screen)),
906 isGridResized (false),1050 isGridResized (false),
907 isGridMaximized (false),1051 isGridMaximized (false),
1052 grabMask (0),
908 pointerBufDx (0),1053 pointerBufDx (0),
909 pointerBufDy (0),1054 pointerBufDy (0),
910 resizeCount (0),1055 resizeCount (0),
911 lastTarget (GridUnknown)1056 lastTarget (GridWindowType::GridUnknown)
912{1057{
913 WindowInterface::setHandler (window);1058 WindowInterface::setHandler (window);
914}1059}
9151060
=== modified file 'src/grid.h'
--- src/grid.h 2011-09-24 06:59:55 +0000
+++ src/grid.h 2011-09-29 12:41:49 +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,13 @@
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,
114 CompOption::Vector&, GridType, bool, bool);117 CompOption::Vector&, unsigned int, bool, bool);
115118
116 void glPaintRectangle (const GLScreenPaintAttrib&,119 void glPaintRectangle (const GLScreenPaintAttrib&,
117 const GLMatrix&, CompOutput *);120 const GLMatrix&, CompOutput *);
@@ -125,9 +128,11 @@
125128
126 std::vector <Animation> animations;129 std::vector <Animation> animations;
127130
128 GridType edgeToGridType ();131 int edgeToGridType ();
132 unsigned int typeToMask (int);
129133
130 void handleEvent (XEvent *event);134 void handleEvent (XEvent *event);
135 void handleCompizEvent (const char *plugin, const char *event, CompOption::Vector &options);
131136
132 bool restoreWindow (CompAction*,137 bool restoreWindow (CompAction*,
133 CompAction::State,138 CompAction::State,
@@ -158,10 +163,13 @@
158163
159 bool isGridResized;164 bool isGridResized;
160 bool isGridMaximized;165 bool isGridMaximized;
166 unsigned int grabMask;
161 int pointerBufDx;167 int pointerBufDx;
162 int pointerBufDy;168 int pointerBufDy;
163 int resizeCount;169 int resizeCount;
170 CompRect currentSize;
164 CompRect originalSize;171 CompRect originalSize;
172 CompWindowExtents lastBorder;
165 GridType lastTarget;173 GridType lastTarget;
166174
167 void grabNotify (int, int, unsigned int, unsigned int);175 void grabNotify (int, int, unsigned int, unsigned int);
@@ -171,6 +179,8 @@
171 void moveNotify (int, int, bool);179 void moveNotify (int, int, bool);
172180
173 void stateChangeNotify (unsigned int);181 void stateChangeNotify (unsigned int);
182
183 void windowNotify (CompWindowNotify n);
174};184};
175185
176#define GRID_WINDOW(w) \186#define GRID_WINDOW(w) \

Subscribers

People subscribed via source and target branches

to all changes: