2
* Copyright © 2005 Novell, Inc.
4
* Permission to use, copy, modify, distribute, and sell this software
5
* and its documentation for any purpose is hereby granted without
6
* fee, provided that the above copyright notice appear in all copies
7
* and that both that copyright notice and this permission notice
8
* appear in supporting documentation, and that the name of
9
* Novell, Inc. not be used in advertising or publicity pertaining to
10
* distribution of the software without specific, written prior permission.
11
* Novell, Inc. makes no representations about the suitability of this
12
* software for any purpose. It is provided "as is" without express or
15
* NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17
* NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23
* Author: David Reveman <davidr@novell.com>
30
#include <sys/types.h>
33
#include <decoration.h>
34
#include <core/core.h>
35
#include <core/privatehandler.h>
36
#include <core/atoms.h>
38
#include <composite/composite.h>
39
#include <opengl/opengl.h>
41
#include <X11/Xatom.h>
42
#include <X11/extensions/Xrender.h>
44
#define ZOOMED_WINDOW_MASK (1 << 0)
45
#define NORMAL_WINDOW_MASK (1 << 1)
47
#define SWITCH_OPTION_NEXT_BUTTON 0
48
#define SWITCH_OPTION_NEXT_KEY 1
49
#define SWITCH_OPTION_PREV_BUTTON 2
50
#define SWITCH_OPTION_PREV_KEY 3
51
#define SWITCH_OPTION_NEXT_ALL_BUTTON 4
52
#define SWITCH_OPTION_NEXT_ALL_KEY 5
53
#define SWITCH_OPTION_PREV_ALL_BUTTON 6
54
#define SWITCH_OPTION_PREV_ALL_KEY 7
55
#define SWITCH_OPTION_NEXT_NO_POPUP_BUTTON 8
56
#define SWITCH_OPTION_NEXT_NO_POPUP_KEY 9
57
#define SWITCH_OPTION_PREV_NO_POPUP_BUTTON 10
58
#define SWITCH_OPTION_PREV_NO_POPUP_KEY 11
59
#define SWITCH_OPTION_NEXT_PANEL_BUTTON 12
60
#define SWITCH_OPTION_NEXT_PANEL_KEY 13
61
#define SWITCH_OPTION_PREV_PANEL_BUTTON 14
62
#define SWITCH_OPTION_PREV_PANEL_KEY 15
63
#define SWITCH_OPTION_SPEED 16
64
#define SWITCH_OPTION_TIMESTEP 17
65
#define SWITCH_OPTION_WINDOW_MATCH 18
66
#define SWITCH_OPTION_MIPMAP 19
67
#define SWITCH_OPTION_SATURATION 20
68
#define SWITCH_OPTION_BRIGHTNESS 21
69
#define SWITCH_OPTION_OPACITY 22
70
#define SWITCH_OPTION_BRINGTOFRONT 23
71
#define SWITCH_OPTION_ZOOM 24
72
#define SWITCH_OPTION_ICON 25
73
#define SWITCH_OPTION_MINIMIZED 26
74
#define SWITCH_OPTION_AUTO_ROTATE 27
75
#define SWITCH_OPTION_NUM 28
77
enum SwitchWindowSelection{
84
public ScreenInterface,
85
public CompositeScreenInterface,
86
public GLScreenInterface,
87
public PrivateHandler<SwitchScreen,CompScreen>
91
SwitchScreen (CompScreen *screen);
94
CompOption::Vector & getOptions ();
95
bool setOption (const char *name, CompOption::Value &value);
97
void handleEvent (XEvent *);
99
void preparePaint (int);
102
bool glPaintOutput (const GLScreenPaintAttrib &,
103
const GLMatrix &, const CompRegion &,
104
CompOutput *, unsigned int);
106
void setSelectedWindowHint ();
107
void activateEvent (bool activating);
108
void updateWindowList (int count);
109
void createWindowList (int count);
110
void switchToWindow (bool toNext);
112
void initiate (SwitchWindowSelection selection,
114
void windowRemove (Window id);
115
void updateForegroundColor ();
117
bool adjustVelocity ();
119
CompositeScreen *cScreen;
122
CompOption::Vector opt;
125
Atom selectFgColorAtom;
129
Window selectedWindow;
131
unsigned int lastActiveNum;
135
CompScreen::GrabHandle grabIndex;
147
CompWindowList windows;
155
SwitchWindowSelection selection;
157
unsigned int fgColor[4];
163
public CompositeWindowInterface,
164
public GLWindowInterface,
165
public PrivateHandler<SwitchWindow,CompWindow>
168
SwitchWindow (CompWindow *window) :
169
PrivateHandler<SwitchWindow,CompWindow> (window),
171
gWindow (GLWindow::get (window)),
172
cWindow (CompositeWindow::get (window)),
173
sScreen (SwitchScreen::get (screen)),
174
gScreen (GLScreen::get (screen))
176
GLWindowInterface::setHandler (gWindow, false);
177
CompositeWindowInterface::setHandler (cWindow, false);
179
if (sScreen->popupWindow && sScreen->popupWindow == window->id ())
180
gWindow->glPaintSetEnabled (this, true);
183
bool glPaint (const GLWindowPaintAttrib &, const GLMatrix &,
184
const CompRegion &, unsigned int);
186
bool damageRect (bool, const CompRect &);
190
void paintThumb (const GLWindowPaintAttrib &, const GLMatrix &,
191
unsigned int, int, int, int, int);
195
CompositeWindow *cWindow;
196
SwitchScreen *sScreen;
200
#define MwmHintsDecorations (1L << 1)
204
unsigned long functions;
205
unsigned long decorations;
212
#define SWITCH_ZOOM 0.1f
218
#define WINDOW_WIDTH(count) (WIDTH * (count) + (SPACE << 1))
219
#define WINDOW_HEIGHT (HEIGHT + (SPACE << 1))
221
#define SWITCH_SCREEN(s) \
222
SwitchScreen *ss = SwitchScreen::get (s)
224
#define SWITCH_WINDOW(w) \
225
SwitchWindow *sw = SwitchWindow::get (w)
227
class SwitchPluginVTable :
228
public CompPlugin::VTableForScreenAndWindow<SwitchScreen, SwitchWindow>
234
PLUGIN_OPTION_HELPER (SwitchScreen);