From bd1cd2f228aaedc3cd3aabc50c7d55c56653e956 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Sat, 17 Oct 2026 15:52:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(explorer):=20=E9=80=90=E5=8C=85=E8=B7=9F?= =?UTF-8?q?=E8=B8=AA=E6=8C=89=E4=B8=8B/=E9=87=8A=E6=94=BE=E6=B2=BF?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=8D=95=E5=87=BB=E9=9C=80=E9=95=BF?= =?UTF-8?q?=E6=8C=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 批量取包后只保留最后一包的按键状态:快速点击的按下+释放落在同一批里,最终 btn=0,按下沿永远检测不到(表现为必须长按)。改为批次内维护 cur 并记录 saw_press(任一分包出现 0→1)。同时把释放与拖动从 elif 改为独立 if:同批内按下并松开时,按下分支之后必须立刻走释放,否则 btn_down 卡在 1,后续点击继续失效。 --- Apps/Explorer/desk_server.vp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Apps/Explorer/desk_server.vp b/Apps/Explorer/desk_server.vp index 5e8b459..6166d1e 100644 --- a/Apps/Explorer/desk_server.vp +++ b/Apps/Explorer/desk_server.vp @@ -1266,14 +1266,21 @@ class DeskServer: if mn >= 9: moved = self._move_cursor(int(*(int32*(uint64(&mp) + uint64(1)))), int(*(int32*(uint64(&mp) + uint64(5))))) - btn: int = int(mp[0]) & 1 + # 批次内逐包跟踪按下/释放沿:只看最后一包会漏掉"按下+释放落在同一批"的快速点击 + cur: int = self.btn_down + saw_press: int = 0 + b0: int = int(mp[0]) & 1 + if b0 != 0 and cur == 0: saw_press = 1 + cur = b0 mn = fs.read(self.mfd, &mp, uint32(16)) while mn > 0: if mn >= 9: if self._move_cursor(int(*(int32*(uint64(&mp) + uint64(1)))), int(*(int32*(uint64(&mp) + uint64(5))))) != 0: moved = 1 - btn = int(mp[0]) & 1 + bi: int = int(mp[0]) & 1 + if bi != 0 and cur == 0: saw_press = 1 + cur = bi mn = fs.read(self.mfd, &mp, uint32(16)) if moved != 0: self.mark(self.pcy - 1, CURSOR_BMP_H + 2) @@ -1288,7 +1295,7 @@ class DeskServer: self.push_event(hw, uint32(desk.DESK_EVT_MOUSE), desk.DESK_MOUSE_HOVER, self.cx - hs.ux, self.cy - hs.uy - TITLE_H - TITLE_GAP, 0) - if btn != 0 and self.btn_down == 0: + if saw_press != 0: self.btn_down = 1 # 任务栏图标优先:命中则激活并跳过窗口命中/拖动 hit: int = -1 @@ -1328,7 +1335,9 @@ class DeskServer: self.push_event(hit, uint32(desk.DESK_EVT_MOUSE), desk.DESK_MOUSE_PRESS, self.cx - s.ux, self.cy - s.uy - TITLE_H - TITLE_GAP, 1) - elif btn == 0 and self.btn_down != 0: + # 独立判断(不是 elif):同批内按下并松开时,按下分支之后还要立刻走释放, + # 否则 btn_down 卡在 1,后续点击永远检测不到按下沿。 + if cur == 0 and self.btn_down != 0: self.btn_down = 0 if self.drag_win < 0: # 松手:投 RELEASE 给光标下的窗口 @@ -1339,7 +1348,7 @@ class DeskServer: desk.DESK_MOUSE_RELEASE, self.cx - rs.ux, self.cy - rs.uy - TITLE_H - TITLE_GAP, 0) self.drag_win = -1 - elif self.btn_down != 0 and self.drag_win >= 0: + if self.btn_down != 0 and self.drag_win >= 0: s2: desk.WinSlot* = self.slot(self.drag_win) if s2.used != 0: self.mark_win(s2.uy, s2.h)