Fix some cases where the detached video dialog would get set to bogus sizes

At very large and very small sizes, setting the window's size with
SetSize may not actually result in the window changing to the requested
size.  Once this happened future adjustments to the size were incorrect,
and the video display would sometimes not fit in the window, and on os x
the window could get set to a negative size, with weird results.
This commit is contained in:
Thomas Goyne 2012-10-27 20:44:09 -07:00
parent f35e10c76a
commit 0e7501f45c

View file

@ -318,8 +318,11 @@ void VideoDisplay::UpdateSize() {
if (freeSize) {
wxWindow *top = GetParent();
while (!top->IsTopLevel()) top = top->GetParent();
top->SetSize(top->GetSize() + videoSize - GetClientSize());
SetClientSize(videoSize);
wxSize cs = GetClientSize();
wxSize oldSize = top->GetSize();
top->SetSize(top->GetSize() + videoSize - cs);
SetClientSize(cs + top->GetSize() - oldSize);
}
else {
SetMinClientSize(videoSize);
@ -378,7 +381,7 @@ void VideoDisplay::OnKeyDown(wxKeyEvent &event) {
void VideoDisplay::SetZoom(double value) {
zoomValue = std::max(value, .125);
size_t selIndex = value / .125 - 1;
size_t selIndex = zoomValue / .125 - 1;
if (selIndex < zoomBox->GetCount())
zoomBox->SetSelection(selIndex);
zoomBox->ChangeValue(wxString::Format("%g%%", zoomValue * 100.));