mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	xdg: add xdg_shell_init()
...to have the event-handler functions in the same translation unit as the signal connector. No functional change intended.
This commit is contained in:
		
							parent
							
								
									8d17ab2d60
								
							
						
					
					
						commit
						7f30de1134
					
				
					 3 changed files with 28 additions and 29 deletions
				
			
		| 
						 | 
					@ -356,10 +356,7 @@ struct constraint {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void xdg_popup_create(struct view *view, struct wlr_xdg_popup *wlr_popup);
 | 
					void xdg_popup_create(struct view *view, struct wlr_xdg_popup *wlr_popup);
 | 
				
			||||||
 | 
					void xdg_shell_init(struct server *server);
 | 
				
			||||||
void xdg_activation_handle_request(struct wl_listener *listener, void *data);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void xdg_surface_new(struct wl_listener *listener, void *data);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
void foreign_toplevel_handle_create(struct view *view);
 | 
					void foreign_toplevel_handle_create(struct view *view);
 | 
				
			||||||
void foreign_toplevel_update_outputs(struct view *view);
 | 
					void foreign_toplevel_update_outputs(struct view *view);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										24
									
								
								src/server.c
									
										
									
									
									
								
							
							
						
						
									
										24
									
								
								src/server.c
									
										
									
									
									
								
							| 
						 | 
					@ -30,8 +30,6 @@
 | 
				
			||||||
#include "workspaces.h"
 | 
					#include "workspaces.h"
 | 
				
			||||||
#include "xwayland.h"
 | 
					#include "xwayland.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define LAB_XDG_SHELL_VERSION (2)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static struct wlr_compositor *compositor;
 | 
					static struct wlr_compositor *compositor;
 | 
				
			||||||
static struct wl_event_source *sighup_source;
 | 
					static struct wl_event_source *sighup_source;
 | 
				
			||||||
static struct wl_event_source *sigint_source;
 | 
					static struct wl_event_source *sigint_source;
 | 
				
			||||||
| 
						 | 
					@ -359,30 +357,10 @@ server_init(struct server *server)
 | 
				
			||||||
	wlr_primary_selection_v1_device_manager_create(server->wl_display);
 | 
						wlr_primary_selection_v1_device_manager_create(server->wl_display);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	seat_init(server);
 | 
						seat_init(server);
 | 
				
			||||||
 | 
						xdg_shell_init(server);
 | 
				
			||||||
	/* Init xdg-shell */
 | 
					 | 
				
			||||||
	server->xdg_shell = wlr_xdg_shell_create(server->wl_display,
 | 
					 | 
				
			||||||
		LAB_XDG_SHELL_VERSION);
 | 
					 | 
				
			||||||
	if (!server->xdg_shell) {
 | 
					 | 
				
			||||||
		wlr_log(WLR_ERROR, "unable to create the XDG shell interface");
 | 
					 | 
				
			||||||
		exit(EXIT_FAILURE);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	server->new_xdg_surface.notify = xdg_surface_new;
 | 
					 | 
				
			||||||
	wl_signal_add(&server->xdg_shell->events.new_surface,
 | 
					 | 
				
			||||||
		&server->new_xdg_surface);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	kde_server_decoration_init(server);
 | 
						kde_server_decoration_init(server);
 | 
				
			||||||
	xdg_server_decoration_init(server);
 | 
						xdg_server_decoration_init(server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	server->xdg_activation = wlr_xdg_activation_v1_create(server->wl_display);
 | 
					 | 
				
			||||||
	if (!server->xdg_activation) {
 | 
					 | 
				
			||||||
		wlr_log(WLR_ERROR, "unable to create xdg_activation interface");
 | 
					 | 
				
			||||||
		exit(EXIT_FAILURE);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	server->xdg_activation_request.notify = xdg_activation_handle_request;
 | 
					 | 
				
			||||||
	wl_signal_add(&server->xdg_activation->events.request_activate,
 | 
					 | 
				
			||||||
		&server->xdg_activation_request);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct wlr_presentation *presentation =
 | 
						struct wlr_presentation *presentation =
 | 
				
			||||||
		wlr_presentation_create(server->wl_display, server->backend);
 | 
							wlr_presentation_create(server->wl_display, server->backend);
 | 
				
			||||||
	if (!presentation) {
 | 
						if (!presentation) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										28
									
								
								src/xdg.c
									
										
									
									
									
								
							
							
						
						
									
										28
									
								
								src/xdg.c
									
										
									
									
									
								
							| 
						 | 
					@ -9,6 +9,7 @@
 | 
				
			||||||
#include "window-rules.h"
 | 
					#include "window-rules.h"
 | 
				
			||||||
#include "workspaces.h"
 | 
					#include "workspaces.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define LAB_XDG_SHELL_VERSION (2)
 | 
				
			||||||
#define CONFIGURE_TIMEOUT_MS 100
 | 
					#define CONFIGURE_TIMEOUT_MS 100
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct xdg_toplevel_view *
 | 
					static struct xdg_toplevel_view *
 | 
				
			||||||
| 
						 | 
					@ -580,7 +581,7 @@ static const struct view_impl xdg_toplevel_view_impl = {
 | 
				
			||||||
	.append_children = xdg_toplevel_view_append_children,
 | 
						.append_children = xdg_toplevel_view_append_children,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					static void
 | 
				
			||||||
xdg_activation_handle_request(struct wl_listener *listener, void *data)
 | 
					xdg_activation_handle_request(struct wl_listener *listener, void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const struct wlr_xdg_activation_v1_request_activate_event *event = data;
 | 
						const struct wlr_xdg_activation_v1_request_activate_event *event = data;
 | 
				
			||||||
| 
						 | 
					@ -624,7 +625,7 @@ xdg_activation_handle_request(struct wl_listener *listener, void *data)
 | 
				
			||||||
 *   - wlr_surface->data = scene_tree
 | 
					 *   - wlr_surface->data = scene_tree
 | 
				
			||||||
 *     to help the popups find their parent nodes
 | 
					 *     to help the popups find their parent nodes
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void
 | 
					static void
 | 
				
			||||||
xdg_surface_new(struct wl_listener *listener, void *data)
 | 
					xdg_surface_new(struct wl_listener *listener, void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct server *server =
 | 
						struct server *server =
 | 
				
			||||||
| 
						 | 
					@ -725,3 +726,26 @@ xdg_surface_new(struct wl_listener *listener, void *data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_list_insert(&server->views, &view->link);
 | 
						wl_list_insert(&server->views, &view->link);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					xdg_shell_init(struct server *server)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						server->xdg_shell = wlr_xdg_shell_create(server->wl_display,
 | 
				
			||||||
 | 
							LAB_XDG_SHELL_VERSION);
 | 
				
			||||||
 | 
						if (!server->xdg_shell) {
 | 
				
			||||||
 | 
							wlr_log(WLR_ERROR, "unable to create the XDG shell interface");
 | 
				
			||||||
 | 
							exit(EXIT_FAILURE);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						server->new_xdg_surface.notify = xdg_surface_new;
 | 
				
			||||||
 | 
						wl_signal_add(&server->xdg_shell->events.new_surface, &server->new_xdg_surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						server->xdg_activation = wlr_xdg_activation_v1_create(server->wl_display);
 | 
				
			||||||
 | 
						if (!server->xdg_activation) {
 | 
				
			||||||
 | 
							wlr_log(WLR_ERROR, "unable to create xdg_activation interface");
 | 
				
			||||||
 | 
							exit(EXIT_FAILURE);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						server->xdg_activation_request.notify = xdg_activation_handle_request;
 | 
				
			||||||
 | 
						wl_signal_add(&server->xdg_activation->events.request_activate,
 | 
				
			||||||
 | 
							&server->xdg_activation_request);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue