separate non-native key handling from IsUserPane
NSOpenGLView is needed under 10.14 as a native view, but it doesn’t have its own native key handling, therefore use the same code we have for non-native custom views.
This commit is contained in:
@@ -897,7 +897,7 @@ static void SetDrawingEnabledIfFrozenRecursive(wxWidgetCocoaImpl *impl, bool ena
|
||||
- (BOOL) canBecomeKeyView
|
||||
{
|
||||
wxWidgetCocoaImpl* viewimpl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||
if ( viewimpl && viewimpl->IsUserPane() && viewimpl->GetWXPeer() )
|
||||
if ( viewimpl && viewimpl->HasUserKeyHandling() && viewimpl->GetWXPeer() )
|
||||
return viewimpl->GetWXPeer()->AcceptsFocus();
|
||||
return NO;
|
||||
}
|
||||
@@ -2101,7 +2101,7 @@ void wxCocoaGesturesImpl::TouchesEnded(NSEvent* event)
|
||||
void wxWidgetCocoaImpl::insertText(NSString* text, WXWidget slf, void *_cmd)
|
||||
{
|
||||
bool result = false;
|
||||
if ( IsUserPane() && !m_hasEditor && [text length] > 0)
|
||||
if ( HasUserKeyHandling() && !m_hasEditor && [text length] > 0)
|
||||
{
|
||||
if ( m_lastKeyDownEvent!=NULL && [text isEqualToString:[m_lastKeyDownEvent characters]])
|
||||
{
|
||||
@@ -2190,7 +2190,7 @@ bool wxWidgetCocoaImpl::performKeyEquivalent(WX_NSEvent event, WXWidget slf, voi
|
||||
|
||||
bool wxWidgetCocoaImpl::acceptsFirstResponder(WXWidget slf, void *_cmd)
|
||||
{
|
||||
if ( IsUserPane() )
|
||||
if ( HasUserKeyHandling() )
|
||||
return m_wxPeer->AcceptsFocus();
|
||||
else
|
||||
{
|
||||
@@ -2512,8 +2512,8 @@ void wxOSXCocoaClassAddWXMethods(Class c, wxOSXSkipOverrides skipFlags)
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxWidgetCocoaImpl , wxWidgetImpl);
|
||||
|
||||
wxWidgetCocoaImpl::wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, bool isRootControl, bool isUserPane ) :
|
||||
wxWidgetImpl( peer, isRootControl, isUserPane )
|
||||
wxWidgetCocoaImpl::wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, bool isRootControl, bool isUserPane, bool wantsKey ) :
|
||||
wxWidgetImpl( peer, isRootControl, isUserPane, wantsKey )
|
||||
{
|
||||
Init();
|
||||
m_osxView = w;
|
||||
@@ -2528,6 +2528,23 @@ wxWidgetCocoaImpl::wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, bool isRoo
|
||||
[m_osxView release];
|
||||
}
|
||||
|
||||
wxWidgetCocoaImpl::wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, bool isRootControl, bool isUserPane ) :
|
||||
wxWidgetImpl( peer, isRootControl, isUserPane )
|
||||
{
|
||||
Init();
|
||||
m_osxView = w;
|
||||
|
||||
// check if the user wants to create the control initially hidden
|
||||
if ( !peer->IsShown() )
|
||||
SetVisibility(false);
|
||||
|
||||
// gc aware handling
|
||||
if ( m_osxView )
|
||||
CFRetain(m_osxView);
|
||||
[m_osxView release];
|
||||
}
|
||||
|
||||
|
||||
wxWidgetCocoaImpl::wxWidgetCocoaImpl()
|
||||
{
|
||||
Init();
|
||||
@@ -3658,7 +3675,7 @@ bool wxWidgetCocoaImpl::DoHandleKeyEvent(NSEvent *event)
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( IsUserPane() && [event type] == NSKeyDown)
|
||||
if ( HasUserKeyHandling() && [event type] == NSKeyDown)
|
||||
{
|
||||
// Don't fire wxEVT_KEY_DOWN here in order to allow IME to intercept
|
||||
// some key events. If the event is not handled by IME, either
|
||||
|
||||
Reference in New Issue
Block a user