1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-23 16:08:07 +02:00

Revert "Bug2267: Nyquist prompt should allow multiline input..."

This reverts commit 33bd2a4d93bbb1fc0dc3367896182b7f3678025a.
This commit is contained in:
Paul Licameli 2019-12-28 19:49:13 -05:00
parent 8c4bc6c91f
commit fb5e871d0a

View File

@ -11,7 +11,6 @@
#include "KeyboardCapture.h"
#if defined(__WXMAC__)
#include <wx/textctrl.h>
#include <AppKit/AppKit.h>
#include <wx/osx/private.h>
#elif defined(__WXGTK__)
@ -194,26 +193,20 @@ public:
return Event_Skip;
#ifdef __WXMAC__
// Bugs 1329 and 2107 (Mac only)
// Bug 2107 (Mac only)
// wxButton::SetDefault() alone doesn't cause correct event routing
// of key-down to the button when a text entry or combo has focus,
// but we can intercept wxEVT_CHAR_HOOK here and do it
if ( type == wxEVT_CHAR_HOOK &&
key.GetKeyCode() == WXK_RETURN ) {
const auto focus = wxWindow::FindFocus();
// Bug 2267 (Mac only): don't apply fix for 2107 when a text entry
// needs to allow multiple line input
const auto text = dynamic_cast<wxTextCtrl*>(focus);
if ( !text ) {
if (auto top =
dynamic_cast< wxTopLevelWindow* >(
wxGetTopLevelParent( focus ) ) ) {
if ( auto button =
dynamic_cast<wxButton*>( top->GetDefaultItem() ) ) {
wxCommandEvent newEvent{ wxEVT_BUTTON, button->GetId() };
button->GetEventHandler()->AddPendingEvent( newEvent );
return Event_Processed;
}
if (auto top =
dynamic_cast< wxTopLevelWindow* >(
wxGetTopLevelParent( wxWindow::FindFocus() ) ) ) {
if ( auto button =
dynamic_cast<wxButton*>( top->GetDefaultItem() ) ) {
wxCommandEvent newEvent{ wxEVT_BUTTON, button->GetId() };
button->GetEventHandler()->AddPendingEvent( newEvent );
return Event_Processed;
}
}
}