aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wlr/types/wlr_tablet_v2.h6
-rw-r--r--types/tablet_v2/wlr_tablet_v2.c2
-rw-r--r--types/tablet_v2/wlr_tablet_v2_tool.c29
3 files changed, 26 insertions, 11 deletions
diff --git a/include/wlr/types/wlr_tablet_v2.h b/include/wlr/types/wlr_tablet_v2.h
index 18fafcc3..09f7454a 100644
--- a/include/wlr/types/wlr_tablet_v2.h
+++ b/include/wlr/types/wlr_tablet_v2.h
@@ -8,7 +8,7 @@
#include "tablet-unstable-v2-protocol.h"
/* This can probably be even lower,the tools don't have a lot of buttons */
-#define WLR_TABLEt_V2_TOOL_BUTTONS_CAP 16
+#define WLR_TABLET_V2_TOOL_BUTTONS_CAP 16
struct wlr_tablet_client_v2;
struct wlr_tablet_tool_client_v2;
@@ -51,8 +51,8 @@ struct wlr_tablet_v2_tablet_tool {
bool is_down;
uint32_t down_serial;
size_t num_buttons;
- uint32_t pressed_buttons[WLR_TABLEt_V2_TOOL_BUTTONS_CAP];
- uint32_t pressed_serials[WLR_TABLEt_V2_TOOL_BUTTONS_CAP];
+ uint32_t pressed_buttons[WLR_TABLET_V2_TOOL_BUTTONS_CAP];
+ uint32_t pressed_serials[WLR_TABLET_V2_TOOL_BUTTONS_CAP];
struct {
struct wl_signal set_cursor; // struct wlr_tablet_v2_event_cursor
diff --git a/types/tablet_v2/wlr_tablet_v2.c b/types/tablet_v2/wlr_tablet_v2.c
index 1ac60e17..58945765 100644
--- a/types/tablet_v2/wlr_tablet_v2.c
+++ b/types/tablet_v2/wlr_tablet_v2.c
@@ -117,6 +117,8 @@ void wlr_tablet_seat_client_v2_destroy(struct wl_resource *resource) {
destroy_tablet_tool_v2(tool->resource);
}
+ wl_list_remove(&seat->seat_link);
+ wl_list_remove(&seat->client_link);
wl_list_remove(&seat->seat_client_destroy.link);
free(seat);
diff --git a/types/tablet_v2/wlr_tablet_v2_tool.c b/types/tablet_v2/wlr_tablet_v2_tool.c
index 0532134d..954c98c9 100644
--- a/types/tablet_v2/wlr_tablet_v2_tool.c
+++ b/types/tablet_v2/wlr_tablet_v2_tool.c
@@ -261,20 +261,22 @@ static ssize_t tablet_tool_button_update(struct wlr_tablet_v2_tablet_tool *tool,
}
}
- if (button == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED && !found &&
- tool->num_buttons < WLR_TABLEt_V2_TOOL_BUTTONS_CAP) {
+ if (state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED && !found &&
+ tool->num_buttons < WLR_TABLET_V2_TOOL_BUTTONS_CAP) {
i = tool->num_buttons++;
tool->pressed_buttons[i] = button;
+ tool->pressed_serials[i] = -1;
+ } else {
+ i = -1;
}
- if (button == ZWP_TABLET_PAD_V2_BUTTON_STATE_RELEASED && found) {
+ if (state == ZWP_TABLET_PAD_V2_BUTTON_STATE_RELEASED && found) {
tool->pressed_buttons[i] = 0;
tool->pressed_serials[i] = 0;
- tool->num_buttons = push_zeroes_to_end(tool->pressed_buttons, WLR_TABLEt_V2_TOOL_BUTTONS_CAP);
- tool->num_buttons = push_zeroes_to_end(tool->pressed_serials, WLR_TABLEt_V2_TOOL_BUTTONS_CAP);
- i = -1;
+ tool->num_buttons = push_zeroes_to_end(tool->pressed_buttons, WLR_TABLET_V2_TOOL_BUTTONS_CAP);
+ tool->num_buttons = push_zeroes_to_end(tool->pressed_serials, WLR_TABLET_V2_TOOL_BUTTONS_CAP);
}
- assert(tool->num_buttons <= WLR_TABLEt_V2_TOOL_BUTTONS_CAP);
+ assert(tool->num_buttons <= WLR_TABLET_V2_TOOL_BUTTONS_CAP);
return i;
}
@@ -352,7 +354,7 @@ void wlr_send_tablet_v2_tablet_tool_proximity_in(
tablet_client->resource, surface->resource);
/* Send all the pressed buttons */
for (size_t i = 0; i < tool->num_buttons; ++i) {
- wlr_send_tablet_v2_tablet_tool_button(tool,
+ wlr_send_tablet_v2_tablet_tool_button(tool,
tool->pressed_buttons[i],
ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED);
}
@@ -378,12 +380,23 @@ void wlr_send_tablet_v2_tablet_tool_motion(
void wlr_send_tablet_v2_tablet_tool_proximity_out(
struct wlr_tablet_v2_tablet_tool *tool) {
if (tool->current_client) {
+ for (size_t i = 0; i < tool->num_buttons; ++i) {
+ zwp_tablet_tool_v2_send_button(tool->current_client->resource,
+ tool->pressed_serials[i],
+ tool->pressed_buttons[i],
+ ZWP_TABLET_PAD_V2_BUTTON_STATE_RELEASED);
+ }
+ if (tool->is_down) {
+ zwp_tablet_tool_v2_send_up(tool->current_client->resource);
+ }
zwp_tablet_tool_v2_send_proximity_out(tool->current_client->resource);
if (tool->current_client->frame_source) {
wl_event_source_remove(tool->current_client->frame_source);
send_tool_frame(tool->current_client);
}
+
tool->current_client = NULL;
+ tool->focused_surface = NULL;
}
}