mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-02 16:49:41 +02:00
Bug2267: Nyquist prompt should allow multiline input...
... Fixing a side effect of the fix for bugs 2107 and 1329 which was done at commit da66806 in version 2.3.3
This commit is contained in:
parent
7171220630
commit
33bd2a4d93
@ -11,6 +11,7 @@
|
||||
#include "KeyboardCapture.h"
|
||||
|
||||
#if defined(__WXMAC__)
|
||||
#include <wx/textctrl.h>
|
||||
#include <AppKit/AppKit.h>
|
||||
#include <wx/osx/private.h>
|
||||
#elif defined(__WXGTK__)
|
||||
@ -193,20 +194,26 @@ public:
|
||||
return Event_Skip;
|
||||
|
||||
#ifdef __WXMAC__
|
||||
// Bug 2107 (Mac only)
|
||||
// Bugs 1329 and 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 ) {
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user