Browse Source

Center DIALOG_SHIM position if it would have appeared off the screen

DIALOG_SHIM stores the dialog position, so every time it is shown, it is
displayed in the same location. This caused problems on multidisplay
setups, as dialogs could show up off the screen if the original display
has been detached in the meantime, effectively making them inaccesible
to the user.

Fixes: lp:1756623
* https://bugs.launchpad.net/kicad/+bug/1756623
pull/5/merge
Maciej Suminski 8 years ago
parent
commit
b40bf4c0ea
  1. 8
      common/dialog_shim.cpp

8
common/dialog_shim.cpp

@ -27,7 +27,7 @@
#include <wx/evtloop.h>
#include <pgm_base.h>
#include <eda_rect.h>
#include <wx/display.h>
/// Toggle a window's "enable" status to disabled, then enabled on destruction.
class WDO_ENABLE_DISABLE
@ -178,6 +178,12 @@ bool DIALOG_SHIM::Show( bool show )
std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
0 );
}
// Be sure that the dialog appears in a visible area
// (the dialog position might have been stored at the time when it was
// shown on another display)
if( wxDisplay::GetFromWindow( this ) == wxNOT_FOUND )
Centre();
}
else
{

Loading…
Cancel
Save