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.
25
#include <core/core.h>
26
#include <core/atoms.h>
27
#include <core/pluginclasshandler.h>
28
#include <composite/composite.h>
29
#include <opengl/opengl.h>
33
#include "grid_options.h"
35
#define SNAPOFF_THRESHOLD 50
37
extern bool compositingActive;
54
typedef struct _GridProps
81
GridRectangle (const CompRect &r) :
82
CompRect::CompRect (r)
86
GridRectangle subtractBorders (CompWindow *w) const;
87
GridRectangle addBorders (CompWindow *w) const;
98
virtual void paint (const GLMatrix &mat) = 0;
101
class AnimatedGridRectangle :
106
AnimatedGridRectangle () :
107
GridRectangle::GridRectangle (),
108
mFrom (CompRect (0, 0, 0, 0)),
114
AnimatedGridRectangle (const GridRectangle &r) :
115
GridRectangle::GridRectangle (r),
116
mFrom (CompRect (0, 0, 0, 0)),
122
AnimatedGridRectangle (const CompRect &r) :
123
GridRectangle::GridRectangle (r),
124
mFrom (CompRect (0, 0, 0, 0)),
133
void setFrom (CompRect &);
134
void setProgress (float);
136
void setTime (unsigned int);
146
class PaintableAnimatedGridRectangle :
148
public AnimatedGridRectangle
152
PaintableAnimatedGridRectangle () :
153
Paintable::Paintable (),
154
AnimatedGridRectangle::AnimatedGridRectangle ()
158
PaintableAnimatedGridRectangle (const GridRectangle &r) :
159
Paintable::Paintable (),
160
AnimatedGridRectangle::AnimatedGridRectangle (r)
164
PaintableAnimatedGridRectangle (const CompRect &r) :
165
Paintable::Paintable (),
166
AnimatedGridRectangle::AnimatedGridRectangle (r)
170
virtual void paint (const GLMatrix &mat);
174
public ScreenInterface,
175
public CompositeScreenInterface,
176
public GLScreenInterface,
177
public PluginClassHandler <GridScreen, CompScreen>,
182
GridScreen (CompScreen *);
183
CompositeScreen *cScreen;
186
PaintableAnimatedGridRectangle *desiredSlot;
187
CompRect workarea, currentRect,
188
desiredRect, lastWorkarea, currentWorkarea;
190
Edges edge, lastEdge;
191
CompWindow *mGrabWindow;
193
void getPaintRectangle (CompRect&);
195
bool initiateCommon (CompAction*, CompAction::State,
196
CompOption::Vector&, GridType, bool);
198
bool glPaintOutput (const GLScreenPaintAttrib &,
199
const GLMatrix &, const CompRegion &,
200
CompOutput *, unsigned int);
202
GridType edgeToGridType ();
204
void handleEvent (XEvent *event);
206
bool restoreWindow (CompAction*,
208
CompOption::Vector&);
211
snapbackOptionChanged (CompOption *option,
216
public WindowInterface,
217
public GLWindowInterface,
218
public PluginClassHandler <GridWindow, CompWindow>
222
GridWindow (CompWindow *);
228
bool isGridMaximized;
232
CompRect originalSize;
236
allowGrid (GridType t);
239
constrainSize (const GridRectangle & slot);
242
glDraw (const GLMatrix &transform,
243
GLFragment::Attrib &fragment,
244
const CompRegion ®ion,
247
void grabNotify (int, int, unsigned int, unsigned int);
249
void ungrabNotify ();
251
void moveNotify (int, int, bool);
254
#define GRID_WINDOW(w) \
255
GridWindow *gw = GridWindow::get (w)
257
class GridPluginVTable :
258
public CompPlugin::VTableForScreenAndWindow <GridScreen, GridWindow>
265
COMPIZ_PLUGIN_20090315 (grid, GridPluginVTable);