mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Merge pull request #1250 from arandomhuman/wlr_session
Add support for WLR_SESSION env variable
This commit is contained in:
		
						commit
						50a8758313
					
				
					 2 changed files with 20 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -66,11 +66,26 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
 | 
			
		|||
 | 
			
		||||
struct wlr_session *wlr_session_create(struct wl_display *disp) {
 | 
			
		||||
	struct wlr_session *session = NULL;
 | 
			
		||||
	const struct session_impl **iter;
 | 
			
		||||
 | 
			
		||||
	const char *env_wlr_session = getenv("WLR_SESSION");
 | 
			
		||||
	if (env_wlr_session) {
 | 
			
		||||
		if (!strcmp(env_wlr_session, "logind") || !strcmp(env_wlr_session, "systemd")) {
 | 
			
		||||
		#if defined(WLR_HAS_SYSTEMD) || defined(WLR_HAS_ELOGIND)
 | 
			
		||||
			session = session_logind.create(disp);
 | 
			
		||||
		#else
 | 
			
		||||
			wlr_log(WLR_ERROR, "wlroots is not compiled with logind support");
 | 
			
		||||
		#endif
 | 
			
		||||
		} else if (!strcmp(env_wlr_session, "direct")) {
 | 
			
		||||
			session = session_direct.create(disp);
 | 
			
		||||
		} else {
 | 
			
		||||
			wlr_log(WLR_ERROR, "WLR_SESSION has an invalid value: %s", env_wlr_session);
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		const struct session_impl **iter;
 | 
			
		||||
		for (iter = impls; !session && *iter; ++iter) {
 | 
			
		||||
			session = (*iter)->create(disp);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!session) {
 | 
			
		||||
		wlr_log(WLR_ERROR, "Failed to load session backend");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,6 +16,8 @@ wlroots specific
 | 
			
		|||
  of outputs
 | 
			
		||||
* *WLR_NO_HARDWARE_CURSORS*: set to 1 to use software cursors instead of
 | 
			
		||||
  hardware cursors
 | 
			
		||||
* *WLR_SESSION*: specifies the wlr\_session to be used (available sessions:
 | 
			
		||||
  logind/systemd, direct)
 | 
			
		||||
 | 
			
		||||
rootston specific
 | 
			
		||||
------------------
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue