fix: 优化 3D 游戏模式

This commit is contained in:
刘旭 2022-05-06 19:16:54 +08:00
commit 475c32a2ef
3 changed files with 15 additions and 4 deletions

View file

@ -110,7 +110,7 @@ static std::optional<LRESULT> HostWndProc(HWND hWnd, UINT message, WPARAM wParam
HWND hwndSrc = App::Get().GetHwndSrc();
HWND hwndForground = GetForegroundWindow();
if (hwndForground != hwndSrc) {
if (!SetForegroundWindow(hwndSrc)) {
if (!Utils::SetForegroundWindow(hwndSrc)) {
// 设置前台窗口失败,可能是因为前台窗口是开始菜单
if (Utils::IsStartMenu(hwndForground)) {
// 限制触发频率
@ -192,6 +192,14 @@ void CursorManager::OnBeginFrame() {
return;
}
if (App::Get().GetConfig().Is3DMode()) {
HWND hwndFore = GetForegroundWindow();
if (hwndFore != App::Get().GetHwndHost() && hwndFore != App::Get().GetHwndSrc()) {
_curCursor = NULL;
return;
}
}
CURSORINFO ci{};
ci.cbSize = sizeof(ci);
if (!::GetCursorInfo(&ci)) {