mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	cursor+keyboard: chase wlroots master
Use wlr_input_device from input device base. Use wlr_keyboard where possible.
This commit is contained in:
		
							parent
							
								
									29021dad6a
								
							
						
					
					
						commit
						581a2bb2f1
					
				
					 2 changed files with 10 additions and 11 deletions
				
			
		| 
						 | 
					@ -643,8 +643,8 @@ cursor_button(struct wl_listener *listener, void *data)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* get modifiers */
 | 
						/* get modifiers */
 | 
				
			||||||
	struct wlr_input_device *device = seat->keyboard_group->input_device;
 | 
						struct wlr_keyboard *keyboard = &seat->keyboard_group->keyboard;
 | 
				
			||||||
	uint32_t modifiers = wlr_keyboard_get_modifiers(device->keyboard);
 | 
						uint32_t modifiers = wlr_keyboard_get_modifiers(keyboard);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* handle _release_ */
 | 
						/* handle _release_ */
 | 
				
			||||||
	if (event->state == WLR_BUTTON_RELEASED) {
 | 
						if (event->state == WLR_BUTTON_RELEASED) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,10 +41,10 @@ keyboard_modifiers_notify(struct wl_listener *listener, void *data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (server->cycle_view) {
 | 
						if (server->cycle_view) {
 | 
				
			||||||
		struct wlr_event_keyboard_key *event = data;
 | 
							struct wlr_event_keyboard_key *event = data;
 | 
				
			||||||
		struct wlr_input_device *device = seat->keyboard_group->input_device;
 | 
							struct wlr_keyboard *keyboard = &seat->keyboard_group->keyboard;
 | 
				
			||||||
		damage_all_outputs(server);
 | 
							damage_all_outputs(server);
 | 
				
			||||||
		if ((event->state == WL_KEYBOARD_KEY_STATE_RELEASED)
 | 
							if ((event->state == WL_KEYBOARD_KEY_STATE_RELEASED)
 | 
				
			||||||
				&& !any_modifiers_pressed(device->keyboard))  {
 | 
									&& !any_modifiers_pressed(keyboard))  {
 | 
				
			||||||
			/* end cycle */
 | 
								/* end cycle */
 | 
				
			||||||
			desktop_focus_and_activate_view(&server->seat,
 | 
								desktop_focus_and_activate_view(&server->seat,
 | 
				
			||||||
				server->cycle_view);
 | 
									server->cycle_view);
 | 
				
			||||||
| 
						 | 
					@ -96,13 +96,13 @@ handle_compositor_keybindings(struct wl_listener *listener,
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct seat *seat = wl_container_of(listener, seat, keyboard_key);
 | 
						struct seat *seat = wl_container_of(listener, seat, keyboard_key);
 | 
				
			||||||
	struct server *server = seat->server;
 | 
						struct server *server = seat->server;
 | 
				
			||||||
	struct wlr_input_device *device = seat->keyboard_group->input_device;
 | 
						struct wlr_keyboard *keyboard = &seat->keyboard_group->keyboard;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Translate libinput keycode -> xkbcommon */
 | 
						/* Translate libinput keycode -> xkbcommon */
 | 
				
			||||||
	uint32_t keycode = event->keycode + 8;
 | 
						uint32_t keycode = event->keycode + 8;
 | 
				
			||||||
	/* Get a list of keysyms based on the keymap for this keyboard */
 | 
						/* Get a list of keysyms based on the keymap for this keyboard */
 | 
				
			||||||
	const xkb_keysym_t *syms;
 | 
						const xkb_keysym_t *syms;
 | 
				
			||||||
	int nsyms = xkb_state_key_get_syms(device->keyboard->xkb_state, keycode, &syms);
 | 
						int nsyms = xkb_state_key_get_syms(keyboard->xkb_state, keycode, &syms);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool handled = false;
 | 
						bool handled = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -117,14 +117,13 @@ handle_compositor_keybindings(struct wl_listener *listener,
 | 
				
			||||||
			&& event->state == WL_KEYBOARD_KEY_STATE_RELEASED) {
 | 
								&& event->state == WL_KEYBOARD_KEY_STATE_RELEASED) {
 | 
				
			||||||
		int nr_bound_keys = key_state_bound_key_remove(keycode);
 | 
							int nr_bound_keys = key_state_bound_key_remove(keycode);
 | 
				
			||||||
		if (!nr_bound_keys) {
 | 
							if (!nr_bound_keys) {
 | 
				
			||||||
			wlr_keyboard_set_repeat_info(device->keyboard,
 | 
								wlr_keyboard_set_repeat_info(keyboard,
 | 
				
			||||||
				rc.repeat_rate, rc.repeat_delay);
 | 
									rc.repeat_rate, rc.repeat_delay);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return true;
 | 
							return true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uint32_t modifiers =
 | 
						uint32_t modifiers = wlr_keyboard_get_modifiers(keyboard);
 | 
				
			||||||
		wlr_keyboard_get_modifiers(device->keyboard);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Catch C-A-F1 to C-A-F12 to change tty */
 | 
						/* Catch C-A-F1 to C-A-F12 to change tty */
 | 
				
			||||||
	if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
 | 
						if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
 | 
				
			||||||
| 
						 | 
					@ -190,7 +189,7 @@ keyboard_key_notify(struct wl_listener *listener, void *data)
 | 
				
			||||||
	struct server *server = seat->server;
 | 
						struct server *server = seat->server;
 | 
				
			||||||
	struct wlr_event_keyboard_key *event = data;
 | 
						struct wlr_event_keyboard_key *event = data;
 | 
				
			||||||
	struct wlr_seat *wlr_seat = server->seat.seat;
 | 
						struct wlr_seat *wlr_seat = server->seat.seat;
 | 
				
			||||||
	struct wlr_input_device *device = seat->keyboard_group->input_device;
 | 
						struct wlr_keyboard *keyboard = &seat->keyboard_group->keyboard;
 | 
				
			||||||
	wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
 | 
						wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool handled = false;
 | 
						bool handled = false;
 | 
				
			||||||
| 
						 | 
					@ -201,7 +200,7 @@ keyboard_key_notify(struct wl_listener *listener, void *data)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!handled) {
 | 
						if (!handled) {
 | 
				
			||||||
		wlr_seat_set_keyboard(wlr_seat, device);
 | 
							wlr_seat_set_keyboard(wlr_seat, &keyboard->base);
 | 
				
			||||||
		wlr_seat_keyboard_notify_key(wlr_seat, event->time_msec,
 | 
							wlr_seat_keyboard_notify_key(wlr_seat, event->time_msec,
 | 
				
			||||||
					     event->keycode, event->state);
 | 
										     event->keycode, event->state);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue