mirror of
https://github.com/labwc/labwc.git
synced 2025-10-31 22:25:34 -04:00
input: prevent cursor notifications from pointer and tablet tool
... at the same time. Omit cursor notifications from a pointer when a tablet tool (stylus/pen) is in proximity. We expect to get cursor notifications from the tablet tool instead.
This commit is contained in:
parent
d00711bc45
commit
2388f37cc7
5 changed files with 24 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ struct drawing_tablet_tool {
|
||||||
struct wl_listener set_cursor;
|
struct wl_listener set_cursor;
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
} handlers;
|
} handlers;
|
||||||
|
struct wl_list link; /* seat.tablet_tools */
|
||||||
};
|
};
|
||||||
|
|
||||||
void tablet_tool_init(struct seat *seat,
|
void tablet_tool_init(struct seat *seat,
|
||||||
|
|
|
||||||
|
|
@ -193,6 +193,8 @@ struct seat {
|
||||||
struct wl_listener touch_motion;
|
struct wl_listener touch_motion;
|
||||||
struct wl_listener touch_frame;
|
struct wl_listener touch_frame;
|
||||||
|
|
||||||
|
struct wl_list tablet_tools;
|
||||||
|
|
||||||
struct wl_listener constraint_commit;
|
struct wl_listener constraint_commit;
|
||||||
struct wl_listener pressed_surface_destroy;
|
struct wl_listener pressed_surface_destroy;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
#include "idle.h"
|
#include "idle.h"
|
||||||
#include "input/gestures.h"
|
#include "input/gestures.h"
|
||||||
#include "input/touch.h"
|
#include "input/touch.h"
|
||||||
|
#include "input/tablet-tool.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "layers.h"
|
#include "layers.h"
|
||||||
#include "menu/menu.h"
|
#include "menu/menu.h"
|
||||||
|
|
@ -140,6 +141,22 @@ request_cursor_notify(struct wl_listener *listener, void *data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Omit cursor notifications from a pointer when a tablet
|
||||||
|
* tool (stylus/pen) is in proximity. We expect to get cursor
|
||||||
|
* notifications from the tablet tool instead.
|
||||||
|
* Receiving cursor notifications from pointer and tablet tool at
|
||||||
|
* the same time is a side effect of also setting pointer focus
|
||||||
|
* when a tablet tool enters proximity on a tablet-capable surface.
|
||||||
|
* See also `notify_motion()` in `input/tablet.c`.
|
||||||
|
*/
|
||||||
|
struct drawing_tablet_tool *tool;
|
||||||
|
wl_list_for_each(tool, &seat->tablet_tools, link) {
|
||||||
|
if (tool->tool_v2->focused_surface) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This event is raised by the seat when a client provides a cursor
|
* This event is raised by the seat when a client provides a cursor
|
||||||
* image
|
* image
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ handle_destroy(struct wl_listener *listener, void *data)
|
||||||
struct drawing_tablet_tool *tool =
|
struct drawing_tablet_tool *tool =
|
||||||
wl_container_of(listener, tool, handlers.destroy);
|
wl_container_of(listener, tool, handlers.destroy);
|
||||||
|
|
||||||
|
wl_list_remove(&tool->link);
|
||||||
wl_list_remove(&tool->handlers.set_cursor.link);
|
wl_list_remove(&tool->handlers.set_cursor.link);
|
||||||
wl_list_remove(&tool->handlers.destroy.link);
|
wl_list_remove(&tool->handlers.destroy.link);
|
||||||
free(tool);
|
free(tool);
|
||||||
|
|
@ -65,4 +66,5 @@ tablet_tool_init(struct seat *seat,
|
||||||
wlr_tablet_tool->wheel ? " wheel" : "");
|
wlr_tablet_tool->wheel ? " wheel" : "");
|
||||||
CONNECT_SIGNAL(tool->tool_v2, &tool->handlers, set_cursor);
|
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);
|
||||||
|
wl_list_insert(&seat->tablet_tools, &tool->link);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -553,6 +553,8 @@ seat_init(struct server *server)
|
||||||
}
|
}
|
||||||
wlr_cursor_attach_output_layout(seat->cursor, server->output_layout);
|
wlr_cursor_attach_output_layout(seat->cursor, server->output_layout);
|
||||||
|
|
||||||
|
wl_list_init(&seat->tablet_tools);
|
||||||
|
|
||||||
input_handlers_init(seat);
|
input_handlers_init(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue