Skip to content

Commit 80913b1

Browse files
committed
Fix mouse during fade and window foreground
1 parent 6bdf2cb commit 80913b1

File tree

4 files changed

+25
-15
lines changed

4 files changed

+25
-15
lines changed

Common/Settings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ void UpdateConfigDefaults()
285285
}
286286

287287
// Set shaders default
288-
EnableCustomShaders = ((EnableSMAA || RestoreBrightnessSelector || EnableCRTShader) && d3d8to9);
288+
EnableCustomShaders = ((EnableSMAA || EnableCRTShader) && d3d8to9);
289289

290290
// Set Input Tweaks default
291291
EnableInputTweaks = (EnableToggleSprint || EnableEnhancedMouse || EnableMouseWheelSwap || MemoScreenFix || EnhanceMouseCursor || AutoHideMouseCursor || CenterPuzzleCursor);

Patches/InputTweaks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ int32_t CanSave_Hook()
112112

113113
void DrawCursor_Hook()
114114
{
115-
if (HideMouseCursor)
115+
if (HideMouseCursor || GetTransitionState() != FADE_NONE)
116116
return;
117117

118118
orgDrawCursor.fun();

Resources/BuildNo.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define BUILD_NUMBER 2223
1+
#define BUILD_NUMBER 2224

Wrappers/d3d8/IDirect3D8.cpp

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "Patches\InputTweaks.h"
1919

2020
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
21+
void SetWindowToTop(HWND MainhWnd);
2122

2223
WNDPROC OriginalWndProc = nullptr;
2324
HWND DeviceWindow = nullptr;
@@ -249,6 +250,9 @@ HRESULT m_IDirect3D8::CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFo
249250
// Update presentation parameters
250251
UpdatePresentParameter(pPresentationParameters, hFocusWindow);
251252

253+
// Bring window to the forefront
254+
SetWindowToTop(DeviceWindow);
255+
252256
// Get WndProc
253257
if (HookWndProc && DeviceWindow && !OriginalWndProc)
254258
{
@@ -495,18 +499,8 @@ void SetScreenAndWindowSize()
495499
WindowInChange = false;
496500
}
497501

498-
// Adjusting the window position for WindowMode
499-
void AdjustWindow(HWND MainhWnd, LONG displayWidth, LONG displayHeight)
502+
void SetWindowToTop(HWND MainhWnd)
500503
{
501-
if (!IsWindow(MainhWnd) || !displayWidth || !displayHeight)
502-
{
503-
LOG_LIMIT(100, __FUNCTION__ << " Error: could not set window size, nullptr.");
504-
return;
505-
}
506-
507-
// Remember first run
508-
static bool FirstRun = true;
509-
510504
// Set topmost
511505
LONG lExStyle = GetWindowLong(MainhWnd, GWL_EXSTYLE);
512506
SetWindowLong(MainhWnd, GWL_EXSTYLE, lExStyle | WS_EX_TOPMOST);
@@ -543,6 +537,22 @@ void AdjustWindow(HWND MainhWnd, LONG displayWidth, LONG displayHeight)
543537
AttachThreadInput(currentThreadId, foregroundThreadId, FALSE);
544538
}
545539
}
540+
}
541+
542+
// Adjusting the window position for WindowMode
543+
void AdjustWindow(HWND MainhWnd, LONG displayWidth, LONG displayHeight)
544+
{
545+
if (!IsWindow(MainhWnd) || !displayWidth || !displayHeight)
546+
{
547+
LOG_LIMIT(100, __FUNCTION__ << " Error: could not set window size, nullptr.");
548+
return;
549+
}
550+
551+
// Remember first run
552+
static bool FirstRun = true;
553+
554+
// Bring window to the forefront
555+
SetWindowToTop(MainhWnd);
546556

547557
// Get screen width and height
548558
LONG screenWidth = 0, screenHeight = 0;
@@ -560,7 +570,7 @@ void AdjustWindow(HWND MainhWnd, LONG displayWidth, LONG displayHeight)
560570

561571
// Get window style
562572
LONG lStyle = GetWindowLong(MainhWnd, GWL_STYLE) | WS_VISIBLE;
563-
lExStyle = GetWindowLong(MainhWnd, GWL_EXSTYLE);
573+
LONG lExStyle = GetWindowLong(MainhWnd, GWL_EXSTYLE);
564574

565575
// Get new style
566576
LONG lNewStyle = (lStyle | WS_OVERLAPPEDWINDOW) & ~(WS_MAXIMIZEBOX | WS_THICKFRAME);

0 commit comments

Comments
 (0)