correctly handle cursor motion when button is held (for layer surfaces)
This commit is contained in:
parent
0d1ca4663c
commit
952fde68a3
2 changed files with 22 additions and 4 deletions
15
client.h
15
client.h
|
@ -307,3 +307,18 @@ toplevel_from_popup(struct wlr_xdg_popup *popup)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void *
|
||||||
|
toplevel_from_wlr_layer_surface(struct wlr_surface *s)
|
||||||
|
{
|
||||||
|
Client *c;
|
||||||
|
struct wlr_layer_surface_v1 *wlr_layer_surface;
|
||||||
|
|
||||||
|
if ((c = client_from_wlr_surface(s)))
|
||||||
|
return c;
|
||||||
|
else if (s && wlr_surface_is_layer_surface(s)
|
||||||
|
&& (wlr_layer_surface = wlr_layer_surface_v1_from_wlr_surface(s)))
|
||||||
|
return wlr_layer_surface->data;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
11
dwl.c
11
dwl.c
|
@ -1504,6 +1504,7 @@ motionnotify(uint32_t time)
|
||||||
{
|
{
|
||||||
double sx = 0, sy = 0;
|
double sx = 0, sy = 0;
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
|
LayerSurface *l;
|
||||||
struct wlr_surface *surface = NULL;
|
struct wlr_surface *surface = NULL;
|
||||||
struct wlr_drag_icon *icon;
|
struct wlr_drag_icon *icon;
|
||||||
|
|
||||||
|
@ -1536,10 +1537,12 @@ motionnotify(uint32_t time)
|
||||||
xytonode(cursor->x, cursor->y, &surface, &c, NULL, &sx, &sy);
|
xytonode(cursor->x, cursor->y, &surface, &c, NULL, &sx, &sy);
|
||||||
|
|
||||||
if (cursor_mode == CurPressed && !seat->drag) {
|
if (cursor_mode == CurPressed && !seat->drag) {
|
||||||
surface = seat->pointer_state.focused_surface;
|
if ((l = toplevel_from_wlr_layer_surface(
|
||||||
c = client_from_wlr_surface(surface);
|
seat->pointer_state.focused_surface))) {
|
||||||
sx = c ? cursor->x - c->geom.x : 0;
|
surface = seat->pointer_state.focused_surface;
|
||||||
sy = c ? cursor->y - c->geom.y : 0;
|
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
|
/* If there's no client surface under the cursor, set the cursor image to a
|
||||||
|
|
Loading…
Reference in a new issue