win_ui: rewrite resizing using WM_WINDOWPOSCHANGED
This commit is contained in:
@@ -485,6 +485,8 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
int i;
|
int i;
|
||||||
RECT rect, *rect_p;
|
RECT rect, *rect_p;
|
||||||
|
|
||||||
|
WINDOWPOS *pos;
|
||||||
|
|
||||||
int temp_x, temp_y;
|
int temp_x, temp_y;
|
||||||
|
|
||||||
if (input_proc(hwnd, message, wParam, lParam) == 0)
|
if (input_proc(hwnd, message, wParam, lParam) == 0)
|
||||||
@@ -840,69 +842,52 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
doresize = 1;
|
doresize = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SIZE:
|
case WM_WINDOWPOSCHANGED:
|
||||||
if (user_resize && !vid_resize)
|
pos = (WINDOWPOS*)lParam;
|
||||||
break;
|
GetClientRect(hwndMain, &rect);
|
||||||
|
|
||||||
temp_x = (lParam & 0xFFFF);
|
if (IsIconic(hwndMain)) {
|
||||||
temp_y = (lParam >> 16);
|
|
||||||
|
|
||||||
if ((temp_x <= 0) || (temp_y <= 0)) {
|
|
||||||
plat_vidapi_enable(0);
|
plat_vidapi_enable(0);
|
||||||
minimized = 1;
|
minimized = 1;
|
||||||
break;
|
return(0);
|
||||||
} else if (minimized == 1) {
|
} else if (minimized) {
|
||||||
minimized = 0;
|
minimized = 0;
|
||||||
video_force_resize_set(1);
|
video_force_resize_set(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
plat_vidapi_enable(0);
|
if (window_remember) {
|
||||||
temp_y -= sbar_height;
|
window_x = pos->x;
|
||||||
if (temp_y < 1)
|
window_y = pos->y;
|
||||||
temp_y = 1;
|
window_w = pos->cx;
|
||||||
|
window_h = pos->cy;
|
||||||
|
save_window_pos = 1;
|
||||||
|
config_save();
|
||||||
|
}
|
||||||
|
|
||||||
if (vid_resize && ((temp_x != scrnsz_x) || (temp_y != scrnsz_y))) {
|
if (!(pos->flags & SWP_NOSIZE)) {
|
||||||
scrnsz_x = temp_x;
|
plat_vidapi_enable(0);
|
||||||
scrnsz_y = temp_y;
|
|
||||||
|
MoveWindow(hwndSBAR, 0, rect.bottom - sbar_height, sbar_height, rect.right, TRUE);
|
||||||
|
MoveWindow(hwndRender, 0, 0, rect.right, rect.bottom - sbar_height, TRUE);
|
||||||
|
|
||||||
|
GetClientRect(hwndRender, &rect);
|
||||||
|
if (rect.right != scrnsz_x || rect.bottom != scrnsz_y) {
|
||||||
|
scrnsz_x = rect.right;
|
||||||
|
scrnsz_y = rect.bottom;
|
||||||
doresize = 1;
|
doresize = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveWindow(hwndRender, 0, 0, temp_x, temp_y, TRUE);
|
plat_vidsize(rect.right, rect.bottom);
|
||||||
|
|
||||||
GetWindowRect(hwndRender, &rect);
|
|
||||||
|
|
||||||
/* Status bar. */
|
|
||||||
MoveWindow(hwndSBAR, 0, rect.bottom, temp_x, 17, TRUE);
|
|
||||||
|
|
||||||
plat_vidsize(temp_x, temp_y);
|
|
||||||
|
|
||||||
if (mouse_capture) {
|
if (mouse_capture) {
|
||||||
|
GetWindowRect(hwndRender, &rect);
|
||||||
ClipCursor(&rect);
|
ClipCursor(&rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window_remember) {
|
|
||||||
GetWindowRect(hwnd, &rect);
|
|
||||||
window_x = rect.left;
|
|
||||||
window_y = rect.top;
|
|
||||||
window_w = rect.right - rect.left;
|
|
||||||
window_h = rect.bottom - rect.top;
|
|
||||||
save_window_pos = 1;
|
|
||||||
}
|
|
||||||
plat_vidapi_enable(2);
|
plat_vidapi_enable(2);
|
||||||
|
|
||||||
config_save();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_MOVE:
|
|
||||||
if (window_remember) {
|
|
||||||
GetWindowRect(hwnd, &rect);
|
|
||||||
window_x = rect.left;
|
|
||||||
window_y = rect.top;
|
|
||||||
window_w = rect.right - rect.left;
|
|
||||||
window_h = rect.bottom - rect.top;
|
|
||||||
save_window_pos = 1;
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
return(0);
|
||||||
|
|
||||||
case WM_TIMER:
|
case WM_TIMER:
|
||||||
if (wParam == TIMER_1SEC)
|
if (wParam == TIMER_1SEC)
|
||||||
|
Reference in New Issue
Block a user