return cursorwarptohint

This commit is contained in:
korei999 2024-01-22 14:41:46 +02:00
parent f5d9598c63
commit 8369f5e137
2 changed files with 16 additions and 12 deletions

View file

@ -51,6 +51,7 @@ static const Rule rules[] = {
{ NULL, "Confirm to replace files", 0, 1, -1},
{ NULL, "File Operation Progress", 0, 1, -1},
{ NULL, "Seer Console", 0, 1, -1},
{ "file-roller", NULL, 0, 1, -1},
};
/* layout(s) */
@ -169,9 +170,9 @@ static const char* PrintSave[] = { "PrintDwl.sh", "Save", NULL };
static const char* PrintSelSave[] = { "PrintDwl.sh", "SelectSave", NULL };
static const char* BMonUp[] = { "light", "-T", "1.4", NULL };
static const char* BMonDown[] = { "light", "-T", "0.72", NULL };
static const char* BufferSave[] = { "buffer-save.sh", NULL };
static const char* BufferToggle[] = { "buffer-toggle.sh", NULL };
static const char* RecToggle[] = { "rec-toggle.sh", NULL };
// static const char* BufferSave[] = { "buffer-save.sh", NULL };
// static const char* BufferToggle[] = { "buffer-toggle.sh", NULL };
// static const char* RecToggle[] = { "rec-toggle.sh", NULL };
static const char* ScreenLock[] = { "Lock.sh", "lock", NULL };
static const char* Swayidle[] = { "Lock.sh", "toggle", NULL };
static const char* Thunar[] = { "Thunar", NULL };
@ -231,9 +232,9 @@ static const Key keys[] = {
{ SUPER, Key_w, killclient, { 0 } },
{ ALT, Key_Escape, spawn, { .v = PowerMenu } },
{ ALT, Key_Caps_Lock, spawn, { .v = PowerMenu } },
{ SUPER, Key_Home, spawn, { .v = BufferToggle } },
{ SUPER, Key_End, spawn, { .v = BufferSave } },
{ SUPER, Key_F12, spawn, { .v = RecToggle } },
// { SUPER, Key_Home, spawn, { .v = BufferToggle } },
// { SUPER, Key_End, spawn, { .v = BufferSave } },
// { SUPER, Key_F12, spawn, { .v = RecToggle } },
{ SUPER | SHIFT, Key_BackSpace, spawn, { .v = ScreenLock } },
{ SUPER, Key_comma, focusmon, { .i = WLR_DIRECTION_LEFT } },
{ SUPER, Key_period, focusmon, { .i = WLR_DIRECTION_RIGHT }},

15
dwl.c
View file

@ -1027,8 +1027,9 @@ createpointerconstraint(struct wl_listener *listener, void *data)
if (active_constraint == pointer_constraint->constraint)
return;
if (active_constraint)
if (active_constraint) {
wlr_pointer_constraint_v1_send_deactivated(active_constraint);
}
active_constraint = pointer_constraint->constraint;
wlr_pointer_constraint_v1_send_activated(pointer_constraint->constraint);
@ -1158,14 +1159,16 @@ void
cursorwarptohint(void)
{
Client *c = NULL;
double sx, sy;
double lx, ly;
double sx = active_constraint->current.cursor_hint.x;
double sy = active_constraint->current.cursor_hint.y;
toplevel_from_wlr_surface(active_constraint->surface, &c, NULL);
/* TODO: wlroots 0.18: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4478 */
if (c && (active_constraint->current.committed & WLR_POINTER_CONSTRAINT_V1_STATE_CURSOR_HINT)) {
sx = active_constraint->current.cursor_hint.x + c->mon->m.x + c->bw;
sy = active_constraint->current.cursor_hint.y + c->mon->m.y + c->bw;
wlr_cursor_warp(cursor, NULL, sx - c->geom.x, sy - c->geom.y);
lx = sx + c->mon->m.x + c->geom.x + c->bw;
ly = sy + c->mon->m.y + c->geom.y + c->bw;
wlr_cursor_warp(cursor, NULL, lx, ly);
wlr_seat_pointer_warp(seat, sx, sy);
}
}
@ -1176,7 +1179,7 @@ destroypointerconstraint(struct wl_listener *listener, void *data)
PointerConstraint *pointer_constraint = wl_container_of(listener, pointer_constraint, destroy);
if (active_constraint == pointer_constraint->constraint) {
// cursorwarptohint();
cursorwarptohint();
active_constraint = NULL;
}