Skip to content

Commit

Permalink
Fix build without Xwayland support
Browse files Browse the repository at this point in the history
separate options for X11 backend and Xwayland support
  • Loading branch information
Hummer12007 committed Jul 15, 2017
1 parent 58ef467 commit 440c6bb
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 15 deletions.
29 changes: 23 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand Down
14 changes: 9 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 6 additions & 4 deletions src/xwayland/xwm.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@

#include <stdbool.h>

#ifdef ENABLE_XWAYLAND

#include <stdint.h>
#include <chck/lut/lut.h>
#include <xcb/xcb.h>
#include <wayland-server.h>
#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 <xcb/xcb.h>

struct wlc_x11_window {
uint32_t id; // xcb_window_t
uint32_t surface_id;
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 440c6bb

Please sign in to comment.