mirror of https://github.com/buggins/dlangui.git
Better pos/resize code in SDL setWindowState()
This commit is contained in:
parent
71789a55b3
commit
c8bc160e58
|
@ -301,29 +301,20 @@ class SDLWindow : Window {
|
||||||
// change size and/or position
|
// change size and/or position
|
||||||
if (newWindowRect != RECT_VALUE_IS_NOT_SET && (newState == WindowState.normal || newState == WindowState.unspecified)) {
|
if (newWindowRect != RECT_VALUE_IS_NOT_SET && (newState == WindowState.normal || newState == WindowState.unspecified)) {
|
||||||
|
|
||||||
if (newWindowRect.top == int.min || newWindowRect.left == int.min) {
|
// change position
|
||||||
// no position specified
|
if (newWindowRect.top != int.min && newWindowRect.left != int.min) {
|
||||||
if (newWindowRect.bottom != int.min && newWindowRect.right != int.min) {
|
SDL_SetWindowPosition(_win, newWindowRect.left, newWindowRect.top);
|
||||||
// change size only
|
res = true;
|
||||||
SDL_SetWindowSize(_win, newWindowRect.right, newWindowRect.bottom);
|
}
|
||||||
res = true;
|
|
||||||
}
|
// change size
|
||||||
} else {
|
if (newWindowRect.bottom != int.min && newWindowRect.right != int.min) {
|
||||||
if (newWindowRect.bottom != int.min && newWindowRect.right != int.min) {
|
SDL_SetWindowSize(_win, newWindowRect.right, newWindowRect.bottom);
|
||||||
// change size and position
|
res = true;
|
||||||
SDL_SetWindowPosition(_win, newWindowRect.left, newWindowRect.top);
|
|
||||||
SDL_SetWindowSize(_win, newWindowRect.right, newWindowRect.bottom);
|
|
||||||
res = true;
|
|
||||||
} else {
|
|
||||||
// change position only
|
|
||||||
SDL_SetWindowPosition(_win, newWindowRect.left, newWindowRect.top);
|
|
||||||
res = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activate)
|
if (activate) {
|
||||||
{
|
|
||||||
SDL_RaiseWindow(_win);
|
SDL_RaiseWindow(_win);
|
||||||
res = true;
|
res = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue