Work around 3D scene focus after de-activation of the main
window without having to resort to CallAfter(), which breaks
on Linux with some window managers that follow mouser cursor.
Fixes #5620 #6870 #6992

3622f06bed was not a correct solution,
it broke focus for non-modal windows.
Fixes #7419

The actual issue seems to be caused by wxProgressDialog not playing
well with modal dialogs closed just before wxProgressDialog opens.
If wxProgressDialog parent was not a main frame, keyboard focus
was not restored correctly after the wxProgressDialog closed.
This commit is contained in:
Vojtech Bubnik 2021-12-05 09:09:34 +01:00
parent d44525d916
commit bfce4f6901
6 changed files with 6 additions and 67 deletions

View file

@ -2101,21 +2101,6 @@ void MainFrame::technology_changed()
}
#if defined(__linux__) || defined(_WIN32)
// wxWidgets callback to enable / disable window and all its children windows.
// called by wxWindowDisabler when entering / leaving modal dialog loop.
// Unfortunately the wxWindowDisabler calls Enable(true) after the wxEVT_ACTIVATE event is processed
// while MainFrame is not yet enabled, thus restoring focus in OnActivate() handler fails
// and we need to do it now.
bool MainFrame::Enable(bool enable)
{
bool retval = DPIFrame::Enable(enable);
if (enable && retval)
this->plater()->restore_keyboard_focus();
return retval;
}
#endif
//
// Called after the Preferences dialog is closed and the program settings are saved.
// Update the UI based on the current preferences.