commit 491c442

uint  ·  2026-08-04 13:55:21 +0000 UTC
parent dbaa0c4
Use Meson scan_xml
1 files changed,  +4, -28
+4, -28
 1@@ -41,34 +41,10 @@ elif backend == 'wayland'
 2 	backend_override_options = ['c_std=c99']
 3 	deps += [ dependency('wayland-client'), dependency('wayland-cursor'), dependency('xkbcommon'), ]
 4 
 5-	wayland_scanner = find_program('wayland-scanner')
 6-	wayland_protocols = dependency('wayland-protocols')
 7-	protos = wayland_protocols.get_variable(pkgconfig: 'pkgdatadir')
 8-
 9-	protocols = [
10-		[ 'xdg-shell', protos / 'stable' / 'xdg-shell' / 'xdg-shell.xml', ],
11-		[ 'pointer-constraints-unstable-v1', protos / 'unstable' / 'pointer-constraints' / 'pointer-constraints-unstable-v1.xml', ],
12-		[ 'relative-pointer-unstable-v1', protos / 'unstable' / 'relative-pointer' / 'relative-pointer-unstable-v1.xml', ],
13-	]
14-
15-	foreach protocol : protocols
16-		name = protocol[0]
17-		xml = protocol[1]
18-
19-		backend_sources += custom_target(
20-			name + '-client-protocol.h',
21-			input: xml,
22-			output: name + '-client-protocol.h',
23-			command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
24-		)
25-
26-		backend_sources += custom_target(
27-			name + '-protocol.c',
28-			input: xml,
29-			output: name + '-protocol.c',
30-			command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
31-		)
32-	endforeach
33+	wayland = import('wayland')
34+	backend_sources += wayland.scan_xml(wayland.find_protocol('xdg-shell'))
35+	backend_sources += wayland.scan_xml(wayland.find_protocol('pointer-constraints', state: 'unstable', version: 1))
36+	backend_sources += wayland.scan_xml(wayland.find_protocol('relative-pointer', state: 'unstable', version: 1))
37 
38 	backend_sources += ['source/maus_wayland.c']
39