Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Commit

Permalink
Revert "avoid setting duplicate cursor image"
Browse files Browse the repository at this point in the history
This reverts commit b5776e5.
  • Loading branch information
sevz17 committed May 7, 2023
1 parent 797e0c7 commit 204bb11
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions dwl.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ static void zoom(const Arg *arg);

/* variables */
static const char broken[] = "broken";
static const char *cursor_image = "left_ptr";
static pid_t child_pid = -1;
static int locked;
static void *exclusive_focus;
Expand Down Expand Up @@ -600,13 +599,10 @@ buttonpress(struct wl_listener *listener, void *data)
break;
case WLR_BUTTON_RELEASED:
/* If you released any buttons, we exit interactive move/resize mode. */
/* TODO should reset to the pointer focus's current setcursor */
if (!locked && cursor_mode != CurNormal && cursor_mode != CurPressed) {
wlr_xcursor_manager_set_cursor_image(cursor_mgr, "left_ptr", cursor);
cursor_mode = CurNormal;
/* Clear the pointer focus, this way if the cursor is over a surface
* we will send an enter event after which the client will provide us
* a cursor surface */
wlr_seat_pointer_clear_focus(seat);
motionnotify(0);
/* Drop the window off on its new monitor */
selmon = xytomon(cursor->x, cursor->y);
setmon(grabc, selmon, 0);
Expand Down Expand Up @@ -1672,8 +1668,8 @@ 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 && !seat->drag && (!cursor_image || strcmp(cursor_image, "left_ptr")))
wlr_xcursor_manager_set_cursor_image(cursor_mgr, (cursor_image = "left_ptr"), cursor);
if (!surface && !seat->drag)
wlr_xcursor_manager_set_cursor_image(cursor_mgr, "left_ptr", cursor);

pointerfocus(c, surface, sx, sy, time);
}
Expand Down Expand Up @@ -1708,7 +1704,7 @@ moveresize(const Arg *arg)
case CurMove:
grabcx = cursor->x - grabc->geom.x;
grabcy = cursor->y - grabc->geom.y;
wlr_xcursor_manager_set_cursor_image(cursor_mgr, (cursor_image = "fleur"), cursor);
wlr_xcursor_manager_set_cursor_image(cursor_mgr, "fleur", cursor);
break;
case CurResize:
/* Doesn't work for X11 output - the next absolute motion event
Expand All @@ -1717,7 +1713,7 @@ moveresize(const Arg *arg)
grabc->geom.x + grabc->geom.width,
grabc->geom.y + grabc->geom.height);
wlr_xcursor_manager_set_cursor_image(cursor_mgr,
(cursor_image = "bottom_right_corner"), cursor);
"bottom_right_corner", cursor);
break;
}
}
Expand Down Expand Up @@ -1818,6 +1814,7 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy,
* wlroots makes this a no-op if surface is already focused */
wlr_seat_pointer_notify_enter(seat, surface, sx, sy);
wlr_seat_pointer_notify_motion(seat, time, sx, sy);

}

void
Expand Down Expand Up @@ -1978,7 +1975,7 @@ run(char *startup_cmd)
* initialized, as the image/coordinates are not transformed for the
* monitor when displayed here */
wlr_cursor_warp_closest(cursor, NULL, cursor->x, cursor->y);
wlr_xcursor_manager_set_cursor_image(cursor_mgr, cursor_image, cursor);
wlr_xcursor_manager_set_cursor_image(cursor_mgr, "left_ptr", cursor);

/* Run the Wayland event loop. This does not return until you exit the
* compositor. Starting the backend rigged up all of the necessary event
Expand All @@ -1997,7 +1994,6 @@ setcursor(struct wl_listener *listener, void *data)
* event, which will result in the client requesting set the cursor surface */
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
* actually has pointer focus first. If so, we can tell the cursor to
* use the provided surface as the cursor image. It will set the
Expand Down

0 comments on commit 204bb11

Please sign in to comment.