mirror of
https://github.com/fanchenio/DawnLauncher.git
synced 2025-07-13 21:02:10 +08:00
修复'失去焦点隐藏'有时无效的问题。
This commit is contained in:
parent
07912ea276
commit
0c2ae8ae5b
@ -215,6 +215,8 @@ function createMainWindow() {
|
|||||||
// 中间单击
|
// 中间单击
|
||||||
showHideMouseWheelClick();
|
showHideMouseWheelClick();
|
||||||
}
|
}
|
||||||
|
// 失去焦点隐藏
|
||||||
|
onBlurHide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 禁用标题栏右键
|
// 禁用标题栏右键
|
||||||
@ -229,6 +231,49 @@ function createMainWindow() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失去焦点隐藏
|
||||||
|
*/
|
||||||
|
function onBlurHide() {
|
||||||
|
if (
|
||||||
|
mainWindow.isVisible() &&
|
||||||
|
global.setting.general.hideLoseFocus &&
|
||||||
|
!global.setting.general.alwaysTop &&
|
||||||
|
mainWindow.getChildWindows().length === 0 &&
|
||||||
|
!global.mainWindowShowDialog &&
|
||||||
|
!hasCursorPosWindow(mainWindow)
|
||||||
|
) {
|
||||||
|
// 隐藏窗口
|
||||||
|
hideMainWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断鼠标是否在置顶的窗口范围内
|
||||||
|
*/
|
||||||
|
function hasCursorPosWindow(window: BrowserWindow) {
|
||||||
|
if (window && !window.isDestroyed() && window.isVisible()) {
|
||||||
|
// 获取鼠标位置
|
||||||
|
let point = screen.getCursorScreenPoint();
|
||||||
|
// 窗口位置信息
|
||||||
|
let bounds = window.getBounds();
|
||||||
|
// 判断鼠标是否在窗口以外
|
||||||
|
if (
|
||||||
|
point.x < bounds.x ||
|
||||||
|
point.x > bounds.x + bounds.width ||
|
||||||
|
point.y < bounds.y ||
|
||||||
|
point.y > bounds.y + bounds.height
|
||||||
|
) {
|
||||||
|
// 窗口以外
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
// 窗口以内
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示窗口之前
|
* 显示窗口之前
|
||||||
* @param blurHide
|
* @param blurHide
|
||||||
|
Loading…
Reference in New Issue
Block a user