mirror of
				https://github.com/wizbright/waybox.git
				synced 2025-10-29 05:40:20 -04:00 
			
		
		
		
	react to wlroots changes
This commit is contained in:
		
							parent
							
								
									2b38536dec
								
							
						
					
					
						commit
						7fb889d171
					
				
					 4 changed files with 25 additions and 9 deletions
				
			
		|  | @ -49,6 +49,7 @@ struct wb_server { | ||||||
| 	struct wlr_xdg_output_manager_v1 *output_manager; | 	struct wlr_xdg_output_manager_v1 *output_manager; | ||||||
| 	struct wlr_renderer *renderer; | 	struct wlr_renderer *renderer; | ||||||
| 	struct wlr_scene *scene; | 	struct wlr_scene *scene; | ||||||
|  | 	struct wlr_scene_output_layout *scene_layout; | ||||||
| 	struct wlr_subcompositor *subcompositor; | 	struct wlr_subcompositor *subcompositor; | ||||||
| 
 | 
 | ||||||
| 	struct wb_config *config; | 	struct wb_config *config; | ||||||
|  |  | ||||||
|  | @ -35,7 +35,11 @@ void output_frame_notify(struct wl_listener *listener, void *data) { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* Render the scene if needed and commit the output */ | 	/* Render the scene if needed and commit the output */ | ||||||
|  | #if WLR_CHECK_VERSION(0, 17, 0) | ||||||
|  | 	wlr_scene_output_commit(scene_output, NULL); | ||||||
|  | #else | ||||||
| 	wlr_scene_output_commit(scene_output); | 	wlr_scene_output_commit(scene_output); | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| 	/* This lets the client know that we've displayed that frame and it can
 | 	/* This lets the client know that we've displayed that frame and it can
 | ||||||
| 	 * prepare another one now if it likes. */ | 	 * prepare another one now if it likes. */ | ||||||
|  | @ -101,8 +105,8 @@ void new_output_notify(struct wl_listener *listener, void *data) { | ||||||
| 		wlr_output_state_set_mode(&state, mode); | 		wlr_output_state_set_mode(&state, mode); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	wlr_output_state_finish(&state); |  | ||||||
| 	wlr_output_commit_state(wlr_output, &state); | 	wlr_output_commit_state(wlr_output, &state); | ||||||
|  | 	wlr_output_state_finish(&state); | ||||||
| #else | #else | ||||||
| 	if (!wl_list_empty(&wlr_output->modes)) { | 	if (!wl_list_empty(&wlr_output->modes)) { | ||||||
| 		struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output); | 		struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output); | ||||||
|  | @ -156,10 +160,15 @@ void new_output_notify(struct wl_listener *listener, void *data) { | ||||||
| 	 * output (such as DPI, scale factor, manufacturer, etc). | 	 * output (such as DPI, scale factor, manufacturer, etc). | ||||||
| 	 */ | 	 */ | ||||||
| #if WLR_CHECK_VERSION(0, 17, 0) | #if WLR_CHECK_VERSION(0, 17, 0) | ||||||
| 	if (!wlr_output_layout_add_auto(server->output_layout, wlr_output)) { | 	struct wlr_output_layout_output *l_output = | ||||||
|  | 		wlr_output_layout_add_auto(server->output_layout, wlr_output); | ||||||
|  | 	if (!l_output) { | ||||||
| 		wlr_log(WLR_ERROR, "%s", _("Could not add an output layout.")); | 		wlr_log(WLR_ERROR, "%s", _("Could not add an output layout.")); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
|  | 	struct wlr_scene_output *scene_output = wlr_scene_output_create(server->scene, wlr_output); | ||||||
|  | 	wlr_scene_output_layout_add_output(server->scene_layout, l_output, scene_output); | ||||||
| #else | #else | ||||||
| 	wlr_output_layout_add_auto(server->output_layout, wlr_output); | 	wlr_output_layout_add_auto(server->output_layout, wlr_output); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -78,7 +78,10 @@ bool wb_start_server(struct wb_server* server) { | ||||||
| 	 * necessary. | 	 * necessary. | ||||||
| 	 */ | 	 */ | ||||||
| 	server->scene = wlr_scene_create(); | 	server->scene = wlr_scene_create(); | ||||||
| 	wlr_scene_attach_output_layout(server->scene, server->output_layout); | #if WLR_CHECK_VERSION(0, 17, 0) | ||||||
|  | 	server->scene_layout = | ||||||
|  | #endif | ||||||
|  | 		wlr_scene_attach_output_layout(server->scene, server->output_layout); | ||||||
| 
 | 
 | ||||||
| 	const char *socket = wl_display_add_socket_auto(server->wl_display); | 	const char *socket = wl_display_add_socket_auto(server->wl_display); | ||||||
| 	if (!socket) { | 	if (!socket) { | ||||||
|  |  | ||||||
|  | @ -72,7 +72,8 @@ void focus_view(struct wb_view *view, struct wlr_surface *surface) { | ||||||
| 			previous = wlr_xdg_surface_from_wlr_surface(prev_surface); | 			previous = wlr_xdg_surface_from_wlr_surface(prev_surface); | ||||||
| 		} | 		} | ||||||
| #endif | #endif | ||||||
| 		if (previous != NULL && previous->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) { | 		if (previous != NULL && previous->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL && | ||||||
|  | 				previous->toplevel != NULL) { | ||||||
| 			wlr_xdg_toplevel_set_activated(previous->toplevel, false); | 			wlr_xdg_toplevel_set_activated(previous->toplevel, false); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | @ -155,11 +156,13 @@ static void xdg_toplevel_unmap(struct wl_listener *listener, void *data) { | ||||||
| 	reset_cursor_mode(view->server); | 	reset_cursor_mode(view->server); | ||||||
| 
 | 
 | ||||||
| 	/* Focus the next view, if any. */ | 	/* Focus the next view, if any. */ | ||||||
| 	struct wb_view *next_view = wl_container_of(view->link.next, next_view, link); | 	if (wl_list_length(&view->link) > 1) { | ||||||
| 	if (next_view && next_view->scene_tree && next_view->scene_tree->node.enabled) { | 		struct wb_view *next_view = wl_container_of(view->link.next, next_view, link); | ||||||
| 		wlr_log(WLR_INFO, "%s: %s", _("Focusing next view"), | 		if (next_view && next_view->xdg_toplevel && next_view->scene_tree && next_view->scene_tree->node.enabled) { | ||||||
| 				next_view->xdg_toplevel->app_id); | 			wlr_log(WLR_INFO, "%s: %s", _("Focusing next view"), | ||||||
| 		focus_view(next_view, next_view->xdg_toplevel->base->surface); | 					next_view->xdg_toplevel->app_id); | ||||||
|  | 			focus_view(next_view, next_view->xdg_toplevel->base->surface); | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Keith Bowes
						Keith Bowes