libkwineffects: Stop including xcb/xcb.h everywhere
Provide a kwinxcb.h header file instead that offers the xcb-specific bits from that API. It helps keep kwin effects disconnected from XCB.
This commit is contained in:
parent
43291d971a
commit
d6b07b313f
13 changed files with 69 additions and 42 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <QTest>
|
||||
#include <private/qtx11extras_p.h>
|
||||
|
||||
#include "libkwineffects/kwinxcb.h"
|
||||
#include "main.h"
|
||||
#include "utils/common.h"
|
||||
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#define TESTUTILS_H
|
||||
// KWin
|
||||
#include "libkwineffects/kwinglobals.h"
|
||||
// XCB
|
||||
#include <xcb/xcb.h>
|
||||
#include "libkwineffects/kwinxcb.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "input.h"
|
||||
#include "libkwineffects/kwinglobals.h"
|
||||
#include "libkwineffects/kwinxcb.h"
|
||||
#include "modifier_only_shortcuts.h"
|
||||
#include "workspace.h"
|
||||
#include "x11eventfilter.h"
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
// own
|
||||
#include "client_machine.h"
|
||||
#include "libkwineffects/kwinxcb.h"
|
||||
#include "main.h"
|
||||
#include "utils/common.h"
|
||||
// KF5
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "libkwineffects/kwinglobals.h"
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QRegion>
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
#include <kwin_export.h>
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
#include "libkwineffects/kwinconfig.h"
|
||||
|
||||
#define KWIN_QT5_PORTING 0
|
||||
|
@ -193,21 +191,6 @@ enum class QuickTileFlag {
|
|||
Q_ENUM_NS(QuickTileFlag);
|
||||
Q_DECLARE_FLAGS(QuickTileMode, QuickTileFlag)
|
||||
|
||||
inline KWIN_EXPORT xcb_connection_t *connection()
|
||||
{
|
||||
return reinterpret_cast<xcb_connection_t *>(qApp->property("x11Connection").value<void *>());
|
||||
}
|
||||
|
||||
inline KWIN_EXPORT xcb_window_t rootWindow()
|
||||
{
|
||||
return qApp->property("x11RootWindow").value<quint32>();
|
||||
}
|
||||
|
||||
inline KWIN_EXPORT xcb_timestamp_t xTime()
|
||||
{
|
||||
return qApp->property("x11Time").value<xcb_timestamp_t>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Short wrapper for a cursor image provided by the Platform.
|
||||
* @since 5.9
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
// include kwinglutils_funcs.h to avoid the redeclaration issues
|
||||
// between qopengl.h and epoxy/gl.h
|
||||
#include "libkwineffects/kwinglutils_funcs.h"
|
||||
#include "libkwineffects/kwinxcb.h"
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
|
57
src/libkwineffects/kwinxcb.h
Normal file
57
src/libkwineffects/kwinxcb.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2006 Lubos Lunak <l.lunak@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <kwin_export.h>
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
inline KWIN_EXPORT xcb_connection_t *connection()
|
||||
{
|
||||
return reinterpret_cast<xcb_connection_t *>(qApp->property("x11Connection").value<void *>());
|
||||
}
|
||||
|
||||
inline KWIN_EXPORT xcb_window_t rootWindow()
|
||||
{
|
||||
return qApp->property("x11RootWindow").value<quint32>();
|
||||
}
|
||||
|
||||
inline KWIN_EXPORT xcb_timestamp_t xTime()
|
||||
{
|
||||
return qApp->property("x11Time").value<xcb_timestamp_t>();
|
||||
}
|
||||
|
||||
void KWIN_EXPORT grabXServer();
|
||||
void KWIN_EXPORT ungrabXServer();
|
||||
bool KWIN_EXPORT grabXKeyboard(xcb_window_t w = XCB_WINDOW_NONE);
|
||||
void KWIN_EXPORT ungrabXKeyboard();
|
||||
|
||||
/**
|
||||
* Small helper class which performs grabXServer in the ctor and
|
||||
* ungrabXServer in the dtor. Use this class to ensure that grab and
|
||||
* ungrab are matched.
|
||||
*/
|
||||
class XServerGrabber
|
||||
{
|
||||
public:
|
||||
XServerGrabber()
|
||||
{
|
||||
grabXServer();
|
||||
}
|
||||
~XServerGrabber()
|
||||
{
|
||||
ungrabXServer();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
|
@ -20,6 +20,8 @@
|
|||
#include <QApplication>
|
||||
#include <QProcessEnvironment>
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
class KPluginMetaData;
|
||||
class QCommandLineParser;
|
||||
|
||||
|
|
|
@ -26,7 +26,9 @@
|
|||
#include <QObject>
|
||||
#include <QRect>
|
||||
#include <QVector>
|
||||
|
||||
#include <memory>
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
class QAction;
|
||||
class QMouseEvent;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "libkwineffects/kwinxcb.h"
|
||||
#include "utils/c_ptr.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
|
|
@ -84,11 +84,6 @@ inline MaximizeMode operator^(MaximizeMode m1, MaximizeMode m2)
|
|||
return MaximizeMode(int(m1) ^ int(m2));
|
||||
}
|
||||
|
||||
void KWIN_EXPORT grabXServer();
|
||||
void KWIN_EXPORT ungrabXServer();
|
||||
bool KWIN_EXPORT grabXKeyboard(xcb_window_t w = XCB_WINDOW_NONE);
|
||||
void KWIN_EXPORT ungrabXKeyboard();
|
||||
|
||||
static inline QRegion mapRegion(const QMatrix4x4 &matrix, const QRegion ®ion)
|
||||
{
|
||||
QRegion result;
|
||||
|
@ -98,24 +93,6 @@ static inline QRegion mapRegion(const QMatrix4x4 &matrix, const QRegion ®ion)
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Small helper class which performs grabXServer in the ctor and
|
||||
* ungrabXServer in the dtor. Use this class to ensure that grab and
|
||||
* ungrab are matched.
|
||||
*/
|
||||
class XServerGrabber
|
||||
{
|
||||
public:
|
||||
XServerGrabber()
|
||||
{
|
||||
grabXServer();
|
||||
}
|
||||
~XServerGrabber()
|
||||
{
|
||||
ungrabXServer();
|
||||
}
|
||||
};
|
||||
|
||||
// converting between X11 mouse/keyboard state mask and Qt button/keyboard states
|
||||
Qt::MouseButton x11ToQtMouseButton(int button);
|
||||
Qt::MouseButton KWIN_EXPORT x11ToQtMouseButton(int button);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "libkwineffects/kwinglobals.h"
|
||||
#include "libkwineffects/kwinxcb.h"
|
||||
#include "main.h"
|
||||
#include "utils/c_ptr.h"
|
||||
|
||||
|
|
Loading…
Reference in a new issue