From 21e1cc9ab47f115a888154aa62a2c4b2ae8f1691 Mon Sep 17 00:00:00 2001 From: Markus Ongyerth Date: Sat, 8 Sep 2018 19:16:56 +0200 Subject: [PATCH] Implement feedback --- types/tablet_v2/wlr_tablet_v2_pad.c | 12 +++++------- types/tablet_v2/wlr_tablet_v2_tool.c | 23 +++++++++++++---------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/types/tablet_v2/wlr_tablet_v2_pad.c b/types/tablet_v2/wlr_tablet_v2_pad.c index f66d2916..74444708 100644 --- a/types/tablet_v2/wlr_tablet_v2_pad.c +++ b/types/tablet_v2/wlr_tablet_v2_pad.c @@ -11,7 +11,7 @@ #include #include -static struct wlr_tablet_pad_v2_grab_interface default_pad_interface; +static struct wlr_tablet_pad_v2_grab_interface default_pad_grab_interface; struct tablet_pad_auxiliary_user_data { struct wlr_tablet_pad_client_v2 *pad; @@ -368,7 +368,7 @@ struct wlr_tablet_v2_tablet_pad *wlr_tablet_pad_create( if (!pad) { return NULL; } - pad->default_grab.interface = &default_pad_interface; + pad->default_grab.interface = &default_pad_grab_interface; pad->default_grab.pad = pad; pad->grab = &pad->default_grab; @@ -631,10 +631,8 @@ void wlr_tablet_v2_start_grab(struct wlr_tablet_v2_tablet_pad *pad, struct wlr_tablet_pad_v2_grab *prev = pad->grab; grab->pad = pad; pad->grab = grab; - if (prev) { - if (prev->interface->cancel) { - prev->interface->cancel(prev); - } + if (prev && prev->interface->cancel) { + prev->interface->cancel(prev); } } } @@ -685,7 +683,7 @@ static void default_pad_cancel(struct wlr_tablet_pad_v2_grab *grab) { // Do nothing, the default cancel can be ignored. } -static struct wlr_tablet_pad_v2_grab_interface default_pad_interface = { +static struct wlr_tablet_pad_v2_grab_interface default_pad_grab_interface = { .enter = default_pad_enter, .button = default_pad_button, .strip = default_pad_strip, diff --git a/types/tablet_v2/wlr_tablet_v2_tool.c b/types/tablet_v2/wlr_tablet_v2_tool.c index c6ae6576..81f13aa1 100644 --- a/types/tablet_v2/wlr_tablet_v2_tool.c +++ b/types/tablet_v2/wlr_tablet_v2_tool.c @@ -12,7 +12,7 @@ #include #include -static const struct wlr_tablet_tool_v2_grab_interface default_tool_interface; +static const struct wlr_tablet_tool_v2_grab_interface default_tool_grab_interface; static const struct wlr_surface_role tablet_tool_cursor_surface_role = { .name = "wp_tablet_tool-cursor", @@ -209,7 +209,7 @@ struct wlr_tablet_v2_tablet_tool *wlr_tablet_tool_create( tool->wlr_tool = wlr_tool; wl_list_init(&tool->clients); tool->default_grab.tool = tool; - tool->default_grab.interface = &default_tool_interface; + tool->default_grab.interface = &default_tool_grab_interface; tool->grab = &tool->default_grab; @@ -602,7 +602,8 @@ void wlr_tablet_v2_tablet_tool_notify_button( } } -void wlr_tablet_tool_v2_start_grab(struct wlr_tablet_v2_tablet_tool *tool, struct wlr_tablet_tool_v2_grab *grab) { +void wlr_tablet_tool_v2_start_grab(struct wlr_tablet_v2_tablet_tool *tool, + struct wlr_tablet_tool_v2_grab *grab) { wlr_tablet_tool_v2_end_grab(tool); tool->grab = grab; } @@ -630,7 +631,7 @@ static void default_tool_up(struct wlr_tablet_tool_v2_grab *grab) { } static void default_tool_motion( - struct wlr_tablet_tool_v2_grab *grab, double x, double y) { + struct wlr_tablet_tool_v2_grab *grab, double x, double y) { wlr_send_tablet_v2_tablet_tool_motion(grab->tool, x, y); } @@ -678,7 +679,8 @@ static void default_tool_cancel(struct wlr_tablet_tool_v2_grab *grab) { /* Do nothing. Default grab can't be canceled */ } -static const struct wlr_tablet_tool_v2_grab_interface default_tool_interface = { +static const struct wlr_tablet_tool_v2_grab_interface + default_tool_grab_interface = { .proximity_in = default_tool_proximity_in, .down = default_tool_down, .up = default_tool_up, @@ -779,7 +781,8 @@ static void implicit_tool_cancel(struct wlr_tablet_tool_v2_grab *grab) { free(grab); } -const struct wlr_tablet_tool_v2_grab_interface implicit_tool_interface = { +static const struct wlr_tablet_tool_v2_grab_interface + implicit_tool_grab_interface = { .proximity_in = implicit_tool_proximity_in, .down = implicit_tool_down, .up = implicit_tool_up, @@ -796,11 +799,11 @@ const struct wlr_tablet_tool_v2_grab_interface implicit_tool_interface = { }; static bool tool_has_implicit_grab(struct wlr_tablet_v2_tablet_tool *tool) { - return tool->grab->interface == &implicit_tool_interface; + return tool->grab->interface == &implicit_tool_grab_interface; } -void wlr_tablet_tool_v2_start_implicit_grab(struct wlr_tablet_v2_tablet_tool *tool) { - /* Durr */ +void wlr_tablet_tool_v2_start_implicit_grab( + struct wlr_tablet_v2_tablet_tool *tool) { if (tool_has_implicit_grab(tool) || !tool->focused_surface) { return; } @@ -816,7 +819,7 @@ void wlr_tablet_tool_v2_start_implicit_grab(struct wlr_tablet_v2_tablet_tool *to return; } - grab->interface = &implicit_tool_interface; + grab->interface = &implicit_tool_grab_interface; grab->tool = tool; struct implicit_grab_state *state = calloc(1, sizeof(struct implicit_grab_state)); if (!state) {