mirror of
				https://github.com/cage-kiosk/cage.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Add initial layer shell skeleton
This commit is contained in:
		
							parent
							
								
									03ddd679fd
								
							
						
					
					
						commit
						6891f76fe1
					
				
					 5 changed files with 52 additions and 1 deletions
				
			
		
							
								
								
									
										13
									
								
								cage.c
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								cage.c
									
										
									
									
									
								
							| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Cage: A Wayland kiosk.
 | 
					 * Cage: A Wayland kiosk.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Copyright (C) 2018-2020 Jente Hidskes
 | 
					 * Copyright (C) 2018-2021 Jente Hidskes
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * See the LICENSE file accompanying this file.
 | 
					 * See the LICENSE file accompanying this file.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
| 
						 | 
					@ -27,6 +27,7 @@
 | 
				
			||||||
#include <wlr/types/wlr_gamma_control_v1.h>
 | 
					#include <wlr/types/wlr_gamma_control_v1.h>
 | 
				
			||||||
#include <wlr/types/wlr_idle_inhibit_v1.h>
 | 
					#include <wlr/types/wlr_idle_inhibit_v1.h>
 | 
				
			||||||
#include <wlr/types/wlr_idle_notify_v1.h>
 | 
					#include <wlr/types/wlr_idle_notify_v1.h>
 | 
				
			||||||
 | 
					#include <wlr/types/wlr_layer_shell_v1.h>
 | 
				
			||||||
#include <wlr/types/wlr_output_layout.h>
 | 
					#include <wlr/types/wlr_output_layout.h>
 | 
				
			||||||
#include <wlr/types/wlr_output_management_v1.h>
 | 
					#include <wlr/types/wlr_output_management_v1.h>
 | 
				
			||||||
#include <wlr/types/wlr_presentation_time.h>
 | 
					#include <wlr/types/wlr_presentation_time.h>
 | 
				
			||||||
| 
						 | 
					@ -52,6 +53,7 @@
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "idle_inhibit_v1.h"
 | 
					#include "idle_inhibit_v1.h"
 | 
				
			||||||
 | 
					#include "layer_shell_v1.h"
 | 
				
			||||||
#include "output.h"
 | 
					#include "output.h"
 | 
				
			||||||
#include "seat.h"
 | 
					#include "seat.h"
 | 
				
			||||||
#include "server.h"
 | 
					#include "server.h"
 | 
				
			||||||
| 
						 | 
					@ -461,6 +463,15 @@ main(int argc, char *argv[])
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						server.layer_shell_v1 = wlr_layer_shell_v1_create(server.wl_display, 4);
 | 
				
			||||||
 | 
						if (!server.layer_shell_v1) {
 | 
				
			||||||
 | 
							wlr_log(WLR_ERROR, "Unable to create the layer shell");
 | 
				
			||||||
 | 
							ret = 1;
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						server.new_layer_shell_v1_surface.notify = handle_layer_shell_v1_surface_new;
 | 
				
			||||||
 | 
						wl_signal_add(&server.layer_shell_v1->events.new_surface, &server.new_layer_shell_v1_surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!wlr_export_dmabuf_manager_v1_create(server.wl_display)) {
 | 
						if (!wlr_export_dmabuf_manager_v1_create(server.wl_display)) {
 | 
				
			||||||
		wlr_log(WLR_ERROR, "Unable to create the export DMABUF manager");
 | 
							wlr_log(WLR_ERROR, "Unable to create the export DMABUF manager");
 | 
				
			||||||
		ret = 1;
 | 
							ret = 1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										27
									
								
								layer_shell_v1.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								layer_shell_v1.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,27 @@
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Cage: A Wayland kiosk.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Copyright (C) 2021 Jente Hidskes
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * See the LICENSE file accompanying this file.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "layer_shell_v1.h"
 | 
				
			||||||
 | 
					#include "server.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <wayland-server-core.h>
 | 
				
			||||||
 | 
					#include <wlr/types/wlr_layer_shell_v1.h>
 | 
				
			||||||
 | 
					#include <wlr/util/log.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					handle_layer_shell_v1_surface_new(struct wl_listener *listener, void *data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct cg_server *server = wl_container_of(listener, server, new_layer_shell_v1_surface);
 | 
				
			||||||
 | 
						struct wlr_layer_surface_v1 *layer_surface = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						wlr_log(WLR_DEBUG, "New layer shell surface: namespace %s layer %d anchor %d size %dx%d margin %d,%d,%d,%d",
 | 
				
			||||||
 | 
							layer_surface->namespace, layer_surface->pending.layer, layer_surface->pending.anchor,
 | 
				
			||||||
 | 
							layer_surface->pending.desired_width, layer_surface->pending.desired_height,
 | 
				
			||||||
 | 
							layer_surface->pending.margin.top, layer_surface->pending.margin.right,
 | 
				
			||||||
 | 
							layer_surface->pending.margin.bottom, layer_surface->pending.margin.left);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										8
									
								
								layer_shell_v1.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								layer_shell_v1.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,8 @@
 | 
				
			||||||
 | 
					#ifndef CG_LAYER_SHELL_V1_H
 | 
				
			||||||
 | 
					#define CG_LAYER_SHELL_V1_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <wayland-server-core.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void handle_layer_shell_v1_surface_new(struct wl_listener *listener, void *data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					@ -92,6 +92,7 @@ endif
 | 
				
			||||||
cage_sources = [
 | 
					cage_sources = [
 | 
				
			||||||
  'cage.c',
 | 
					  'cage.c',
 | 
				
			||||||
  'idle_inhibit_v1.c',
 | 
					  'idle_inhibit_v1.c',
 | 
				
			||||||
 | 
					  'layer_shell_v1.c',
 | 
				
			||||||
  'output.c',
 | 
					  'output.c',
 | 
				
			||||||
  'seat.c',
 | 
					  'seat.c',
 | 
				
			||||||
  'view.c',
 | 
					  'view.c',
 | 
				
			||||||
| 
						 | 
					@ -103,6 +104,7 @@ cage_headers = [
 | 
				
			||||||
                 output: 'config.h',
 | 
					                 output: 'config.h',
 | 
				
			||||||
                 configuration: conf_data),
 | 
					                 configuration: conf_data),
 | 
				
			||||||
  'idle_inhibit_v1.h',
 | 
					  'idle_inhibit_v1.h',
 | 
				
			||||||
 | 
					  'layer_shell_v1.h',
 | 
				
			||||||
  'output.h',
 | 
					  'output.h',
 | 
				
			||||||
  'seat.h',
 | 
					  'seat.h',
 | 
				
			||||||
  'server.h',
 | 
					  'server.h',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										3
									
								
								server.h
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								server.h
									
										
									
									
									
								
							| 
						 | 
					@ -52,6 +52,9 @@ struct cg_server {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wl_listener new_virtual_keyboard;
 | 
						struct wl_listener new_virtual_keyboard;
 | 
				
			||||||
	struct wl_listener new_virtual_pointer;
 | 
						struct wl_listener new_virtual_pointer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct wlr_layer_shell_v1 *layer_shell_v1;
 | 
				
			||||||
 | 
						struct wl_listener new_layer_shell_v1_surface;
 | 
				
			||||||
#if CAGE_HAS_XWAYLAND
 | 
					#if CAGE_HAS_XWAYLAND
 | 
				
			||||||
	struct wl_listener new_xwayland_surface;
 | 
						struct wl_listener new_xwayland_surface;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue