Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Also fixed Cocoa implementation so that it affects client area, not the whole window area.
This commit is contained in:
parent
ce28a79602
commit
1a92f18381
11 changed files with 148 additions and 4 deletions
|
@ -27,7 +27,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#define VIDEO_USAGE \
|
||||
"[--video driver] [--renderer driver] [--info all|video|modes|render|event] [--log all|error|system|audio|video|render|input] [--display N] [--fullscreen | --fullscreen-desktop | --windows N] [--title title] [--icon icon.bmp] [--center | --position X,Y] [--geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab]"
|
||||
"[--video driver] [--renderer driver] [--info all|video|modes|render|event] [--log all|error|system|audio|video|render|input] [--display N] [--fullscreen | --fullscreen-desktop | --windows N] [--title title] [--icon icon.bmp] [--center | --position X,Y] [--geometry WxH] [--min-geometry WxH] [--max-geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab]"
|
||||
|
||||
#define AUDIO_USAGE \
|
||||
"[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]"
|
||||
|
@ -266,6 +266,44 @@ SDLTest_CommonArg(SDLTest_CommonState * state, int index)
|
|||
state->window_h = SDL_atoi(h);
|
||||
return 2;
|
||||
}
|
||||
if (SDL_strcasecmp(argv[index], "--min-geometry") == 0) {
|
||||
char *w, *h;
|
||||
++index;
|
||||
if (!argv[index]) {
|
||||
return -1;
|
||||
}
|
||||
w = argv[index];
|
||||
h = argv[index];
|
||||
while (*h && *h != 'x') {
|
||||
++h;
|
||||
}
|
||||
if (!*h) {
|
||||
return -1;
|
||||
}
|
||||
*h++ = '\0';
|
||||
state->window_minW = SDL_atoi(w);
|
||||
state->window_minH = SDL_atoi(h);
|
||||
return 2;
|
||||
}
|
||||
if (SDL_strcasecmp(argv[index], "--max-geometry") == 0) {
|
||||
char *w, *h;
|
||||
++index;
|
||||
if (!argv[index]) {
|
||||
return -1;
|
||||
}
|
||||
w = argv[index];
|
||||
h = argv[index];
|
||||
while (*h && *h != 'x') {
|
||||
++h;
|
||||
}
|
||||
if (!*h) {
|
||||
return -1;
|
||||
}
|
||||
*h++ = '\0';
|
||||
state->window_maxW = SDL_atoi(w);
|
||||
state->window_maxH = SDL_atoi(h);
|
||||
return 2;
|
||||
}
|
||||
if (SDL_strcasecmp(argv[index], "--depth") == 0) {
|
||||
++index;
|
||||
if (!argv[index]) {
|
||||
|
@ -751,6 +789,12 @@ SDLTest_CommonInit(SDLTest_CommonState * state)
|
|||
SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
}
|
||||
if (state->window_minW || state->window_minH) {
|
||||
SDL_SetWindowMinimumSize(state->windows[i], state->window_minW, state->window_minH);
|
||||
}
|
||||
if (state->window_maxW || state->window_maxH) {
|
||||
SDL_SetWindowMaximumSize(state->windows[i], state->window_maxW, state->window_maxH);
|
||||
}
|
||||
SDL_GetWindowSize(state->windows[i], &w, &h);
|
||||
if (!(state->window_flags & SDL_WINDOW_RESIZABLE) &&
|
||||
(w != state->window_w || h != state->window_h)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue