From: Martin Steghöfer Date: Wed, 6 Jun 2018 10:55:07 +0000 (+0100) Subject: Workaround for wx bug causing layout problems in recovery dialog X-Git-Tag: archive/raspbian/3.6.3+dfsg-1+rpi1~1^2^2^2^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f2c13c7d1abb70f4428aa4c56bfd80d7ca111d94;p=audacity.git Workaround for wx bug causing layout problems in recovery dialog Forwarded: lllucius@gmail.com, 2014-10-20 Bug-Debian: http://bugs.debian.org/765341 Workaround for a bug in wxWidgets 3.0 that causes the Fit() function to fail in certain desktop environments (gnome, xfce) before the first window of the same style class is shown on screen (http://trac.wxwidgets.org/ticket/16440). As a workaround, call Fit() and other methods that depend on its results again *after* we know that the window has been shown. While the bug may affect other calls to Fit() on a low level, the workaround is necessary only for the recovery dialog, which is particularly vulnerable because: 1. It is shown very, very early in the program execution and therefore very likely to be the first dialog of its style class shown on screen. 2. It doesn't have scrollbars or flexible-size controls that could compensate the wrong dialog size. Gbp-Pq: Name 0002-workaround-wxwidgets-fit-recovery.patch --- diff --git a/src/AutoRecovery.cpp b/src/AutoRecovery.cpp index 3c658934..7b185e60 100644 --- a/src/AutoRecovery.cpp +++ b/src/AutoRecovery.cpp @@ -46,6 +46,10 @@ class AutoRecoveryDialog final : public wxDialogWrapper public: AutoRecoveryDialog(wxWindow *parent); +#if defined(__WXGTK__) && wxCHECK_VERSION(3, 0, 0) + void OnShow(wxShowEvent & event); +#endif + private: void PopulateList(); void PopulateOrExchange(ShuttleGui & S); @@ -74,6 +78,9 @@ BEGIN_EVENT_TABLE(AutoRecoveryDialog, wxDialogWrapper) EVT_BUTTON(ID_RECOVER_ALL, AutoRecoveryDialog::OnRecoverAll) EVT_BUTTON(ID_RECOVER_NONE, AutoRecoveryDialog::OnRecoverNone) EVT_BUTTON(ID_QUIT_AUDACITY, AutoRecoveryDialog::OnQuitAudacity) +#if defined(__WXGTK__) && wxCHECK_VERSION(3, 0, 0) + EVT_SHOW(AutoRecoveryDialog::OnShow) +#endif END_EVENT_TABLE() void AutoRecoveryDialog::PopulateOrExchange(ShuttleGui& S) @@ -115,6 +122,22 @@ void AutoRecoveryDialog::PopulateOrExchange(ShuttleGui& S) Center(); } +#if defined(__WXGTK__) && wxCHECK_VERSION(3, 0, 0) +void AutoRecoveryDialog::OnShow(wxShowEvent & event) +{ + // Workaround for wxWidgets bug #16440: + // http://trac.wxwidgets.org/ticket/16440 + // Fit() doesn't work correctly in some desktop environments + // with GTK. But it does work after the first window of the + // same style class has been shown on screen. So re-execute + // Fit() and other methods that depend on its result AFTER + // we know that the window has been shown. + Fit(); + SetMinSize(GetSize()); + Center(); +} +#endif + void AutoRecoveryDialog::PopulateList() { mFileList->DeleteAllItems();