mirror of
https://codeberg.org/dwl/dwl.git
synced 2024-12-27 03:36:31 +00:00
change cursor during move and resize
This commit is contained in:
parent
2f21445761
commit
fb6b16aeee
1 changed files with 15 additions and 2 deletions
17
dwl.c
17
dwl.c
|
@ -235,10 +235,16 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||||
* event. */
|
* event. */
|
||||||
struct wlr_event_pointer_button *event = data;
|
struct wlr_event_pointer_button *event = data;
|
||||||
/* Notify the client with pointer focus that a button press has occurred */
|
/* Notify the client with pointer focus that a button press has occurred */
|
||||||
|
/* XXX probably don't want to pass the event if it's handled by the
|
||||||
|
* compositor at the bottom of this function */
|
||||||
wlr_seat_pointer_notify_button(seat,
|
wlr_seat_pointer_notify_button(seat,
|
||||||
event->time_msec, event->button, event->state);
|
event->time_msec, event->button, event->state);
|
||||||
if (event->state == WLR_BUTTON_RELEASED) {
|
if (event->state == WLR_BUTTON_RELEASED) {
|
||||||
/* If you released any buttons, we exit interactive move/resize mode. */
|
/* If you released any buttons, we exit interactive move/resize mode. */
|
||||||
|
/* XXX should reset to the pointer focus's current setcursor */
|
||||||
|
if (cursor_mode != CurNormal)
|
||||||
|
wlr_xcursor_manager_set_cursor_image(cursor_mgr,
|
||||||
|
"left_ptr", cursor);
|
||||||
cursor_mode = CurNormal;
|
cursor_mode = CurNormal;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -659,8 +665,8 @@ motionnotify(uint32_t time)
|
||||||
* default. This is what makes the cursor image appear when you move it
|
* default. This is what makes the cursor image appear when you move it
|
||||||
* around the screen, not over any clients. */
|
* around the screen, not over any clients. */
|
||||||
if (!c)
|
if (!c)
|
||||||
wlr_xcursor_manager_set_cursor_image(
|
wlr_xcursor_manager_set_cursor_image(cursor_mgr,
|
||||||
cursor_mgr, "left_ptr", cursor);
|
"left_ptr", cursor);
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
/* Clear pointer focus so future button events and such are not sent to
|
/* Clear pointer focus so future button events and such are not sent to
|
||||||
* the last client to have the cursor over it. */
|
* the last client to have the cursor over it. */
|
||||||
|
@ -718,6 +724,7 @@ movemouse(const Arg *arg)
|
||||||
if (!grabc->isfloating && selmon->lt[selmon->sellt]->arrange)
|
if (!grabc->isfloating && selmon->lt[selmon->sellt]->arrange)
|
||||||
grabc->isfloating = 1;
|
grabc->isfloating = 1;
|
||||||
cursor_mode = CurMove;
|
cursor_mode = CurMove;
|
||||||
|
wlr_xcursor_manager_set_cursor_image(cursor_mgr, "fleur", cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -904,6 +911,8 @@ resizemouse(const Arg *arg)
|
||||||
if (!grabc->isfloating && selmon->lt[selmon->sellt]->arrange)
|
if (!grabc->isfloating && selmon->lt[selmon->sellt]->arrange)
|
||||||
grabc->isfloating = 1;
|
grabc->isfloating = 1;
|
||||||
cursor_mode = CurResize;
|
cursor_mode = CurResize;
|
||||||
|
wlr_xcursor_manager_set_cursor_image(cursor_mgr,
|
||||||
|
"bottom_right_corner", cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -990,6 +999,10 @@ sendmon(Client *c, Monitor *m)
|
||||||
void
|
void
|
||||||
setcursor(struct wl_listener *listener, void *data)
|
setcursor(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
/* If we're "grabbing" the cursor, don't use the client's image */
|
||||||
|
/* XXX still need to save the provided surface to restore later */
|
||||||
|
if (cursor_mode != CurNormal)
|
||||||
|
return;
|
||||||
/* This event is raised by the seat when a client provides a cursor image */
|
/* This event is raised by the seat when a client provides a cursor image */
|
||||||
struct wlr_seat_pointer_request_set_cursor_event *event = data;
|
struct wlr_seat_pointer_request_set_cursor_event *event = data;
|
||||||
/* This can be sent by any client, so we check to make sure this one is
|
/* This can be sent by any client, so we check to make sure this one is
|
||||||
|
|
Loading…
Reference in a new issue