kwin/libkwineffects/kwinglobals.h
Martin Gräßlin b967527db3 Use XCB to resolve the X11 Extensions
The extension handling is removed from kwinglobals and moved into the
xcbutils in KWin core in namespace KWin::Xcb. The motivation for this
change is that the Extensions are only used in KWin core and are marked
as internal. So there is no need to have them in the library.

What remains in Extensions are the non-native pixmaps. This will be
removed once we are on Qt 5 as QPixmap can no longer reference an XPixmap.

The remaining code in kwinglobals also still initialize the XLib versions
of extensions emitting events. It seems like there are no XEvents emitted
if not done so even if the extension is correctly initialized with xcb.
This needs to be removed once the event handling is ported over to xcb.

REVIEW: 107832
2013-01-22 07:50:03 +01:00

183 lines
5.3 KiB
C++

/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
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/>.
*********************************************************************/
#ifndef KWIN_LIB_KWINGLOBALS_H
#define KWIN_LIB_KWINGLOBALS_H
#include <QtGui/QX11Info>
#include <QtCore/QPoint>
#include <QtGui/QRegion>
#include <kdemacros.h>
#include <X11/Xlib.h>
#include <X11/Xlib-xcb.h>
#include <fixx11h.h>
#include <kwinconfig.h>
#define KWIN_EXPORT KDE_EXPORT
namespace KWin
{
enum CompositingType {
NoCompositing = 0,
/**
* 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
};
enum OpenGLPlatformInterface {
NoOpenGLPlatformInterface = 0,
GlxPlatformInterface,
EglPlatformInterface
};
enum clientAreaOption {
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
};
enum ElectricBorder {
ElectricTop,
ElectricTopRight,
ElectricRight,
ElectricBottomRight,
ElectricBottom,
ElectricBottomLeft,
ElectricLeft,
ElectricTopLeft,
ELECTRIC_COUNT,
ElectricNone
};
enum QuickTileFlag {
QuickTileNone = 0,
QuickTileLeft = 1,
QuickTileRight = 1<<1,
QuickTileTop = 1<<2,
QuickTileBottom = 1<<3,
QuickTileHorizontal = QuickTileLeft|QuickTileRight,
QuickTileVertical = QuickTileTop|QuickTileBottom,
QuickTileMaximize = QuickTileLeft|QuickTileRight|QuickTileTop|QuickTileBottom
};
Q_DECLARE_FLAGS(QuickTileMode, QuickTileFlag)
// 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.
enum ElectricBorderAction {
ElectricActionNone, // No special action, not set, desktop switch or an effect
ElectricActionDashboard, // Launch the Plasma dashboard
ElectricActionShowDesktop, // Show desktop or restore
ElectricActionLockScreen, // Lock screen
ElectricActionPreventScreenLocking,
ELECTRIC_ACTION_COUNT
};
// DesktopMode and WindowsMode are based on the order in which the desktop
// or window were viewed.
// DesktopListMode lists them in the order created.
enum TabBoxMode {
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
TabBoxCurrentAppWindowsAlternativeMode // Same as secondary switching mode but only for windows of current application
};
enum KWinOption {
CloseButtonCorner
};
inline
KWIN_EXPORT Display* display()
{
return QX11Info::display();
}
inline
KWIN_EXPORT xcb_connection_t *connection()
{
return XGetXCBConnection(display());
}
inline
KWIN_EXPORT Window rootWindow()
{
return QX11Info::appRootWindow();
}
inline
KWIN_EXPORT Window xTime()
{
return QX11Info::appTime();
}
inline
KWIN_EXPORT int displayWidth()
{
return XDisplayWidth(display(), DefaultScreen(display()));
}
inline
KWIN_EXPORT int displayHeight()
{
return XDisplayHeight(display(), DefaultScreen(display()));
}
/** @internal */
// TODO: QT5: remove
class KWIN_EXPORT Extensions
{
public:
static void init();
static bool nonNativePixmaps() {
return non_native_pixmaps;
}
private:
static bool non_native_pixmaps;
};
} // namespace
Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::QuickTileMode)
#endif