1
/********************************************************************
2
KWin - the KDE window manager
3
This file is part of the KDE project.
5
Copyright (C) 2008 Martin Gräßlin <ubuntu@martin-graesslin.com>
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2 of the License, or
10
(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.
17
You should have received a copy of the GNU General Public License
18
along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*********************************************************************/
24
#include <kwineffects.h>
25
#include <kwinglutils.h>
26
#include <kshortcut.h>
31
#include "cube_inside.h"
32
#include "cube_proxy.h"
44
virtual void reconfigure(ReconfigureFlags);
45
virtual void prePaintScreen(ScreenPrePaintData& data, int time);
46
virtual void paintScreen(int mask, QRegion region, ScreenPaintData& data);
47
virtual void postPaintScreen();
48
virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time);
49
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
50
virtual bool borderActivated(ElectricBorder border);
51
virtual void grabbedKeyboardEvent(QKeyEvent* e);
52
virtual void windowInputMouseEvent(Window w, QEvent* e);
55
virtual void* proxy();
56
void registerCubeInsideEffect(CubeInsideEffect* effect);
57
void unregisterCubeInsideEffect(CubeInsideEffect* effect);
59
static bool supported();
62
void toggleCylinder();
64
// slots for global shortcut changed
65
// needed to toggle the effect
66
void cubeShortcutChanged(const QKeySequence& seq);
67
void cylinderShortcutChanged(const QKeySequence& seq);
68
void sphereShortcutChanged(const QKeySequence& seq);
69
void slotTabBoxAdded(int mode);
70
void slotTabBoxUpdated();
71
void slotTabBoxClosed();
72
void slotMouseChanged(const QPoint& pos, const QPoint& oldpos, Qt::MouseButtons buttons,
73
Qt::MouseButtons oldbuttons, Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers);
75
enum RotationDirection {
81
enum VerticalRotationPosition {
91
void toggle(CubeMode newMode = Cube);
92
void paintCube(int mask, QRegion region, ScreenPaintData& data);
93
void paintCap(bool frontFirst, float zOffset);
95
void paintCylinderCap();
96
void paintSphereCap();
98
void loadConfig(QString config);
100
void rotateToDesktop(int desktop);
101
void setActive(bool active);
107
QList<ElectricBorder> borderActivate;
108
QList<ElectricBorder> borderActivateCylinder;
109
QList<ElectricBorder> borderActivateSphere;
110
int painting_desktop;
114
bool opacityDesktopOnly;
115
bool displayDesktopName;
116
EffectFrame* desktopNameFrame;
117
QFont desktopNameFont;
120
bool verticalRotating;
121
bool desktopChangedWhileRotating;
124
QTimeLine verticalTimeLine;
125
RotationDirection rotationDirection;
126
RotationDirection verticalRotationDirection;
127
VerticalRotationPosition verticalPosition;
128
QQueue<RotationDirection> rotations;
129
QQueue<RotationDirection> verticalRotations;
130
QColor backgroundColor;
132
GLTexture* wallpaper;
134
GLTexture* capTexture;
136
float manualVerticalAngle;
137
QTimeLine::CurveShape currentShape;
140
bool reflectionPainting;
141
int rotationDuration;
144
bool closeOnMouseRelease;
151
bool shortcutsRegistered;
154
GLShader* cylinderShader;
155
GLShader* sphereShader;
156
GLShader* m_reflectionShader;
157
GLShader* m_capShader;
158
float capDeformationFactor;
160
float zOrderingFactor;
162
// needed for reflection
163
float mAddedHeightCoeff1;
164
float mAddedHeightCoeff2;
166
QMatrix4x4 m_rotationMatrix;
167
QMatrix4x4 m_reflectionMatrix;
168
QMatrix4x4 m_textureMirrorMatrix;
169
GLVertexBuffer *m_cubeCapBuffer;
171
// Shortcuts - needed to toggle the effect
172
KShortcut cubeShortcut;
173
KShortcut cylinderShortcut;
174
KShortcut sphereShortcut;
177
CubeEffectProxy m_proxy;
178
QList< CubeInsideEffect* > m_cubeInsideEffects;