feat: add global option edge_scroller_pointer_focus

This commit is contained in:
DreamMaoMao 2025-09-04 09:55:53 +08:00
parent ffba02fd59
commit c7b0e2e6c8
4 changed files with 15 additions and 1 deletions

View file

@ -52,6 +52,7 @@ scroller_structs=20
scroller_default_proportion=0.8 scroller_default_proportion=0.8
scroller_focus_center=0 scroller_focus_center=0
scroller_prefer_center=0 scroller_prefer_center=0
edge_scroller_pointer_focus=1
scroller_default_proportion_single=1.0 scroller_default_proportion_single=1.0
scroller_proportion_preset=0.5,0.8,1.0 scroller_proportion_preset=0.5,0.8,1.0

View file

@ -167,6 +167,7 @@ typedef struct {
float scroller_default_proportion_single; float scroller_default_proportion_single;
int scroller_focus_center; int scroller_focus_center;
int scroller_prefer_center; int scroller_prefer_center;
int edge_scroller_pointer_focus;
int focus_cross_monitor; int focus_cross_monitor;
int focus_cross_tag; int focus_cross_tag;
int no_border_when_single; int no_border_when_single;
@ -938,6 +939,8 @@ void parse_config_line(Config *config, const char *line) {
config->scroller_focus_center = atoi(value); config->scroller_focus_center = atoi(value);
} else if (strcmp(key, "scroller_prefer_center") == 0) { } else if (strcmp(key, "scroller_prefer_center") == 0) {
config->scroller_prefer_center = atoi(value); 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) { } else if (strcmp(key, "focus_cross_monitor") == 0) {
config->focus_cross_monitor = atoi(value); config->focus_cross_monitor = atoi(value);
} else if (strcmp(key, "focus_cross_tag") == 0) { } 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); CLAMP_FLOAT(config.scroller_default_proportion_single, 0.1f, 1.0f);
scroller_focus_center = CLAMP_INT(config.scroller_focus_center, 0, 1); scroller_focus_center = CLAMP_INT(config.scroller_focus_center, 0, 1);
scroller_prefer_center = CLAMP_INT(config.scroller_prefer_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); scroller_structs = CLAMP_INT(config.scroller_structs, 0, 1000);
// 主从布局设置 // 主从布局设置
@ -2384,6 +2389,7 @@ void set_value_default() {
scroller_default_proportion_single; scroller_default_proportion_single;
config.scroller_focus_center = scroller_focus_center; config.scroller_focus_center = scroller_focus_center;
config.scroller_prefer_center = scroller_prefer_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_monitor = focus_cross_monitor;
config.focus_cross_tag = focus_cross_tag; config.focus_cross_tag = focus_cross_tag;
config.single_scratchpad = single_scratchpad; config.single_scratchpad = single_scratchpad;

View file

@ -132,6 +132,7 @@ int disable_while_typing = 1;
int left_handed = 0; int left_handed = 0;
int middle_button_emulation = 0; int middle_button_emulation = 0;
int single_scratchpad = 1; int single_scratchpad = 1;
int edge_scroller_pointer_focus = 1;
/* You can choose between: /* You can choose between:
LIBINPUT_CONFIG_SCROLL_NO_SCROLL LIBINPUT_CONFIG_SCROLL_NO_SCROLL

View file

@ -3710,7 +3710,13 @@ void motionnotify(unsigned int time, struct wlr_input_device *device, double dx,
c->geom.y < c->mon->m.y)) { c->geom.y < c->mon->m.y)) {
should_lock = true; 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) { if (should_lock && c && c->mon && ISTILED(c) && c == c->mon->sel) {
scroller_focus_lock = 1; scroller_focus_lock = 1;