Limited the render area to a minimum size of 1x1, should fix some crashes.

This commit is contained in:
OBattler
2018-02-15 12:48:31 +01:00
parent 12760db9cc
commit 07bc427839

View File

@@ -8,7 +8,7 @@
* *
* user Interface module for WinAPI on Windows. * user Interface module for WinAPI on Windows.
* *
* Version: @(#)win_ui.c 1.0.21 2018/02/14 * Version: @(#)win_ui.c 1.0.22 2018/02/15
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -616,8 +616,10 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
temp_x = (lParam & 0xFFFF); temp_x = (lParam & 0xFFFF);
temp_y = (lParam >> 16) - (21 + sb_borders[1]); temp_y = (lParam >> 16) - (21 + sb_borders[1]);
if (temp_y < 0) if (temp_x < 1)
temp_y = 0; temp_x = 1;
if (temp_y < 1)
temp_y = 1;
if ((temp_x != scrnsz_x) || (temp_y != scrnsz_y)) if ((temp_x != scrnsz_x) || (temp_y != scrnsz_y))
doresize = 1; doresize = 1;
@@ -627,8 +629,6 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
MoveWindow(hwndRender, 0, 0, scrnsz_x, scrnsz_y, TRUE); MoveWindow(hwndRender, 0, 0, scrnsz_x, scrnsz_y, TRUE);
plat_vidsize(scrnsz_x, scrnsz_y);
GetWindowRect(hwndRender, &rect); GetWindowRect(hwndRender, &rect);
/* Status bar. */ /* Status bar. */
@@ -636,6 +636,8 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
0, rect.bottom + GetSystemMetrics(SM_CYEDGE), 0, rect.bottom + GetSystemMetrics(SM_CYEDGE),
scrnsz_x, 17, TRUE); scrnsz_x, 17, TRUE);
plat_vidsize(scrnsz_x, scrnsz_y);
if (mouse_capture) { if (mouse_capture) {
GetWindowRect(hwndRender, &rect); GetWindowRect(hwndRender, &rect);