Here is a patch that moves the definition of the default window geometry to HumanClientApp, which is allows the default position to be set to a constant that tells SDL to let the window manager decide. The downside is that the user will see this numerical constant in the settings window. Does this fix the window positioning?Geoff the Medio wrote:In the SDL / SDK branch build, it's mostly running OK on Windows in windowed mode.
As seen in the attached, though, it always creates the window such that the title bar is above the top of the screen, and the left side is hidden under the taskbar I've got at the left side due to poorly-designed laptop aspect ratio. It should be appearing by default to the right of the taskbar, and so that the window title bar is visible.
[patch:SDL] Window default position
Moderator: Committer
[patch:SDL] Window default position
- Attachments
-
[The extension patch has been deactivated and can no longer be displayed.]
Any code by me in this post is released under GPL 2.0 or later.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: [patch:SDL] Window default position
With this patch, the default position for the top-left of the window is the centre of the screen. This is not an improvement...
Re: [patch:SDL] Window default position
Here is a version that centers the window by default. Better?
- Attachments
-
[The extension patch has been deactivated and can no longer be displayed.]
Any code by me in this post is released under GPL 2.0 or later.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: [patch:SDL] Window default position
Somewhat better, but the window top bar is off the screen so I can't move the window around...
- Attachments
-
- default window position
- sdl_window_position.png (501.87 KiB) Viewed 2176 times
Re: [patch:SDL] Window default position
That is not centered. I'm telling it to be centered, but it is not. Sigh...
New version: center it horizontally, and hard code 100 as the top position. A bit stupid, but a reasonable default if it works, I think.
New version: center it horizontally, and hard code 100 as the top position. A bit stupid, but a reasonable default if it works, I think.
- Attachments
-
[The extension patch has been deactivated and can no longer be displayed.]
Any code by me in this post is released under GPL 2.0 or later.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: [patch:SDL] Window default position
That defaults to a too-low position...
- Attachments
-
- another default window position
- sdl_window_pos.png (501.11 KiB) Viewed 2169 times
- adrian_broher
- Programmer
- Posts: 1156
- Joined: Fri Mar 01, 2013 9:52 am
- Location: Germany
Re: [patch:SDL] Window default position
Why don't you let the window manager decide?
Pass SDL_WINDOWPOS_UNDEFINED as initial default. If the user wants to place it somewhere else then he can still drag it.
Edit: I see you already tried that in a previous patch. Did you check if you still get SDL_WINDOWPOS_UNDEFINED as value when you pull it out of the OptionsDB?
Pass SDL_WINDOWPOS_UNDEFINED as initial default. If the user wants to place it somewhere else then he can still drag it.
Edit: I see you already tried that in a previous patch. Did you check if you still get SDL_WINDOWPOS_UNDEFINED as value when you pull it out of the OptionsDB?
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz
Re: [patch:SDL] Window default position
Didn't test that precisely, but the constant makes the window behave as expected on linux and the settings window shows a very large number that seems like the sort of number the constant ought to be.
Any code by me in this post is released under GPL 2.0 or later.
Re: [patch:SDL] Window default position
The second and third version of the patch (sdl_default_window_pos_centered and sdl_default_window_pos.2) work perfectly on OSX. Both solve the issue that when maximizing the FO window, after exiting and restarting it is resized to a minimum size and put in the upper left corner of the screen. With these patches applied, that doesn't happen anymore, the FO window is restored exactly at the size it had when you exited FO the last time.
I'm very much in favor of committing this patch (after the issues on Windows have been resolved).
I'm very much in favor of committing this patch (after the issues on Windows have been resolved).
Re: [patch:SDL] Window default position
Well, it's always gonna be a bit off for someone. The main point is that the bar with which you can drag it to a good place is visible along with some edge that lets you resize it. Nonetheless, 100 may make this phenomenon unnecessarily common. I lowered it to 50. That should still avoid being below a possible top bar.Geoff the Medio wrote:That defaults to a too-low position...
- Attachments
-
[The extension patch has been deactivated and can no longer be displayed.]
Any code by me in this post is released under GPL 2.0 or later.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: [patch:SDL] Window default position
What version is patch 3 relative to? I don't have the lines being changed in HumanClientApp.cpp
Re: [patch:SDL] Window default position
Sorry, I accidentally left one of the commits that are part of this patch out. Here should be a working version.
- Attachments
-
[The extension patch has been deactivated and can no longer be displayed.]
Any code by me in this post is released under GPL 2.0 or later.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: [patch:SDL] Window default position
Better. It doesn't seem to put the window where I left it when I exit and restart...
However, it also doesn't save and restore the window size if I resize it small enough to actually fit on my (relatively small) laptop screen.
Not a major issue, really, but annoying...However, it also doesn't save and restore the window size if I resize it small enough to actually fit on my (relatively small) laptop screen.
- adrian_broher
- Programmer
- Posts: 1156
- Joined: Fri Mar 01, 2013 9:52 am
- Location: Germany
Re: [patch:SDL] Window default position
Could you please provide the value of the x and y position over a series of restarts? I suspect that we have different point of origins when calling SDL_CreateWindow and SDL_GetPosition. One function seems to consider the window decorations and the other one doesn't.Geoff the Medio wrote:Better. It doesn't seem to put the window where I left it when I exit and restart...Not a major issue, really, but annoying...
However, it also doesn't save and restore the window size if I resize it small enough to actually fit on my (relatively small) laptop screen.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: [patch:SDL] Window default position
After a fresh start (no config.xml present), config.xml has:adrian_broher wrote:Could you please provide the value of the x and y position over a series of restarts?
Code: Select all
<app-height>768</app-height>
<app-height-windowed>745</app-height-windowed>
<app-left-windowed>805240832</app-left-windowed>
<app-top-windowed>50</app-top-windowed>
<app-width>1024</app-width>
<app-width-windowed>1024</app-width-windowed>
Code: Select all
<app-height>768</app-height>
<app-height-windowed>725</app-height-windowed>
<app-left-windowed>805240832</app-left-windowed>
<app-top-windowed>50</app-top-windowed>
<app-width>1024</app-width>
<app-width-windowed>1277</app-width-windowed>