From 830db47f50e73571814378b33768517a95696476 Mon Sep 17 00:00:00 2001 From: BusinessmanProgrammerSteve Date: Wed, 14 Apr 2010 18:32:03 +0000 Subject: [PATCH] Work-around for bug 154 --- src/AudacityApp.cpp | 5 +++++ src/AudacityApp.h | 7 +++++++ src/LabelTrack.cpp | 15 ++++++++++++++- src/TrackPanel.cpp | 11 +++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index ac21d8e07..9ec5799db 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -869,6 +869,11 @@ void AudacityApp::OnFatalException() // main frame bool AudacityApp::OnInit() { +#if defined(__WXGTK__) + // Workaround for bug 154 -- initialize to false + inKbdHandler = false; +#endif + #if defined(__WXMAC__) // Disable window animation wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); diff --git a/src/AudacityApp.h b/src/AudacityApp.h index c030c1658..66970ab7e 100644 --- a/src/AudacityApp.h +++ b/src/AudacityApp.h @@ -172,6 +172,13 @@ class AudacityApp:public wxApp { Importer *mImporter; wxLogWindow *mLogger; + +#if defined(__WXGTK__) + /** \brief This flag is set true when in a keyboard event handler. + * Used to work around a hang issue with ibus (bug 154) */ + bool inKbdHandler; +#endif + private: CommandHandler *mCmdHandler; FileHistory *mRecentFiles; diff --git a/src/LabelTrack.cpp b/src/LabelTrack.cpp index 9dfbcc8a1..d40af46e2 100644 --- a/src/LabelTrack.cpp +++ b/src/LabelTrack.cpp @@ -1123,7 +1123,20 @@ bool LabelTrack::IsTextClipSupported() CaptureEvents capture; #endif - return wxTheClipboard->IsSupported(wxDF_TEXT); +#if defined(__WXGTK__) + // AWD: work-around for bug 154: do not call wxClipboard::IsSupported() + // when handling a keyboard event + if (!wxGetApp().inKbdHandler) { +#endif + + return wxTheClipboard->IsSupported(wxDF_TEXT); + +#if defined (__WXGTK__) + } + + // In keyboard handler; return false for now + return false; +#endif } diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index 867102cec..01f39e789 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -4256,6 +4256,12 @@ void TrackPanel::OnKeyDown(wxKeyEvent & event) /// Allow typing into LabelTracks. void TrackPanel::OnChar(wxKeyEvent & event) { +#if defined (__WXGTK__) + // AWD: workaround for bug 154 + bool restore = wxGetApp().inKbdHandler; + wxGetApp().inKbdHandler = true; +#endif + // Only deal with LabelTracks Track *t = GetFocusedTrack(); if (!t || t->GetKind() != Track::Label) { @@ -4277,6 +4283,11 @@ void TrackPanel::OnChar(wxKeyEvent & event) Refresh( false ); else if (!event.GetSkipped()) RefreshTrack(t); + +#if defined (__WXGTK__) + // AWD: workaround for bug 154 + wxGetApp().inKbdHandler = restore; +#endif } /// Should handle the case when the mouse capture is lost.