2007-11-27 19:40:25 +00:00
|
|
|
/********************************************************************
|
2007-04-29 17:35:43 +00:00
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
|
2007-11-27 19:40:25 +00:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#ifndef KWIN_LIB_KWINGLOBALS_H
|
|
|
|
#define KWIN_LIB_KWINGLOBALS_H
|
|
|
|
|
2013-07-23 09:43:11 +00:00
|
|
|
#include <QtX11Extras/QX11Info>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-12-06 07:37:16 +00:00
|
|
|
#include <kwin_export.h>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-02-26 07:14:17 +00:00
|
|
|
#include <xcb/xcb.h>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2007-12-17 14:14:53 +00:00
|
|
|
#include <kwinconfig.h>
|
|
|
|
|
2013-07-22 14:15:42 +00:00
|
|
|
#define KWIN_QT5_PORTING 0
|
2013-12-06 07:37:16 +00:00
|
|
|
#define KWIN_EXPORT KDEINIT_KWIN_EXPORT
|
2008-01-16 18:13:24 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
enum CompositingType {
|
2007-04-29 17:35:43 +00:00
|
|
|
NoCompositing = 0,
|
2012-09-20 09:33:32 +00:00
|
|
|
/**
|
|
|
|
* Used as a flag whether OpenGL based compositing is used.
|
|
|
|
* The flag is or-ed to the enum values of the specific OpenGL types.
|
|
|
|
* The actual Compositors use the @c OpenGL1Compositing or @c OpenGL2Compositing
|
|
|
|
* flags. If you need to know whether OpenGL is used, either and the flag or
|
|
|
|
* use EffectsHandler::isOpenGLCompositing().
|
|
|
|
**/
|
|
|
|
OpenGLCompositing = 1,
|
|
|
|
XRenderCompositing = 1<<1,
|
|
|
|
OpenGL1Compositing = 1<<2 | OpenGLCompositing,
|
|
|
|
OpenGL2Compositing = 1<<3 | OpenGLCompositing
|
2007-04-29 17:35:43 +00:00
|
|
|
};
|
|
|
|
|
2012-09-29 11:19:35 +00:00
|
|
|
enum OpenGLPlatformInterface {
|
|
|
|
NoOpenGLPlatformInterface = 0,
|
|
|
|
GlxPlatformInterface,
|
|
|
|
EglPlatformInterface
|
|
|
|
};
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
enum clientAreaOption {
|
2007-04-29 17:35:43 +00:00
|
|
|
PlacementArea, // geometry where a window will be initially placed after being mapped
|
|
|
|
MovementArea, // ??? window movement snapping area? ignore struts
|
|
|
|
MaximizeArea, // geometry to which a window will be maximized
|
|
|
|
MaximizeFullArea, // like MaximizeArea, but ignore struts - used e.g. for topmenu
|
|
|
|
FullScreenArea, // area for fullscreen windows
|
|
|
|
// these below don't depend on xinerama settings
|
|
|
|
WorkArea, // whole workarea (all screens together)
|
|
|
|
FullArea, // whole area (all screens together), ignore struts
|
|
|
|
ScreenArea // one whole screen, ignore struts
|
|
|
|
};
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
enum ElectricBorder {
|
2007-04-29 17:35:43 +00:00
|
|
|
ElectricTop,
|
|
|
|
ElectricTopRight,
|
|
|
|
ElectricRight,
|
|
|
|
ElectricBottomRight,
|
|
|
|
ElectricBottom,
|
|
|
|
ElectricBottomLeft,
|
|
|
|
ElectricLeft,
|
|
|
|
ElectricTopLeft,
|
|
|
|
ELECTRIC_COUNT,
|
|
|
|
ElectricNone
|
|
|
|
};
|
|
|
|
|
2009-02-28 08:33:16 +00:00
|
|
|
// TODO: Hardcoding is bad, need to add some way of registering global actions to these.
|
|
|
|
// When designing the new system we must keep in mind that we have conditional actions
|
|
|
|
// such as "only when moving windows" desktop switching that the current global action
|
|
|
|
// system doesn't support.
|
2011-01-30 14:34:42 +00:00
|
|
|
enum ElectricBorderAction {
|
2009-02-28 08:33:16 +00:00
|
|
|
ElectricActionNone, // No special action, not set, desktop switch or an effect
|
|
|
|
ElectricActionDashboard, // Launch the Plasma dashboard
|
2009-06-28 20:32:50 +00:00
|
|
|
ElectricActionShowDesktop, // Show desktop or restore
|
2010-03-10 22:25:20 +00:00
|
|
|
ElectricActionLockScreen, // Lock screen
|
|
|
|
ElectricActionPreventScreenLocking,
|
2009-02-28 08:33:16 +00:00
|
|
|
ELECTRIC_ACTION_COUNT
|
|
|
|
};
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
// DesktopMode and WindowsMode are based on the order in which the desktop
|
|
|
|
// or window were viewed.
|
|
|
|
// DesktopListMode lists them in the order created.
|
2011-01-30 14:34:42 +00:00
|
|
|
enum TabBoxMode {
|
2012-04-25 20:57:48 +00:00
|
|
|
TabBoxDesktopMode, // Focus chain of desktops
|
|
|
|
TabBoxDesktopListMode, // Static desktop order
|
|
|
|
TabBoxWindowsMode, // Primary window switching mode
|
|
|
|
TabBoxWindowsAlternativeMode, // Secondary window switching mode
|
|
|
|
TabBoxCurrentAppWindowsMode, // Same as primary window switching mode but only for windows of current application
|
2012-06-06 22:38:13 +00:00
|
|
|
TabBoxCurrentAppWindowsAlternativeMode // Same as secondary switching mode but only for windows of current application
|
2009-09-13 11:36:45 +00:00
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-04-25 15:04:04 +00:00
|
|
|
enum KWinOption {
|
2013-01-30 12:36:37 +00:00
|
|
|
CloseButtonCorner,
|
|
|
|
SwitchDesktopOnScreenEdge,
|
|
|
|
SwitchDesktopOnScreenEdgeMovingWindows
|
2011-04-25 15:04:04 +00:00
|
|
|
};
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
inline
|
|
|
|
KWIN_EXPORT Display* display()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-08-02 06:31:53 +00:00
|
|
|
static Display *s_display = nullptr;
|
|
|
|
if (!s_display) {
|
|
|
|
s_display = QX11Info::display();
|
|
|
|
}
|
|
|
|
return s_display;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-03-26 15:14:04 +00:00
|
|
|
inline
|
|
|
|
KWIN_EXPORT xcb_connection_t *connection()
|
|
|
|
{
|
2013-02-14 07:39:56 +00:00
|
|
|
static xcb_connection_t *s_con = NULL;
|
|
|
|
if (!s_con) {
|
2013-07-23 10:46:04 +00:00
|
|
|
s_con = QX11Info::connection();
|
2013-02-14 07:39:56 +00:00
|
|
|
}
|
|
|
|
return s_con;
|
2012-03-26 15:14:04 +00:00
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
inline
|
2013-02-26 07:14:17 +00:00
|
|
|
KWIN_EXPORT xcb_window_t rootWindow()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-08-02 06:31:53 +00:00
|
|
|
static xcb_window_t s_rootWindow = XCB_WINDOW_NONE;
|
|
|
|
if (s_rootWindow == XCB_WINDOW_NONE) {
|
|
|
|
s_rootWindow = QX11Info::appRootWindow();
|
|
|
|
}
|
|
|
|
return s_rootWindow;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline
|
2013-02-26 07:14:17 +00:00
|
|
|
KWIN_EXPORT xcb_timestamp_t xTime()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return QX11Info::appTime();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-02-26 07:14:17 +00:00
|
|
|
inline
|
|
|
|
KWIN_EXPORT xcb_screen_t *defaultScreen()
|
|
|
|
{
|
|
|
|
static xcb_screen_t *s_screen = NULL;
|
|
|
|
if (s_screen) {
|
|
|
|
return s_screen;
|
|
|
|
}
|
|
|
|
int screen = QX11Info::appScreen();
|
|
|
|
for (xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(connection()));
|
|
|
|
it.rem;
|
|
|
|
--screen, xcb_screen_next(&it)) {
|
|
|
|
if (screen == 0) {
|
|
|
|
s_screen = it.data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return s_screen;
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
inline
|
|
|
|
KWIN_EXPORT int displayWidth()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-02-26 07:14:17 +00:00
|
|
|
xcb_screen_t *screen = defaultScreen();
|
|
|
|
return screen ? screen->width_in_pixels : 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline
|
|
|
|
KWIN_EXPORT int displayHeight()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-02-26 07:14:17 +00:00
|
|
|
xcb_screen_t *screen = defaultScreen();
|
|
|
|
return screen ? screen->height_in_pixels : 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2013-04-05 07:41:25 +00:00
|
|
|
#define KWIN_SINGLETON_VARIABLE(ClassName, variableName) \
|
|
|
|
public: \
|
|
|
|
static ClassName *create(QObject *parent = 0);\
|
|
|
|
static ClassName *self() { return variableName; }\
|
|
|
|
protected: \
|
|
|
|
explicit ClassName(QObject *parent = 0); \
|
|
|
|
private: \
|
|
|
|
static ClassName *variableName;
|
|
|
|
|
|
|
|
#define KWIN_SINGLETON(ClassName) KWIN_SINGLETON_VARIABLE(ClassName, s_self)
|
|
|
|
|
|
|
|
#define KWIN_SINGLETON_FACTORY_VARIABLE_FACTORED(ClassName, FactoredClassName, variableName) \
|
|
|
|
ClassName *ClassName::variableName = 0; \
|
|
|
|
ClassName *ClassName::create(QObject *parent) \
|
|
|
|
{ \
|
|
|
|
Q_ASSERT(!variableName); \
|
|
|
|
variableName = new FactoredClassName(parent); \
|
|
|
|
return variableName; \
|
|
|
|
}
|
|
|
|
#define KWIN_SINGLETON_FACTORY_VARIABLE(ClassName, variableName) KWIN_SINGLETON_FACTORY_VARIABLE_FACTORED(ClassName, ClassName, variableName)
|
|
|
|
#define KWIN_SINGLETON_FACTORY_FACTORED(ClassName, FactoredClassName) KWIN_SINGLETON_FACTORY_VARIABLE_FACTORED(ClassName, FactoredClassName, s_self)
|
|
|
|
#define KWIN_SINGLETON_FACTORY(ClassName) KWIN_SINGLETON_FACTORY_VARIABLE(ClassName, s_self)
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
#endif
|