Small window management issues

Hi list,

I have come across two annoying issues, which I am not sure if they warrant
a full bug report. So I’ll post them here and open bug only on demand.

Under Windows (8.1), when switching from true fullscreen to window mode,
the title bar of the window is outside the desktop area, so it cannot be
moved around. It seems that since the fullscreen window is positioned at
(0,0), upon switching the window content is still placed at (0,0), without
taking into account the window decoration that is now present.
I worked around this by centering the window on the screen after the
switch, so it really is only a minor nuisance. It never happened on OSX or
Linux.

Under X11, using the new SDL_GetDisplayUsableBounds function directly after
switching from 640x480 fullscreen mode to window mode still returns bounds
even smaller than 640x480. As I use that to size the window appropriately,
this leads to a tiny window. This does not happen on either OSX or Windows.
For now I have no workaround, other than perhaps enforcing a big enough
minimum size for the window.

In general, mode switching under Linux seems to be the least robust,
compared to OSX and Windows. (Still not even so much as a comment on
https://bugzilla.libsdl.org/show_bug.cgi?id=3357) Are there any tricks to
make this work better? Like waiting for certain events from the window
manager before doing certain actions (like resizing the window) instead of
doing all function calls one after the other?

Also, issue https://bugzilla.libsdl.org/show_bug.cgi?id=3345 is affecting
me, causing garbage to appear outside the game window in letterbox mode.
One user even reports flickering garbage. I’ve tried clearing the screen
before enabling the clip rect as a workaround, but not yet sure if it
really helps. So I’d be in favour of fixing that bug, too :-).

Just in case somebody wants to take a look, the mode switching code is here
http://cvs.savannah.gnu.org/viewvc/adonthell-0.3/src/screen.cc?root=adonthell&view=markup
Look for this method
bool screen::set_fullscreen (const u_int8 & m)

It’ll be called with the new mode (0 = Windowed, 1 = Desktop Fullscreen, 2
= Fullscreen). Not an enum for historical reasons.

Kai

Under X11, using the new SDL_GetDisplayUsableBounds function directly
after switching from 640x480 fullscreen mode to window mode still returns
bounds even smaller than 640x480. As I use that to size the window
appropriately, this leads to a tiny window. This does not happen on
either OSX
or Windows.

Surprisingly, SDL_Delay(250) between

SDL_SetWindowFullscreen(Window, SDL_FALSE) and
SDL_GetDisplayUsableBounds(screen, &bounds);

helps to prevent the issue, at least on my PC. Seems to indicate that
SDL_SetWindowFullscreen is not really a synchronous call that returns when
all the work is complete. While I am not entirely happy about that
workaround, as it is likely to break more often than not, it’s better than
nothing, at least.

KaiOn Mon, Jul 18, 2016 at 10:39 AM, Kai Sterker <@Kai_Sterker> wrote: