[macOS w/ SDL2] Assertion failure sending mouse click events

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Re: [macOS w/ SDL2] Assertion failure sending mouse click ev

Postby tarmac » Tue Mar 14, 2023 2:10 pm

Ah, I believe the problem is that SDL itself overrides sendEvent: https://github.com/libsdl-org/SDL/blob/ ... nts.m#L101

If I understand correctly, the message to CEF would get sent in the call in line 101. But since I swizzled the sendEvent method in NSApplication, the `CefScopedSendingEvent` would affect only the method call in line 104. So, I believe I should be extending/swizzling SDLApplication(haven't been able to do this yet since it looks like it isn't exposed by SDL :( )

I'll try to figure my way around SDLApplication, but does my understanding of the problem make sense?
tarmac
Newbie
 
Posts: 9
Joined: Tue Nov 08, 2022 5:08 am

Re: [macOS w/ SDL2] Assertion failure sending mouse click ev

Postby tarmac » Tue Mar 14, 2023 2:12 pm

magreenblatt wrote:You’ll likely need to start with a breakpoint in main() after the framework is loaded, or the file/line breakpoint in CEF/Chromium won’t resolve.


So I'm able to set a breakpoint, and the lldb output seems to indicate it found the correct method but the breakpoint doesn't get hit when I see the fatal error log message.
tarmac
Newbie
 
Posts: 9
Joined: Tue Nov 08, 2022 5:08 am

Re: [macOS w/ SDL2] Assertion failure sending mouse click ev

Postby magreenblatt » Tue Mar 14, 2023 4:49 pm

I would expect that FATAL error to crash your application. Something strange is going on there.

If Cocoa_DispatchEvent is calling back into Chromium (outside of CefScopedSendingEvent as you describe above), that might explain why you are still having the issue.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: [macOS w/ SDL2] Assertion failure sending mouse click ev

Postby tarmac » Wed Mar 15, 2023 7:15 am

magreenblatt wrote:If Cocoa_DispatchEvent is calling back into Chromium (outside of CefScopedSendingEvent as you describe above), that might explain why you are still having the issue.


Huh, the SDL API lets you poll for events and then handle them. So, if I understand correctly, even with `[SDLApplication sendEvent]` swizzled, the handling of the SDL event would always be outside of CefScopedSendingEvent.

That is, the call to sendEvent(and thus CefScopedSendingEvent scope) seems to happen when calling SDL_PollEvent while CEF is sent the event after the call to SDL_PollEvent.

Perhaps the way forward then is to attempt setting/unsetting the `g_handling_send_event` boolean in a function that includes both the polling and event handling?
tarmac
Newbie
 
Posts: 9
Joined: Tue Nov 08, 2022 5:08 am

Previous

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 103 guests