mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 14:50:41 -07:00
graphics: fix window position if out of bounds (#630)
## Link to GitHub Issue or related Pull Request, if one exists #618 ## Description of change Before calling `CreateWindowEx[A/W]`, check dimensions of the window about to be created, and check if it will be out of bounds (completely or partially). If it's completely out of bounds, move it to `(0, 0)` to prevent crashes or rendering issues. ## Testing Tested popn and sdvx.
This commit is contained in:
@@ -368,6 +368,10 @@ static HWND WINAPI CreateWindowExA_hook(DWORD dwExStyle, LPCSTR lpClassName, LPC
|
||||
}
|
||||
}
|
||||
|
||||
if (GRAPHICS_WINDOWED) {
|
||||
graphics_window_check_bounds_before_creation(x, y, nWidth, nHeight);
|
||||
}
|
||||
|
||||
// call original
|
||||
HWND result = CreateWindowExA_orig(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight,
|
||||
hWndParent, hMenu, hInstance, lpParam);
|
||||
@@ -468,6 +472,10 @@ static HWND WINAPI CreateWindowExW_hook(DWORD dwExStyle, LPCWSTR lpClassName, LP
|
||||
}
|
||||
}
|
||||
|
||||
if (GRAPHICS_WINDOWED) {
|
||||
graphics_window_check_bounds_before_creation(x, y, nWidth, nHeight);
|
||||
}
|
||||
|
||||
// call original
|
||||
HWND result = CreateWindowExW_orig(
|
||||
dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight,
|
||||
|
||||
Reference in New Issue
Block a user