1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-06 14:52:34 +02:00

Once again permit TAB navigation to pinned head button on Mac...

... But still don't let the ruler accept focus from a click on any platform
This commit is contained in:
Paul Licameli 2016-07-06 15:12:11 -04:00
parent 0f597ae98e
commit 4375010983
2 changed files with 24 additions and 2 deletions

View File

@ -3284,3 +3284,16 @@ void AdornedRulerPanel::GetMaxSize(wxCoord *width, wxCoord *height)
{ {
mRuler.GetMaxSize(width, height); mRuler.GetMaxSize(width, height);
} }
bool AdornedRulerPanel::s_AcceptsFocus{ false };
auto AdornedRulerPanel::TemporarilyAllowFocus() -> TempAllowFocus {
s_AcceptsFocus = true;
return std::move(TempAllowFocus{ &s_AcceptsFocus });
}
void AdornedRulerPanel::SetFocusFromKbd()
{
auto temp = TemporarilyAllowFocus();
SetFocus();
}

View File

@ -294,8 +294,9 @@ public:
~AdornedRulerPanel(); ~AdornedRulerPanel();
bool AcceptsFocus() const override { return false; } bool AcceptsFocus() const override { return s_AcceptsFocus; }
bool AcceptsFocusFromKeyboard() const override { return false; } bool AcceptsFocusFromKeyboard() const override { return true; }
void SetFocusFromKbd() override;
public: public:
int GetRulerHeight() { return GetRulerHeight(mShowScrubbing); } int GetRulerHeight() { return GetRulerHeight(mShowScrubbing); }
@ -357,6 +358,14 @@ public:
void DoDrawIndicator(wxDC * dc, wxCoord xx, bool playing, int width, bool scrub, bool seek); void DoDrawIndicator(wxDC * dc, wxCoord xx, bool playing, int width, bool scrub, bool seek);
void UpdateButtonStates(); void UpdateButtonStates();
private:
static bool s_AcceptsFocus;
struct Resetter { void operator () (bool *p) const { if(p) *p = false; } };
using TempAllowFocus = std::unique_ptr<bool, Resetter>;
public:
static TempAllowFocus TemporarilyAllowFocus();
private: private:
QuickPlayIndicatorOverlay *GetOverlay(); QuickPlayIndicatorOverlay *GetOverlay();
void ShowOrHideQuickPlayIndicator(bool show); void ShowOrHideQuickPlayIndicator(bool show);