Closed KeyWorksRW closed 8 months ago
There doesn't seem to be a way around this. I tried the following:
#if defined(__UNIX__)
// Check if running under WSL
bool isRunningUnderWSL = std::getenv("WSLENV") != nullptr;
if (isRunningUnderWSL)
{
GtkWindow* gtkWindow = GTK_WINDOW(GetHandle());
wxDisplay desktop(this);
wxRect rect_parent(desktop.GetClientArea());
wxRect rect_this(GetSize());
rect_this.x = rect_parent.x + (rect_parent.width - rect_this.width) / 2;
rect_this.y = rect_parent.y + (rect_parent.height - rect_this.height) / 3;
gtk_window_move(gtkWindow, (rect_parent.width - rect_this.width) / 2, (rect_parent.height - rect_this.height) / 3);
// gtk_window_set_position(gtkWindow, GTK_WIN_POS_CENTER_ON_PARENT);
}
#endif
However this still failed to move the window. I also tried calling gtk_window_set_position()
(see commented-out line) and that too did no change the window position.
Note that this is also going to be why wxPersistenceManager
doesn't work.
All of this means the problem will persist until/if there is a version of WSL2 that correctly maps the gtk window movement calls.
Description:
On WSL2, the code to launch the Startup Dialog is not working correctly -- the dialog appears in different places every time the app is launched. This used to happen when the dialog only called Center(). The current code uses a modified version of the wxWidgets Center() code, but that also doesn't work. This may ultimately be an issue with wxWidgets, but it needs investigation in wxUiEditor running on WSL2 first to confirm (and find a fix).