]> git.mdlowis.com Git - proto/labwc.git/commitdiff
cursor: Call wlr_seat_pointer_notify_clear_focus() only if needed
authorJohn Lindgren <john@jlindgren.net>
Tue, 11 Oct 2022 15:46:30 +0000 (11:46 -0400)
committerJohan Malm <johanmalm@users.noreply.github.com>
Fri, 14 Oct 2022 20:56:34 +0000 (21:56 +0100)
@Consolatis determined that apparently the extra "clear focus"
event confuses the drag source during drag-and-drop.

Fixes drag-and-drop of files into folders within the same Thunar
window.

src/cursor.c

index 077c285334358011673dbf7bf944e52382927f80..62d89c8dc7d783837662f98efe08d6c93a6f455c 100644 (file)
@@ -369,8 +369,10 @@ cursor_update_common(struct server *server, struct cursor_context *ctx,
                 * cursor image will be set by request_cursor_notify()
                 * in response to the enter event.
                 */
-               if (ctx->surface != wlr_seat->pointer_state.focused_surface
-                               || seat->server_cursor != LAB_CURSOR_CLIENT) {
+               bool has_focus = (ctx->surface ==
+                       wlr_seat->pointer_state.focused_surface);
+
+               if (!has_focus || seat->server_cursor != LAB_CURSOR_CLIENT) {
                        /*
                         * Enter the surface if necessary.  Usually we
                         * prevent re-entering an already focused
@@ -382,7 +384,9 @@ cursor_update_common(struct server *server, struct cursor_context *ctx,
                         * if a server-side cursor was set and we need
                         * to trigger a cursor image update.
                         */
-                       wlr_seat_pointer_notify_clear_focus(wlr_seat);
+                       if (has_focus) {
+                               wlr_seat_pointer_notify_clear_focus(wlr_seat);
+                       }
                        wlr_seat_pointer_notify_enter(wlr_seat, ctx->surface,
                                ctx->sx, ctx->sy);
                        seat->server_cursor = LAB_CURSOR_CLIENT;