Package: audacity / 2.2.2-1

0002-workaround-wxwidgets-fit-recovery.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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/src/AutoRecovery.cpp
+++ b/src/AutoRecovery.cpp
@@ -46,6 +46,10 @@ class AutoRecoveryDialog final : public
 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, wx
    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::PopulateOrExcha
    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();