aboutsummaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-10-08 13:00:03 -0500
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-10-08 13:02:43 -0500
commit952fde68a3cb1871f39c464d56f999d5a966e7a4 (patch)
tree4ddfb9d721bca7eca02db70c56d0d13e6a9fbc9d /dwl.c
parent0d1ca4663ca62329e1e171053ceb35bbc71ec30a (diff)
correctly handle cursor motion when button is held (for layer surfaces)
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/dwl.c b/dwl.c
index 3fdef90..76430aa 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1504,6 +1504,7 @@ motionnotify(uint32_t time)
{
double sx = 0, sy = 0;
Client *c = NULL;
+ LayerSurface *l;
struct wlr_surface *surface = NULL;
struct wlr_drag_icon *icon;
@@ -1536,10 +1537,12 @@ motionnotify(uint32_t time)
xytonode(cursor->x, cursor->y, &surface, &c, NULL, &sx, &sy);
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;
- sy = c ? cursor->y - c->geom.y : 0;
+ if ((l = toplevel_from_wlr_layer_surface(
+ seat->pointer_state.focused_surface))) {
+ surface = seat->pointer_state.focused_surface;
+ sx = cursor->x - l->geom.x;
+ sy = cursor->y - l->geom.y;
+ }
}
/* If there's no client surface under the cursor, set the cursor image to a