From ce23c4bc209d2166a1495adc8d101e7736a42ef7 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Fri, 21 Feb 2025 14:56:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A6=82=E4=BD=95=E6=BB=9A=E5=8A=A8=E5=8A=A8?= =?UTF-8?q?=E4=BD=9C=E6=96=B9=E5=90=91=E6=98=AF=E4=B8=8D=E5=90=8C=E7=9A=84?= =?UTF-8?q?=EF=BC=8C=E5=88=99=E4=B8=8D=E7=94=A8=E5=BB=B6=E8=BF=9F=E6=A3=80?= =?UTF-8?q?=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- maomao.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/maomao.c b/maomao.c index 7c6ba719..3dcf1ef3 100644 --- a/maomao.c +++ b/maomao.c @@ -614,6 +614,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; /* global event handlers */ static struct zdwl_ipc_manager_v2_interface dwl_manager_implementation = { @@ -1597,11 +1598,14 @@ axisnotify(struct wl_listener *listener, void *data) { a = &config.axis_bindings[ji]; if (CLEANMASK(mods) == CLEANMASK(a->mod) && // 按键一致 adir == a->dir && a->func) { // 滚轮方向判断一致且处理函数存在 - if (event->time_msec - axis_apply_time > axis_bind_apply_timeout) { + if (event->time_msec - axis_apply_time > axis_bind_apply_timeout || + axis_apply_dir * event->delta < 0) { a->func(&a->arg); axis_apply_time = event->time_msec; + axis_apply_dir = event->delta > 0 ? 1 : -1; return; // 如果成功匹配就不把这个滚轮事件传送给客户端了 } else { + axis_apply_dir = event->delta > 0 ? 1 : -1; axis_apply_time = event->time_msec; return; }