2
* Compiz Fusion Grid plugin
4
* Copyright (c) 2008 Stephen Kennedy <suasol@gmail.com>
5
* Copyright (c) 2010 Scott Moreau <oreaus@gmail.com>
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 2
10
* of the License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
19
* Plugin to act like winsplit revolution (http://www.winsplit-revolution.com/)
20
* use <Control><Alt>NUMPAD_KEY to move and tile your windows.
22
* Press the tiling keys several times to cycle through some tiling options.
27
bool compositingActive;
29
static const GridProps gridProps[] =
49
GridRectangle::subtractBorders (CompWindow *w) const
51
return CompRect (x () + w->border ().left,
52
y () + w->border ().top,
53
width () - (w->border ().left + w->border ().right),
54
height () - (w->border ().top + w->border ().bottom));
58
GridRectangle::addBorders (CompWindow *w) const
60
return CompRect (x () - w->border ().left,
61
y () - w->border ().top,
62
width () + (w->border ().left + w->border ().right),
63
height () + (w->border ().top + w->border ().bottom));
67
GridWindow::constrainSize (const GridRectangle& slot)
69
GridRectangle result = slot.subtractBorders (window);
70
CompRect wa = screen->outputDevs ().at (screen->outputDeviceForGeometry (window->serverGeometry ())).workArea ();
73
if (window->constrainNewWindowSize (result.width (), result.height (), &cw, &ch))
75
/* constrained size may put window offscreen, adjust for that case */
76
int dx = result.x () + cw - wa.right () + window->border ().right;
77
int dy = result.y () + ch - wa.bottom () + window->border ().bottom;
80
result.setX (result.x () - dx);
82
result.setY (result.y () - dy);
84
/* constrainment may leave gaps between the edges of the screen
85
* and the window borders ... in that case center the window so
86
* that these gaps are even */
88
if (result.width () != cw)
89
result.setX (result.x () + ((result.width () - cw) / 2));
91
if (result.height () != ch)
92
result.setY (result.y () + ((result.height () - ch) / 2));
95
result.setHeight (ch);
98
return result.addBorders (window);
102
GridWindow::allowGrid (GridType where)
104
/* Don't grid windows that can't be resized */
105
if (!(window->actions () & CompWindowActionResizeMask))
108
if (where == GridMaximize)
110
if (!(window->actions () & (CompWindowActionMaximizeHorzMask | CompWindowActionMaximizeVertMask)))
113
/* Don't maximize windows twice */
114
if (window->state () & (MAXIMIZE_STATE))
123
GridScreen::initiateCommon (CompAction *action,
124
CompAction::State state,
125
CompOption::Vector &option,
132
xid = CompOption::getIntOptionNamed (option, "window");
133
cw = screen->findWindow (xid);
135
if (where == GridUnknown)
145
else if (screen->otherGrabExist ("move", NULL))
154
if (!gw->allowGrid (where))
157
if (gw->lastTarget != where)
160
props = gridProps[where];
162
/* get current available area */
163
if (cw == mGrabWindow)
164
workarea = screen->getWorkareaForOutput
165
(screen->outputDeviceForPoint (pointerX, pointerY));
168
workarea = screen->getWorkareaForOutput (cw->outputDevice ());
170
if (!gw->isGridResized)
171
/* Store size not including borders when using a keybinding */
172
gw->originalSize = (CompRect &) cw->serverGeometry ();
175
if ((cw->state () & MAXIMIZE_STATE) &&
176
(resize || optionGetSnapoffMaximized ()))
178
/* maximized state interferes with us, clear it */
182
if (where == GridMaximize && resize)
184
/* move the window to the correct output */
185
if (cw == mGrabWindow)
187
xwc.x = workarea.x () + 50;
188
xwc.y = workarea.y () + 50;
189
xwc.width = workarea.width ();
190
xwc.height = workarea.height ();
191
cw->configureXWindow (CWX | CWY, &xwc);
194
cw->maximize (MAXIMIZE_STATE);
195
gw->isGridResized = true;
196
gw->isGridMaximized = true;
201
/* Should really be three different types here, but not enough time
202
* to implement that one FIXME */
207
desiredSlot = new PaintableAnimatedGridRectangle ();
214
CompRect sbr = cw->serverBorderRect ();
215
if (compositingActive)
217
CompRect sbr = cw->serverBorderRect ();
218
desiredSlot = new PaintableAnimatedGridRectangle ();
225
desiredSlot = new PaintableAnimatedGridRectangle ();
231
((AnimatedGridRectangle *) desiredSlot)->setFrom (sbr);
236
* xxxSlot include decorations (it's the screen area occupied)
237
* xxxRect are undecorated (it's the constrained position
241
/* slice and dice to get desired slot - including decorations */
242
desiredSlot->setY (workarea.y () + props.gravityDown *
243
(workarea.height () / props.numCellsY));
244
desiredSlot->setHeight (workarea.height () / props.numCellsY);
245
desiredSlot->setX (workarea.x () + props.gravityRight *
246
(workarea.width () / props.numCellsX));
247
desiredSlot->setWidth (workarea.width () / props.numCellsX);
249
/* Adjust for constraints and decorations */
250
desiredRect = gw->constrainSize (*desiredSlot).subtractBorders (cw);
251
/* Get current rect not including decorations */
252
currentRect.setGeometry (cw->serverX (), cw->serverY (),
254
cw->serverHeight ());
256
if (desiredRect.y () == currentRect.y () &&
257
desiredRect.height () == currentRect.height () &&
258
where != GridMaximize && gw->lastTarget == where)
260
int slotWidth25 = workarea.width () / 4;
261
int slotWidth33 = (workarea.width () / 3) + cw->border ().left;
262
int slotWidth17 = slotWidth33 - slotWidth25;
263
int slotWidth66 = workarea.width () - slotWidth33;
264
int slotWidth75 = workarea.width () - slotWidth25;
266
if (props.numCellsX == 2) /* keys (1, 4, 7, 3, 6, 9) */
268
if ((currentRect.width () == desiredRect.width () &&
269
currentRect.x () == desiredRect.x ()) ||
270
(gw->resizeCount < 1) || (gw->resizeCount > 5))
273
/* tricky, have to allow for window constraints when
274
* computing what the 33% and 66% offsets would be
276
switch (gw->resizeCount)
279
desiredSlot->setWidth (slotWidth66);
280
desiredSlot->setX (workarea.x () +
281
props.gravityRight * slotWidth33);
288
desiredSlot->setWidth (slotWidth33);
289
desiredSlot->setX (workarea.x () +
290
props.gravityRight * slotWidth66);
294
desiredSlot->setWidth (slotWidth25);
295
desiredSlot->setX (workarea.x () +
296
props.gravityRight * slotWidth75);
300
desiredSlot->setWidth (slotWidth75);
301
desiredSlot->setX (workarea.x () +
302
props.gravityRight * slotWidth25);
309
else /* keys (2, 5, 8) */
312
if ((currentRect.width () == desiredRect.width () &&
313
currentRect.x () == desiredRect.x ()) ||
314
(gw->resizeCount < 1) || (gw->resizeCount > 5))
317
switch (gw->resizeCount)
320
desiredSlot->setWidth (workarea.width () -
322
desiredSlot->setX (workarea.x () + slotWidth17);
326
desiredSlot->setWidth ((slotWidth25 * 2) +
328
desiredSlot->setX (workarea.x () +
329
(slotWidth25 - slotWidth17));
333
desiredSlot->setWidth ((slotWidth25 * 2));
334
desiredSlot->setX (workarea.x () + slotWidth25);
338
desiredSlot->setWidth (slotWidth33 -
339
(cw->border ().left + cw->border ().right));
340
desiredSlot->setX (workarea.x () + slotWidth33);
351
if (gw->resizeCount == 6)
354
desiredRect = gw->constrainSize (*desiredSlot).subtractBorders (cw);
357
/* TODO: animate move+resize */
360
xwc.x = desiredRect.x ();
361
xwc.y = desiredRect.y ();
362
xwc.width = desiredRect.width ();
363
xwc.height = desiredRect.height ();
365
/* Store a copy of xwc since configureXWindow changes it's values */
366
XWindowChanges wc = xwc;
367
unsigned int flags = (CWX | CWY | CWWidth | CWHeight);
370
cw->sendSyncRequest ();
375
cw->configureXWindow (flags, &xwc);
376
gw->isGridResized = true;
377
gw->isGridMaximized = false;
380
gw->lastTarget = where;
387
AnimatedGridRectangle::current ()
389
/* Expand edges out to destination rect based on progress */
391
CompRect ret = mFrom;
393
ret.setTop (floor (mFrom.top () + (top () - mFrom.top ()) * mProgress));
394
ret.setLeft (floor (mFrom.left () + (left () - mFrom.left ()) * mProgress));
395
ret.setRight (floor (mFrom.right () + (right () - mFrom.right ()) * mProgress));
396
ret.setBottom (floor (mFrom.bottom () + (bottom () - mFrom.bottom ()) * mProgress));
402
AnimatedGridRectangle::progress ()
408
AnimatedGridRectangle::setTime (unsigned int t)
414
AnimatedGridRectangle::setFrom (CompRect &f)
420
AnimatedGridRectangle::setProgress (float p)
424
if (mProgress >= 1.0f)
426
else if (mProgress <= 0.0f)
431
AnimatedGridRectangle::reset ()
437
PaintableAnimatedGridRectangle::paint (const GLMatrix &mat)
440
CompRect fill = current ();
441
GridScreen *gScreen = GridScreen::get (screen);
443
if (gScreen->optionGetIndicatorType () == GridOptions::IndicatorTypeOutline)
447
glLoadMatrixf (mat.getMatrix ());
449
glDisableClientState (GL_TEXTURE_COORD_ARRAY);
453
glColor4f ((float) gScreen->optionGetFillColorRed () / 65535.0f,
454
(float) gScreen->optionGetFillColorGreen () / 65535.0f,
455
(float) gScreen->optionGetFillColorBlue () / 65535.0f,
456
((float) gScreen->optionGetFillColorAlpha () / 65535.0f) * progress ());
457
glRecti (fill.x1 (), fill.y2 (), fill.x2 (), fill.y1 ());
459
/* Set outline rect smaller to avoid damage issues */
460
outline.setGeometry (fill.x () + 1, fill.y () + 1,
461
fill.width () - 2,fill. height () - 2);
464
glColor4f ((float) gScreen->optionGetOutlineColorRed () / 65535.0f,
465
(float) gScreen->optionGetOutlineColorGreen () / 65535.0f,
466
(float) gScreen->optionGetOutlineColorBlue () / 65535.0f,
467
((float) gScreen->optionGetOutlineColorAlpha () / 65535.0f) * progress ());
469
glBegin (GL_LINE_LOOP);
470
glVertex2i (outline.x1 (), outline.y1 ());
471
glVertex2i (outline.x2 (), outline.y1 ());
472
glVertex2i (outline.x2 (), outline.y2 ());
473
glVertex2i (outline.x1 (), outline.y2 ());
477
glColor4usv (defaultColor);
478
glDisable (GL_BLEND);
479
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
485
GridScreen::glPaintOutput (const GLScreenPaintAttrib &attrib,
486
const GLMatrix &matrix,
487
const CompRegion ®ion,
493
if (desiredSlot && optionGetDrawIndicator ())
495
GLMatrix sTransform (matrix);
496
status = glScreen->glPaintOutput (attrib, matrix, region, output, mask);
498
sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
499
((PaintableAnimatedGridRectangle *) desiredSlot)->paint (sTransform);
502
status = glScreen->glPaintOutput (attrib, matrix, region, output, mask);
508
GridScreen::edgeToGridType ()
514
ret = (GridType) optionGetLeftEdgeAction ();
517
ret = (GridType) optionGetRightEdgeAction ();
520
ret = (GridType) optionGetTopEdgeAction ();
523
ret = (GridType) optionGetBottomEdgeAction ();
526
ret = (GridType) optionGetTopLeftCornerAction ();
529
ret = (GridType) optionGetTopRightCornerAction ();
532
ret = (GridType) optionGetBottomLeftCornerAction ();
535
ret = (GridType) optionGetBottomRightCornerAction ();
547
GridScreen::handleEvent (XEvent *event)
550
CompOption::Vector opts;
551
CompOption::Value v = CompOption::Value ((int) mGrabWindow->id ());
552
CompRect *edgeBox = NULL;
553
float edgeDist; /* interpolated 0.0f -> 1.0f based on distance */
555
screen->handleEvent (event);
557
if (event->type != MotionNotify || !mGrabWindow)
561
opts.at (0).setName ("window", CompOption::TypeInt);
564
out = screen->outputDevs ().at (
565
screen->outputDeviceForPoint (CompPoint (pointerX, pointerY)));
567
/* Detect corners first */
569
if (pointerY > (out.y () + out.height () - optionGetBottomEdgeThreshold() - 1) &&
570
pointerX < out.x () + optionGetLeftEdgeThreshold())
573
unsigned int xptr = (out.x ()) + pointerX;
574
unsigned int yptr = (out.y () + out.height ()) - pointerY;
577
xd = MIN (((float) xptr / (float) optionGetLeftEdgeThreshold ()), 1.0f);
582
yd = MIN (((float) yptr / (float) (optionGetBottomEdgeThreshold () - 1)), 1.0f);
586
if (optionGetIndicatorDirection () == GridOptions::IndicatorDirectionFromEdge)
587
edgeBox = new CompRect (out.x (), out.y () + (out.height () - mGrabWindow->height ()),
588
mGrabWindow->width (), mGrabWindow->height ());
590
edgeDist = (xd + yd) / 2.0f;
594
else if (pointerY > (out.y () + out.height () - optionGetBottomEdgeThreshold() - 1) &&
595
pointerX > (out.x () + out.width () - optionGetRightEdgeThreshold() - 1))
598
unsigned int xptr = (out.x () + out.width ()) - pointerX;
599
unsigned int yptr = (out.y () + out.height ()) - pointerY;
602
xd = MIN (((float) xptr / (float) (optionGetRightEdgeThreshold () - 1)), 1.0f);
607
yd = MIN (((float) yptr / (float) (optionGetBottomEdgeThreshold () - 1)), 1.0f);
611
if (optionGetIndicatorDirection () == GridOptions::IndicatorDirectionFromEdge)
612
edgeBox = new CompRect (out.x () + (out.width () - mGrabWindow->width ()),
613
out.y () + (out.height () - mGrabWindow->height ()),
614
mGrabWindow->width (), mGrabWindow->height ());
616
edgeDist = (xd + yd) / 2.0f;
620
else if (pointerY < optionGetTopEdgeThreshold() &&
621
pointerX < optionGetLeftEdgeThreshold())
624
unsigned int xptr = (out.x ()) + pointerX;
625
unsigned int yptr = (out.y ()) + pointerY;
628
xd = MIN (((float) xptr / (float) optionGetLeftEdgeThreshold ()), 1.0f);
633
yd = MIN (((float) yptr / (float) optionGetTopEdgeThreshold ()), 1.0f);
637
if (optionGetIndicatorDirection () == GridOptions::IndicatorDirectionFromEdge)
638
edgeBox = new CompRect (out.x (),
640
mGrabWindow->width (), mGrabWindow->height ());
642
edgeDist = (xd + yd) / 2.0f;
646
else if (pointerY < out.y () + optionGetTopEdgeThreshold() &&
647
pointerX > (out.x () + out.width () - optionGetRightEdgeThreshold() - 1))
650
unsigned int xptr = (out.x () + out.width ()) - pointerX;
651
unsigned int yptr = (out.y ()) + pointerY;
654
xd = MIN (((float) xptr / (float) (optionGetRightEdgeThreshold () - 1)), 1.0f);
659
yd = MIN (((float) yptr / (float) optionGetTopEdgeThreshold ()), 1.0f);
663
if (optionGetIndicatorDirection () == GridOptions::IndicatorDirectionFromEdge)
664
edgeBox = new CompRect (out.x () + (out.width () - mGrabWindow->width ()),
666
mGrabWindow->width (), mGrabWindow->height ());
668
edgeDist = (xd + yd) / 2.0f;
672
else if (pointerX < out.x () + optionGetLeftEdgeThreshold())
675
unsigned int xptr = (out.x ()) + pointerX;
678
xd = MIN (((float) xptr / (float) optionGetLeftEdgeThreshold ()), 1.0f);
682
if (optionGetIndicatorDirection () == GridOptions::IndicatorDirectionFromEdge)
683
edgeBox = new CompRect (out.x (),
684
out.y () + (out.height () / 2.0f) - mGrabWindow->height () / 2.0f,
685
mGrabWindow->width (), mGrabWindow->height ());
691
else if (pointerX > (out.x () + out.width () - optionGetRightEdgeThreshold() - 1))
694
unsigned int xptr = (out.x () + out.width ()) - pointerX;
697
xd = MIN (((float) xptr / (float) (optionGetRightEdgeThreshold () - 1)), 1.0f);
701
if (optionGetIndicatorDirection () == GridOptions::IndicatorDirectionFromEdge)
702
edgeBox = new CompRect (out.x () + (out.width () - mGrabWindow->width ()),
703
out.y () + (out.height () / 2.0f) - mGrabWindow->height () / 2.0f,
704
mGrabWindow->width (), mGrabWindow->height ());
710
else if (pointerY < out.y () + optionGetTopEdgeThreshold())
713
unsigned int yptr = (out.y ()) + pointerY;
716
yd = MIN (((float) yptr / (float) optionGetTopEdgeThreshold ()), 1.0f);
720
if (optionGetIndicatorDirection () == GridOptions::IndicatorDirectionFromEdge)
721
edgeBox = new CompRect (out.x () + (out.width () / 2.0f) - mGrabWindow->width () / 2.0f,
723
mGrabWindow->width (), mGrabWindow->height ());
729
else if (pointerY > (out.y () + out.height () - optionGetBottomEdgeThreshold() - 1))
732
unsigned int yptr = (out.y () + out.width ()) - pointerY;
735
yd = MIN (((float) yptr / (float) (optionGetBottomEdgeThreshold () - 1)), 1.0f);
739
if (optionGetIndicatorDirection () == GridOptions::IndicatorDirectionFromEdge)
740
edgeBox = new CompRect (out.x () + (out.width () / 2.0f) - mGrabWindow->width () / 2.0f,
741
out.y () + (out.height () - mGrabWindow->height ()),
742
mGrabWindow->width (), mGrabWindow->height ());
751
/* Detect when cursor enters another output */
753
currentWorkarea = screen->getWorkareaForOutput
754
(screen->outputDeviceForPoint (pointerX, pointerY));
755
if (lastWorkarea != currentWorkarea)
762
lastWorkarea = currentWorkarea;
764
if (compositingActive && cScreen)
765
cScreen->damageRegion (old);
767
initiateCommon (0, 0, opts, edgeToGridType (), false);
769
if (edgeBox && desiredSlot)
771
desiredSlot->setFrom (*edgeBox);
775
if (compositingActive && cScreen)
776
cScreen->damageRegion (desiredSlot ? *desiredSlot : old);
779
/* Detect edge region change */
780
if (lastEdge != edge)
786
((AnimatedGridRectangle *) desiredSlot)->reset ();
792
if (compositingActive && cScreen)
793
cScreen->damageRegion (old);
795
initiateCommon (0, 0, opts, edgeToGridType (), false);
797
if (edgeBox && desiredSlot)
799
desiredSlot->setFrom (*edgeBox);
803
if (compositingActive && cScreen)
804
cScreen->damageRegion (desiredSlot ? *desiredSlot : old);
807
/* The closer the user gets to the edge, the more progress should go up */
811
CompRect sbr = mGrabWindow->serverBorderRect ();
813
damage = ((AnimatedGridRectangle *) desiredSlot)->current ();
814
cScreen->damageRegion (damage);
816
if (optionGetIndicatorDirection () == GridOptions::IndicatorDirectionFromWindow)
817
((AnimatedGridRectangle *) desiredSlot)->setFrom (sbr);
818
((AnimatedGridRectangle *) desiredSlot)->setProgress (1.0f - edgeDist);
820
damage = ((AnimatedGridRectangle *) desiredSlot)->current ();
821
cScreen->damageRegion (damage);
824
GRID_WINDOW (mGrabWindow);
826
if ((gw->pointerBufDx > SNAPOFF_THRESHOLD ||
827
gw->pointerBufDy > SNAPOFF_THRESHOLD ||
828
gw->pointerBufDx < -SNAPOFF_THRESHOLD ||
829
gw->pointerBufDy < -SNAPOFF_THRESHOLD) &&
831
optionGetSnapbackWindows ())
832
restoreWindow (0, 0, opts);
836
GridWindow::glDraw (const GLMatrix &transform,
837
GLFragment::Attrib &fragment,
838
const CompRegion ®ion,
841
CompRegion nRegion = region;
843
if (gScreen->desiredSlot)
845
nRegion = nRegion.united (gScreen->desiredSlot->current ());
847
gScreen->desiredSlot->paint (transform);
850
return glWindow->glDraw (transform, fragment, nRegion, mask);
854
GridWindow::grabNotify (int x,
859
if (screen->grabExist ("move"))
861
screen->handleEventSetEnabled (gScreen, true);
862
if (compositingActive)
864
if (gScreen->optionGetBehindWindow ())
865
glWindow->glDrawSetEnabled (this, true);
867
gScreen->glScreen->glPaintOutputSetEnabled (gScreen, true);
869
gScreen->mGrabWindow = window;
870
pointerBufDx = pointerBufDy = 0;
872
if (!isGridResized && gScreen->optionGetSnapbackWindows ())
873
/* Store size not including borders when grabbing with cursor */
874
originalSize = window->serverGeometry ();
877
if (screen->grabExist ("resize"))
879
isGridResized = false;
883
window->grabNotify (x, y, state, mask);
887
GridWindow::ungrabNotify ()
889
if (window == gScreen->mGrabWindow)
891
CompOption::Vector opts;
892
CompRect damage = gScreen->desiredSlot ? *gScreen->desiredSlot : CompRect (0, 0, 0, 0);
893
CompOption::Value v = CompOption::Value ((int) gScreen->mGrabWindow->id ());
896
opts.at (0).setName ("window", CompOption::TypeInt);
899
gScreen->initiateCommon
900
(0, 0, opts, gScreen->edgeToGridType (), true);
902
screen->handleEventSetEnabled (gScreen, false);
904
if (compositingActive)
906
if (gScreen->optionGetBehindWindow ())
907
glWindow->glDrawSetEnabled (this, false);
909
gScreen->glScreen->glPaintOutputSetEnabled (gScreen, false);
910
gScreen->cScreen->damageRegion (damage);
913
gScreen->mGrabWindow = NULL;
917
gScreen->edge = NoEdge;
919
window->ungrabNotify ();
923
GridWindow::moveNotify (int dx, int dy, bool immediate)
925
window->moveNotify (dx, dy, immediate);
932
GridScreen::restoreWindow (CompAction *action,
933
CompAction::State state,
934
CompOption::Vector &option)
937
CompWindow *cw = screen->findWindow (screen->activeWindow ());
944
if (!gw->isGridResized)
947
if (gw->isGridMaximized & !(cw->state () & MAXIMIZE_STATE))
948
gw->isGridMaximized = false;
951
if (cw == mGrabWindow)
953
xwc.x = pointerX - (gw->originalSize.width () >> 1);
954
xwc.y = pointerY + (cw->border ().top >> 1);
958
xwc.x = gw->originalSize.x ();
959
xwc.y = gw->originalSize.y ();
961
xwc.width = gw->originalSize.width ();
962
xwc.height = gw->originalSize.height ();
964
cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc);
965
gw->pointerBufDx = 0;
966
gw->pointerBufDy = 0;
968
gw->isGridResized = false;
974
GridScreen::GridScreen (CompScreen *screen) :
975
PluginClassHandler<GridScreen, CompScreen> (screen),
979
if (compositingActive)
981
cScreen = CompositeScreen::get (screen);
982
glScreen = GLScreen::get (screen);
984
CompositeScreenInterface::setHandler (cScreen, false);
985
GLScreenInterface::setHandler (glScreen, false);
988
ScreenInterface::setHandler (screen, false);
990
edge = lastEdge = NoEdge;
991
currentWorkarea = lastWorkarea = screen->getWorkareaForOutput
992
(screen->outputDeviceForPoint (pointerX, pointerY));
994
#define GRIDSET(opt,where,resize) \
995
optionSet##opt##Initiate (boost::bind (&GridScreen::initiateCommon, this, \
996
_1, _2, _3, where, resize))
998
GRIDSET (PutCenterKey, GridCenter, true);
999
GRIDSET (PutLeftKey, GridLeft, true);
1000
GRIDSET (PutRightKey, GridRight, true);
1001
GRIDSET (PutTopKey, GridTop, true);
1002
GRIDSET (PutBottomKey, GridBottom, true);
1003
GRIDSET (PutTopleftKey, GridTopLeft, true);
1004
GRIDSET (PutToprightKey, GridTopRight, true);
1005
GRIDSET (PutBottomleftKey, GridBottomLeft, true);
1006
GRIDSET (PutBottomrightKey, GridBottomRight, true);
1007
GRIDSET (PutMaximizeKey, GridMaximize, true);
1011
optionSetPutRestoreKeyInitiate (boost::bind (&GridScreen::
1012
restoreWindow, this, _1, _2, _3));
1016
GridWindow::GridWindow (CompWindow *window) :
1017
PluginClassHandler <GridWindow, CompWindow> (window),
1019
glWindow (GLWindow::get (window)),
1020
gScreen (GridScreen::get (screen)),
1021
isGridResized (false),
1022
isGridMaximized (false),
1026
lastTarget (GridUnknown)
1028
WindowInterface::setHandler (window);
1029
GLWindowInterface::setHandler (glWindow, false);
1032
/* Initial plugin init function called. Checks to see if we are ABI
1033
* compatible with core, otherwise unload */
1036
GridPluginVTable::init ()
1038
if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
1041
if (!CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI) ||
1042
!CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
1043
compositingActive = false;
1045
compositingActive = true;