mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-10-29 05:40:21 -04:00
feat: avoid continuous scrolling for scroller layout
Avoid continuous scrolling of the scroll layout by moving the mouse to the edge of the screen
This commit is contained in:
parent
5bf93e54d2
commit
af51e86b32
1 changed files with 19 additions and 1 deletions
20
maomao.c
20
maomao.c
|
|
@ -640,6 +640,7 @@ static Monitor *selmon;
|
|||
static int enablegaps = 1; /* enables gaps, used by togglegaps */
|
||||
static int axis_apply_time = 0;
|
||||
static int axis_apply_dir = 0;
|
||||
static int scroller_focus_lock = 0;
|
||||
|
||||
/* global event handlers */
|
||||
static struct zdwl_ipc_manager_v2_interface dwl_manager_implementation = {
|
||||
|
|
@ -3812,6 +3813,7 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx,
|
|||
LayerSurface *l = NULL;
|
||||
struct wlr_surface *surface = NULL;
|
||||
struct wlr_pointer_constraint_v1 *constraint;
|
||||
bool should_lock = false;
|
||||
|
||||
/* Find the client under the pointer and send the event along. */
|
||||
xytonode(cursor->x, cursor->y, &surface, &c, NULL, &sx, &sy);
|
||||
|
|
@ -3888,7 +3890,23 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx,
|
|||
if (!surface && !seat->drag)
|
||||
wlr_cursor_set_xcursor(cursor, cursor_mgr, "left_ptr");
|
||||
|
||||
pointerfocus(c, surface, sx, sy, time);
|
||||
|
||||
if(c && c->mon && !c->animation.running && !(c->geom.x + c->geom.width > c->mon->m.x + c->mon->m.width || c->geom.x < c->mon->m.x)) {
|
||||
scroller_focus_lock = 0;
|
||||
}
|
||||
|
||||
should_lock = false;
|
||||
if(!scroller_focus_lock || !(c && c->mon && (c->geom.x + c->geom.width > c->mon->m.x + c->mon->m.width || c->geom.x < c->mon->m.x)) ) {
|
||||
if(c && c->mon && strcmp(c->mon->pertag->ltidxs[selmon->pertag->curtag]->name,
|
||||
"scroller") == 0 && (c->geom.x + c->geom.width > c->mon->m.x + c->mon->m.width || c->geom.x < c->mon->m.x)) {
|
||||
should_lock = true;
|
||||
}
|
||||
pointerfocus(c, surface, sx, sy, time);
|
||||
|
||||
if(should_lock && c && c->mon && c == c->mon->sel) {
|
||||
scroller_focus_lock = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void // fix for 0.5 光标相对位置移动事件处理
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue