mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	add keys array param to seat keyboard enter
This commit is contained in:
		
							parent
							
								
									9cde828c94
								
							
						
					
					
						commit
						84a8f1b42d
					
				
					 3 changed files with 10 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -129,7 +129,10 @@ static void example_set_focused_surface(struct sample_state *sample,
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	if (surface) {
 | 
			
		||||
		wlr_seat_keyboard_enter(sample->wl_seat, surface->surface);
 | 
			
		||||
		// TODO: send array of currently pressed keys
 | 
			
		||||
		struct wl_array keys;
 | 
			
		||||
		wl_array_init(&keys);
 | 
			
		||||
		wlr_seat_keyboard_enter(sample->wl_seat, surface->surface, keys);
 | 
			
		||||
	} else {
 | 
			
		||||
		wlr_seat_keyboard_clear_focus(sample->wl_seat);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -128,10 +128,10 @@ void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time,
 | 
			
		|||
/**
 | 
			
		||||
 * Send a keyboard enter event to the given surface and consider it to be the
 | 
			
		||||
 * focused surface for the keyboard. This will send a leave event to the last
 | 
			
		||||
 * surface that was entered.
 | 
			
		||||
 * surface that was entered. Pass an array of currently pressed keys.
 | 
			
		||||
 */
 | 
			
		||||
void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat,
 | 
			
		||||
		struct wlr_surface *surface);
 | 
			
		||||
		struct wlr_surface *surface, struct wl_array keys);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Clear the focused surface for the keyboard and leave all entered surfaces.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -414,7 +414,7 @@ static void handle_keyboard_focus_resource_destroyed(
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat,
 | 
			
		||||
		struct wlr_surface *surface) {
 | 
			
		||||
		struct wlr_surface *surface, struct wl_array keys) {
 | 
			
		||||
	if (wlr_seat->keyboard_state.focused_surface == surface) {
 | 
			
		||||
		// this surface already got an enter notify
 | 
			
		||||
		return;
 | 
			
		||||
| 
						 | 
				
			
			@ -442,9 +442,6 @@ void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat,
 | 
			
		|||
	// enter the current surface
 | 
			
		||||
	if (handle && handle->keyboard) {
 | 
			
		||||
		uint32_t serial = wl_display_next_serial(wlr_seat->display);
 | 
			
		||||
		// TODO: send currently pressed keys
 | 
			
		||||
		struct wl_array keys;
 | 
			
		||||
		wl_array_init(&keys);
 | 
			
		||||
		wl_keyboard_send_enter(handle->keyboard, serial,
 | 
			
		||||
			surface->resource, &keys);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -475,7 +472,9 @@ void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat,
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
void wlr_seat_keyboard_clear_focus(struct wlr_seat *wlr_seat) {
 | 
			
		||||
	wlr_seat_keyboard_enter(wlr_seat, NULL);
 | 
			
		||||
	struct wl_array keys;
 | 
			
		||||
	wl_array_init(&keys);
 | 
			
		||||
	wlr_seat_keyboard_enter(wlr_seat, NULL, keys);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool wlr_seat_keyboard_has_focus_resource(struct wlr_seat *wlr_seat) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue