Check display area before moving window to the last saved position. #2600

This commit is contained in:
Alessandro Ranellucci 2015-01-30 13:21:07 +01:00
parent fe4f79ba90
commit e61deb3673

View File

@ -47,8 +47,14 @@ sub new {
$self->Fit;
$self->SetMinSize([760, 490]);
if (defined $Slic3r::GUI::Settings->{_}{main_frame_size}) {
$self->SetSize([ split ',', $Slic3r::GUI::Settings->{_}{main_frame_size}, 2 ]);
$self->Move([ split ',', $Slic3r::GUI::Settings->{_}{main_frame_pos}, 2 ]);
my $size = [ split ',', $Slic3r::GUI::Settings->{_}{main_frame_size}, 2 ];
$self->SetSize($size);
my $display = Wx::Display->new->GetClientArea();
my $pos = [ split ',', $Slic3r::GUI::Settings->{_}{main_frame_pos}, 2 ];
if (($pos->[X] + $size->[X]/2) < $display->GetRight && ($pos->[Y] + $size->[Y]/2) < $display->GetBottom) {
$self->Move($pos);
}
$self->Maximize(1) if $Slic3r::GUI::Settings->{_}{main_frame_maximized};
} else {
$self->SetSize($self->GetMinSize);