diff --git a/include/types/wlr_tablet_v2.h b/include/types/wlr_tablet_v2.h index f2d9b8e4..4b9e727d 100644 --- a/include/types/wlr_tablet_v2.h +++ b/include/types/wlr_tablet_v2.h @@ -26,7 +26,7 @@ struct wlr_tablet_seat_client_v2 { struct wl_resource *resource; struct wlr_tablet_manager_client_v2 *client; - struct wlr_seat_client *seat; + struct wlr_seat_client *seat_client; struct wl_listener seat_client_destroy; @@ -85,7 +85,7 @@ struct wlr_tablet_tool_client_v2 *tablet_tool_client_from_resource(struct wl_res void add_tablet_tool_client(struct wlr_tablet_seat_client_v2 *seat, struct wlr_tablet_v2_tablet_tool *tool); struct wlr_tablet_seat_client_v2 *tablet_seat_client_from_resource(struct wl_resource *resource); -void wlr_tablet_seat_client_v2_destroy(struct wl_resource *resource); +void tablet_seat_client_v2_destroy(struct wl_resource *resource); struct wlr_tablet_seat_v2 *get_or_create_tablet_seat( struct wlr_tablet_manager_v2 *manager, struct wlr_seat *wlr_seat); diff --git a/include/wlr/types/wlr_tablet_v2.h b/include/wlr/types/wlr_tablet_v2.h index bebf8a19..afa74d05 100644 --- a/include/wlr/types/wlr_tablet_v2.h +++ b/include/wlr/types/wlr_tablet_v2.h @@ -137,7 +137,7 @@ void wlr_send_tablet_v2_tablet_tool_slider( struct wlr_tablet_v2_tablet_tool *tool, double position); void wlr_send_tablet_v2_tablet_tool_wheel( - struct wlr_tablet_v2_tablet_tool *tool, double delta, int32_t clicks); + struct wlr_tablet_v2_tablet_tool *tool, double degrees, int32_t clicks); void wlr_send_tablet_v2_tablet_tool_proximity_out( struct wlr_tablet_v2_tablet_tool *tool); diff --git a/types/tablet_v2/wlr_tablet_v2.c b/types/tablet_v2/wlr_tablet_v2.c index 802de77f..fa058e79 100644 --- a/types/tablet_v2/wlr_tablet_v2.c +++ b/types/tablet_v2/wlr_tablet_v2.c @@ -36,7 +36,7 @@ static void handle_wlr_seat_destroy(struct wl_listener *listener, void *data) { struct wlr_tablet_seat_client_v2 *client; struct wlr_tablet_seat_client_v2 *tmp; wl_list_for_each_safe(client, tmp, &seat->clients, seat_link) { - wlr_tablet_seat_client_v2_destroy(client->resource); + tablet_seat_client_v2_destroy(client->resource); } } @@ -94,7 +94,7 @@ struct wlr_tablet_seat_client_v2 *tablet_seat_client_from_resource( return wl_resource_get_user_data(resource); } -void wlr_tablet_seat_client_v2_destroy(struct wl_resource *resource) { +void tablet_seat_client_v2_destroy(struct wl_resource *resource) { struct wlr_tablet_seat_client_v2 *seat = tablet_seat_client_from_resource(resource); if (!seat) { return; @@ -129,7 +129,7 @@ void wlr_tablet_seat_client_v2_destroy(struct wl_resource *resource) { static void handle_seat_client_destroy(struct wl_listener *listener, void *data) { struct wlr_tablet_seat_client_v2 *seat = wl_container_of(listener, seat, seat_client_destroy); - wlr_tablet_seat_client_v2_destroy(seat->resource); + tablet_seat_client_v2_destroy(seat->resource); } static void tablet_manager_destroy(struct wl_client *client, @@ -148,7 +148,7 @@ static void get_tablet_seat(struct wl_client *wl_client, struct wl_resource *res * destruction, without allocations or advertising things */ wl_resource_set_implementation(seat_resource, &seat_impl, NULL, - wlr_tablet_seat_client_v2_destroy); + tablet_seat_client_v2_destroy); return; } struct wlr_seat_client *seat = wlr_seat_client_from_resource(seat_resource); @@ -175,10 +175,10 @@ static void get_tablet_seat(struct wl_client *wl_client, struct wl_resource *res return; } wl_resource_set_implementation(seat_client->resource, &seat_impl, seat_client, - wlr_tablet_seat_client_v2_destroy); + tablet_seat_client_v2_destroy); - seat_client->seat = seat; + seat_client->seat_client = seat; seat_client->client = manager; seat_client->wl_client = wl_client; wl_list_init(&seat_client->tools); @@ -229,7 +229,7 @@ static void wlr_tablet_manager_v2_destroy(struct wl_resource *resource) { struct wlr_tablet_seat_client_v2 *pos; struct wlr_tablet_seat_client_v2 *tmp; wl_list_for_each_safe(pos, tmp, &client->tablet_seats, client_link) { - wlr_tablet_seat_client_v2_destroy(pos->resource); + tablet_seat_client_v2_destroy(pos->resource); } wl_list_remove(&client->link); diff --git a/types/tablet_v2/wlr_tablet_v2_pad.c b/types/tablet_v2/wlr_tablet_v2_pad.c index 154e6434..899f60cd 100644 --- a/types/tablet_v2/wlr_tablet_v2_pad.c +++ b/types/tablet_v2/wlr_tablet_v2_pad.c @@ -86,7 +86,7 @@ static void handle_tablet_pad_ring_v2_set_feedback(struct wl_client *client, .serial = serial, .description = description, .index = aux->index - }; + }; wl_signal_emit(&aux->pad->pad->events.ring_feedback, &evt); } @@ -221,12 +221,17 @@ static void add_tablet_pad_group(struct wlr_tablet_v2_tablet_pad *pad, struct tablet_pad_auxiliary_user_data *user_data = calloc(1, sizeof(struct tablet_pad_auxiliary_user_data)); if (!user_data) { - continue; + wl_client_post_no_memory(client->client); + return; } user_data->pad = client; user_data->index = strip; client->strips[strip] = wl_resource_create(client->client, &zwp_tablet_pad_strip_v2_interface, 1, 0); + if (!client->strips[strip]) { + wl_client_post_no_memory(client->client); + return; + } wl_resource_set_implementation(client->strips[strip], &tablet_pad_strip_impl, user_data, destroy_tablet_pad_strip_v2); zwp_tablet_pad_group_v2_send_strip(client->groups[index], client->strips[strip]); @@ -238,12 +243,17 @@ static void add_tablet_pad_group(struct wlr_tablet_v2_tablet_pad *pad, struct tablet_pad_auxiliary_user_data *user_data = calloc(1, sizeof(struct tablet_pad_auxiliary_user_data)); if (!user_data) { - continue; + wl_client_post_no_memory(client->client); + return; } user_data->pad = client; user_data->index = ring; client->rings[ring] = wl_resource_create(client->client, &zwp_tablet_pad_ring_v2_interface, 1, 0); + if (!client->rings[ring]) { + wl_client_post_no_memory(client->client); + return; + } wl_resource_set_implementation(client->rings[ring], &tablet_pad_ring_impl, user_data, destroy_tablet_pad_ring_v2); zwp_tablet_pad_group_v2_send_ring(client->groups[index], client->rings[ring]); @@ -262,14 +272,14 @@ void add_tablet_pad_client(struct wlr_tablet_seat_client_v2 *seat, } client->pad = pad; - client->groups = calloc(sizeof(int), wl_list_length(&pad->wlr_pad->groups)); + client->groups = calloc(wl_list_length(&pad->wlr_pad->groups), sizeof(struct wl_resource*)); if (!client->groups) { wl_client_post_no_memory(seat->wl_client); free(client); return; } - client->rings = calloc(sizeof(struct wl_resource*), pad->wlr_pad->ring_count); + client->rings = calloc(pad->wlr_pad->ring_count, sizeof(struct wl_resource*)); if (!client->rings) { wl_client_post_no_memory(seat->wl_client); free(client->groups); @@ -277,7 +287,7 @@ void add_tablet_pad_client(struct wlr_tablet_seat_client_v2 *seat, return; } - client->strips = calloc(sizeof(struct wl_resource*), pad->wlr_pad->strip_count); + client->strips = calloc(pad->wlr_pad->strip_count, sizeof(struct wl_resource*)); if (!client->strips) { wl_client_post_no_memory(seat->wl_client); free(client->groups); diff --git a/types/tablet_v2/wlr_tablet_v2_tool.c b/types/tablet_v2/wlr_tablet_v2_tool.c index d254f21a..f476c2db 100644 --- a/types/tablet_v2/wlr_tablet_v2_tool.c +++ b/types/tablet_v2/wlr_tablet_v2_tool.c @@ -28,7 +28,7 @@ static void handle_tablet_tool_v2_set_cursor(struct wl_client *client, if (surface_resource != NULL) { surface = wlr_surface_from_resource(surface_resource); if (!wlr_surface_set_role(surface, &pointer_cursor_surface_role, NULL, - surface_resource, WL_POINTER_ERROR_ROLE)) { + surface_resource, ZWP_TABLET_TOOL_V2_ERROR_ROLE)) { return; } } @@ -38,7 +38,7 @@ static void handle_tablet_tool_v2_set_cursor(struct wl_client *client, .serial = serial, .hotspot_x = hotspot_x, .hotspot_y = hotspot_y, - .seat_client = tool->seat->seat, + .seat_client = tool->seat->seat_client, }; wl_signal_emit(&tool->tool->events.set_cursor, &evt); @@ -476,10 +476,10 @@ void wlr_send_tablet_v2_tablet_tool_button( } void wlr_send_tablet_v2_tablet_tool_wheel( - struct wlr_tablet_v2_tablet_tool *tool, double delta, int32_t clicks) { + struct wlr_tablet_v2_tablet_tool *tool, double degrees, int32_t clicks) { if (tool->current_client) { zwp_tablet_tool_v2_send_wheel(tool->current_client->resource, - clicks, delta); + clicks, degrees); queue_tool_frame(tool->current_client); }