加入滑鼠事件紀錄與鎖定/解鎖處理,追查解鎖後點不到寵物

根本原因:
使用者回報登出/鎖定螢幕再回來後就不能拖曳、不能右鍵。現場量測顯示 OS
這一層正常(點穿位元會切、WindowFromPoint 打到寵物視窗),但事件紀錄裡
完全沒有拖曳或選單的痕跡,代表問題在 renderer 有沒有收到滑鼠事件這一層,
而這一層目前沒有任何可觀測資料,無法判斷。

影響:
解鎖後偶發點不到寵物,且發生時查不出卡在哪裡。

修法:
1. renderer 把 mousedown/mouseup(含按鍵與座標、當時的 pressed/drag)與
   hover 進出寫進事件紀錄;pet:state 帶 rendererMouse(pressed/drag/hovered
   /overlay),/state 可直接查。
2. 主程序監聽 powerMonitor 的 lock-screen/unlock-screen/suspend/resume:
   記錄到事件紀錄與 /state.mouse.sessionEvents,解鎖或喚醒後重新套用目前的
   點穿狀態、showInactive 並重宣告置頂。
版號 2.0.12。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-25 14:56:59 +08:00
co-authored by Claude Fable 5
parent bf059b19cf
commit 30d3e481e4
4 changed files with 37 additions and 5 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "claude-pet",
"version": "2.0.11",
"version": "2.0.12",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "claude-pet",
"version": "2.0.11",
"version": "2.0.12",
"devDependencies": {
"electron": "^43.4.1",
"electron-builder": "^26.0.12"