Make X11 fully optional

Make X11 Backend (in addition to XWayland) optional and small bug fix on XWayland includes.
This commit is contained in:
Cedric Sodhi 2018-03-09 15:17:15 +01:00
parent bfc0e95d2c
commit ebdabc2030
5 changed files with 49 additions and 27 deletions

View File

@ -94,6 +94,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
} }
} }
#ifdef WLR_HAS_X11_BACKEND
const char *x11_display = getenv("DISPLAY"); const char *x11_display = getenv("DISPLAY");
if (x11_display) { if (x11_display) {
struct wlr_backend *x11_backend = struct wlr_backend *x11_backend =
@ -101,6 +102,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
wlr_multi_backend_add(backend, x11_backend); wlr_multi_backend_add(backend, x11_backend);
return backend; return backend;
} }
#endif
// Attempt DRM+libinput // Attempt DRM+libinput
struct wlr_session *session = wlr_session_create(display); struct wlr_session *session = wlr_session_create(display);

View File

@ -24,7 +24,6 @@ backend_files = files(
'wayland/output.c', 'wayland/output.c',
'wayland/registry.c', 'wayland/registry.c',
'wayland/wl_seat.c', 'wayland/wl_seat.c',
'x11/backend.c',
) )
backend_deps = [ backend_deps = [
@ -50,6 +49,10 @@ if conf_data.get('WLR_HAS_SYSTEMD', false)
backend_deps += systemd backend_deps += systemd
endif endif
if conf_data.get('WLR_HAS_X11_BACKEND', false)
backend_files += files('x11/backend.c')
endif
if conf_data.get('WLR_HAS_ELOGIND', false) if conf_data.get('WLR_HAS_ELOGIND', false)
backend_files += files('session/logind.c') backend_files += files('session/logind.c')
backend_deps += elogind backend_deps += elogind

View File

@ -58,14 +58,6 @@ libinput = dependency('libinput', version: '>=1.7.0')
xkbcommon = dependency('xkbcommon') xkbcommon = dependency('xkbcommon')
udev = dependency('libudev') udev = dependency('libudev')
pixman = dependency('pixman-1') pixman = dependency('pixman-1')
xcb = dependency('xcb')
xcb_composite = dependency('xcb-composite')
xcb_xfixes = dependency('xcb-xfixes')
xcb_image = dependency('xcb-image')
xcb_render = dependency('xcb-render')
xcb_icccm = dependency('xcb-icccm', required: false)
xcb_errors = dependency('xcb-errors', required: get_option('enable_xcb_errors') == 'true')
x11_xcb = dependency('x11-xcb')
libcap = dependency('libcap', required: get_option('enable_libcap') == 'true') libcap = dependency('libcap', required: get_option('enable_libcap') == 'true')
systemd = dependency('libsystemd', required: get_option('enable_systemd') == 'true') systemd = dependency('libsystemd', required: get_option('enable_systemd') == 'true')
elogind = dependency('libelogind', required: get_option('enable_elogind') == 'true') elogind = dependency('libelogind', required: get_option('enable_elogind') == 'true')
@ -75,14 +67,6 @@ exclude_headers = []
wlr_parts = [] wlr_parts = []
wlr_deps = [] wlr_deps = []
if xcb_icccm.found()
conf_data.set('WLR_HAS_XCB_ICCCM', true)
endif
if xcb_errors.found() and get_option('enable_xcb_errors') != 'false'
conf_data.set('WLR_HAS_XCB_ERRORS', true)
endif
if libcap.found() and get_option('enable_libcap') != 'false' if libcap.found() and get_option('enable_libcap') != 'false'
conf_data.set('WLR_HAS_LIBCAP', true) conf_data.set('WLR_HAS_LIBCAP', true)
wlr_deps += libcap wlr_deps += libcap
@ -97,6 +81,38 @@ if elogind.found() and get_option('enable_elogind') != 'false'
conf_data.set('WLR_HAS_ELOGIND', true) conf_data.set('WLR_HAS_ELOGIND', true)
endif endif
if get_option('enable_x11_backend') or get_option('enable_xwayland')
xcb = dependency('xcb')
xcb_composite = dependency('xcb-composite')
xcb_xfixes = dependency('xcb-xfixes')
xcb_image = dependency('xcb-image')
xcb_render = dependency('xcb-render')
x11_xcb = dependency('x11-xcb')
xcb_icccm = dependency('xcb-icccm', required: false)
xcb_errors = dependency('xcb-errors', required: get_option('enable_xcb_errors') == 'true')
if xcb_icccm.found()
conf_data.set('WLR_HAS_XCB_ICCCM', true)
endif
if xcb_errors.found() and get_option('enable_xcb_errors') != 'false'
conf_data.set('WLR_HAS_XCB_ERRORS', true)
endif
wlr_deps += [
xcb,
xcb_composite,
x11_xcb,
]
else
add_project_arguments('-DMESA_EGL_NO_X11_HEADERS', language: 'c')
endif
if get_option('enable_x11_backend')
conf_data.set('WLR_HAS_X11_BACKEND', true)
endif
if get_option('enable_xwayland') if get_option('enable_xwayland')
subdir('xwayland') subdir('xwayland')
wlr_parts += [lib_wlr_xwayland] wlr_parts += [lib_wlr_xwayland]
@ -138,9 +154,6 @@ wlr_deps += [
xkbcommon, xkbcommon,
udev, udev,
pixman, pixman,
xcb,
xcb_composite,
x11_xcb,
math, math,
] ]
@ -168,12 +181,13 @@ summary = [
'----------------', '----------------',
'wlroots @0@'.format(meson.project_version()), 'wlroots @0@'.format(meson.project_version()),
'', '',
' libcap: @0@'.format(conf_data.get('WLR_HAS_LIBCAP', false)), ' libcap: @0@'.format(conf_data.get('WLR_HAS_LIBCAP', false)),
' systemd: @0@'.format(conf_data.get('WLR_HAS_SYSTEMD', false)), ' systemd: @0@'.format(conf_data.get('WLR_HAS_SYSTEMD', false)),
' elogind: @0@'.format(conf_data.get('WLR_HAS_ELOGIND', false)), ' elogind: @0@'.format(conf_data.get('WLR_HAS_ELOGIND', false)),
' xwayland: @0@'.format(conf_data.get('WLR_HAS_XWAYLAND', false)), ' xwayland: @0@'.format(conf_data.get('WLR_HAS_XWAYLAND', false)),
' xcb-icccm: @0@'.format(conf_data.get('WLR_HAS_XCB_ICCCM', false)), ' x11_backend: @0@'.format(conf_data.get('WLR_HAS_X11BACKEND', false)),
' xcb-errors: @0@'.format(conf_data.get('WLR_HAS_XCB_ERRORS', false)), ' xcb-icccm: @0@'.format(conf_data.get('WLR_HAS_XCB_ICCCM', false)),
' xcb-errors: @0@'.format(conf_data.get('WLR_HAS_XCB_ERRORS', false)),
'----------------', '----------------',
'' ''
] ]

View File

@ -3,3 +3,4 @@ option('enable_systemd', type: 'combo', choices: ['auto', 'true', 'false'], valu
option('enable_elogind', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'Enable support for logind') option('enable_elogind', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'Enable support for logind')
option('enable_xcb_errors', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'Use xcb-errors util library') option('enable_xcb_errors', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'Use xcb-errors util library')
option('enable_xwayland', type: 'boolean', value: true, description: 'Enable support X11 applications') option('enable_xwayland', type: 'boolean', value: true, description: 'Enable support X11 applications')
option('enable_x11_backend', type: 'boolean', value: false, description: 'Enable X11 backend')

View File

@ -5,7 +5,9 @@
#include <wlr/types/wlr_cursor.h> #include <wlr/types/wlr_cursor.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include <wlr/xcursor.h> #include <wlr/xcursor.h>
#include <wlr/xwayland.h> #ifdef WLR_HAS_XWAYLAND
# include <wlr/xwayland.h>
#endif
#include "rootston/config.h" #include "rootston/config.h"
#include "rootston/input.h" #include "rootston/input.h"
#include "rootston/keyboard.h" #include "rootston/keyboard.h"