SetWindowMinimumSize Windows implementation
This commit is contained in:
parent
de7aeffa50
commit
ea4e328e39
1 changed files with 22 additions and 14 deletions
|
@ -426,16 +426,13 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
RECT size;
|
||||
int x, y;
|
||||
int w, h;
|
||||
int min_w, min_h;
|
||||
int style;
|
||||
BOOL menu;
|
||||
|
||||
/* If we allow resizing, let the resize happen naturally */
|
||||
if(SDL_IsShapedWindow(data->window))
|
||||
if (SDL_IsShapedWindow(data->window))
|
||||
Win32_ResizeWindowShape(data->window);
|
||||
if (SDL_GetWindowFlags(data->window) & SDL_WINDOW_RESIZABLE) {
|
||||
returnCode = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get the current position of our window */
|
||||
GetWindowRect(hwnd, &size);
|
||||
|
@ -444,12 +441,18 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
/* Calculate current size of our window */
|
||||
SDL_GetWindowSize(data->window, &w, &h);
|
||||
SDL_GetWindowMinimumSize(data->window, &min_w, &min_h);
|
||||
|
||||
/* Store in min_w and min_h difference between current size and minimal
|
||||
size so we don't need to call AdjustWindowRectEx twice */
|
||||
min_w -= w;
|
||||
min_h -= h;
|
||||
|
||||
size.top = 0;
|
||||
size.left = 0;
|
||||
size.bottom = h;
|
||||
size.right = w;
|
||||
|
||||
|
||||
style = GetWindowLong(hwnd, GWL_STYLE);
|
||||
/* DJM - according to the docs for GetMenu(), the
|
||||
return value is undefined if hwnd is a child window.
|
||||
|
@ -463,14 +466,19 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
/* Fix our size to the current size */
|
||||
info = (MINMAXINFO *) lParam;
|
||||
info->ptMaxSize.x = w;
|
||||
info->ptMaxSize.y = h;
|
||||
info->ptMaxPosition.x = x;
|
||||
info->ptMaxPosition.y = y;
|
||||
info->ptMinTrackSize.x = w;
|
||||
info->ptMinTrackSize.y = h;
|
||||
info->ptMaxTrackSize.x = w;
|
||||
info->ptMaxTrackSize.y = h;
|
||||
if (SDL_GetWindowFlags(data->window) & SDL_WINDOW_RESIZABLE) {
|
||||
info->ptMinTrackSize.x = w + min_w;
|
||||
info->ptMinTrackSize.y = h + min_h;
|
||||
} else {
|
||||
info->ptMaxSize.x = w;
|
||||
info->ptMaxSize.y = h;
|
||||
info->ptMaxPosition.x = x;
|
||||
info->ptMaxPosition.y = y;
|
||||
info->ptMinTrackSize.x = w;
|
||||
info->ptMinTrackSize.y = h;
|
||||
info->ptMaxTrackSize.x = w;
|
||||
info->ptMaxTrackSize.y = h;
|
||||
}
|
||||
}
|
||||
returnCode = 0;
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue