Re: Re[2]: Mac shortcut keys issue. Keys being sent to parent frame window.

Tony Kennedy <[email protected]> Tue, 1 Apr 2025 04:32:39 -0700 (PDT)
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <[email protected]>
I've done a little experimentation on this today and seemed to have got 
something working. *But I'm really worried about any knock on effects.*

Two functions have been changed,  wxWidgetCocoaImpl::keyEvent in window.mm 
and - (void)sendEvent:(NSEvent *)anEvent in utils.mm (images below show the 
differences).

In the  wxWidgetCocoaImpl::keyEvent function (window.mm I think), for a key 
down event, it's sent to the menu first. If I re-order the function to what 
is below (let the control have a go first), copy/paste work. 

Are there any Mac specialists here that can comment on this change? 

Thanks in advance,

Tony.

On Wednesday, 26 March 2025 at 21:20:24 UTC Vadim Zeitlin wrote:

> On Tue, 25 Mar 2025 09:52:10 -0700 (PDT) Tony Kennedy wrote:
>
> TK> No problem. I'm not familiar with objective C at all and not even sure 
> if 
> TK> the code below is objective C or Swift.
>
> It's Objective-C++ (as indicated by .mm extension, rather than the
> standard .m for Objective-C), we don't use Swift.
>
> TK> I'm trying to trace things. In utils.m, I found the sendEvent 
> function. And 
> TK> in it, there is a test for NSKeyUp, and the Apple docs say that it's 
> TK> depreciated. It also says there is an AppKit bug.
> TK> 
> TK> https://developer.apple.com/documentation/appkit/nskeyup
> TK> 
> TK> I tried replacing NSKeyUp with NSEvent.EventType.keyUp 
> TK> <
> https://developer.apple.com/documentation/appkit/nsevent/eventtype/keyup>, 
>
> TK> but it refuses to compile so I'm stuck.
>
> What was the intention behind this change? NSKeyUp is perfectly fine...
>
> Perhaps it would be worth removing this "if" (or even this entire
> function) entirely -- maybe it's indeed why you get the events in a wrong
> window (although I'm not sure, as I'd expect the key window to be the
> palette window).
>
> Regards,
> VZ
>
> -- 
> TT-Solutions: wxWidgets consultancy and technical support
> https://www.tt-solutions.com/
>

-- 
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
--- 
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/wx-users/2f2ba49d-9f21-479e-8df9-ff227713476en%40googlegroups.com.
ChangeToUtilsMM.jpg (image/jpeg, 67.3 KB) - not displayed
ChangeToWindowMM.jpg (image/jpeg, 229.5 KB) - not displayed