From 5d946e37629b56be5b57931c1a3f0463dc8bd913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 11 Aug 2015 13:50:35 +0200 Subject: [PATCH] Make X11_XCB a build dependency of X11 windowed backend Let's rather not build the plugin if we don't have the dependency then building it without OpenGL support. Simplifies the code a bit and makes the backend overall more useful and goes along with e.g. the Wayland one which has EGL also as a hard dependency for the plugin. REVIEW: 124697 --- CMakeLists.txt | 2 +- backends/CMakeLists.txt | 4 +++- backends/x11/CMakeLists.txt | 5 +---- backends/x11/x11windowed_backend.cpp | 13 ------------- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1b9c6c361..5687720dd9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -208,7 +208,7 @@ add_feature_info("XCB-ICCCM" XCB_ICCCM_FOUND "Required for building test applica find_package(X11_XCB) set_package_properties(X11_XCB PROPERTIES - PURPOSE "Required for OpenGL support in X11 windowed backend of kwin_wayland" + PURPOSE "Required for building X11 windowed backend of kwin_wayland" TYPE OPTIONAL) ########### configure tests ############### diff --git a/backends/CMakeLists.txt b/backends/CMakeLists.txt index 809ac64edb..d3dc674bfe 100644 --- a/backends/CMakeLists.txt +++ b/backends/CMakeLists.txt @@ -6,4 +6,6 @@ if(HAVE_LIBHYBRIS) add_subdirectory(hwcomposer) endif() add_subdirectory(wayland) -add_subdirectory(x11) +if(X11_XCB_FOUND) + add_subdirectory(x11) +endif() diff --git a/backends/x11/CMakeLists.txt b/backends/x11/CMakeLists.txt index 9ce72fad1a..9ac360768c 100644 --- a/backends/x11/CMakeLists.txt +++ b/backends/x11/CMakeLists.txt @@ -6,10 +6,7 @@ set(X11BACKEND_SOURCES ) add_library(KWinWaylandX11Backend MODULE ${X11BACKEND_SOURCES}) -target_link_libraries(KWinWaylandX11Backend kwin) -if(X11_XCB_FOUND) - target_link_libraries(KWinWaylandX11Backend X11::XCB) -endif() +target_link_libraries(KWinWaylandX11Backend kwin X11::XCB) install( TARGETS diff --git a/backends/x11/x11windowed_backend.cpp b/backends/x11/x11windowed_backend.cpp index 95a5b70ecf..74df134add 100644 --- a/backends/x11/x11windowed_backend.cpp +++ b/backends/x11/x11windowed_backend.cpp @@ -23,9 +23,7 @@ along with this program. If not, see . #include "logging.h" #include "wayland_server.h" #include "xcbutils.h" -#if HAVE_X11_XCB #include "eglonxbackend.h" -#endif #include #include #include @@ -36,9 +34,7 @@ along with this program. If not, see . #include // system #include -#if HAVE_X11_XCB #include -#endif namespace KWin { @@ -67,22 +63,16 @@ void X11WindowedBackend::init() { int screen = 0; xcb_connection_t *c = nullptr; -#if HAVE_X11_XCB Display *xDisplay = XOpenDisplay(deviceIdentifier().constData()); if (xDisplay) { c = XGetXCBConnection(xDisplay); XSetEventQueueOwner(xDisplay, XCBOwnsEventQueue); screen = XDefaultScreen(xDisplay); } -#else - c = xcb_connect(deviceIdentifier().constData(), &screen); -#endif if (c && !xcb_connection_has_error(c)) { m_connection = c; m_screenNumber = screen; -#if HAVE_X11_XCB m_display = xDisplay; -#endif for (xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(m_connection)); it.rem; --screen, xcb_screen_next(&it)) { @@ -325,10 +315,7 @@ Screens *X11WindowedBackend::createScreens(QObject *parent) OpenGLBackend *X11WindowedBackend::createOpenGLBackend() { -#if HAVE_X11_XCB return new EglOnXBackend(connection(), display(), rootWindow(), screenNumer(), window()); -#endif - return nullptr; } QPainterBackend *X11WindowedBackend::createQPainterBackend()