mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
input: move notify-idle-manager to tablet/touch handlers
Move them away from the cursor emulate functions. This avoid calling them twice for touch motion. Also notify idle manager on touch down/up.
This commit is contained in:
parent
eed972cef1
commit
7e0cd8ee5a
3 changed files with 13 additions and 10 deletions
|
|
@ -1194,8 +1194,6 @@ void
|
|||
cursor_emulate_move_absolute(struct seat *seat, struct wlr_input_device *device,
|
||||
double x, double y, uint32_t time_msec)
|
||||
{
|
||||
idle_manager_notify_activity(seat->seat);
|
||||
|
||||
double lx, ly;
|
||||
wlr_cursor_absolute_to_layout_coords(seat->cursor,
|
||||
device, x, y, &lx, &ly);
|
||||
|
|
@ -1210,8 +1208,6 @@ void
|
|||
cursor_emulate_button(struct seat *seat, uint32_t button,
|
||||
enum wl_pointer_button_state state, uint32_t time_msec)
|
||||
{
|
||||
idle_manager_notify_activity(seat->seat);
|
||||
|
||||
bool notify;
|
||||
switch (state) {
|
||||
case WL_POINTER_BUTTON_STATE_PRESSED:
|
||||
|
|
|
|||
|
|
@ -180,8 +180,6 @@ notify_motion(struct drawing_tablet *tablet, struct drawing_tablet_tool *tool,
|
|||
struct wlr_surface *surface, double x, double y, double dx, double dy,
|
||||
uint32_t time)
|
||||
{
|
||||
idle_manager_notify_activity(tool->seat->seat);
|
||||
|
||||
bool enter_surface = false;
|
||||
/* Postpone proximity-in on a new surface when the tip is down */
|
||||
if (surface != tool->tool_v2->focused_surface && !tool->tool_v2->is_down) {
|
||||
|
|
@ -252,6 +250,8 @@ handle_tablet_tool_proximity(struct wl_listener *listener, void *data)
|
|||
return;
|
||||
}
|
||||
|
||||
idle_manager_notify_activity(tablet->seat->seat);
|
||||
|
||||
if (ev->state == WLR_TABLET_TOOL_PROXIMITY_IN) {
|
||||
tablet->motion_mode =
|
||||
tool_motion_mode(rc.tablet_tool.motion, ev->tool);
|
||||
|
|
@ -312,6 +312,8 @@ handle_tablet_tool_axis(struct wl_listener *listener, void *data)
|
|||
return;
|
||||
}
|
||||
|
||||
idle_manager_notify_activity(tablet->seat->seat);
|
||||
|
||||
/*
|
||||
* Reset relative coordinates. If those axes aren't updated,
|
||||
* the delta is zero.
|
||||
|
|
@ -490,6 +492,8 @@ handle_tablet_tool_tip(struct wl_listener *listener, void *data)
|
|||
return;
|
||||
}
|
||||
|
||||
idle_manager_notify_activity(tablet->seat->seat);
|
||||
|
||||
double x, y, dx, dy;
|
||||
struct wlr_surface *surface = tablet_get_coords(tablet, &x, &y, &dx, &dy);
|
||||
|
||||
|
|
@ -506,8 +510,6 @@ handle_tablet_tool_tip(struct wl_listener *listener, void *data)
|
|||
*/
|
||||
if (tool && !is_down_mouse_emulation && (surface
|
||||
|| wlr_tablet_tool_v2_has_implicit_grab(tool->tool_v2))) {
|
||||
idle_manager_notify_activity(tool->seat->seat);
|
||||
|
||||
uint32_t stylus_button = to_stylus_button(button);
|
||||
if (stylus_button != BTN_TOOL_PEN) {
|
||||
wlr_log(WLR_INFO, "ignoring stylus tool pen mapping for tablet mode");
|
||||
|
|
@ -569,6 +571,8 @@ handle_tablet_tool_button(struct wl_listener *listener, void *data)
|
|||
return;
|
||||
}
|
||||
|
||||
idle_manager_notify_activity(tablet->seat->seat);
|
||||
|
||||
double x, y, dx, dy;
|
||||
struct wlr_surface *surface = tablet_get_coords(tablet, &x, &y, &dx, &dy);
|
||||
|
||||
|
|
@ -583,8 +587,6 @@ handle_tablet_tool_button(struct wl_listener *listener, void *data)
|
|||
* - the surface below the tip understands the tablet protocol.
|
||||
*/
|
||||
if (tool && !is_down_mouse_emulation && surface) {
|
||||
idle_manager_notify_activity(tool->seat->seat);
|
||||
|
||||
if (button && ev->state == WLR_BUTTON_PRESSED) {
|
||||
struct view *view = view_from_wlr_surface(surface);
|
||||
struct mousebind *mousebind;
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ handle_touch_motion(struct wl_listener *listener, void *data)
|
|||
{
|
||||
struct seat *seat = wl_container_of(listener, seat, touch_motion);
|
||||
struct wlr_touch_motion_event *event = data;
|
||||
|
||||
idle_manager_notify_activity(seat->seat);
|
||||
|
||||
int touch_point_count = wl_list_length(&seat->touch_points);
|
||||
|
|
@ -110,6 +111,8 @@ handle_touch_down(struct wl_listener *listener, void *data)
|
|||
struct seat *seat = wl_container_of(listener, seat, touch_down);
|
||||
struct wlr_touch_down_event *event = data;
|
||||
|
||||
idle_manager_notify_activity(seat->seat);
|
||||
|
||||
/* Compute layout => surface offset and save for this touch point */
|
||||
struct touch_point *touch_point = znew(*touch_point);
|
||||
double x_offset = 0.0, y_offset = 0.0;
|
||||
|
|
@ -167,6 +170,8 @@ handle_touch_up(struct wl_listener *listener, void *data)
|
|||
struct seat *seat = wl_container_of(listener, seat, touch_up);
|
||||
struct wlr_touch_up_event *event = data;
|
||||
|
||||
idle_manager_notify_activity(seat->seat);
|
||||
|
||||
/* Remove the touch point from the seat */
|
||||
struct touch_point *touch_point, *tmp;
|
||||
wl_list_for_each_safe(touch_point, tmp, &seat->touch_points, link) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue