7
* Copyright (c) 2006 Robert Carr <racarr@beryl-project.org>
10
* Robert Carr <racarr@beryl-project.org>
11
* Dennis Kasprzyk <onestone@opencompositing.org>
13
* This program is free software; you can redistribute it and/or
14
* modify it under the terms of the GNU General Public License
15
* as published by the Free Software Foundation; either version 2
16
* of the License, or (at your option) any later version.
18
* This program is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
25
#include <core/core.h>
26
#include <core/pluginclasshandler.h>
27
#include <composite/composite.h>
28
#include <opengl/opengl.h>
29
#include <mousepoll/mousepoll.h>
31
#include <cairo-xlib-xrender.h>
34
#include "wall_options.h"
43
} ScreenTransformation;
45
/* FIXME: put into own class? */
46
typedef struct _WallCairoContext
49
GLTexture::List texture;
51
cairo_surface_t *surface;
60
public ScreenInterface,
61
public CompositeScreenInterface,
62
public GLScreenInterface,
63
public PluginClassHandler <WallScreen, CompScreen>,
77
WallScreen (CompScreen *s);
80
void preparePaint (int);
81
void paint (CompOutput::ptrList &, unsigned int);
83
void handleEvent (XEvent *event);
85
bool glPaintOutput (const GLScreenPaintAttrib &,
86
const GLMatrix &, const CompRegion &,
87
CompOutput *, unsigned int);
88
void glPaintTransformedOutput (const GLScreenPaintAttrib &,
91
CompOutput *, unsigned int);
93
bool setOptionForPlugin (const char *, const char *,
95
void matchExpHandlerChanged ();
96
void matchPropertyChanged (CompWindow *);
98
void createCairoContexts (bool);
99
void setupCairoContext (WallCairoContext &);
100
void destroyCairoContext (WallCairoContext &);
101
void clearCairoLayer (cairo_t *);
102
void drawSwitcherBackground ();
104
void drawHighlight ();
106
void drawCairoTextureOnScreen();
108
void releaseMoveWindow ();
109
void computeTranslation (float &, float &);
110
void determineMovementAngle ();
111
bool checkDestination (unsigned int, unsigned int);
112
void checkAmount (int, int, int &, int &);
114
bool initiate (CompAction *, CompAction::State, CompOption::Vector &,
116
bool terminate (CompAction *, CompAction::State, CompOption::Vector &);
117
bool initiateFlip (Direction, CompAction::State);
119
bool moveViewport (int, int, Window);
121
void optionChanged (CompOption *opt, WallOptions::Options num);
122
void toggleEdges (bool);
124
void positionUpdate (const CompPoint &pos);
125
void updateScreenEdgeRegions ();
127
CompositeScreen *cScreen;
130
bool moving; /* Used to track miniview movement */
138
int direction; /* >= 0 : direction arrow angle, < 0 : no direction */
141
unsigned int boxOutputDevice;
149
ScreenTransformation transform;
150
CompOutput *currOutput;
152
GLWindowPaintAttrib mSAttribs;
164
WallCairoContext switcherContext;
165
WallCairoContext thumbContext;
166
WallCairoContext highlightContext;
167
WallCairoContext arrowContext;
171
CompRegion edgeRegion;
172
CompRegion noEdgeRegion;
176
public WindowInterface,
177
public GLWindowInterface,
178
public PluginClassHandler <WallWindow, CompWindow>
181
WallWindow (CompWindow *);
183
virtual void activate ();
184
void grabNotify (int, int, unsigned int, unsigned int);
185
void ungrabNotify ();
186
bool glPaint (const GLWindowPaintAttrib &, const GLMatrix &,
187
const CompRegion &, unsigned int);
195
#define WALL_SCREEN(s) \
196
WallScreen *ws = WallScreen::get (s)
198
#define WALL_WINDOW(w) \
199
WallWindow *ww = WallWindow::get (w)
201
class WallPluginVTable :
202
public CompPlugin::VTableForScreenAndWindow <WallScreen, WallWindow>