mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	xdg-deco: Respect decoration requests properly
Signed-off-by: Joshua Ashton <joshua@froggi.es>
This commit is contained in:
		
							parent
							
								
									60547cffe6
								
							
						
					
					
						commit
						89f09567f5
					
				
					 3 changed files with 25 additions and 8 deletions
				
			
		| 
						 | 
					@ -355,6 +355,7 @@ void view_set_fullscreen(struct view *view, bool fullscreen,
 | 
				
			||||||
	struct wlr_output *wlr_output);
 | 
						struct wlr_output *wlr_output);
 | 
				
			||||||
void view_toggle_maximize(struct view *view);
 | 
					void view_toggle_maximize(struct view *view);
 | 
				
			||||||
void view_toggle_decorations(struct view *view);
 | 
					void view_toggle_decorations(struct view *view);
 | 
				
			||||||
 | 
					void view_set_decorations(struct view *view, bool decorations);
 | 
				
			||||||
void view_toggle_fullscreen(struct view *view);
 | 
					void view_toggle_fullscreen(struct view *view);
 | 
				
			||||||
void view_for_each_surface(struct view *view,
 | 
					void view_for_each_surface(struct view *view,
 | 
				
			||||||
	wlr_surface_iterator_func_t iterator, void *user_data);
 | 
						wlr_surface_iterator_func_t iterator, void *user_data);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -177,6 +177,15 @@ view_toggle_decorations(struct view *view)
 | 
				
			||||||
	ssd_update_geometry(view, true);
 | 
						ssd_update_geometry(view, true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					view_set_decorations(struct view *view, bool decorations)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (view->ssd.enabled != decorations) {
 | 
				
			||||||
 | 
							view->ssd.enabled = decorations;
 | 
				
			||||||
 | 
							ssd_update_geometry(view, true);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
view_toggle_fullscreen(struct view *view)
 | 
					view_toggle_fullscreen(struct view *view)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,6 +4,7 @@
 | 
				
			||||||
struct xdg_deco {
 | 
					struct xdg_deco {
 | 
				
			||||||
	struct wlr_xdg_toplevel_decoration_v1 *wlr_decoration;
 | 
						struct wlr_xdg_toplevel_decoration_v1 *wlr_decoration;
 | 
				
			||||||
	struct server *server;
 | 
						struct server *server;
 | 
				
			||||||
 | 
						struct view *view;
 | 
				
			||||||
	struct wl_listener destroy;
 | 
						struct wl_listener destroy;
 | 
				
			||||||
	struct wl_listener request_mode;
 | 
						struct wl_listener request_mode;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -21,15 +22,19 @@ xdg_deco_destroy(struct wl_listener *listener, void *data)
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
xdg_deco_request_mode(struct wl_listener *listener, void *data)
 | 
					xdg_deco_request_mode(struct wl_listener *listener, void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct xdg_deco *xdg_deco;
 | 
						struct xdg_deco *xdg_deco = wl_container_of(listener, xdg_deco, request_mode);
 | 
				
			||||||
	xdg_deco = wl_container_of(listener, xdg_deco, request_mode);
 | 
						enum wlr_xdg_toplevel_decoration_v1_mode client_mode =
 | 
				
			||||||
	enum wlr_xdg_toplevel_decoration_v1_mode mode;
 | 
							xdg_deco->wlr_decoration->requested_mode;
 | 
				
			||||||
	if (rc.xdg_shell_server_side_deco) {
 | 
						
 | 
				
			||||||
		mode = WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE;
 | 
						if (client_mode == WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_NONE) {
 | 
				
			||||||
	} else {
 | 
							client_mode = rc.xdg_shell_server_side_deco
 | 
				
			||||||
		mode = WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
 | 
								? WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE
 | 
				
			||||||
 | 
								: WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	wlr_xdg_toplevel_decoration_v1_set_mode(xdg_deco->wlr_decoration, mode);
 | 
					
 | 
				
			||||||
 | 
						wlr_xdg_toplevel_decoration_v1_set_mode(xdg_deco->wlr_decoration, client_mode);
 | 
				
			||||||
 | 
						view_set_decorations(xdg_deco->view,
 | 
				
			||||||
 | 
							client_mode == WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
| 
						 | 
					@ -44,10 +49,12 @@ xdg_toplevel_decoration(struct wl_listener *listener, void *data)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	xdg_deco->wlr_decoration = wlr_decoration;
 | 
						xdg_deco->wlr_decoration = wlr_decoration;
 | 
				
			||||||
	xdg_deco->server = server;
 | 
						xdg_deco->server = server;
 | 
				
			||||||
 | 
						xdg_deco->view = wlr_decoration->surface->data;
 | 
				
			||||||
	xdg_deco->destroy.notify = xdg_deco_destroy;
 | 
						xdg_deco->destroy.notify = xdg_deco_destroy;
 | 
				
			||||||
	wl_signal_add(&wlr_decoration->events.destroy, &xdg_deco->destroy);
 | 
						wl_signal_add(&wlr_decoration->events.destroy, &xdg_deco->destroy);
 | 
				
			||||||
	xdg_deco->request_mode.notify = xdg_deco_request_mode;
 | 
						xdg_deco->request_mode.notify = xdg_deco_request_mode;
 | 
				
			||||||
	wl_signal_add(&wlr_decoration->events.request_mode,
 | 
						wl_signal_add(&wlr_decoration->events.request_mode,
 | 
				
			||||||
		      &xdg_deco->request_mode);
 | 
							      &xdg_deco->request_mode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	xdg_deco_request_mode(&xdg_deco->request_mode, wlr_decoration);
 | 
						xdg_deco_request_mode(&xdg_deco->request_mode, wlr_decoration);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue