Resize GameArea after MainFrame initialization
The GameArea was setting incorrect minimum size during initialization due to the MainFrame not being entirely loaded, this caused the MainFrame to not be resized properly on initialization. Resetting the MainFrame minimum size after everything has been loaded fixes the issue. This also changes MainFrame to ignore events sent before initialization is complete, which should speed up startup a bit. Fixes #1186
This commit is contained in:
parent
71ca0fb270
commit
bf2452aab9
|
@ -2813,5 +2813,12 @@ bool MainFrame::BindControls()
|
|||
panel->SetFrameTitle();
|
||||
// All OK; activate idle loop
|
||||
panel->SetExtraStyle(panel->GetExtraStyle() | wxWS_EX_PROCESS_IDLE);
|
||||
|
||||
// Re-adjust size now to nudge some sense into Widgets.
|
||||
panel->AdjustSize(false);
|
||||
|
||||
// Frame initialization is complete.
|
||||
init_complete_ = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -930,6 +930,9 @@ void MainFrame::OnMenu(wxContextMenuEvent& event)
|
|||
}
|
||||
|
||||
void MainFrame::OnMove(wxMoveEvent&) {
|
||||
if (!init_complete_) {
|
||||
return;
|
||||
}
|
||||
if (!IsFullScreen() && !IsMaximized()) {
|
||||
const wxPoint window_pos = GetScreenPosition();
|
||||
OPTION(kGeomWindowX) = window_pos.x;
|
||||
|
@ -954,6 +957,9 @@ void MainFrame::OnMoveEnd(wxMoveEvent&) {
|
|||
void MainFrame::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
wxFrame::OnSize(event);
|
||||
if (!init_complete_) {
|
||||
return;
|
||||
}
|
||||
const wxRect window_rect = GetRect();
|
||||
const wxPoint window_pos = GetScreenPosition();
|
||||
|
||||
|
|
|
@ -356,6 +356,9 @@ private:
|
|||
JoystickPoller* jpoll = nullptr;
|
||||
// quicker & more accurate than FindFocus() != NULL
|
||||
bool focused;
|
||||
// One-time toggle to indicate that this object is fully initialized. This
|
||||
// used to filter events that are sent during initialization.
|
||||
bool init_complete_ = false;
|
||||
#ifndef NO_LINK
|
||||
const config::OptionsObserver gba_link_observer_;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue