Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] OpenTTD not store position on screen #6229

Closed
DorpsGek opened this issue Feb 7, 2015 · 6 comments
Closed

[Windows] OpenTTD not store position on screen #6229

DorpsGek opened this issue Feb 7, 2015 · 6 comments
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

DorpsGek commented Feb 7, 2015

admini opened the ticket and wrote:

Hi!

I am using OpenTTD 1.4.4 (and all lower versions) on large screen, and prefer to use some position on the screen.

close& open, the size is correct but the position on the screen is the center from top and center from left, while ignoring original position or windows taskbar.

can be tested in any version, move, close, open.

Thanks

Reported version: 1.4.4
Operating system: Windows


This issue was imported from FlySpray: https://bugs.openttd.org/task/6229
@DorpsGek
Copy link
Member Author

DorpsGek commented Feb 8, 2015

inz_germanista wrote:

It's not due to OpenTTD itself but MS Windows and it's Window Placement. I'm using Linux and it's Compiz Window Manager has build in plugin to place any chosen program window excacly in the fixed place on the desktop every time the window is opened. Try find some software that would add this functionality to MS Windows or write it yourself if you know any programing language, it's not hard but requires usage of WinAPI.

For excample: http://www.desksoft.com/WindowManager.htm but it's comercial solution that costs $10 to buy. Trial is fully functional during the evaluation period.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6229#comment13767

@DorpsGek
Copy link
Member Author

DorpsGek commented Mar 4, 2015

vtk wrote:

Firefox seems to restore its exact previous window positions when restoring session on launch. I'm boldly assuming the Windows API call to achieve a specific position (rather than whatever position Windows wants) for a created window is trivial. Note, care should be taken to prevent the window from appearing completely off-screen (such as, if the user is running a much lower screen resolution than the last time OpenTTD was run).


This comment was imported from FlySpray: https://bugs.openttd.org/task/6229#comment13805

@DorpsGek
Copy link
Member Author

DorpsGek commented Mar 5, 2015

inz_germanista wrote:

Of course there is something in WinAPI, to be excact each window has four integer variables (Top, Left, Width and Hight) and there is also SetWindowPos function in WinAPI to override current position and size of window and GetClientRect function to retrive current values (as they are WinAPI they require handle to window as a parameter). And no, there isn't WinAPI function to archive the goal. Applications that can do such thing with itself and it's windows calls those two function, GetClientRect before quiting and store those values somewhere (application ini file, windows register, wherever) and after the application is once more time opened and MS-Windows done with placing the app's windows where it likes to be placed application itsefl calls the SetWindowPos function with previous saved values, this is the only solution. This is the only solution and its common knowledge allong programers working with MS-Windows. Borland's VCL has for excample possibility to make TForm shown in predesigned place, but it's mechanism does the same thing but uses values stored as constants in application binaries (.exe file).
The comercial solution I gave above does excacly the same thing but as it doesn't know when application is about to be clesed then it sets a hook on each supported (chosen by user) application and when in the communicates query there is MoveWindow saves the rect of last one on the query (the one with final destantion and size of window) and if it detects the application is reopened it sets the values back to last saved value.
Now you know how it works, and if you know any programing language you can write yourself such tool to operate with OpenTTD. I won't do such thing because I don't need this since Compiz Window Placement does it for me and I don't have time to write some app that isn't needed by myself. And also I'm preety sure that this function if programed wouldn't be included in OpenTTD because it's strictly MS-Windows only feature to override one of huge collection of MS's OS design flosses. By the way WinAPI has only two functions that overrides default (stupid) window placement mechanism: Title all windows and Cascede them, and all of those is since Windows 3.0.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6229#comment13806

@DorpsGek
Copy link
Member Author

andythenorth wrote:

See also https://bugs.openttd.org/task/4721


This comment was imported from FlySpray: https://bugs.openttd.org/task/6229#comment14567

@DorpsGek
Copy link
Member Author

andythenorth wrote:

Cleaning Flyspray. This is OS specific, so setting it to low priority. Leaving it open as the request seems to come up moderately frequently, might be solvable in future.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6229#comment14568

@DorpsGek DorpsGek added component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) enhancement labels Apr 7, 2018
@andythenorth
Copy link
Contributor

TMWFTLB solving OS-specific issue. Closing, thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

2 participants