diff --git a/config.conf b/config.conf index f6ffe6a..e2b6c91 100644 --- a/config.conf +++ b/config.conf @@ -31,6 +31,7 @@ scroller_structs=20 scroller_default_proportion=0.8 scroller_focus_center=0 scroller_prefer_center=0 +edge_scroller_pointer_focus=1 scroller_default_proportion_single=1.0 scroller_proportion_preset=0.5,0.8,1.0 diff --git a/src/config/parse_config.h b/src/config/parse_config.h index 0f05811..e6c0b8a 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -165,6 +165,7 @@ typedef struct { float scroller_default_proportion_single; int scroller_focus_center; int scroller_prefer_center; + int edge_scroller_pointer_focus; int focus_cross_monitor; int focus_cross_tag; int no_border_when_single; @@ -921,6 +922,8 @@ void parse_config_line(Config *config, const char *line) { config->scroller_focus_center = atoi(value); } else if (strcmp(key, "scroller_prefer_center") == 0) { config->scroller_prefer_center = atoi(value); + } else if (strcmp(key, "edge_scroller_pointer_focus") == 0) { + config->edge_scroller_pointer_focus = atoi(value); } else if (strcmp(key, "focus_cross_monitor") == 0) { config->focus_cross_monitor = atoi(value); } else if (strcmp(key, "focus_cross_tag") == 0) { @@ -2146,6 +2149,8 @@ void override_config(void) { CLAMP_FLOAT(config.scroller_default_proportion_single, 0.1f, 1.0f); scroller_focus_center = CLAMP_INT(config.scroller_focus_center, 0, 1); scroller_prefer_center = CLAMP_INT(config.scroller_prefer_center, 0, 1); + edge_scroller_pointer_focus = + CLAMP_INT(config.edge_scroller_pointer_focus, 0, 1); scroller_structs = CLAMP_INT(config.scroller_structs, 0, 1000); // 主从布局设置 @@ -2299,6 +2304,7 @@ void set_value_default() { scroller_default_proportion_single; config.scroller_focus_center = scroller_focus_center; config.scroller_prefer_center = scroller_prefer_center; + config.edge_scroller_pointer_focus = edge_scroller_pointer_focus; config.focus_cross_monitor = focus_cross_monitor; config.focus_cross_tag = focus_cross_tag; config.single_scratchpad = single_scratchpad; diff --git a/src/config/preset.h b/src/config/preset.h index 08567f3..a24c59e 100644 --- a/src/config/preset.h +++ b/src/config/preset.h @@ -132,6 +132,7 @@ int disable_while_typing = 1; int left_handed = 0; int middle_button_emulation = 0; int single_scratchpad = 1; +int edge_scroller_pointer_focus = 1; /* You can choose between: LIBINPUT_CONFIG_SCROLL_NO_SCROLL diff --git a/src/mango.c b/src/mango.c index a6b6726..014f0b0 100644 --- a/src/mango.c +++ b/src/mango.c @@ -3627,7 +3627,13 @@ void motionnotify(unsigned int time, struct wlr_input_device *device, double dx, c->geom.y < c->mon->m.y)) { should_lock = true; } - pointerfocus(c, surface, sx, sy, time); + + if (!(!edge_scroller_pointer_focus && c && c->mon && + is_scroller_layout(c->mon) && + (c->geom.x < c->mon->m.x || c->geom.y < c->mon->m.y || + c->geom.x + c->geom.width > c->mon->m.x + c->mon->m.width || + c->geom.y + c->geom.height > c->mon->m.y + c->mon->m.height))) + pointerfocus(c, surface, sx, sy, time); if (should_lock && c && c->mon && ISTILED(c) && c == c->mon->sel) { scroller_focus_lock = 1;