aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
authorMarkus Ongyerth <ongy@ongy.net>2018-05-04 11:46:32 +0200
committerMarkus Ongyerth <ongy@ongy.net>2018-07-14 09:40:39 +0200
commit5c7a37f30922d973e176b0eec29bb5fddf241eee (patch)
tree73f90d316f4aa5c509ff5dca69851964dd9761e6 /rootston
parent391eef6ea9acfd12856970548cb75dbef83dc702 (diff)
Add tool buttons
Diffstat (limited to 'rootston')
-rw-r--r--rootston/seat.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/rootston/seat.c b/rootston/seat.c
index eb909e78..eb1e7e0b 100644
--- a/rootston/seat.c
+++ b/rootston/seat.c
@@ -140,7 +140,6 @@ static void handle_tablet_tool_position(struct roots_cursor *cursor,
}
static void handle_tool_axis(struct wl_listener *listener, void *data) {
- wlr_log(L_DEBUG, "Tool Axis");
struct roots_cursor *cursor =
wl_container_of(listener, cursor, tool_axis);
struct roots_desktop *desktop = cursor->seat->input->server->desktop;
@@ -148,7 +147,7 @@ static void handle_tool_axis(struct wl_listener *listener, void *data) {
struct wlr_event_tablet_tool_axis *event = data;
struct roots_tablet_tool_tool *roots_tool = event->tool->data;
- if (!roots_tool) {
+ if (!roots_tool) { // Should this be an assert?
wlr_log(L_DEBUG, "Tool Axis, before proximity");
return;
}
@@ -182,7 +181,6 @@ static void handle_tool_tip(struct wl_listener *listener, void *data) {
}
static void handle_tablet_tool_tool_destroy(struct wl_listener *listener, void *data) {
- wlr_log(L_DEBUG, "Tool destroy");
struct roots_tablet_tool_tool *tool =
wl_container_of(listener, tool, tool_destroy);
@@ -195,8 +193,18 @@ static void handle_tablet_tool_tool_destroy(struct wl_listener *listener, void *
free(tool);
}
+static void handle_tool_button(struct wl_listener *listener, void *data) {
+ struct roots_cursor *cursor =
+ wl_container_of(listener, cursor, tool_button);
+ struct roots_desktop *desktop = cursor->seat->input->server->desktop;
+ wlr_idle_notify_activity(desktop->idle, cursor->seat->seat);
+ struct wlr_event_tablet_tool_button *event = data;
+ struct roots_tablet_tool_tool *roots_tool = event->tool->data;
+
+ wlr_send_tablet_v2_tablet_tool_button(roots_tool->tablet_v2_tool, event->button, event->state);
+}
+
static void handle_tool_proximity(struct wl_listener *listener, void *data) {
- wlr_log(L_DEBUG, "Tool Proximity");
struct roots_cursor *cursor =
wl_container_of(listener, cursor, tool_proximity);
struct roots_desktop *desktop = cursor->seat->input->server->desktop;
@@ -358,6 +366,9 @@ static void roots_seat_init_cursor(struct roots_seat *seat) {
wl_signal_add(&wlr_cursor->events.tablet_tool_proximity, &seat->cursor->tool_proximity);
seat->cursor->tool_proximity.notify = handle_tool_proximity;
+ wl_signal_add(&wlr_cursor->events.tablet_tool_button, &seat->cursor->tool_button);
+ seat->cursor->tool_button.notify = handle_tool_button;
+
wl_signal_add(&seat->seat->events.request_set_cursor,
&seat->cursor->request_set_cursor);
seat->cursor->request_set_cursor.notify = handle_request_set_cursor;