|
|
@ -12,7 +12,7 @@
|
|
|
|
#include <wlr/types/wlr_tablet_v2.h>
|
|
|
|
#include <wlr/types/wlr_tablet_v2.h>
|
|
|
|
#include <wlr/util/log.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 = {
|
|
|
|
static const struct wlr_surface_role tablet_tool_cursor_surface_role = {
|
|
|
|
.name = "wp_tablet_tool-cursor",
|
|
|
|
.name = "wp_tablet_tool-cursor",
|
|
|
@ -209,7 +209,7 @@ struct wlr_tablet_v2_tablet_tool *wlr_tablet_tool_create(
|
|
|
|
tool->wlr_tool = wlr_tool;
|
|
|
|
tool->wlr_tool = wlr_tool;
|
|
|
|
wl_list_init(&tool->clients);
|
|
|
|
wl_list_init(&tool->clients);
|
|
|
|
tool->default_grab.tool = tool;
|
|
|
|
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;
|
|
|
|
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);
|
|
|
|
wlr_tablet_tool_v2_end_grab(tool);
|
|
|
|
tool->grab = grab;
|
|
|
|
tool->grab = grab;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -678,7 +679,8 @@ static void default_tool_cancel(struct wlr_tablet_tool_v2_grab *grab) {
|
|
|
|
/* Do nothing. Default grab can't be canceled */
|
|
|
|
/* 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,
|
|
|
|
.proximity_in = default_tool_proximity_in,
|
|
|
|
.down = default_tool_down,
|
|
|
|
.down = default_tool_down,
|
|
|
|
.up = default_tool_up,
|
|
|
|
.up = default_tool_up,
|
|
|
@ -779,7 +781,8 @@ static void implicit_tool_cancel(struct wlr_tablet_tool_v2_grab *grab) {
|
|
|
|
free(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,
|
|
|
|
.proximity_in = implicit_tool_proximity_in,
|
|
|
|
.down = implicit_tool_down,
|
|
|
|
.down = implicit_tool_down,
|
|
|
|
.up = implicit_tool_up,
|
|
|
|
.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) {
|
|
|
|
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) {
|
|
|
|
void wlr_tablet_tool_v2_start_implicit_grab(
|
|
|
|
/* Durr */
|
|
|
|
struct wlr_tablet_v2_tablet_tool *tool) {
|
|
|
|
if (tool_has_implicit_grab(tool) || !tool->focused_surface) {
|
|
|
|
if (tool_has_implicit_grab(tool) || !tool->focused_surface) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -816,7 +819,7 @@ void wlr_tablet_tool_v2_start_implicit_grab(struct wlr_tablet_v2_tablet_tool *to
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
grab->interface = &implicit_tool_interface;
|
|
|
|
grab->interface = &implicit_tool_grab_interface;
|
|
|
|
grab->tool = tool;
|
|
|
|
grab->tool = tool;
|
|
|
|
struct implicit_grab_state *state = calloc(1, sizeof(struct implicit_grab_state));
|
|
|
|
struct implicit_grab_state *state = calloc(1, sizeof(struct implicit_grab_state));
|
|
|
|
if (!state) {
|
|
|
|
if (!state) {
|
|
|
|