Bug#830815: libsdl2-2.0-0: SDL_RestoreWindow doesn't restore the window
Sascha Reißner
reiszner at novaplan.at
Mon Jul 11 19:47:37 UTC 2016
Package: libsdl2-2.0-0
Version: 2.0.2+dfsg1-6
Severity: normal
Dear Maintainer,
i write a program with SDL2 and when i resize the window, the content ins't
proportional.
So i wrote a function that will be called if F11 is pressed.
typedef struct visual_s {
SDL_Window *window;
…
} visual_t;
void set_proportion(visual_t *visual) {
int x, y, w, h, max_w, max_h;
SDL_GetWindowPosition(visual->window, &x, &y);
printf("Window pos %d / %d!\n", x, y);
SDL_GetWindowSize(visual->window, &w, &h);
printf("Window size %d / %d!\n", w, h);
SDL_GetWindowMaximumSize(visual->window, &max_w, &max_h);
printf("Window max %d / %d!\n", max_w, max_h);
SDL_RestoreWindow(visual->window);
SDL_SetWindowPosition(visual->window, x, y);
if (w * SCREEN_HEIGHT / SCREEN_WIDTH > h) {
w = h * SCREEN_WIDTH / SCREEN_HEIGHT;
SDL_SetWindowSize(visual->window, w, h);
printf("Window set to %d x %d!\n", w, h);
}
else if (h * SCREEN_WIDTH / SCREEN_HEIGHT > w) {
h = w * SCREEN_HEIGHT / SCREEN_WIDTH;
SDL_SetWindowSize(visual->window, w, h);
printf("Window set to %d x %d!\n", w, h);
}
else {
printf("Window is proportional!\n");
}
}
This function works great, if the window isn't maximized.
If i maximize the window (right most button at titlebar) and press F11,
the border of the window is still maximized. Only the content shift to the
right size.
So, i have insert the lines:
uint32_t flags;
flags = SDL_GetWindowFlags(visual->window);
printf("Window flags: %08x\n", flags);
and it shows me:
Window flags: 00000626
But the flag for SDL_WINDOW_MAXIMIZED is 0x00000080
The function SDL_RestoreWindow looks also to the flags and will only act,
if SDL_WINDOW_MAXIMIZED or SDL_WINDOW_MINIMIZED is set.
So, it looks like the flags will not refrect the current state.
I have only tested on Debian jessie with libsdl2 2.0.2.
Don't know, if this bug is fixed in libsdl2 2.0.4.
-- System Information:
Debian Release: 8.5
APT prefers stable
APT policy: (700, 'stable'), (500, 'stable-updates'), (500, 'proposed-updates')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_AT.UTF-8, LC_CTYPE=de_AT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages libsdl2-2.0-0 depends on:
ii libasound2 1.0.28-1
ii libc6 2.19-18+deb8u4
ii libpulse0 5.0-13
ii libwayland-client0 1.6.0-2
ii libwayland-cursor0 1.6.0-2
ii libwayland-egl1-mesa [libwayland-egl1] 10.3.2-1+deb8u1
ii libx11-6 2:1.6.2-3
ii libxcursor1 1:1.1.14-1+b1
ii libxext6 2:1.3.3-1
ii libxi6 2:1.7.4-1+b2
ii libxinerama1 2:1.1.3-1+b1
ii libxkbcommon0 0.4.3-2
ii libxrandr2 2:1.4.2-1+b1
ii libxss1 1:1.2.2-1
ii libxxf86vm1 1:1.1.3-1+b1
ii multiarch-support 2.19-18+deb8u4
libsdl2-2.0-0 recommends no packages.
libsdl2-2.0-0 suggests no packages.
-- no debconf information
More information about the Pkg-sdl-maintainers
mailing list