diff --git a/CMakeLists.txt b/CMakeLists.txt index 810ce861..29a536dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,12 +23,15 @@ include(CTest) include(test) # Options -OPTION(WLC_X11_SUPPORT "Build X11 backend and XWayland support" ON) +OPTION(WLC_X11_BACKEND_SUPPORT "Build X11 backend" ON) +OPTION(WLC_XWAYLAND_SUPPORT "Support XWayland applications" ON) OPTION(WLC_WAYLAND_BACKEND_SUPPORT "Build Wayland backend" ON) OPTION(WLC_BUILD_STATIC "Build wlc as static library" OFF) OPTION(WLC_BUILD_EXAMPLES "Build wlc examples" ON) OPTION(WLC_BUILD_TESTS "Build wlc tests" ON) +add_feature_info(X11Backend WLC_X11_BACKEND_SUPPORT "Compile X11 backend") +add_feature_info(XWaylandSupport WLC_XWAYLAND_SUPPORT "Compile support for XWayland") add_feature_info(WaylandBackend WLC_WAYLAND_BACKEND_SUPPORT "Compile Wayland backend") add_feature_info(Static WLC_BUILD_STATIC "Compile as static library") add_feature_info(Examples WLC_BUILD_EXAMPLES "Compile example programs") @@ -43,12 +46,26 @@ find_package(Udev REQUIRED) find_package(LibInput REQUIRED) find_package(WaylandProtocols REQUIRED) -if (WLC_X11_SUPPORT) - find_package(X11 REQUIRED COMPONENTS X11-xcb Xfixes) - set_package_properties(X11 PROPERTIES TYPE REQUIRED PURPOSE "Enables X11 backend") - find_package(XCB REQUIRED COMPONENTS xcb-ewmh xcb-composite xcb-xkb xcb-image xcb-xfixes) - set_package_properties(XCB PROPERTIES TYPE REQUIRED PURPOSE "Enables Xwayland and X11 backend") +if (WLC_X11_BACKEND_SUPPORT) + find_package(X11 REQUIRED COMPONENTS X11-xcb Xfixes) + set_package_properties(X11 PROPERTIES TYPE REQUIRED PURPOSE "Enables X11 backend") + find_package(XCB REQUIRED COMPONENTS xcb-ewmh xcb-composite xcb-xkb xcb-image xcb-xfixes) + set_package_properties(XCB PROPERTIES TYPE REQUIRED PURPOSE "Enables Xwayland and X11 backend") + if (X11_FOUND AND XCB_FOUND) + set(ENABLE_X11_BACKEND YES) + endif () endif () + +if (WLC_XWAYLAND_SUPPORT) + if (NOT XCB_FOUND) + find_package(XCB REQUIRED COMPONENTS xcb-ewmh xcb-composite xcb-xkb xcb-image xcb-xfixes) + set_package_properties(XCB PROPERTIES TYPE REQUIRED PURPOSE "Enables Xwayland and X11 backend") + endif () + if (XCB_FOUND) + set(ENABLE_XWAYLAND_SUPPORT YES) + endif () +endif () + find_package(GLESv2 REQUIRED) set_package_properties(GLESv2 PROPERTIES TYPE REQUIRED PURPOSE "Enables OpenGL renderer") find_package(EGL REQUIRED) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 51434d73..5f0b4c71 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -62,18 +62,22 @@ set(sources extended/wlc-render.c ) -if (X11_FOUND) +if (ENABLE_X11_BACKEND OR ENABLE_XWAYLAND_SUPPORT) + add_definitions(${XCB_DEFINITIONS}) + include_directories(${XCB_INCLUDE_DIRS}) + list(APPEND libs ${XCB_LIBRARIES}) +endif () + +if (ENABLE_X11_BACKEND) add_definitions(-DENABLE_X11_BACKEND) include_directories(${X11_INCLUDE_DIR}) list(APPEND sources platform/backend/x11.c) list(APPEND libs ${X11_LIBRARIES}) endif () -if (XCB_FOUND) - add_definitions(-DENABLE_XWAYLAND ${XCB_DEFINITIONS}) - include_directories(${XCB_INCLUDE_DIRS}) +if (ENABLE_XWAYLAND_SUPPORT) + add_definitions(-DENABLE_XWAYLAND) list(APPEND sources xwayland/xwayland.c xwayland/xwm.c xwayland/selection.c) - list(APPEND libs ${XCB_LIBRARIES}) endif () if (DBUS_FOUND) diff --git a/src/xwayland/xwm.h b/src/xwayland/xwm.h index 82cd0ad6..4cd7ac23 100644 --- a/src/xwayland/xwm.h +++ b/src/xwayland/xwm.h @@ -3,17 +3,18 @@ #include -#ifdef ENABLE_XWAYLAND - #include #include -#include #include +#include "compositor/seat/seat.h" #include "resources/types/data-source.h" #include "resources/types/surface.h" enum wlc_view_state_bit; +#ifdef ENABLE_XWAYLAND +#include + struct wlc_x11_window { uint32_t id; // xcb_window_t uint32_t surface_id; @@ -152,9 +153,10 @@ wlc_x11_window_close(struct wlc_x11_window *win) } WLC_NONULL static inline bool -wlc_xwm(struct wlc_xwm *xwm) +wlc_xwm(struct wlc_xwm *xwm, struct wlc_seat *seat) { (void)xwm; + (void)seat; return true; }