diff --git a/autotests/test_x11_timestamp_update.cpp b/autotests/test_x11_timestamp_update.cpp index f6f5ca07ea..e9b0985140 100644 --- a/autotests/test_x11_timestamp_update.cpp +++ b/autotests/test_x11_timestamp_update.cpp @@ -10,6 +10,7 @@ #include #include +#include "libkwineffects/kwinxcb.h" #include "main.h" #include "utils/common.h" diff --git a/autotests/testutils.h b/autotests/testutils.h index 98b740dce2..5efbdf2c6c 100644 --- a/autotests/testutils.h +++ b/autotests/testutils.h @@ -10,8 +10,7 @@ #define TESTUTILS_H // KWin #include "libkwineffects/kwinglobals.h" -// XCB -#include +#include "libkwineffects/kwinxcb.h" namespace { diff --git a/src/backends/x11/standalone/x11_standalone_xinputintegration.cpp b/src/backends/x11/standalone/x11_standalone_xinputintegration.cpp index 32a9a2ad4f..05b4e0ffb8 100644 --- a/src/backends/x11/standalone/x11_standalone_xinputintegration.cpp +++ b/src/backends/x11/standalone/x11_standalone_xinputintegration.cpp @@ -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" diff --git a/src/client_machine.cpp b/src/client_machine.cpp index cd9ec7c67b..79cc02107d 100644 --- a/src/client_machine.cpp +++ b/src/client_machine.cpp @@ -8,6 +8,7 @@ */ // own #include "client_machine.h" +#include "libkwineffects/kwinxcb.h" #include "main.h" #include "utils/common.h" // KF5 diff --git a/src/composite.h b/src/composite.h index 2256d6590b..25090feca6 100644 --- a/src/composite.h +++ b/src/composite.h @@ -10,6 +10,7 @@ #pragma once #include "libkwineffects/kwinglobals.h" +#include #include #include diff --git a/src/libkwineffects/kwinglobals.h b/src/libkwineffects/kwinglobals.h index a4209c109b..3cf3358d78 100644 --- a/src/libkwineffects/kwinglobals.h +++ b/src/libkwineffects/kwinglobals.h @@ -16,8 +16,6 @@ #include -#include - #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(qApp->property("x11Connection").value()); -} - -inline KWIN_EXPORT xcb_window_t rootWindow() -{ - return qApp->property("x11RootWindow").value(); -} - -inline KWIN_EXPORT xcb_timestamp_t xTime() -{ - return qApp->property("x11Time").value(); -} - /** * Short wrapper for a cursor image provided by the Platform. * @since 5.9 diff --git a/src/libkwineffects/kwinglplatform.cpp b/src/libkwineffects/kwinglplatform.cpp index 60f178dc3f..4f90947211 100644 --- a/src/libkwineffects/kwinglplatform.cpp +++ b/src/libkwineffects/kwinglplatform.cpp @@ -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 #include diff --git a/src/libkwineffects/kwinxcb.h b/src/libkwineffects/kwinxcb.h new file mode 100644 index 0000000000..0993380b68 --- /dev/null +++ b/src/libkwineffects/kwinxcb.h @@ -0,0 +1,57 @@ +/* + KWin - the KDE window manager + This file is part of the KDE project. + + SPDX-FileCopyrightText: 2006 Lubos Lunak + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#pragma once + +#include +#include +#include + +namespace KWin +{ + +inline KWIN_EXPORT xcb_connection_t *connection() +{ + return reinterpret_cast(qApp->property("x11Connection").value()); +} + +inline KWIN_EXPORT xcb_window_t rootWindow() +{ + return qApp->property("x11RootWindow").value(); +} + +inline KWIN_EXPORT xcb_timestamp_t xTime() +{ + return qApp->property("x11Time").value(); +} + +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(); + } +}; + +} diff --git a/src/main.h b/src/main.h index df08d78c77..b612b756eb 100644 --- a/src/main.h +++ b/src/main.h @@ -20,6 +20,8 @@ #include #include +#include + class KPluginMetaData; class QCommandLineParser; diff --git a/src/screenedge.h b/src/screenedge.h index 43e5a10bd5..2c7aa7a5bf 100644 --- a/src/screenedge.h +++ b/src/screenedge.h @@ -26,7 +26,9 @@ #include #include #include + #include +#include class QAction; class QMouseEvent; diff --git a/src/utils/common.cpp b/src/utils/common.cpp index ec64aa4747..82db671cd7 100644 --- a/src/utils/common.cpp +++ b/src/utils/common.cpp @@ -15,6 +15,7 @@ */ #include "utils/common.h" +#include "libkwineffects/kwinxcb.h" #include "utils/c_ptr.h" #include diff --git a/src/utils/common.h b/src/utils/common.h index c2f001821a..df9f55e9ba 100644 --- a/src/utils/common.h +++ b/src/utils/common.h @@ -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); diff --git a/src/utils/xcbutils.h b/src/utils/xcbutils.h index b0e94bb843..1589d0cb2f 100644 --- a/src/utils/xcbutils.h +++ b/src/utils/xcbutils.h @@ -9,6 +9,7 @@ #pragma once #include "libkwineffects/kwinglobals.h" +#include "libkwineffects/kwinxcb.h" #include "main.h" #include "utils/c_ptr.h"