Ticket #47189: workaround-wxwidgets-fit-recovery.patch

File workaround-wxwidgets-fit-recovery.patch, 2.3 KB (added by RJVB (René Bertin), 9 years ago)
  • src/AutoRecovery.cpp

    Description: Workaround for wx bug causing layout problems in recovery dialog
     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.
    Author: Martin Steghöfer <martin@steghoefer.eu>
    Forwarded: lllucius@gmail.com, 2014-10-20
    Bug-Debian: http://bugs.debian.org/765341
    
    a b  
    3838public:
    3939   AutoRecoveryDialog(wxWindow *parent);
    4040
     41#if defined(__WXGTK__) && wxCHECK_VERSION(3, 0, 0)
     42   void OnShow(wxShowEvent & event);
     43#endif
     44
    4145private:
    4246   void PopulateList();
    4347   void PopulateOrExchange(ShuttleGui & S);
     
    6569   EVT_BUTTON(ID_RECOVER_ALL, AutoRecoveryDialog::OnRecoverAll)
    6670   EVT_BUTTON(ID_RECOVER_NONE, AutoRecoveryDialog::OnRecoverNone)
    6771   EVT_BUTTON(ID_QUIT_AUDACITY, AutoRecoveryDialog::OnQuitAudacity)
     72#if defined(__WXGTK__) && wxCHECK_VERSION(3, 0, 0)
     73   EVT_SHOW(AutoRecoveryDialog::OnShow)
     74#endif
    6875END_EVENT_TABLE()
    6976
    7077void AutoRecoveryDialog::PopulateOrExchange(ShuttleGui& S)
     
    102109   Center();
    103110}
    104111
     112#if defined(__WXGTK__) && wxCHECK_VERSION(3, 0, 0)
     113void AutoRecoveryDialog::OnShow(wxShowEvent & event)
     114{
     115   // Workaround for wxWidgets bug #16440:
     116   // http://trac.wxwidgets.org/ticket/16440
     117   // Fit() doesn't work correctly in some desktop environments
     118   // with GTK. But it does work after the first window of the
     119   // same style class has been shown on screen. So re-execute
     120   // Fit() and other methods that depend on its result AFTER
     121   // we know that the window has been shown.
     122   Fit();
     123   SetMinSize(GetSize());
     124   Center();
     125}
     126#endif
     127
    105128void AutoRecoveryDialog::PopulateList()
    106129{
    107130   mFileList->DeleteAllItems();