aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Gräßlin <[email protected]>2016-11-11 09:59:46 +0100
committerMartin Gräßlin <[email protected]>2016-11-16 18:00:00 +0100
commit346619aa36c38176c7431aa429174a6ebfdd178f (patch)
tree0618dfac81f2cd5bc9fd202d2c7ad444f7f4daf5
parentd7fa827644877e7a83aa0f77547195198bef7345 (diff)
Remove KWin::display from kwinglobals
Summary: And finally nothing inside libkwineffects, libkwinglutils, libkwinxrenderutils and kwineffect and kwin core uses KWin::display. We are finally XLib free! This change drops KWin::display and removes the include to QX11Info from kwinglobals.h. And the libraries no longer need to link X11Extras. Due to that removal a few seeming unrelated changes are required to add the include where needed and linkage to X11Extras. The biggest change is to x11 platform plugin which still needs the display and caches it in the Platform and passes it to various places in a way that the code doesn't need to be adjusted. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D3337
-rw-r--r--autotests/CMakeLists.txt3
-rw-r--r--autotests/mock_effectshandler.h2
-rw-r--r--autotests/test_client_machine.cpp1
-rw-r--r--autotests/test_screen_edges.cpp1
-rw-r--r--autotests/test_xcb_size_hints.cpp1
-rw-r--r--autotests/test_xcb_window.cpp1
-rw-r--r--autotests/test_xcb_wrapper.cpp1
-rw-r--r--kcmkwin/kwinrules/main.cpp1
-rw-r--r--libkwineffects/CMakeLists.txt3
-rw-r--r--libkwineffects/kwinglobals.h11
-rw-r--r--main_x11.cpp3
-rw-r--r--plugins/platforms/x11/common/eglonxbackend.cpp4
-rw-r--r--plugins/platforms/x11/common/eglonxbackend.h2
-rw-r--r--plugins/platforms/x11/standalone/glxbackend.cpp4
-rw-r--r--plugins/platforms/x11/standalone/glxbackend.h9
-rw-r--r--plugins/platforms/x11/standalone/x11_platform.cpp7
-rw-r--r--plugins/platforms/x11/standalone/x11_platform.h1
-rw-r--r--plugins/platforms/x11/standalone/xinputintegration.cpp3
-rw-r--r--plugins/platforms/x11/standalone/xinputintegration.h7
-rw-r--r--tests/screenedgeshowtest.cpp1
-rw-r--r--utils.cpp1
21 files changed, 43 insertions, 24 deletions
diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
index 2974d96..25c059d 100644
--- a/autotests/CMakeLists.txt
+++ b/autotests/CMakeLists.txt
@@ -134,6 +134,7 @@ add_executable( testBuiltInEffectLoader ${testBuiltInEffectLoader_SRCS})
target_link_libraries(testBuiltInEffectLoader
Qt5::Concurrent
Qt5::Test
+ Qt5::X11Extras
KF5::Package
kwineffects
kwin4_effect_builtins
@@ -160,6 +161,7 @@ target_link_libraries(testScriptedEffectLoader
Qt5::Concurrent
Qt5::Script
Qt5::Test
+ Qt5::X11Extras
KF5::ConfigGui
KF5::GlobalAccel
KF5::I18n
@@ -184,6 +186,7 @@ add_executable( testPluginEffectLoader ${testPluginEffectLoader_SRCS})
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
index 3855892..86b259d 100644
--- a/autotests/mock_effectshandler.h
+++ b/autotests/mock_effectshandler.h
@@ -21,6 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MOCK_EFFECTS_HANDLER_H
#include <kwineffects.h>
+#include <QX11Info>
+
class MockEffectsHandler : public KWin::EffectsHandler
{
Q_OBJECT
diff --git a/autotests/test_client_machine.cpp b/autotests/test_client_machine.cpp
index e862473..1d97f6d 100644
--- a/autotests/test_client_machine.cpp
+++ b/autotests/test_client_machine.cpp
@@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Qt
#include <QApplication>
#include <QtTest/QtTest>
+#include <QX11Info>
// xcb
#include <xcb/xcb.h>
// system
diff --git a/autotests/test_screen_edges.cpp b/autotests/test_screen_edges.cpp
index 87017bd..0595f53 100644
--- a/autotests/test_screen_edges.cpp
+++ b/autotests/test_screen_edges.cpp
@@ -35,6 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KConfigGroup>
// Qt
#include <QtTest/QtTest>
+#include <QX11Info>
// xcb
#include <xcb/xcb.h>
Q_DECLARE_METATYPE(KWin::ElectricBorder)
diff --git a/autotests/test_xcb_size_hints.cpp b/autotests/test_xcb_size_hints.cpp
index e759943..59b6bfc 100644
--- a/autotests/test_xcb_size_hints.cpp
+++ b/autotests/test_xcb_size_hints.cpp
@@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Qt
#include <QApplication>
#include <QtTest/QtTest>
+#include <QX11Info>
#include <netwm.h>
// xcb
#include <xcb/xcb.h>
diff --git a/autotests/test_xcb_window.cpp b/autotests/test_xcb_window.cpp
index 339be67..ee703f3 100644
--- a/autotests/test_xcb_window.cpp
+++ b/autotests/test_xcb_window.cpp
@@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Qt
#include <QApplication>
#include <QtTest/QtTest>
+#include <QX11Info>
// xcb
#include <xcb/xcb.h>
diff --git a/autotests/test_xcb_wrapper.cpp b/autotests/test_xcb_wrapper.cpp
index a1e312c..4a428c9 100644
--- a/autotests/test_xcb_wrapper.cpp
+++ b/autotests/test_xcb_wrapper.cpp
@@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Qt
#include <QApplication>
#include <QtTest/QtTest>
+#include <QX11Info>
#include <netwm.h>
// xcb
#include <xcb/xcb.h>
diff --git a/kcmkwin/kwinrules/main.cpp b/kcmkwin/kwinrules/main.cpp
index 885e7ab..ae66a03 100644
--- a/kcmkwin/kwinrules/main.cpp
+++ b/kcmkwin/kwinrules/main.cpp
@@ -22,6 +22,7 @@
#include <KLocalizedString>
#include <kwindowsystem.h>
#include <QtDBus/QtDBus>
+#include <QX11Info>
#include <X11/Xlib.h>
#include <fixx11h.h>
diff --git a/libkwineffects/CMakeLists.txt b/libkwineffects/CMakeLists.txt
index 306e380..165abc5 100644
--- a/libkwineffects/CMakeLists.txt
+++ b/libkwineffects/CMakeLists.txt
@@ -45,7 +45,6 @@ set(kwin_EFFECTSLIB_SRCS
set(kwineffects_QT_LIBS
Qt5::DBus
Qt5::Widgets
- Qt5::X11Extras
)
set(kwineffects_KDE_LIBS
@@ -91,7 +90,7 @@ macro( KWIN4_ADD_GLUTILS_BACKEND name glinclude )
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
index e755da1..ba57d27 100644
--- a/libkwineffects/kwinglobals.h
+++ b/libkwineffects/kwinglobals.h
@@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QImage>
#include <QPoint>
#include <QVariant>
-#include <QtX11Extras/QX11Info>
#include <QCoreApplication>
#include <QVariant>
@@ -131,16 +130,6 @@ enum PointerAxisDirection {
};
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
index e4db348..da3c045 100644
--- a/main_x11.cpp
+++ b/main_x11.cpp
@@ -43,6 +43,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QLabel>
#include <QPushButton>
#include <QVBoxLayout>
+#include <QX11Info>
// system
#ifdef HAVE_UNISTD_H
@@ -439,7 +440,7 @@ KWIN_EXPORT int kdemain(int argc, char * argv[])
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.cpp b/plugins/platforms/x11/common/eglonxbackend.cpp
index 78e0ce4..077d9b8 100644
--- a/plugins/platforms/x11/common/eglonxbackend.cpp
+++ b/plugins/platforms/x11/common/eglonxbackend.cpp
@@ -38,14 +38,14 @@ Q_LOGGING_CATEGORY(KWIN_CORE, "kwin_core", QtCriticalMsg)
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/common/eglonxbackend.h b/plugins/platforms/x11/common/eglonxbackend.h
index d123fee..941f660 100644
--- a/plugins/platforms/x11/common/eglonxbackend.h
+++ b/plugins/platforms/x11/common/eglonxbackend.h
@@ -31,7 +31,7 @@ namespace KWin
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/standalone/glxbackend.cpp b/plugins/platforms/x11/standalone/glxbackend.cpp
index d2dbada..59599ac 100644
--- a/plugins/platforms/x11/standalone/glxbackend.cpp
+++ b/plugins/platforms/x11/standalone/glxbackend.cpp
@@ -37,6 +37,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Qt
#include <QDebug>
#include <QOpenGLContext>
+#include <QX11Info>
// system
#include <unistd.h>
@@ -105,7 +106,7 @@ bool SwapEventFilter::event(xcb_generic_event_t *event)
-GlxBackend::GlxBackend()
+GlxBackend::GlxBackend(Display *display)
: OpenGLBackend()
, m_overlayWindow(new OverlayWindow())
, window(None)
@@ -114,6 +115,7 @@ GlxBackend::GlxBackend()
, ctx(nullptr)
, m_bufferAge(0)
, haveSwapInterval(false)
+ , m_x11Display(display)
{
}
diff --git a/plugins/platforms/x11/standalone/glxbackend.h b/plugins/platforms/x11/standalone/glxbackend.h
index 1f801df..5978741 100644
--- a/plugins/platforms/x11/standalone/glxbackend.h
+++ b/plugins/platforms/x11/standalone/glxbackend.h
@@ -65,7 +65,7 @@ private:
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 @@ private:
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 @@ private:
bool m_haveINTELSwapEvent = false;
bool haveSwapInterval = false;
bool haveWaitSync = false;
+ Display *m_x11Display;
friend class GlxTexture;
};
@@ -130,6 +134,9 @@ private:
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/x11_platform.cpp b/plugins/platforms/x11/standalone/x11_platform.cpp
index 0c1dc19..73db092 100644
--- a/plugins/platforms/x11/standalone/x11_platform.cpp
+++ b/plugins/platforms/x11/standalone/x11_platform.cpp
@@ -46,10 +46,11 @@ namespace KWin
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 @@ OpenGLBackend *X11StandalonePlatform::createOpenGLBackend()
#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/x11_platform.h b/plugins/platforms/x11/standalone/x11_platform.h
index 4a17f88..e4811f1 100644
--- a/plugins/platforms/x11/standalone/x11_platform.h
+++ b/plugins/platforms/x11/standalone/x11_platform.h
@@ -70,6 +70,7 @@ private:
XInputIntegration *m_xinputIntegration = nullptr;
QThread *m_openGLFreezeProtectionThread = nullptr;
QTimer *m_openGLFreezeProtection = nullptr;
+ Display *m_x11Display;
};
diff --git a/plugins/platforms/x11/standalone/xinputintegration.cpp b/plugins/platforms/x11/standalone/xinputintegration.cpp
index 490f150..a944a55 100644
--- a/plugins/platforms/x11/standalone/xinputintegration.cpp
+++ b/plugins/platforms/x11/standalone/xinputintegration.cpp
@@ -162,8 +162,9 @@ private:
Xkb *m_xkb = nullptr;
};
-XInputIntegration::XInputIntegration(QObject *parent)
+XInputIntegration::XInputIntegration(Display *display, QObject *parent)
: QObject(parent)
+ , m_x11Display(display)
{
}
diff --git a/plugins/platforms/x11/standalone/xinputintegration.h b/plugins/platforms/x11/standalone/xinputintegration.h
index a818569..ba1ff4b 100644
--- a/plugins/platforms/x11/standalone/xinputintegration.h
+++ b/plugins/platforms/x11/standalone/xinputintegration.h
@@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QObject>
#include <QPointer>
#include <QScopedPointer>
+typedef struct _XDisplay Display;
namespace KWin
{
@@ -36,7 +37,7 @@ class XInputIntegration : public QObject
{
Q_OBJECT
public:
- explicit XInputIntegration(QObject *parent);
+ explicit XInputIntegration(Display *display, QObject *parent);
virtual ~XInputIntegration();
void init();
@@ -49,6 +50,9 @@ public:
void setXkb(Xkb *xkb);
private:
+ Display *display() const {
+ return m_x11Display;
+ }
bool m_hasXInput = false;
int m_xiOpcode = 0;
@@ -57,6 +61,7 @@ private:
QPointer<X11Cursor> m_x11Cursor;
// TODO: QPointer
Xkb *m_xkb = nullptr;
+ Display *m_x11Display;
QScopedPointer<XInputEventFilter> m_xiEventFilter;
QScopedPointer<XKeyPressReleaseEventFilter> m_keyPressFilter;
diff --git a/tests/screenedgeshowtest.cpp b/tests/screenedgeshowtest.cpp
index ec3f2de..804fd36 100644
--- a/tests/screenedgeshowtest.cpp
+++ b/tests/screenedgeshowtest.cpp
@@ -28,6 +28,7 @@
#include <QWindow>
#include <QWidget>
#include <QCheckBox>
+#include <QX11Info>
#include "../xcbutils.h"
#include <KWindowSystem>
diff --git a/utils.cpp b/utils.cpp
index ad45406..afa631c 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -35,6 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QApplication>
#include <QDebug>
+#include <QX11Info>
#include <X11/Xlib.h>
#include <stdio.h>