Skip to content

fix(window): 支持拖拽文件时保持窗口#506

Open
guopenghui wants to merge 2 commits into
ZToolsCenter:mainfrom
guopenghui:feature/drag-file-into-search
Open

fix(window): 支持拖拽文件时保持窗口#506
guopenghui wants to merge 2 commits into
ZToolsCenter:mainfrom
guopenghui:feature/drag-file-into-search

Conversation

@guopenghui
Copy link
Copy Markdown
Contributor

@guopenghui guopenghui commented May 18, 2026

变更内容

  • 集中管理 ioHook
  • 调整了搜索窗口隐藏的逻辑,支持了在拖拽文件时不关闭窗口,从而实现了将文件拖入搜索窗口的功能
  • 调整了 doubleTap 管理的逻辑,解决了双击修饰键(如 ctrl + ctrl ) 打开搜索窗口时获取不到焦点,无法输入的问题。

动机

  • 解决文件拖入窗口,和双击修饰键窗口无法获得焦点的问题。

视频

2026-05-18-19-45-38.mp4

相关 issue

备注

目前仅在 Windows 平台上经过测试,Mac/Linux 平台表现暂不明确。

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a GlobalInputManager to centralize global input event handling and resolve focus issues related to double-tap shortcuts and drag-and-drop operations. Key changes include refactoring DoubleTapManager to use the new manager and implementing logic in WindowManager to delay window hiding during external drag events. A review comment identified a logical redundancy in the mouse-up event handler where visibility resolution was being triggered twice; it is recommended to refactor this into a single conditional branch to improve clarity and avoid duplicate execution.

Comment thread src/main/managers/windowManager.ts Outdated
Comment on lines +203 to +204
this.hideAfterDeferredMouseUpIfNeeded()
this.resolveMouseUpVisibility()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这里存在逻辑冗余。hideAfterDeferredMouseUpIfNeeded 内部已经包含了对 resolveMouseUpVisibility 的调用。当 pendingBlurHideOnMouseUp 为 true 时,会导致 resolveMouseUpVisibility 被连续执行两次。建议根据 pendingBlurHideOnMouseUp 的状态进行分支处理,以提高代码清晰度并避免重复逻辑执行。

      if (this.pendingBlurHideOnMouseUp) {
        this.hideAfterDeferredMouseUpIfNeeded()
      } else {
        this.resolveMouseUpVisibility()
      }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [Bug] 搜索栏通过快捷键呼出时偶发未获得输入焦点

1 participant