]> git.mdlowis.com Git - proto/labwc.git/commitdiff
input: move notify-idle-manager to tablet/touch handlers
authorJens Peters <jp7677@gmail.com>
Tue, 29 Oct 2024 19:39:17 +0000 (20:39 +0100)
committerHiroaki Yamamoto <hrak1529@gmail.com>
Sun, 10 Nov 2024 08:08:38 +0000 (17:08 +0900)
Move them away from the cursor emulate functions. This
avoid calling them twice for touch motion.

Also notify idle manager on touch down/up.

src/input/cursor.c
src/input/tablet.c
src/input/touch.c

index 513aff3a8ce476a780eed9fb207e43723c137e04..0d2ebca20dc455de113383ef4b7a69a048f87926 100644 (file)
@@ -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:
index 02783888fc77748954d1e4b8c91b848ec51802c6..ac94228b859ffc5468d3311ad0ecc7be6c62f439 100644 (file)
@@ -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;
index 07666799fbb47fd7a3eb212fc5a89a5576391503..d36d98858809f8cc22a27cbd7d18bb4110a18ac7 100644 (file)
@@ -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) {