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

[Feature] Handle window coordinates of launched game #3516

Open
d-faure opened this issue Jan 16, 2022 · 2 comments
Open

[Feature] Handle window coordinates of launched game #3516

d-faure opened this issue Jan 16, 2022 · 2 comments
Labels
Enhancement New features or functionality GUI Issues affecting the interactive GUI

Comments

@d-faure
Copy link

d-faure commented Jan 16, 2022

Problem

I have recently upgraded my regular KSP host and my physical screen & desk setup has indeed changed. While I was used to play in windowed mode with the AnyRes Continued mod to accommodate to the screen size, I'm now forced to move the game window each time I start to have it displayed on the right place on my extended desktop.

Suggestions

As an unconditional CKAN user, I already wrote some powershell to automate this window move from the CKAN's Game command-line option, but I'm sure this kind of feature could be advantageously integrated into the tool itself.

For the record, the related power script : https://gist.github.com/d-faure/543e8f74a1a7573dd5b7cab872ea56ba

@HebaruSan HebaruSan added Enhancement New features or functionality GUI Issues affecting the interactive GUI labels Jan 16, 2022
@HebaruSan
Copy link
Member

Hi @d-faure, thanks for the submission.

Would you mind adding some details about what exactly CKAN would need to do for this? It's not clear what sort of settings or capabilities would be needed or what problem we would be solving from the current description. Is this mainly about positioning KSP on a non-primary monitor? I've been browsing your PowerShell script (thanks for the link!), but there's a limit to how much we can glean from that. A good start would be to explain in detail the problems that you have if you don't use the script (maybe with screenshots). It's apparent that the window isn't where you want it to be, but we don't know where it is or where you want it to be (just that they're not the same).

Also, please keep in mind that CKAN runs on Windows, Mac, and Linux, so any features we might add in this space would need to be cross-platform as well (unlike the functions you're using from the Windows-only user32.dll). The different platforms can be pretty divergent when it comes to what their GUIs can do and how they work (e.g., the concept of MainWindowHandle that you're using may not exist on Linux). Your PowerShell script might end up being the optimal solution for Windows users.

@d-faure
Copy link
Author

d-faure commented Jan 17, 2022

My screen configuration is something like:

       +----------+
+-----+|          |
|  1  ||    2     |
+-----++----------+

I already found that I could easily have KSP in a secondary screen centered window with a command line invocation like:

KSP_x64.exe -monitor 2

and thanks to the AnyRes mod, also have this window enlarged almost as I want. BUT the resulting game window will be kept centered at start, whereas my desired configuration was to keep some extraneous space on the bottom side only.
In short, instead of something like at left, I would prefer the right solution:

+-------------------+        +-------------------+
|  (wasted space)   |        |+-----------------+|
|+-----------------+|        ||       KSP       ||
||      KSP        ||  ===>  ||                 ||
||                 ||        |+-----------------+|
|+-----------------+|        |(more useful space)|
|(not enough space) |        |                   |
+-------------------+        +-------------------+

I found that by default (when starting KSP without screen/resolution handling option), the game window is always located to (0,0), ie. the top-left corner of the first screen, and the purpose of the powershell was to simply put the game window where I want at start.

A quick look at https://askubuntu.com/questions/613973/how-can-i-start-up-an-application-with-a-pre-defined-window-size-and-position gives some hint on the unix situation, which doesn't seem any better either.

Anyway, if this kind of feature implementation would merely rely on an external scripted launch, it would be convenient for such custom launchers to get more details (via environment variables for example) on the current game instance (eg. instance name, working directory...),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New features or functionality GUI Issues affecting the interactive GUI
Projects
None yet
Development

No branches or pull requests

2 participants