~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kwin/libkwineffects/kwinglobals.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/********************************************************************
 
2
 KWin - the KDE window manager
 
3
 This file is part of the KDE project.
 
4
 
 
5
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
 
6
 
 
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.
 
11
 
 
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.
 
16
 
 
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
*********************************************************************/
 
20
 
 
21
#ifndef KWIN_LIB_KWINGLOBALS_H
 
22
#define KWIN_LIB_KWINGLOBALS_H
 
23
 
 
24
#include <QtGui/QX11Info>
 
25
#include <QtCore/QPoint>
 
26
#include <QtGui/QRegion>
 
27
 
 
28
#include <kdemacros.h>
 
29
 
 
30
#include <X11/Xlib.h>
 
31
#include <fixx11h.h>
 
32
 
 
33
#include <kwinconfig.h>
 
34
 
 
35
#define KWIN_EXPORT KDE_EXPORT
 
36
 
 
37
namespace KWin
 
38
{
 
39
 
 
40
 
 
41
enum CompositingType {
 
42
    NoCompositing = 0,
 
43
    OpenGLCompositing,
 
44
    XRenderCompositing
 
45
};
 
46
 
 
47
enum clientAreaOption {
 
48
    PlacementArea,         // geometry where a window will be initially placed after being mapped
 
49
    MovementArea,          // ???  window movement snapping area?  ignore struts
 
50
    MaximizeArea,          // geometry to which a window will be maximized
 
51
    MaximizeFullArea,      // like MaximizeArea, but ignore struts - used e.g. for topmenu
 
52
    FullScreenArea,        // area for fullscreen windows
 
53
    // these below don't depend on xinerama settings
 
54
    WorkArea,              // whole workarea (all screens together)
 
55
    FullArea,              // whole area (all screens together), ignore struts
 
56
    ScreenArea             // one whole screen, ignore struts
 
57
};
 
58
 
 
59
enum ElectricBorder {
 
60
    ElectricTop,
 
61
    ElectricTopRight,
 
62
    ElectricRight,
 
63
    ElectricBottomRight,
 
64
    ElectricBottom,
 
65
    ElectricBottomLeft,
 
66
    ElectricLeft,
 
67
    ElectricTopLeft,
 
68
    ELECTRIC_COUNT,
 
69
    ElectricNone
 
70
};
 
71
 
 
72
enum QuickTileFlag {
 
73
    QuickTileNone = 0,
 
74
    QuickTileLeft = 1,
 
75
    QuickTileRight = 1<<1,
 
76
    QuickTileTop = 1<<2,
 
77
    QuickTileBottom = 1<<3,
 
78
    QuickTileHorizontal = QuickTileLeft|QuickTileRight,
 
79
    QuickTileVertical = QuickTileTop|QuickTileBottom,
 
80
    QuickTileMaximize = QuickTileLeft|QuickTileRight|QuickTileTop|QuickTileBottom
 
81
};
 
82
 
 
83
Q_DECLARE_FLAGS(QuickTileMode, QuickTileFlag)
 
84
 
 
85
// TODO: Hardcoding is bad, need to add some way of registering global actions to these.
 
86
// When designing the new system we must keep in mind that we have conditional actions
 
87
// such as "only when moving windows" desktop switching that the current global action
 
88
// system doesn't support.
 
89
enum ElectricBorderAction {
 
90
    ElectricActionNone,          // No special action, not set, desktop switch or an effect
 
91
    ElectricActionDashboard,     // Launch the Plasma dashboard
 
92
    ElectricActionShowDesktop,   // Show desktop or restore
 
93
    ElectricActionLockScreen,   // Lock screen
 
94
    ElectricActionPreventScreenLocking,
 
95
    ELECTRIC_ACTION_COUNT
 
96
};
 
97
 
 
98
// DesktopMode and WindowsMode are based on the order in which the desktop
 
99
//  or window were viewed.
 
100
// DesktopListMode lists them in the order created.
 
101
enum TabBoxMode {
 
102
    TabBoxDesktopMode,           // Focus chain of desktops
 
103
    TabBoxDesktopListMode,       // Static desktop order
 
104
    TabBoxWindowsMode,           // Primary window switching mode
 
105
    TabBoxWindowsAlternativeMode // Secondary window switching mode
 
106
};
 
107
 
 
108
inline
 
109
KWIN_EXPORT Display* display()
 
110
{
 
111
    return QX11Info::display();
 
112
}
 
113
 
 
114
inline
 
115
KWIN_EXPORT Window rootWindow()
 
116
{
 
117
    return QX11Info::appRootWindow();
 
118
}
 
119
 
 
120
inline
 
121
KWIN_EXPORT Window xTime()
 
122
{
 
123
    return QX11Info::appTime();
 
124
}
 
125
 
 
126
inline
 
127
KWIN_EXPORT int displayWidth()
 
128
{
 
129
    return XDisplayWidth(display(), DefaultScreen(display()));
 
130
}
 
131
 
 
132
inline
 
133
KWIN_EXPORT int displayHeight()
 
134
{
 
135
    return XDisplayHeight(display(), DefaultScreen(display()));
 
136
}
 
137
 
 
138
/** @internal */
 
139
class KWIN_EXPORT Extensions
 
140
{
 
141
public:
 
142
    static void init();
 
143
    static bool shapeAvailable() {
 
144
        return shape_version > 0;
 
145
    }
 
146
    static bool shapeInputAvailable();
 
147
    static int shapeNotifyEvent();
 
148
    static bool hasShape(Window w);
 
149
    static bool randrAvailable() {
 
150
        return has_randr;
 
151
    }
 
152
    static int randrNotifyEvent();
 
153
    static bool damageAvailable() {
 
154
        return has_damage;
 
155
    }
 
156
    static int damageNotifyEvent();
 
157
    static bool compositeAvailable() {
 
158
        return composite_version > 0;
 
159
    }
 
160
    static bool compositeOverlayAvailable();
 
161
    static bool renderAvailable() {
 
162
        return render_version > 0;
 
163
    }
 
164
    static bool fixesAvailable() {
 
165
        return fixes_version > 0;
 
166
    }
 
167
    static bool fixesRegionAvailable();
 
168
    static bool glxAvailable() {
 
169
        return has_glx;
 
170
    }
 
171
    static bool syncAvailable() {
 
172
        return has_sync;
 
173
    }
 
174
    static bool nonNativePixmaps() {
 
175
        return non_native_pixmaps;
 
176
    }
 
177
    static int syncAlarmNotifyEvent();
 
178
    static void fillExtensionsData(const char**& extensions, int& nextensions, int*&majors, int*& error_bases);
 
179
private:
 
180
    static void addData(const char* name);
 
181
    static int shape_version;
 
182
    static int shape_event_base;
 
183
    static bool has_randr;
 
184
    static int randr_event_base;
 
185
    static bool has_damage;
 
186
    static int damage_event_base;
 
187
    static int composite_version;
 
188
    static int render_version;
 
189
    static int fixes_version;
 
190
    static bool has_glx;
 
191
    static bool has_sync;
 
192
    static int sync_event_base;
 
193
    static const char* data_extensions[ 32 ];
 
194
    static int data_nextensions;
 
195
    static int data_opcodes[ 32 ];
 
196
    static int data_error_bases[ 32 ];
 
197
    static bool non_native_pixmaps;
 
198
};
 
199
 
 
200
} // namespace
 
201
 
 
202
Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::QuickTileMode)
 
203
 
 
204
#endif