Implement feedback

This commit is contained in:
Markus Ongyerth 2018-09-08 19:16:56 +02:00
parent 3ad7b146eb
commit 21e1cc9ab4
2 changed files with 18 additions and 17 deletions

View File

@ -11,7 +11,7 @@
#include <wlr/types/wlr_tablet_v2.h>
#include <wlr/util/log.h>
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,

View File

@ -12,7 +12,7 @@
#include <wlr/types/wlr_tablet_v2.h>
#include <wlr/util/log.h>
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) {