diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -134,6 +134,7 @@ target_link_libraries(testBuiltInEffectLoader Qt5::Concurrent Qt5::Test + Qt5::X11Extras KF5::Package kwineffects kwin4_effect_builtins @@ -160,6 +161,7 @@ Qt5::Concurrent Qt5::Script Qt5::Test + Qt5::X11Extras KF5::ConfigGui KF5::GlobalAccel KF5::I18n @@ -184,6 +186,7 @@ target_link_libraries(testPluginEffectLoader Qt5::Concurrent Qt5::Test + Qt5::X11Extras KF5::Package kwineffects kwin4_effect_builtins diff --git a/autotests/mock_effectshandler.h b/autotests/mock_effectshandler.h --- a/autotests/mock_effectshandler.h +++ b/autotests/mock_effectshandler.h @@ -21,6 +21,8 @@ #define MOCK_EFFECTS_HANDLER_H #include +#include + class MockEffectsHandler : public KWin::EffectsHandler { Q_OBJECT diff --git a/autotests/test_client_machine.cpp b/autotests/test_client_machine.cpp --- a/autotests/test_client_machine.cpp +++ b/autotests/test_client_machine.cpp @@ -24,6 +24,7 @@ // Qt #include #include +#include // xcb #include // system diff --git a/autotests/test_screen_edges.cpp b/autotests/test_screen_edges.cpp --- a/autotests/test_screen_edges.cpp +++ b/autotests/test_screen_edges.cpp @@ -35,6 +35,7 @@ #include // Qt #include +#include // xcb #include Q_DECLARE_METATYPE(KWin::ElectricBorder) diff --git a/autotests/test_xcb_size_hints.cpp b/autotests/test_xcb_size_hints.cpp --- a/autotests/test_xcb_size_hints.cpp +++ b/autotests/test_xcb_size_hints.cpp @@ -23,6 +23,7 @@ // Qt #include #include +#include #include // xcb #include diff --git a/autotests/test_xcb_window.cpp b/autotests/test_xcb_window.cpp --- a/autotests/test_xcb_window.cpp +++ b/autotests/test_xcb_window.cpp @@ -23,6 +23,7 @@ // Qt #include #include +#include // xcb #include diff --git a/autotests/test_xcb_wrapper.cpp b/autotests/test_xcb_wrapper.cpp --- a/autotests/test_xcb_wrapper.cpp +++ b/autotests/test_xcb_wrapper.cpp @@ -23,6 +23,7 @@ // Qt #include #include +#include #include // xcb #include diff --git a/kcmkwin/kwinrules/main.cpp b/kcmkwin/kwinrules/main.cpp --- a/kcmkwin/kwinrules/main.cpp +++ b/kcmkwin/kwinrules/main.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include diff --git a/libkwineffects/CMakeLists.txt b/libkwineffects/CMakeLists.txt --- a/libkwineffects/CMakeLists.txt +++ b/libkwineffects/CMakeLists.txt @@ -45,7 +45,6 @@ set(kwineffects_QT_LIBS Qt5::DBus Qt5::Widgets - Qt5::X11Extras ) set(kwineffects_KDE_LIBS @@ -91,7 +90,7 @@ include_directories(${glinclude}) add_library(${name} SHARED ${kwin_GLUTILSLIB_SRCS}) generate_export_header(${name} BASE_NAME kwinglutils EXPORT_FILE_NAME kwinglutils_export.h) - target_link_libraries(${name} PUBLIC Qt5::DBus Qt5::X11Extras XCB::XCB KF5::CoreAddons KF5::WindowSystem) + target_link_libraries(${name} PUBLIC Qt5::DBus XCB::XCB KF5::CoreAddons KF5::WindowSystem) set_target_properties(${name} PROPERTIES VERSION ${KWINEFFECTS_VERSION_STRING} SOVERSION ${KWINEFFECTS_SOVERSION} diff --git a/libkwineffects/kwinglobals.h b/libkwineffects/kwinglobals.h --- a/libkwineffects/kwinglobals.h +++ b/libkwineffects/kwinglobals.h @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -131,16 +130,6 @@ }; inline -KWIN_EXPORT Display* display() -{ - static Display *s_display = nullptr; - if (!s_display && QX11Info::isPlatformX11()) { - s_display = QX11Info::display(); - } - return s_display; -} - -inline KWIN_EXPORT xcb_connection_t *connection() { static xcb_connection_t *s_con = nullptr; diff --git a/main_x11.cpp b/main_x11.cpp --- a/main_x11.cpp +++ b/main_x11.cpp @@ -43,6 +43,7 @@ #include #include #include +#include // system #ifdef HAVE_UNISTD_H @@ -439,7 +440,7 @@ argv[0], qPrintable(a.platformName())); exit(1); } - if (!KWin::display()) { + if (!QX11Info::display()) { fprintf(stderr, "%s: FATAL ERROR KWin requires Xlib support in the xcb plugin. Do not configure Qt with -no-xcb-xlib\n", argv[0]); exit(1); diff --git a/plugins/platforms/x11/common/eglonxbackend.h b/plugins/platforms/x11/common/eglonxbackend.h --- a/plugins/platforms/x11/common/eglonxbackend.h +++ b/plugins/platforms/x11/common/eglonxbackend.h @@ -31,7 +31,7 @@ class KWIN_EXPORT EglOnXBackend : public AbstractEglBackend { public: - EglOnXBackend(); + EglOnXBackend(Display *display); explicit EglOnXBackend(xcb_connection_t *connection, Display *display, xcb_window_t rootWindow, int screenNumber, xcb_window_t renderingWindow); virtual ~EglOnXBackend(); virtual void screenGeometryChanged(const QSize &size); diff --git a/plugins/platforms/x11/common/eglonxbackend.cpp b/plugins/platforms/x11/common/eglonxbackend.cpp --- a/plugins/platforms/x11/common/eglonxbackend.cpp +++ b/plugins/platforms/x11/common/eglonxbackend.cpp @@ -38,14 +38,14 @@ namespace KWin { -EglOnXBackend::EglOnXBackend() +EglOnXBackend::EglOnXBackend(Display *display) : AbstractEglBackend() , m_overlayWindow(new OverlayWindow()) , surfaceHasSubPost(0) , m_bufferAge(0) , m_usesOverlayWindow(true) , m_connection(connection()) - , m_x11Display(display()) + , m_x11Display(display) , m_rootWindow(rootWindow()) , m_x11ScreenNumber(kwinApp()->x11ScreenNumber()) { diff --git a/plugins/platforms/x11/standalone/glxbackend.h b/plugins/platforms/x11/standalone/glxbackend.h --- a/plugins/platforms/x11/standalone/glxbackend.h +++ b/plugins/platforms/x11/standalone/glxbackend.h @@ -65,7 +65,7 @@ class GlxBackend : public OpenGLBackend { public: - GlxBackend(); + GlxBackend(Display *display); virtual ~GlxBackend(); virtual void screenGeometryChanged(const QSize &size); virtual SceneOpenGL::TexturePrivate *createBackendTexture(SceneOpenGL::Texture *texture); @@ -89,6 +89,9 @@ bool initFbConfig(); void initVisualDepthHashTable(); void setSwapInterval(int interval); + Display *display() const { + return m_x11Display; + } int visualDepth(xcb_visualid_t visual) const; FBConfigInfo *infoForVisual(xcb_visualid_t visual); @@ -112,6 +115,7 @@ bool m_haveINTELSwapEvent = false; bool haveSwapInterval = false; bool haveWaitSync = false; + Display *m_x11Display; friend class GlxTexture; }; @@ -130,6 +134,9 @@ friend class GlxBackend; GlxTexture(SceneOpenGL::Texture *texture, GlxBackend *backend); bool loadTexture(xcb_pixmap_t pix, const QSize &size, xcb_visualid_t visual); + Display *display() const { + return m_backend->m_x11Display; + } SceneOpenGL::Texture *q; GlxBackend *m_backend; GLXPixmap m_glxpixmap; // the glx pixmap the texture is bound to diff --git a/plugins/platforms/x11/standalone/glxbackend.cpp b/plugins/platforms/x11/standalone/glxbackend.cpp --- a/plugins/platforms/x11/standalone/glxbackend.cpp +++ b/plugins/platforms/x11/standalone/glxbackend.cpp @@ -37,6 +37,7 @@ // Qt #include #include +#include // system #include @@ -105,15 +106,16 @@ -GlxBackend::GlxBackend() +GlxBackend::GlxBackend(Display *display) : OpenGLBackend() , m_overlayWindow(new OverlayWindow()) , window(None) , fbconfig(NULL) , glxWindow(None) , ctx(nullptr) , m_bufferAge(0) , haveSwapInterval(false) + , m_x11Display(display) { } diff --git a/plugins/platforms/x11/standalone/x11_platform.h b/plugins/platforms/x11/standalone/x11_platform.h --- a/plugins/platforms/x11/standalone/x11_platform.h +++ b/plugins/platforms/x11/standalone/x11_platform.h @@ -70,6 +70,7 @@ XInputIntegration *m_xinputIntegration = nullptr; QThread *m_openGLFreezeProtectionThread = nullptr; QTimer *m_openGLFreezeProtection = nullptr; + Display *m_x11Display; }; diff --git a/plugins/platforms/x11/standalone/x11_platform.cpp b/plugins/platforms/x11/standalone/x11_platform.cpp --- a/plugins/platforms/x11/standalone/x11_platform.cpp +++ b/plugins/platforms/x11/standalone/x11_platform.cpp @@ -46,10 +46,11 @@ X11StandalonePlatform::X11StandalonePlatform(QObject *parent) : Platform(parent) + , m_x11Display(QX11Info::display()) { #if HAVE_X11_XINPUT if (!qEnvironmentVariableIsSet("KWIN_NO_XI2")) { - m_xinputIntegration = new XInputIntegration(this); + m_xinputIntegration = new XInputIntegration(m_x11Display, this); m_xinputIntegration->init(); if (!m_xinputIntegration->hasXinput()) { delete m_xinputIntegration; @@ -84,14 +85,14 @@ #if HAVE_EPOXY_GLX case GlxPlatformInterface: if (hasGlx()) { - return new GlxBackend(); + return new GlxBackend(m_x11Display); } else { qCWarning(KWIN_X11STANDALONE) << "Glx not available, trying EGL instead."; // no break, needs fall-through } #endif case EglPlatformInterface: - return new EglOnXBackend(); + return new EglOnXBackend(m_x11Display); default: // no backend available return nullptr; diff --git a/plugins/platforms/x11/standalone/xinputintegration.h b/plugins/platforms/x11/standalone/xinputintegration.h --- a/plugins/platforms/x11/standalone/xinputintegration.h +++ b/plugins/platforms/x11/standalone/xinputintegration.h @@ -23,6 +23,7 @@ #include #include #include +typedef struct _XDisplay Display; namespace KWin { @@ -36,7 +37,7 @@ { Q_OBJECT public: - explicit XInputIntegration(QObject *parent); + explicit XInputIntegration(Display *display, QObject *parent); virtual ~XInputIntegration(); void init(); @@ -49,14 +50,18 @@ void setXkb(Xkb *xkb); private: + Display *display() const { + return m_x11Display; + } bool m_hasXInput = false; int m_xiOpcode = 0; int m_majorVersion = 0; int m_minorVersion = 0; QPointer m_x11Cursor; // TODO: QPointer Xkb *m_xkb = nullptr; + Display *m_x11Display; QScopedPointer m_xiEventFilter; QScopedPointer m_keyPressFilter; diff --git a/plugins/platforms/x11/standalone/xinputintegration.cpp b/plugins/platforms/x11/standalone/xinputintegration.cpp --- a/plugins/platforms/x11/standalone/xinputintegration.cpp +++ b/plugins/platforms/x11/standalone/xinputintegration.cpp @@ -162,8 +162,9 @@ Xkb *m_xkb = nullptr; }; -XInputIntegration::XInputIntegration(QObject *parent) +XInputIntegration::XInputIntegration(Display *display, QObject *parent) : QObject(parent) + , m_x11Display(display) { } diff --git a/tests/screenedgeshowtest.cpp b/tests/screenedgeshowtest.cpp --- a/tests/screenedgeshowtest.cpp +++ b/tests/screenedgeshowtest.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include "../xcbutils.h" #include diff --git a/utils.cpp b/utils.cpp --- a/utils.cpp +++ b/utils.cpp @@ -35,6 +35,7 @@ #include #include +#include #include #include