mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	xwayland: handle set_override_redirect events
This is needed to allow X11 applications to create surfaces as non-override_redirect and then change them to override_redirect later Without this gitk-menus and rofi are treated as xwayland-views with associated server-side-decoration and forced positioning.
This commit is contained in:
		
							parent
							
								
									cbed8acf01
								
							
						
					
					
						commit
						81f216b6a2
					
				
					 3 changed files with 37 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -38,7 +38,7 @@ parent_view(struct server *server, struct wlr_xwayland_surface *surface)
 | 
			
		|||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
void
 | 
			
		||||
unmanaged_handle_map(struct wl_listener *listener, void *data)
 | 
			
		||||
{
 | 
			
		||||
	struct xwayland_unmanaged *unmanaged =
 | 
			
		||||
| 
						 | 
				
			
			@ -108,7 +108,7 @@ unmanaged_handle_destroy(struct wl_listener *listener, void *data)
 | 
			
		|||
	free(unmanaged);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
struct xwayland_unmanaged *
 | 
			
		||||
xwayland_unmanaged_create(struct server *server,
 | 
			
		||||
			  struct wlr_xwayland_surface *xsurface)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -126,4 +126,5 @@ xwayland_unmanaged_create(struct server *server,
 | 
			
		|||
	unmanaged->unmap.notify = unmanaged_handle_unmap;
 | 
			
		||||
	wl_signal_add(&xsurface->events.destroy, &unmanaged->destroy);
 | 
			
		||||
	unmanaged->destroy.notify = unmanaged_handle_destroy;
 | 
			
		||||
	return unmanaged;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -104,9 +104,17 @@ handle_destroy(struct wl_listener *listener, void *data)
 | 
			
		|||
	/* Remove XWayland specific handlers */
 | 
			
		||||
	wl_list_remove(&view->map.link);
 | 
			
		||||
	wl_list_remove(&view->unmap.link);
 | 
			
		||||
	wl_list_remove(&view->request_move.link);
 | 
			
		||||
	wl_list_remove(&view->request_resize.link);
 | 
			
		||||
	wl_list_remove(&view->request_configure.link);
 | 
			
		||||
	wl_list_remove(&view->request_activate.link);
 | 
			
		||||
	wl_list_remove(&view->request_minimize.link);
 | 
			
		||||
	wl_list_remove(&view->request_maximize.link);
 | 
			
		||||
	wl_list_remove(&view->request_fullscreen.link);
 | 
			
		||||
	wl_list_remove(&view->set_title.link);
 | 
			
		||||
	wl_list_remove(&view->set_app_id.link);
 | 
			
		||||
	wl_list_remove(&view->set_decorations.link);
 | 
			
		||||
	wl_list_remove(&view->override_redirect.link);
 | 
			
		||||
	wl_list_remove(&view->destroy.link);
 | 
			
		||||
 | 
			
		||||
	/* And finally destroy / free the view */
 | 
			
		||||
| 
						 | 
				
			
			@ -236,6 +244,25 @@ handle_set_decorations(struct wl_listener *listener, void *data)
 | 
			
		|||
	view_set_decorations(view, want_deco(view));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
handle_override_redirect(struct wl_listener *listener, void *data)
 | 
			
		||||
{
 | 
			
		||||
	struct view *view = wl_container_of(listener, view, override_redirect);
 | 
			
		||||
	struct wlr_xwayland_surface *xsurface = data;
 | 
			
		||||
	struct server *server = view->server;
 | 
			
		||||
	bool mapped = xsurface->mapped;
 | 
			
		||||
	if (mapped) {
 | 
			
		||||
		handle_unmap(&view->unmap, NULL);
 | 
			
		||||
	}
 | 
			
		||||
	handle_destroy(&view->destroy, view);
 | 
			
		||||
	xsurface->data = NULL;
 | 
			
		||||
	struct xwayland_unmanaged *unmanaged =
 | 
			
		||||
		xwayland_unmanaged_create(server, xsurface);
 | 
			
		||||
	if (mapped) {
 | 
			
		||||
		unmanaged_handle_map(&unmanaged->map, xsurface);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
top_left_edge_boundary_check(struct view *view)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -428,5 +455,9 @@ xwayland_surface_new(struct wl_listener *listener, void *data)
 | 
			
		|||
	wl_signal_add(&xsurface->events.set_decorations,
 | 
			
		||||
			&view->set_decorations);
 | 
			
		||||
 | 
			
		||||
	view->override_redirect.notify = handle_override_redirect;
 | 
			
		||||
	wl_signal_add(&xsurface->events.set_override_redirect,
 | 
			
		||||
			&view->override_redirect);
 | 
			
		||||
 | 
			
		||||
	wl_list_insert(&view->server->views, &view->link);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue