aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-01-21 22:16:55 +0100
committeremersion <contact@emersion.fr>2018-01-21 22:18:06 +0100
commit59c53e8333cae17210832fb79514c4d0110c7de8 (patch)
treea2b06676b53f4f7ca075ce728155d0d442f69759 /rootston
parentf704c3d42b80ad28bfd096e5467a5219c0778e3b (diff)
parente5fa4d8e8e6e81b0cdac9df2dcb1f589867c98f2 (diff)
Merge remote-tracking branch 'upstream/master' into output-damage
Diffstat (limited to 'rootston')
-rw-r--r--rootston/keyboard.c3
-rw-r--r--rootston/seat.c42
2 files changed, 38 insertions, 7 deletions
diff --git a/rootston/keyboard.c b/rootston/keyboard.c
index 14199afd..f1123599 100644
--- a/rootston/keyboard.c
+++ b/rootston/keyboard.c
@@ -288,7 +288,8 @@ void roots_keyboard_handle_key(struct roots_keyboard *keyboard,
void roots_keyboard_handle_modifiers(struct roots_keyboard *r_keyboard) {
struct wlr_seat *seat = r_keyboard->seat->seat;
wlr_seat_set_keyboard(seat, r_keyboard->device);
- wlr_seat_keyboard_notify_modifiers(seat);
+ wlr_seat_keyboard_notify_modifiers(seat,
+ &r_keyboard->device->keyboard->modifiers);
}
static void keyboard_config_merge(struct roots_keyboard_config *config,
diff --git a/rootston/seat.c b/rootston/seat.c
index 130c7b27..1a0e6253 100644
--- a/rootston/seat.c
+++ b/rootston/seat.c
@@ -293,11 +293,6 @@ struct roots_seat *roots_seat_create(struct roots_input *input, char *name) {
return NULL;
}
- wlr_seat_set_capabilities(seat->seat,
- WL_SEAT_CAPABILITY_KEYBOARD |
- WL_SEAT_CAPABILITY_POINTER |
- WL_SEAT_CAPABILITY_TOUCH);
-
wl_list_insert(&input->seats, &seat->link);
seat->seat_destroy.notify = roots_seat_handle_seat_destroy;
@@ -306,6 +301,28 @@ struct roots_seat *roots_seat_create(struct roots_input *input, char *name) {
return seat;
}
+static void seat_update_capabilities(struct roots_seat *seat) {
+ uint32_t caps = 0;
+ if (!wl_list_empty(&seat->keyboards)) {
+ caps |= WL_SEAT_CAPABILITY_KEYBOARD;
+ }
+ if (!wl_list_empty(&seat->pointers) || !wl_list_empty(&seat->tablet_tools)) {
+ caps |= WL_SEAT_CAPABILITY_POINTER;
+ }
+ if (!wl_list_empty(&seat->touch)) {
+ caps |= WL_SEAT_CAPABILITY_TOUCH;
+ }
+ wlr_seat_set_capabilities(seat->seat, caps);
+
+ // Hide cursor if seat doesn't have pointer capability
+ if ((caps & WL_SEAT_CAPABILITY_POINTER) == 0) {
+ wlr_cursor_set_image(seat->cursor->cursor, NULL, 0, 0, 0, 0, 0, 0);
+ } else {
+ wlr_xcursor_manager_set_cursor_image(seat->cursor->xcursor_manager,
+ seat->cursor->default_xcursor, seat->cursor->cursor);
+ }
+}
+
static void seat_add_keyboard(struct roots_seat *seat,
struct wlr_input_device *device) {
assert(device->type == WLR_INPUT_DEVICE_KEYBOARD);
@@ -404,6 +421,8 @@ void roots_seat_add_device(struct roots_seat *seat,
seat_add_tablet_tool(seat, device);
break;
}
+
+ seat_update_capabilities(seat);
}
static void seat_remove_keyboard(struct roots_seat *seat,
@@ -480,6 +499,8 @@ void roots_seat_remove_device(struct roots_seat *seat,
seat_remove_tablet_tool(seat, device);
break;
}
+
+ seat_update_capabilities(seat);
}
void roots_seat_configure_xcursor(struct roots_seat *seat) {
@@ -641,7 +662,16 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
seat->has_focus = true;
wl_list_remove(&seat_view->link);
wl_list_insert(&seat->views, &seat_view->link);
- wlr_seat_keyboard_notify_enter(seat->seat, view->wlr_surface);
+
+ struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat->seat);
+ if (keyboard != NULL) {
+ wlr_seat_keyboard_notify_enter(seat->seat, view->wlr_surface,
+ keyboard->keycodes, keyboard->num_keycodes,
+ &keyboard->modifiers);
+ } else {
+ wlr_seat_keyboard_notify_enter(seat->seat, view->wlr_surface,
+ NULL, 0, NULL);
+ }
}
void roots_seat_cycle_focus(struct roots_seat *seat) {