2
* Copyright © 2005 Novell, Inc.
3
* Copyright (C) 2007, 2008 Kristian Lyngstøl
5
* Ported to compiz 0.9 by:
6
* Copyright (C) 2009, Sam Spilsbury
8
* Permission to use, copy, modify, distribute, and sell this software
9
* and its documentation for any purpose is hereby granted without
10
* fee, provided that the above copyright notice appear in all copies
11
* and that both that copyright notice and this permission notice
12
* appear in supporting documentation, and that the name of
13
* Novell, Inc. not be used in advertising or publicity pertaining to
14
* distribution of the software without specific, written prior permission.
15
* Novell, Inc. makes no representations about the suitability of this
16
* software for any purpose. It is provided "as is" without express or
19
* NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
20
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
21
* NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
22
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
23
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
24
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
25
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
29
* - Original zoom plug-in; David Reveman <davidr@novell.com>
30
* - Most features beyond basic zoom;
31
* Kristian Lyngstol <kristian@bohemians.org>
32
* - Sam I suppose? (for the c++)
34
* Todo: Un-puke the header-file. Five levels of indentation in a .h is a
35
* clear sign that something is horribly wrong.
37
* Essentially, this needs to be re-done for C++. As is the case of most of
42
#include <core/core.h>
43
#include <core/serialization.h>
44
#include <composite/composite.h>
45
#include <opengl/opengl.h>
46
#include <mousepoll/mousepoll.h>
49
#include "ezoom_options.h"
54
public PluginClassHandler <EZoomScreen, CompScreen>,
55
public PluginStateWriter <EZoomScreen>,
57
public ScreenInterface,
58
public CompositeScreenInterface,
59
public GLScreenInterface
63
EZoomScreen (CompScreen *);
68
CompositeScreen *cScreen;
102
/* Stores an actual zoom-setup. This can later be used to store/restore
103
* zoom areas on the fly.
105
* [xy]Translate and newZoom are target values, and [xy]Translate always
106
* ranges from -0.5 to 0.5.
108
* currentZoom is actual zoomed value
110
* real[XY]Translate are the currently used values in the same range as
111
* [xy]Translate, and [xy]trans is adjusted for the zoom level in place.
112
* [xyz]trans should never be modified except in updateActualTranslates()
114
* viewport is a mask of the viewport, or ~0 for "any".
120
template <class Archive>
121
void serialize (Archive &ar, const unsigned int)
139
unsigned long int viewport;
147
GLfloat realXTranslate;
148
GLfloat realYTranslate;
158
updateActualTranslates ();
163
template <class Archive>
164
void serialize (Archive &ar, const unsigned int version)
171
std::vector <ZoomArea> zooms; // list of zooms (different zooms for
173
CompPoint mouse; // we get this from mousepoll
174
unsigned long int grabbed;
175
CompScreen::GrabHandle grabIndex; // for zoomBox
177
CursorTexture cursor; // the texture for the faux-cursor
178
// we paint to do fake input
180
bool cursorInfoSelected;
185
MousePoller pollHandle; // mouse poller object
203
glPaintOutput (const GLScreenPaintAttrib &,
213
handleEvent (XEvent *);
218
distanceToEdge (int out, EZoomScreen::ZoomEdge edge);
221
isInMovement (int out);
224
adjustZoomVelocity (int out, float chunk);
227
adjustXYVelocity (int out, float chunk);
230
drawBox (const GLMatrix &transform,
235
setCenter (int x, int y, bool instant);
245
areaToWindow (CompWindow *w);
248
panZoom (int xvalue, int yvalue);
251
enableMousePolling ();
254
setScale (int out, float value);
257
syncCenterToMouse ();
260
convertToZoomed (int out,
267
convertToZoomedTarget (int out,
274
ensureVisibility (int x, int y, int margin);
277
ensureVisibilityArea (int x1,
282
ZoomGravity gravity);
285
restrainCursor (int out);
291
updateMousePosition (const CompPoint &p);
294
updateMouseInterval (const CompPoint &p);
298
freeCursor (CursorTexture * cursor);
301
drawCursor (CompOutput *output,
302
const GLMatrix &transform);
305
updateCursor (CursorTexture * cursor);
308
cursorZoomInactive ();
311
cursorZoomActive (int);
316
setZoomAreaAction (CompAction *action,
317
CompAction::State state,
318
CompOption::Vector options);
321
ensureVisibilityAction (CompAction *action,
322
CompAction::State state,
323
CompOption::Vector options);
326
zoomBoxActivate (CompAction *action,
327
CompAction::State state,
328
CompOption::Vector options);
331
zoomBoxDeactivate (CompAction *action,
332
CompAction::State state,
333
CompOption::Vector options);
336
zoomIn (CompAction *action,
337
CompAction::State state,
338
CompOption::Vector options);
341
lockZoomAction (CompAction *action,
342
CompAction::State state,
343
CompOption::Vector options);
346
zoomSpecific (CompAction *action,
347
CompAction::State state,
348
CompOption::Vector options,
352
zoomToWindow (CompAction *action,
353
CompAction::State state,
354
CompOption::Vector options);
357
zoomPan (CompAction *action,
358
CompAction::State state,
359
CompOption::Vector options,
364
zoomCenterMouse (CompAction *action,
365
CompAction::State state,
366
CompOption::Vector options);
369
zoomFitWindowToZoom (CompAction *action,
370
CompAction::State state,
371
CompOption::Vector options);
374
initiate (CompAction *action,
375
CompAction::State state,
376
CompOption::Vector options);
379
zoomOut (CompAction *action,
380
CompAction::State state,
381
CompOption::Vector options);
384
terminate (CompAction *action,
385
CompAction::State state,
386
CompOption::Vector options);
389
focusTrack (XEvent *event);
392
#define ZOOM_SCREEN(s) \
393
EZoomScreen *zs = EZoomScreen::get (s)
395
class ZoomPluginVTable :
396
public CompPlugin::VTableForScreen <EZoomScreen>