aboutsummaryrefslogtreecommitdiff
path: root/xwayland/meson.build
blob: 5a8c732ddb511b2f5c2aa06b426347451964cbf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
xwayland_libs = []
xwayland_required = [
	'xcb',
	'xcb-composite',
	'xcb-icccm',
	'xcb-render',
	'xcb-res',
	'xcb-xfixes',
]
xwayland_optional = {
	'xcb-errors': 'Required for printing X11 errors.',
}

msg = []
if get_option('xwayland').enabled()
	msg += 'Install "@0@" or pass "-Dxwayland=disabled".'
endif
if not get_option('xwayland').disabled()
	msg += 'Required for Xwayland support.'
endif

xwayland = dependency('xwayland', required: false)
if not xwayland.found()
	# There's no Xwayland release with the pkg-config file shipped yet.
	xwayland_prog = find_program('Xwayland', required: false)
	if not xwayland_prog.found()
		if get_option('xwayland').enabled()
			error('\n'.join(msg).format('xwayland'))
		else
			subdir_done()
		endif
	endif
endif

foreach lib : xwayland_required
	dep = dependency(lib,
		required: get_option('xwayland'),
		not_found_message: '\n'.join(msg).format(lib),
	)
	if not dep.found()
		subdir_done()
	endif

	xwayland_libs += dep
endforeach

foreach lib, desc : xwayland_optional
	msg = []
	if get_option(lib).enabled()
		msg += 'Install "@0@" or pass "-D@0@=disabled".'
	endif
	if not get_option(lib).disabled()
		msg += desc
	endif

	dep = dependency(lib,
		required: get_option(lib),
		not_found_message: '\n'.join(msg).format(lib),
	)

	internal_features += { lib: dep.found() }
	xwayland_libs += dep
endforeach

xwayland_feature_names = [
	'listenfd',
	'no_touch_pointer_emulation',
	'force_xrandr_emulation',
	'terminate_delay',
]

xwayland_features = {}
if xwayland.found()
	xwayland_path = xwayland.get_variable('xwayland')
	foreach name : xwayland_feature_names
		have = xwayland.get_variable('have_' + name, default_value: 'false') == 'true'
		xwayland_features += { name: have }
	endforeach
else
	xwayland_path = xwayland_prog.full_path()
	foreach name : xwayland_feature_names
		xwayland_features += { name: false }
	endforeach
endif

internal_config.set_quoted('XWAYLAND_PATH', xwayland_path)
foreach name, have : xwayland_features
	internal_config.set10('HAVE_XWAYLAND_' + name.to_upper(), have)
endforeach

wlr_files += files(
	'selection/dnd.c',
	'selection/incoming.c',
	'selection/outgoing.c',
	'selection/selection.c',
	'server.c',
	'shell.c',
	'sockets.c',
	'xwayland.c',
	'xwm.c',
)
wlr_deps += xwayland_libs
features += { 'xwayland': true }

have = cc.has_function('xcb_xfixes_set_client_disconnect_mode', dependencies: xwayland_libs)
internal_config.set10('HAS_XCB_XFIXES_SET_CLIENT_DISCONNECT_MODE', have)