mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	seat: implement virtual keyboard protocol
This commit is contained in:
		
							parent
							
								
									4b8d0ba4b2
								
							
						
					
					
						commit
						76d5fb1dda
					
				
					 2 changed files with 25 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -41,6 +41,7 @@
 | 
			
		|||
#include <wlr/types/wlr_xdg_shell.h>
 | 
			
		||||
#include <wlr/types/wlr_drm_lease_v1.h>
 | 
			
		||||
#include <wlr/types/wlr_virtual_pointer_v1.h>
 | 
			
		||||
#include <wlr/types/wlr_virtual_keyboard_v1.h>
 | 
			
		||||
#include <wlr/util/log.h>
 | 
			
		||||
#if HAVE_XWAYLAND
 | 
			
		||||
#include <wlr/xwayland.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -160,6 +161,9 @@ struct seat {
 | 
			
		|||
 | 
			
		||||
	struct wlr_virtual_pointer_manager_v1 *virtual_pointer;
 | 
			
		||||
	struct wl_listener virtual_pointer_new;
 | 
			
		||||
 | 
			
		||||
	struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
 | 
			
		||||
	struct wl_listener virtual_keyboard_new;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct lab_data_buffer;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										21
									
								
								src/seat.c
									
										
									
									
									
								
							
							
						
						
									
										21
									
								
								src/seat.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -307,6 +307,21 @@ new_virtual_pointer(struct wl_listener *listener, void *data)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
new_virtual_keyboard(struct wl_listener *listener, void *data)
 | 
			
		||||
{
 | 
			
		||||
	struct seat *seat = wl_container_of(listener, seat, virtual_keyboard_new);
 | 
			
		||||
	struct wlr_virtual_keyboard_v1 *keyboard = data;
 | 
			
		||||
	struct wlr_input_device *device = &keyboard->keyboard.base;
 | 
			
		||||
	struct input *input = calloc(1, sizeof(struct input));
 | 
			
		||||
 | 
			
		||||
	device->data = input;
 | 
			
		||||
	input->wlr_input_device = device;
 | 
			
		||||
 | 
			
		||||
	seat_add_device(seat, input);
 | 
			
		||||
	new_keyboard(seat, input);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
seat_init(struct server *server)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -337,6 +352,12 @@ seat_init(struct server *server)
 | 
			
		|||
		&seat->virtual_pointer_new);
 | 
			
		||||
	seat->virtual_pointer_new.notify = new_virtual_pointer;
 | 
			
		||||
 | 
			
		||||
	seat->virtual_keyboard = wlr_virtual_keyboard_manager_v1_create(
 | 
			
		||||
		server->wl_display);
 | 
			
		||||
	wl_signal_add(&seat->virtual_keyboard->events.new_virtual_keyboard,
 | 
			
		||||
		&seat->virtual_keyboard_new);
 | 
			
		||||
	seat->virtual_keyboard_new.notify = new_virtual_keyboard;
 | 
			
		||||
 | 
			
		||||
	seat->cursor = wlr_cursor_create();
 | 
			
		||||
	if (!seat->cursor) {
 | 
			
		||||
		wlr_log(WLR_ERROR, "unable to create cursor");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue