mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
input: handle tablet tool cursor requests
Similar to cursor requests for pointers.
This commit is contained in:
parent
abfa100b38
commit
63744951af
1 changed files with 24 additions and 0 deletions
|
|
@ -11,6 +11,29 @@
|
||||||
#include "input/tablet-tool.h"
|
#include "input/tablet-tool.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
|
||||||
|
static void
|
||||||
|
handle_set_cursor(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
struct drawing_tablet_tool *tool =
|
||||||
|
wl_container_of(listener, tool, handlers.set_cursor);
|
||||||
|
struct wlr_tablet_v2_event_cursor *ev = data;
|
||||||
|
|
||||||
|
struct seat *seat = tool->seat;
|
||||||
|
struct wlr_seat_client *focused_client =
|
||||||
|
seat->seat->pointer_state.focused_client;
|
||||||
|
|
||||||
|
if (seat->server->input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ev->seat_client != focused_client) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wlr_cursor_set_surface(seat->cursor, ev->surface,
|
||||||
|
ev->hotspot_x, ev->hotspot_y);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_destroy(struct wl_listener *listener, void *data)
|
handle_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
|
@ -40,5 +63,6 @@ tablet_tool_init(struct seat *seat,
|
||||||
wlr_tablet_tool->rotation ? " rotation" : "",
|
wlr_tablet_tool->rotation ? " rotation" : "",
|
||||||
wlr_tablet_tool->slider ? " slider" : "",
|
wlr_tablet_tool->slider ? " slider" : "",
|
||||||
wlr_tablet_tool->wheel ? " wheel" : "");
|
wlr_tablet_tool->wheel ? " wheel" : "");
|
||||||
|
CONNECT_SIGNAL(tool->tool_v2, &tool->handlers, set_cursor);
|
||||||
CONNECT_SIGNAL(wlr_tablet_tool, &tool->handlers, destroy);
|
CONNECT_SIGNAL(wlr_tablet_tool, &tool->handlers, destroy);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue