|
|
@ -12,6 +12,8 @@
|
|
|
|
#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_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",
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -206,6 +208,9 @@ 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.interface = &default_tool_grab_interface;
|
|
|
|
|
|
|
|
tool->grab = &tool->default_grab;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tool->tool_destroy.notify = handle_wlr_tablet_tool_destroy;
|
|
|
|
tool->tool_destroy.notify = handle_wlr_tablet_tool_destroy;
|
|
|
@ -384,11 +389,11 @@ void wlr_send_tablet_v2_tablet_tool_proximity_out(
|
|
|
|
if (tool->is_down) {
|
|
|
|
if (tool->is_down) {
|
|
|
|
zwp_tablet_tool_v2_send_up(tool->current_client->resource);
|
|
|
|
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) {
|
|
|
|
if (tool->current_client->frame_source) {
|
|
|
|
wl_event_source_remove(tool->current_client->frame_source);
|
|
|
|
wl_event_source_remove(tool->current_client->frame_source);
|
|
|
|
send_tool_frame(tool->current_client);
|
|
|
|
send_tool_frame(tool->current_client);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
zwp_tablet_tool_v2_send_proximity_out(tool->current_client->resource);
|
|
|
|
|
|
|
|
|
|
|
|
tool->current_client = NULL;
|
|
|
|
tool->current_client = NULL;
|
|
|
|
tool->focused_surface = NULL;
|
|
|
|
tool->focused_surface = NULL;
|
|
|
@ -512,3 +517,318 @@ void wlr_send_tablet_v2_tablet_tool_up(struct wlr_tablet_v2_tablet_tool *tool) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_tablet_v2_tablet_tool_notify_proximity_in(
|
|
|
|
|
|
|
|
struct wlr_tablet_v2_tablet_tool *tool,
|
|
|
|
|
|
|
|
struct wlr_tablet_v2_tablet *tablet,
|
|
|
|
|
|
|
|
struct wlr_surface *surface) {
|
|
|
|
|
|
|
|
if (tool->grab->interface->proximity_in) {
|
|
|
|
|
|
|
|
tool->grab->interface->proximity_in(tool->grab, tablet, surface);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_tablet_v2_tablet_tool_notify_down(struct wlr_tablet_v2_tablet_tool *tool) {
|
|
|
|
|
|
|
|
if (tool->grab->interface->down) {
|
|
|
|
|
|
|
|
tool->grab->interface->down(tool->grab);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void wlr_tablet_v2_tablet_tool_notify_up(struct wlr_tablet_v2_tablet_tool *tool) {
|
|
|
|
|
|
|
|
if (tool->grab->interface->up) {
|
|
|
|
|
|
|
|
tool->grab->interface->up(tool->grab);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_tablet_v2_tablet_tool_notify_motion(
|
|
|
|
|
|
|
|
struct wlr_tablet_v2_tablet_tool *tool, double x, double y) {
|
|
|
|
|
|
|
|
if (tool->grab->interface->motion) {
|
|
|
|
|
|
|
|
tool->grab->interface->motion(tool->grab, x, y);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_tablet_v2_tablet_tool_notify_pressure(
|
|
|
|
|
|
|
|
struct wlr_tablet_v2_tablet_tool *tool, double pressure) {
|
|
|
|
|
|
|
|
if (tool->grab->interface->pressure) {
|
|
|
|
|
|
|
|
tool->grab->interface->pressure(tool->grab, pressure);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_tablet_v2_tablet_tool_notify_distance(
|
|
|
|
|
|
|
|
struct wlr_tablet_v2_tablet_tool *tool, double distance) {
|
|
|
|
|
|
|
|
if (tool->grab->interface->distance) {
|
|
|
|
|
|
|
|
tool->grab->interface->distance(tool->grab, distance);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_tablet_v2_tablet_tool_notify_tilt(
|
|
|
|
|
|
|
|
struct wlr_tablet_v2_tablet_tool *tool, double x, double y) {
|
|
|
|
|
|
|
|
if (tool->grab->interface->tilt) {
|
|
|
|
|
|
|
|
tool->grab->interface->tilt(tool->grab, x, y);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_tablet_v2_tablet_tool_notify_rotation(
|
|
|
|
|
|
|
|
struct wlr_tablet_v2_tablet_tool *tool, double degrees) {
|
|
|
|
|
|
|
|
if (tool->grab->interface->rotation) {
|
|
|
|
|
|
|
|
tool->grab->interface->rotation(tool->grab, degrees);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_tablet_v2_tablet_tool_notify_slider(
|
|
|
|
|
|
|
|
struct wlr_tablet_v2_tablet_tool *tool, double position) {
|
|
|
|
|
|
|
|
if (tool->grab->interface->slider) {
|
|
|
|
|
|
|
|
tool->grab->interface->slider(tool->grab, position);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_tablet_v2_tablet_tool_notify_wheel(
|
|
|
|
|
|
|
|
struct wlr_tablet_v2_tablet_tool *tool, double degrees, int32_t clicks) {
|
|
|
|
|
|
|
|
if (tool->grab->interface->wheel) {
|
|
|
|
|
|
|
|
tool->grab->interface->wheel(tool->grab, degrees, clicks);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_tablet_v2_tablet_tool_notify_proximity_out(
|
|
|
|
|
|
|
|
struct wlr_tablet_v2_tablet_tool *tool) {
|
|
|
|
|
|
|
|
if (tool->grab->interface->proximity_out) {
|
|
|
|
|
|
|
|
tool->grab->interface->proximity_out(tool->grab);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_tablet_v2_tablet_tool_notify_button(
|
|
|
|
|
|
|
|
struct wlr_tablet_v2_tablet_tool *tool, uint32_t button,
|
|
|
|
|
|
|
|
enum zwp_tablet_pad_v2_button_state state) {
|
|
|
|
|
|
|
|
if (tool->grab->interface->button) {
|
|
|
|
|
|
|
|
tool->grab->interface->button(tool->grab, button, state);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_tablet_tool_v2_end_grab(struct wlr_tablet_v2_tablet_tool *tool) {
|
|
|
|
|
|
|
|
if (tool->grab->interface->cancel) {
|
|
|
|
|
|
|
|
tool->grab->interface->cancel(tool->grab);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
tool->grab = &tool->default_grab;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void default_tool_proximity_in(
|
|
|
|
|
|
|
|
struct wlr_tablet_tool_v2_grab *grab,
|
|
|
|
|
|
|
|
struct wlr_tablet_v2_tablet *tablet,
|
|
|
|
|
|
|
|
struct wlr_surface *surface) {
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_proximity_in(grab->tool, tablet, surface);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void default_tool_down(struct wlr_tablet_tool_v2_grab *grab) {
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_down(grab->tool);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void default_tool_up(struct wlr_tablet_tool_v2_grab *grab) {
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_up(grab->tool);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void default_tool_motion(
|
|
|
|
|
|
|
|
struct wlr_tablet_tool_v2_grab *grab, double x, double y) {
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_motion(grab->tool, x, y);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void default_tool_pressure(
|
|
|
|
|
|
|
|
struct wlr_tablet_tool_v2_grab *grab, double pressure) {
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_pressure(grab->tool, pressure);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void default_tool_distance(
|
|
|
|
|
|
|
|
struct wlr_tablet_tool_v2_grab *grab, double distance) {
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_distance(grab->tool, distance);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void default_tool_tilt(
|
|
|
|
|
|
|
|
struct wlr_tablet_tool_v2_grab *grab, double x, double y) {
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_tilt(grab->tool, x, y);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void default_tool_rotation(
|
|
|
|
|
|
|
|
struct wlr_tablet_tool_v2_grab *grab, double degrees) {
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_rotation(grab->tool, degrees);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void default_tool_slider(
|
|
|
|
|
|
|
|
struct wlr_tablet_tool_v2_grab *grab, double position) {
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_slider(grab->tool, position);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void default_tool_wheel(
|
|
|
|
|
|
|
|
struct wlr_tablet_tool_v2_grab *grab, double degrees, int32_t clicks) {
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_wheel(grab->tool, degrees, clicks);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void default_tool_proximity_out(struct wlr_tablet_tool_v2_grab *grab) {
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_proximity_out(grab->tool);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void default_tool_button(
|
|
|
|
|
|
|
|
struct wlr_tablet_tool_v2_grab *grab, uint32_t button,
|
|
|
|
|
|
|
|
enum zwp_tablet_pad_v2_button_state state) {
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_button(grab->tool, button, state);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_grab_interface = {
|
|
|
|
|
|
|
|
.proximity_in = default_tool_proximity_in,
|
|
|
|
|
|
|
|
.down = default_tool_down,
|
|
|
|
|
|
|
|
.up = default_tool_up,
|
|
|
|
|
|
|
|
.motion = default_tool_motion,
|
|
|
|
|
|
|
|
.pressure = default_tool_pressure,
|
|
|
|
|
|
|
|
.distance = default_tool_distance,
|
|
|
|
|
|
|
|
.tilt = default_tool_tilt,
|
|
|
|
|
|
|
|
.rotation = default_tool_rotation,
|
|
|
|
|
|
|
|
.slider = default_tool_slider,
|
|
|
|
|
|
|
|
.wheel = default_tool_wheel,
|
|
|
|
|
|
|
|
.proximity_out = default_tool_proximity_out,
|
|
|
|
|
|
|
|
.button = default_tool_button,
|
|
|
|
|
|
|
|
.cancel = default_tool_cancel,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct implicit_grab_state {
|
|
|
|
|
|
|
|
struct wlr_surface *original;
|
|
|
|
|
|
|
|
bool released;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_surface *focused;
|
|
|
|
|
|
|
|
struct wlr_tablet_v2_tablet *tablet;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void check_and_release_implicit_grab(struct wlr_tablet_tool_v2_grab *grab) {
|
|
|
|
|
|
|
|
struct implicit_grab_state *state = grab->data;
|
|
|
|
|
|
|
|
/* Still button or tip pressed. We should hold the grab */
|
|
|
|
|
|
|
|
if (grab->tool->is_down || grab->tool->num_buttons > 0 || state->released) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
state->released = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* We should still focus the same surface. Do nothing */
|
|
|
|
|
|
|
|
if (state->original == state->focused) {
|
|
|
|
|
|
|
|
wlr_tablet_tool_v2_end_grab(grab->tool);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_proximity_out(grab->tool);
|
|
|
|
|
|
|
|
if (state->focused) {
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_proximity_in(grab->tool,
|
|
|
|
|
|
|
|
state->tablet, state->focused);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wlr_tablet_tool_v2_end_grab(grab->tool);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void implicit_tool_proximity_in(
|
|
|
|
|
|
|
|
struct wlr_tablet_tool_v2_grab *grab,
|
|
|
|
|
|
|
|
struct wlr_tablet_v2_tablet *tablet,
|
|
|
|
|
|
|
|
struct wlr_surface *surface) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* As long as we got an implicit grab, proximity won't change
|
|
|
|
|
|
|
|
* But should track the currently focused surface to change to it when
|
|
|
|
|
|
|
|
* the grab is released.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct implicit_grab_state *state = grab->data;
|
|
|
|
|
|
|
|
state->focused = surface;
|
|
|
|
|
|
|
|
state->tablet = tablet;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void implicit_tool_proximity_out(struct wlr_tablet_tool_v2_grab *grab) {
|
|
|
|
|
|
|
|
struct implicit_grab_state *state = grab->data;
|
|
|
|
|
|
|
|
state->focused = NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void implicit_tool_down(struct wlr_tablet_tool_v2_grab *grab) {
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_down(grab->tool);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void implicit_tool_up(struct wlr_tablet_tool_v2_grab *grab) {
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_up(grab->tool);
|
|
|
|
|
|
|
|
check_and_release_implicit_grab(grab);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Only send the motion event, when we are over the surface for now */
|
|
|
|
|
|
|
|
static void implicit_tool_motion(
|
|
|
|
|
|
|
|
struct wlr_tablet_tool_v2_grab *grab, double x, double y) {
|
|
|
|
|
|
|
|
struct implicit_grab_state *state = grab->data;
|
|
|
|
|
|
|
|
if (state->focused != state->original) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_motion(grab->tool, x, y);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void implicit_tool_button(
|
|
|
|
|
|
|
|
struct wlr_tablet_tool_v2_grab *grab, uint32_t button,
|
|
|
|
|
|
|
|
enum zwp_tablet_pad_v2_button_state state) {
|
|
|
|
|
|
|
|
wlr_send_tablet_v2_tablet_tool_button(grab->tool, button, state);
|
|
|
|
|
|
|
|
check_and_release_implicit_grab(grab);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void implicit_tool_cancel(struct wlr_tablet_tool_v2_grab *grab) {
|
|
|
|
|
|
|
|
check_and_release_implicit_grab(grab);
|
|
|
|
|
|
|
|
free(grab->data);
|
|
|
|
|
|
|
|
free(grab);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
|
|
|
.motion = implicit_tool_motion,
|
|
|
|
|
|
|
|
.pressure = default_tool_pressure,
|
|
|
|
|
|
|
|
.distance = default_tool_distance,
|
|
|
|
|
|
|
|
.tilt = default_tool_tilt,
|
|
|
|
|
|
|
|
.rotation = default_tool_rotation,
|
|
|
|
|
|
|
|
.slider = default_tool_slider,
|
|
|
|
|
|
|
|
.wheel = default_tool_wheel,
|
|
|
|
|
|
|
|
.proximity_out = implicit_tool_proximity_out,
|
|
|
|
|
|
|
|
.button = implicit_tool_button,
|
|
|
|
|
|
|
|
.cancel = implicit_tool_cancel,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool tool_has_implicit_grab(struct wlr_tablet_v2_tablet_tool *tool) {
|
|
|
|
|
|
|
|
return tool->grab->interface == &implicit_tool_grab_interface;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* No current implicit grab */
|
|
|
|
|
|
|
|
if (!(tool->is_down || tool->num_buttons > 0)) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_tablet_tool_v2_grab *grab =
|
|
|
|
|
|
|
|
calloc(1, sizeof(struct wlr_tablet_tool_v2_grab));
|
|
|
|
|
|
|
|
if (!grab) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
grab->interface = &implicit_tool_grab_interface;
|
|
|
|
|
|
|
|
grab->tool = tool;
|
|
|
|
|
|
|
|
struct implicit_grab_state *state = calloc(1, sizeof(struct implicit_grab_state));
|
|
|
|
|
|
|
|
if (!state) {
|
|
|
|
|
|
|
|
free(grab);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
state->original = tool->focused_surface;
|
|
|
|
|
|
|
|
grab->data = state;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wlr_tablet_tool_v2_start_grab(tool, grab);
|
|
|
|
|
|
|
|
}
|
|
|
|