mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 05:25:54 +08:00
Fix window geometry shenanigans
This commit is contained in:
parent
08cbcd717e
commit
c05cdf8019
@ -1042,18 +1042,24 @@ void restore_window_size(wxTopLevelWindow *window, const std::string &name)
|
|||||||
|
|
||||||
void on_window_geometry(wxTopLevelWindow *tlw, std::function<void()> callback)
|
void on_window_geometry(wxTopLevelWindow *tlw, std::function<void()> callback)
|
||||||
{
|
{
|
||||||
tlw->Bind(wxEVT_CREATE, [=](wxWindowCreateEvent &event) {
|
#ifdef _WIN32
|
||||||
#ifdef __linux__
|
// On windows, the wxEVT_SHOW is not received if the window is created maximized
|
||||||
// On Linux, the geometry is only available after wxEVT_CREATE + CallAfter
|
// cf. https://groups.google.com/forum/#!topic/wx-users/c7ntMt6piRI
|
||||||
|
// OTOH the geometry is available very soon, so we can call the callback right away
|
||||||
|
callback();
|
||||||
|
#elif defined __linux__
|
||||||
|
tlw->Bind(wxEVT_SHOW, [=](wxShowEvent &evt) {
|
||||||
|
// On Linux, the geometry is only available after wxEVT_SHOW + CallAfter
|
||||||
// cf. https://groups.google.com/forum/?pli=1#!topic/wx-users/fERSXdpVwAI
|
// cf. https://groups.google.com/forum/?pli=1#!topic/wx-users/fERSXdpVwAI
|
||||||
tlw->CallAfter([=]() {
|
tlw->CallAfter([=]() { callback(); });
|
||||||
#endif
|
evt.Skip();
|
||||||
callback();
|
|
||||||
#ifdef __linux__
|
|
||||||
});
|
|
||||||
#endif
|
|
||||||
event.Skip();
|
|
||||||
});
|
});
|
||||||
|
#elif defined __APPLE__
|
||||||
|
tlw->Bind(wxEVT_SHOW, [=](wxShowEvent &evt) {
|
||||||
|
callback();
|
||||||
|
evt.Skip();
|
||||||
|
});
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void about()
|
void about()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user