diff --git a/maomao.c b/maomao.c index 4e85842..c328ee0 100644 --- a/maomao.c +++ b/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 光标相对位置移动事件处理