* 强制激活窗口(解决alert等弹窗后无法唤起的问题)
()
| 781 | * 强制激活窗口(解决alert等弹窗后无法唤起的问题) |
| 782 | */ |
| 783 | private forceActivateWindow(): void { |
| 784 | if (!this.mainWindow) return |
| 785 | |
| 786 | // 1. 显示窗口 |
| 787 | this.mainWindow.show() |
| 788 | |
| 789 | // 2. macOS特殊处理:重申置顶,防止因为系统事件掉层级 |
| 790 | if (platform.isMacOS) { |
| 791 | this.mainWindow.setAlwaysOnTop(true, 'modal-panel', 1) |
| 792 | return |
| 793 | } |
| 794 | |
| 795 | // 3. 设置窗口层级为最前 |
| 796 | this.mainWindow.setAlwaysOnTop(true) |
| 797 | |
| 798 | // 4. 聚焦窗口 |
| 799 | this.mainWindow.focus() |
| 800 | } |
| 801 | |
| 802 | private refocusSearchAfterDoubleTap(): void { |
| 803 | if (!platform.isWindows) return |
no test coverage detected