| 
									
										
										
										
											2018-08-24 19:35:02 +12:00
										 |  |  | xwayland_libs = []
 | 
					
						
							|  |  |  | xwayland_required = [
 | 
					
						
							|  |  |  | 	'xcb',
 | 
					
						
							|  |  |  | 	'xcb-composite',
 | 
					
						
							| 
									
										
										
										
											2021-03-29 12:03:35 +02:00
										 |  |  | 	'xcb-icccm',
 | 
					
						
							| 
									
										
										
										
											2018-08-24 19:35:02 +12:00
										 |  |  | 	'xcb-render',
 | 
					
						
							| 
									
										
										
										
											2021-04-16 19:27:12 -07:00
										 |  |  | 	'xcb-res',
 | 
					
						
							| 
									
										
										
										
											2018-08-24 19:35:02 +12:00
										 |  |  | 	'xcb-xfixes',
 | 
					
						
							|  |  |  | ]
 | 
					
						
							| 
									
										
										
										
											2019-11-22 20:11:15 +13:00
										 |  |  | 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
 | 
					
						
							| 
									
										
										
										
											2018-08-24 19:35:02 +12:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-04 17:31:12 +01:00
										 |  |  | 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
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-24 19:35:02 +12:00
										 |  |  | foreach lib : xwayland_required
 | 
					
						
							| 
									
										
										
										
											2019-11-22 20:11:15 +13:00
										 |  |  | 	dep = dependency(lib,
 | 
					
						
							|  |  |  | 		required: get_option('xwayland'),
 | 
					
						
							|  |  |  | 		not_found_message: '\n'.join(msg).format(lib),
 | 
					
						
							|  |  |  | 	)
 | 
					
						
							| 
									
										
										
										
											2018-08-24 19:35:02 +12:00
										 |  |  | 	if not dep.found()
 | 
					
						
							|  |  |  | 		subdir_done()
 | 
					
						
							|  |  |  | 	endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	xwayland_libs += dep
 | 
					
						
							|  |  |  | endforeach
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-22 20:11:15 +13:00
										 |  |  | 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),
 | 
					
						
							|  |  |  | 	)
 | 
					
						
							| 
									
										
										
										
											2021-04-06 11:59:57 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	internal_features += { lib: dep.found() }
 | 
					
						
							|  |  |  | 	xwayland_libs += dep
 | 
					
						
							| 
									
										
										
										
											2018-08-24 19:35:02 +12:00
										 |  |  | endforeach
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-22 20:11:15 +13:00
										 |  |  | wlr_files += files(
 | 
					
						
							|  |  |  | 	'selection/dnd.c',
 | 
					
						
							|  |  |  | 	'selection/incoming.c',
 | 
					
						
							|  |  |  | 	'selection/outgoing.c',
 | 
					
						
							|  |  |  | 	'selection/selection.c',
 | 
					
						
							| 
									
										
										
										
											2020-05-05 10:24:08 +02:00
										 |  |  | 	'server.c',
 | 
					
						
							| 
									
										
										
										
											2019-11-22 20:11:15 +13:00
										 |  |  | 	'sockets.c',
 | 
					
						
							|  |  |  | 	'xwayland.c',
 | 
					
						
							|  |  |  | 	'xwm.c',
 | 
					
						
							| 
									
										
										
										
											2017-08-30 14:30:47 -04:00
										 |  |  | )
 | 
					
						
							| 
									
										
										
										
											2019-11-22 20:11:15 +13:00
										 |  |  | wlr_deps += xwayland_libs
 | 
					
						
							| 
									
										
										
										
											2021-02-08 15:16:10 +01:00
										 |  |  | features += { 'xwayland': true }
 | 
					
						
							| 
									
										
										
										
											2021-06-25 13:49:47 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | have = cc.has_function('xcb_xfixes_set_client_disconnect_mode', dependencies: xwayland_libs)
 | 
					
						
							|  |  |  | add_project_arguments(
 | 
					
						
							|  |  |  | 	'-DHAS_XCB_XFIXES_SET_CLIENT_DISCONNECT_MODE=@0@'.format(have.to_int()),
 | 
					
						
							|  |  |  | 	language: 'c',
 | 
					
						
							|  |  |  | )
 |