From c7b0e2e6c8a837adf17f50cbf096502802fe98ec Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Thu, 4 Sep 2025 09:55:53 +0800 Subject: [PATCH] feat: add global option edge_scroller_pointer_focus --- config.conf | 1 + src/config/parse_config.h | 6 ++++++ src/config/preset.h | 1 + src/mango.c | 8 +++++++- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/config.conf b/config.conf index d15cfdd..c243958 100644 --- a/config.conf +++ b/config.conf @@ -52,6 +52,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 8a6688a..c312984 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -167,6 +167,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; @@ -938,6 +939,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) { @@ -2212,6 +2215,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); // 主从布局设置 @@ -2384,6 +2389,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 4d75449..6acdb3b 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 03b9f9c..f1d4b13 100644 --- a/src/mango.c +++ b/src/mango.c @@ -3710,7 +3710,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;