fix drag and drop not working

this fixes another issue where the cursor doesn't change when selecting text
but there is still an issue about not changing border color of clients during
dnd operations

Bug: https://github.com/djpohly/dwl/issues/318
This commit is contained in:
Leonardo Hernández Hernández 2022-10-07 00:02:29 -05:00
parent 87c4c1f629
commit f6820a6c29
Failed to generate hash of commit

6
dwl.c
View file

@ -1535,7 +1535,7 @@ motionnotify(uint32_t time)
/* Find the client under the pointer and send the event along. */
xytonode(cursor->x, cursor->y, &surface, &c, NULL, &sx, &sy);
if (cursor_mode == CurPressed) {
if (cursor_mode == CurPressed && !seat->drag) {
surface = seat->pointer_state.focused_surface;
c = client_from_wlr_surface(surface);
sx = c ? cursor->x - c->geom.x : 0;
@ -1545,7 +1545,7 @@ motionnotify(uint32_t time)
/* If there's no client surface under the cursor, set the cursor image to a
* default. This is what makes the cursor image appear when you move it
* off of a client or over its border. */
if (!surface && (!cursor_image || strcmp(cursor_image, "left_ptr")))
if (!surface && !seat->drag && (!cursor_image || strcmp(cursor_image, "left_ptr")))
wlr_xcursor_manager_set_cursor_image(cursor_mgr, (cursor_image = "left_ptr"), cursor);
pointerfocus(c, surface, sx, sy, time);
@ -1906,7 +1906,7 @@ setcursor(struct wl_listener *listener, void *data)
/* If we're "grabbing" the cursor, don't use the client's image, we will
* restore it after "grabbing" sending a leave event, followed by a enter
* event, which will result in the client requesting set the cursor surface */
if (cursor_mode != CurNormal)
if (cursor_mode != CurNormal && cursor_mode != CurPressed)
return;
cursor_image = NULL;
/* This can be sent by any client, so we check to make sure this one is