Repository navigation
Made save / restore size and position of the main window using wxConfig - #30
ManeFunction wants to merge 13 commits into
Conversation
|
Thanks for the PR! I will take a look when I have a chance. |
|
I tested it on both mac and windows, and while this works on mac, it does not work on windows. The call to config->Read on windows always fails. Not sure if this is an issue with wxConfig or with our usage of it here. |
|
Thank you for the test! I'll check this out a bit later if no one helps with this. |
…ave the latest visible state
|
Hello, @Ravbug! I’m really sorry this fix took so long. I forgot about this PR after I stopped using Native Hub. It launches the standard Hub, which makes the whole thing feel kind of pointless, but I’d like to start using it again, so I hope I can get this fixed, if you don’t mind. As for this PR, I’ve updated the branch, added a few features (like saving the state of the projects table), and fixed the Windows-related issue. It actually affected macOS as well, but only partially. |
|
I'm hesitant to merge this because of the many edge cases that could result in the app's window becoming inaccessible, eg, the app is quit then the monitor the window was on is disconnected, so the window attempts to restore to an invalid coordinate on its next launch and ends up offscreen. Based on my research I don't think wxWidgets currently provides a good way of telling the OS to handle window restore, and I don't think UnityHubNative should attempt handling this itself. For now I think I'll leave this PR here in case anyone wants this in their own fork. Thank you for your effort though! |
…cover the cases of out of screen window
|
Thank you for pointing that out! I hadn’t considered that case, but I think we can easily fix it. Take a look: I’ve added a check that runs when the hub launches, checks its position, and brings it back into the visible viewport if it’s off-screen. Also, to be extra safe, I’ve added a “Window > Center Window on Current Display” menu item that brings the window back onto your current display. But honestly, with the first fix in place, that shouldn’t happen anymore. |
|
Hello, @Ravbug! I've done some more testing and found that on Linux, Wayland doesn't allow applications to change their window positions from an apps code. So maybe you're right, and Unity Hub Native shouldn't manage its own window position. In that case, I'd like to submit a separate PR just to save the state of the projects table (column widths and the current sort order). What do you think? UPD: I've created a new PR with just a table state saving. |
|
I'm closing this due to the aforementioned issues with window restore. |
Added a feature to keep main window's size and position, and not reset it on each launch. Used default wxConfig feature already included in project, so no any new tools here.
Tested on Mac, can't test it on Windows or Linux at the time. Sorry if I did something wrong, C++ is not my main language.