Skip to content

Commit

Permalink
Fix flickering issues in time boxes and meter panels
Browse files Browse the repository at this point in the history
Sometimes, resizing the window can cause the project selection, time
toolbars, and/or the input and output VU meter toolbars to flicker. A
simple fix is to set the background style to wxBG_STYLE_PAINT instead of
wxBG_STYLE_SYSTEM because, as the wxWidgets documentation recommends,
"you should change the background style to wxBG_STYLE_PAINT if you define
an EVT_PAINT handler which completely overwrites the window background".
(I'm under the impression that these widgets' paint handlers perform
their own erasing anyways).

Signed-off-by: Avery King <[email protected]>
(cherry picked from commit 4918dfd)
  • Loading branch information
Avery King committed Aug 29, 2024
1 parent e025a2b commit ec72fc8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/widgets/MeterPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ MeterPanel::MeterPanel(TenacityProject *project,
wxUnusedVar(MicMenu_xpm);
wxUnusedVar(PrefStyles);

SetBackgroundStyle(wxBG_STYLE_PAINT);

mStyle = mDesiredStyle;

mIsFocused = false;
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/NumericTextCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,8 @@ NumericTextCtrl::NumericTextCtrl(wxWindow *parent, wxWindowID id,
mAutoPos(options.autoPos)
, mType(type)
{
SetBackgroundStyle(wxBG_STYLE_PAINT);

mAllowInvalidValue = false;

mDigitBoxW = 11;
Expand Down
1 change: 0 additions & 1 deletion src/widgets/NumericTextCtrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ class TENACITY_DLL_API NumericTextCtrl final
void OnKeyDown(wxKeyEvent &event);
void OnKeyUp(wxKeyEvent &event);
void OnMouse(wxMouseEvent &event);
void OnErase(wxEraseEvent &event);
void OnPaint(wxPaintEvent &event);
void OnFocus(wxFocusEvent &event);
void OnContext(wxContextMenuEvent &event);
Expand Down

0 comments on commit ec72fc8

Please sign in to comment.