mirror of
https://github.com/Blinue/Magpie.git
synced 2026-06-24 02:04:10 +00:00
fix: 优化 3D 游戏模式
This commit is contained in:
parent
6dbb9f83ea
commit
475c32a2ef
3 changed files with 15 additions and 4 deletions
|
|
@ -413,8 +413,9 @@ LRESULT App::_HostWndProcStatic(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
|
|||
|
||||
|
||||
LRESULT App::_HostWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
for (auto& pair : _wndProcHandlers) {
|
||||
const auto& result = pair.second(hWnd, message, wParam, lParam);
|
||||
// 以反向调用回调
|
||||
for (auto it = _wndProcHandlers.rbegin(); it != _wndProcHandlers.rend(); ++it) {
|
||||
const auto& result = it->second(hWnd, message, wParam, lParam);
|
||||
if (result.has_value()) {
|
||||
return result.value();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@ OverlayDrawer::OverlayDrawer() {}
|
|||
|
||||
OverlayDrawer::~OverlayDrawer() {
|
||||
if (App::Get().GetConfig().Is3DMode() && IsUIVisiable()) {
|
||||
EnableWindow(App::Get().GetHwndSrc(), TRUE);
|
||||
HWND hwndSrc = App::Get().GetHwndSrc();
|
||||
EnableWindow(hwndSrc, TRUE);
|
||||
SetForegroundWindow(hwndSrc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue