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
This commit is contained in:
parent
06aacf4f65
commit
5d946e3762
4 changed files with 5 additions and 19 deletions
|
@ -208,7 +208,7 @@ add_feature_info("XCB-ICCCM" XCB_ICCCM_FOUND "Required for building test applica
|
||||||
|
|
||||||
find_package(X11_XCB)
|
find_package(X11_XCB)
|
||||||
set_package_properties(X11_XCB PROPERTIES
|
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)
|
TYPE OPTIONAL)
|
||||||
|
|
||||||
########### configure tests ###############
|
########### configure tests ###############
|
||||||
|
|
|
@ -6,4 +6,6 @@ if(HAVE_LIBHYBRIS)
|
||||||
add_subdirectory(hwcomposer)
|
add_subdirectory(hwcomposer)
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory(wayland)
|
add_subdirectory(wayland)
|
||||||
add_subdirectory(x11)
|
if(X11_XCB_FOUND)
|
||||||
|
add_subdirectory(x11)
|
||||||
|
endif()
|
||||||
|
|
|
@ -6,10 +6,7 @@ set(X11BACKEND_SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(KWinWaylandX11Backend MODULE ${X11BACKEND_SOURCES})
|
add_library(KWinWaylandX11Backend MODULE ${X11BACKEND_SOURCES})
|
||||||
target_link_libraries(KWinWaylandX11Backend kwin)
|
target_link_libraries(KWinWaylandX11Backend kwin X11::XCB)
|
||||||
if(X11_XCB_FOUND)
|
|
||||||
target_link_libraries(KWinWaylandX11Backend X11::XCB)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
install(
|
install(
|
||||||
TARGETS
|
TARGETS
|
||||||
|
|
|
@ -23,9 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "wayland_server.h"
|
#include "wayland_server.h"
|
||||||
#include "xcbutils.h"
|
#include "xcbutils.h"
|
||||||
#if HAVE_X11_XCB
|
|
||||||
#include "eglonxbackend.h"
|
#include "eglonxbackend.h"
|
||||||
#endif
|
|
||||||
#include <kwinxrenderutils.h>
|
#include <kwinxrenderutils.h>
|
||||||
#include <QAbstractEventDispatcher>
|
#include <QAbstractEventDispatcher>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
@ -36,9 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <KWayland/Server/surface_interface.h>
|
#include <KWayland/Server/surface_interface.h>
|
||||||
// system
|
// system
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#if HAVE_X11_XCB
|
|
||||||
#include <X11/Xlib-xcb.h>
|
#include <X11/Xlib-xcb.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
@ -67,22 +63,16 @@ void X11WindowedBackend::init()
|
||||||
{
|
{
|
||||||
int screen = 0;
|
int screen = 0;
|
||||||
xcb_connection_t *c = nullptr;
|
xcb_connection_t *c = nullptr;
|
||||||
#if HAVE_X11_XCB
|
|
||||||
Display *xDisplay = XOpenDisplay(deviceIdentifier().constData());
|
Display *xDisplay = XOpenDisplay(deviceIdentifier().constData());
|
||||||
if (xDisplay) {
|
if (xDisplay) {
|
||||||
c = XGetXCBConnection(xDisplay);
|
c = XGetXCBConnection(xDisplay);
|
||||||
XSetEventQueueOwner(xDisplay, XCBOwnsEventQueue);
|
XSetEventQueueOwner(xDisplay, XCBOwnsEventQueue);
|
||||||
screen = XDefaultScreen(xDisplay);
|
screen = XDefaultScreen(xDisplay);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
c = xcb_connect(deviceIdentifier().constData(), &screen);
|
|
||||||
#endif
|
|
||||||
if (c && !xcb_connection_has_error(c)) {
|
if (c && !xcb_connection_has_error(c)) {
|
||||||
m_connection = c;
|
m_connection = c;
|
||||||
m_screenNumber = screen;
|
m_screenNumber = screen;
|
||||||
#if HAVE_X11_XCB
|
|
||||||
m_display = xDisplay;
|
m_display = xDisplay;
|
||||||
#endif
|
|
||||||
for (xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(m_connection));
|
for (xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(m_connection));
|
||||||
it.rem;
|
it.rem;
|
||||||
--screen, xcb_screen_next(&it)) {
|
--screen, xcb_screen_next(&it)) {
|
||||||
|
@ -325,10 +315,7 @@ Screens *X11WindowedBackend::createScreens(QObject *parent)
|
||||||
|
|
||||||
OpenGLBackend *X11WindowedBackend::createOpenGLBackend()
|
OpenGLBackend *X11WindowedBackend::createOpenGLBackend()
|
||||||
{
|
{
|
||||||
#if HAVE_X11_XCB
|
|
||||||
return new EglOnXBackend(connection(), display(), rootWindow(), screenNumer(), window());
|
return new EglOnXBackend(connection(), display(), rootWindow(), screenNumer(), window());
|
||||||
#endif
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QPainterBackend *X11WindowedBackend::createQPainterBackend()
|
QPainterBackend *X11WindowedBackend::createQPainterBackend()
|
||||||
|
|
Loading…
Reference in a new issue