aboutsummaryrefslogtreecommitdiff
path: root/rootston/seat.c
diff options
context:
space:
mode:
Diffstat (limited to 'rootston/seat.c')
-rw-r--r--rootston/seat.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/rootston/seat.c b/rootston/seat.c
index 507254d4..82444dcb 100644
--- a/rootston/seat.c
+++ b/rootston/seat.c
@@ -16,6 +16,7 @@
#include "rootston/input.h"
#include "rootston/keyboard.h"
#include "rootston/seat.h"
+#include "rootston/text_input.h"
#include "rootston/xcursor.h"
@@ -178,9 +179,18 @@ static void handle_tool_axis(struct wl_listener *listener, void *data) {
roots_tool->tablet_v2_tool, event->distance);
}
+ if (event->updated_axes & WLR_TABLET_TOOL_AXIS_TILT_X) {
+ roots_tool->tilt_x = event->tilt_x;
+ }
+
+ if (event->updated_axes & WLR_TABLET_TOOL_AXIS_TILT_Y) {
+ roots_tool->tilt_y = event->tilt_y;
+ }
+
if (event->updated_axes & (WLR_TABLET_TOOL_AXIS_TILT_X | WLR_TABLET_TOOL_AXIS_TILT_Y)) {
wlr_tablet_v2_tablet_tool_notify_tilt(
- roots_tool->tablet_v2_tool, event->tilt_x, event->tilt_y);
+ roots_tool->tablet_v2_tool,
+ roots_tool->tilt_x, roots_tool->tilt_y);
}
if (event->updated_axes & WLR_TABLET_TOOL_AXIS_ROTATION) {
@@ -285,6 +295,12 @@ static void handle_tool_proximity(struct wl_listener *listener, void *data) {
wl_list_init(&roots_tool->tool_link);
}
+ if (event->state == WLR_TABLET_TOOL_PROXIMITY_OUT) {
+ struct roots_tablet_tool *roots_tool = tool->data;
+ wlr_tablet_v2_tablet_tool_notify_proximity_out(roots_tool->tablet_v2_tool);
+ return;
+ }
+
handle_tablet_tool_position(cursor, event->device->data, event->tool,
true, true, event->x, event->y, 0, 0);
}
@@ -299,6 +315,14 @@ static void handle_request_set_cursor(struct wl_listener *listener,
roots_cursor_handle_request_set_cursor(cursor, event);
}
+static void handle_pointer_focus_change(struct wl_listener *listener,
+ void *data) {
+ struct roots_cursor *cursor =
+ wl_container_of(listener, cursor, focus_change);
+ struct wlr_seat_pointer_focus_change_event *event = data;
+ roots_cursor_handle_focus_change(cursor, event);
+}
+
static void seat_reset_device_mappings(struct roots_seat *seat,
struct wlr_input_device *device) {
struct wlr_cursor *cursor = seat->cursor->cursor;
@@ -434,6 +458,12 @@ static void roots_seat_init_cursor(struct roots_seat *seat) {
wl_signal_add(&seat->seat->events.request_set_cursor,
&seat->cursor->request_set_cursor);
seat->cursor->request_set_cursor.notify = handle_request_set_cursor;
+
+ wl_signal_add(&seat->seat->pointer_state.events.focus_change,
+ &seat->cursor->focus_change);
+ seat->cursor->focus_change.notify = handle_pointer_focus_change;
+
+ wl_list_init(&seat->cursor->constraint_commit.link);
}
static void roots_drag_icon_handle_surface_commit(struct wl_listener *listener,
@@ -567,6 +597,7 @@ struct roots_seat *roots_seat_create(struct roots_input *input, char *name) {
free(seat);
return NULL;
}
+ seat->seat->data = seat;
roots_seat_init_cursor(seat);
if (!seat->cursor) {
@@ -575,6 +606,8 @@ struct roots_seat *roots_seat_create(struct roots_input *input, char *name) {
return NULL;
}
+ roots_input_method_relay_init(seat, &seat->im_relay);
+
wl_list_insert(&input->seats, &seat->link);
seat->new_drag_icon.notify = roots_seat_handle_new_drag_icon;
@@ -1152,6 +1185,7 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
if (view == NULL) {
seat->cursor->mode = ROOTS_CURSOR_PASSTHROUGH;
wlr_seat_keyboard_clear_focus(seat->seat);
+ roots_input_method_relay_set_focus(&seat->im_relay, NULL);
return;
}
@@ -1186,6 +1220,12 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
wlr_seat_keyboard_notify_enter(seat->seat, view->wlr_surface,
NULL, 0, NULL);
}
+
+ if (seat->cursor) {
+ roots_cursor_update_focus(seat->cursor);
+ }
+
+ roots_input_method_relay_set_focus(&seat->im_relay, view->wlr_surface);
}
/**
@@ -1220,6 +1260,11 @@ void roots_seat_set_focus_layer(struct roots_seat *seat,
wlr_seat_keyboard_notify_enter(seat->seat, layer->surface,
NULL, 0, NULL);
}
+
+
+ if (seat->cursor) {
+ roots_cursor_update_focus(seat->cursor);
+ }
}
void roots_seat_set_exclusive_client(struct roots_seat *seat,