mirror of
https://github.com/tiyn/dwl.git
synced 2025-11-13 13:59:45 +01:00
patched warpcursor
This commit is contained in:
27
dwl.c
27
dwl.c
@@ -347,6 +347,7 @@ static void urgent(struct wl_listener *listener, void *data);
|
|||||||
static void view(const Arg *arg);
|
static void view(const Arg *arg);
|
||||||
static void virtualkeyboard(struct wl_listener *listener, void *data);
|
static void virtualkeyboard(struct wl_listener *listener, void *data);
|
||||||
static void virtualpointer(struct wl_listener *listener, void *data);
|
static void virtualpointer(struct wl_listener *listener, void *data);
|
||||||
|
static void warpcursor(const Client *c);
|
||||||
static Monitor *xytomon(double x, double y);
|
static Monitor *xytomon(double x, double y);
|
||||||
static void xytonode(double x, double y, struct wlr_surface **psurface,
|
static void xytonode(double x, double y, struct wlr_surface **psurface,
|
||||||
Client **pc, LayerSurface **pl, double *nx, double *ny);
|
Client **pc, LayerSurface **pl, double *nx, double *ny);
|
||||||
@@ -540,6 +541,7 @@ arrange(Monitor *m)
|
|||||||
m->lt[m->sellt]->arrange(m);
|
m->lt[m->sellt]->arrange(m);
|
||||||
motionnotify(0, NULL, 0, 0, 0, 0);
|
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||||
checkidleinhibitor(NULL);
|
checkidleinhibitor(NULL);
|
||||||
|
warpcursor(focustop(selmon));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1407,6 +1409,10 @@ focusclient(Client *c, int lift)
|
|||||||
if (locked)
|
if (locked)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* Warp cursor to center of client if it is outside */
|
||||||
|
if (lift)
|
||||||
|
warpcursor(c);
|
||||||
|
|
||||||
/* Raise client in stacking order if requested */
|
/* Raise client in stacking order if requested */
|
||||||
if (c && lift)
|
if (c && lift)
|
||||||
wlr_scene_node_raise_to_top(&c->scene->node);
|
wlr_scene_node_raise_to_top(&c->scene->node);
|
||||||
@@ -2999,6 +3005,27 @@ virtualpointer(struct wl_listener *listener, void *data)
|
|||||||
wlr_cursor_map_input_to_output(cursor, device, event->suggested_output);
|
wlr_cursor_map_input_to_output(cursor, device, event->suggested_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
warpcursor(const Client *c) {
|
||||||
|
if (cursor_mode != CurNormal) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!c && selmon) {
|
||||||
|
wlr_cursor_warp_closest(cursor,
|
||||||
|
NULL,
|
||||||
|
selmon->w.x + selmon->w.width / 2.0 ,
|
||||||
|
selmon->w.y + selmon->w.height / 2.0);
|
||||||
|
}
|
||||||
|
else if ( c && (cursor->x < c->geom.x ||
|
||||||
|
cursor->x > c->geom.x + c->geom.width ||
|
||||||
|
cursor->y < c->geom.y ||
|
||||||
|
cursor->y > c->geom.y + c->geom.height))
|
||||||
|
wlr_cursor_warp_closest(cursor,
|
||||||
|
NULL,
|
||||||
|
c->geom.x + c->geom.width / 2.0,
|
||||||
|
c->geom.y + c->geom.height / 2.0);
|
||||||
|
}
|
||||||
|
|
||||||
Monitor *
|
Monitor *
|
||||||
xytomon(double x, double y)
|
xytomon(double x, double y)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user