Page 1 of 2

Mouse events not arriving on CEF Browser View on MAC 13

PostPosted: Thu Aug 18, 2022 6:30 pm
by ccbournejr
We are a CEF application that uses full screen mode as a kiosk -- driven run-time by internal application aspects. We have recently tried to do a certification test on MAC OS Ventura 13.0 Beta and when exiting full screen mode, NSEvents are not being realized on our broswer views. (* The CEF message pumps still seems to be providing NSEvents on our NSApplication *)
In an attempt to provide the simplest recreation and eliminate our application parts, we've reproduced the problem on cefsimple in the example distribution. By adding a simple mechanism in sendEvent of cefsimple_mac.mm::SimpleApplication, you can clearly see that on exit of fullscreen Version 13.0 does not work as expected. The code below is our addition to cefsimple and we've ensured that it works on CEF 96 / Big Sur, but not on CEF 96 / Ventura. (* Our production application currently runs CEF 103 *)

I used a simple TAB to toggle in/out of full screen. To keep the logic minimal and still see google.com operate in cef simple.

Code: Select all
    // add toggle state to @interface SimpleApplication
    BOOL toggleFull;   


Code: Select all
- (void)sendEvent:(NSEvent*)event {
  CefScopedSendingEvent sendingEventScoper;

    // simple addition to toggle full screen on TAB press
    if (event.type == NSEventTypeKeyDown && event.keyCode == 48) {
        if (toggleFull == TRUE) {
            toggleFull = FALSE;
            [self.keyWindow.contentView exitFullScreenModeWithOptions:[NSDictionary dictionary]];
       } else {
            toggleFull = TRUE;
            [self.keyWindow.contentView enterFullScreenMode:[NSScreen mainScreen] withOptions:nil ];
       }
    }
    // end ADDITION

    [super sendEvent:event];
}


Any suggestions would be great,
Thanks

Re: Mouse events not arriving on CEF Browser View on MAC 13

PostPosted: Tue Aug 23, 2022 4:15 am
by sjames1958
Anyone have any insight on this? This is going to be critical for us to be able to run on macOS 13.

Re: Mouse events not arriving on CEF Browser View on MAC 13

PostPosted: Tue Aug 23, 2022 8:17 am
by magreenblatt
Have you tried using CefKeyboardHandler to capture the key event?

Re: Mouse events not arriving on CEF Browser View on MAC 13

PostPosted: Tue Aug 23, 2022 9:01 am
by ccbournejr
Did you see the addition to the CefSimple? The sendEvent is only to allow for enter/exit fullScreenMode in the AppKit via a TAB press to reproduce the problem.
The hover and mouse click events are not arriving on the UI side (only through observing that they aren't in the browser view) in Ventura 13 MacOs

Thanks,

Re: Mouse events not arriving on CEF Browser View on MAC 13

PostPosted: Tue Aug 23, 2022 9:36 am
by magreenblatt
Your meaning is not clear. Are you intentionally trying to disable all mouse and keyboard events, or are they just not working in the browser view? Are they only not working in full screen mode?

Re: Mouse events not arriving on CEF Browser View on MAC 13

PostPosted: Tue Aug 23, 2022 10:37 am
by ccbournejr
Upon exiting full screen mode, we are not seeing the mouse events on the UI browser side (which is seemingly an internal function of the CEF) in Ventura 13 beta MacOs.

I can reproduce the exact behavior on cefSimple on Ventura 13 beta MacOs. By adding a keystroke to enter and exit full screen mode (above example used TAB), the UI Browser View can no longer process mouse events for the default web page google.com

Code: Select all
CefSimple


              UI google.com

                     │                        │
                     │                        │
                     │                        │
            ┌────────┴─────────────┐          │
            │ Mouse hover          │          │
            │ Mouse click          │          │
            │ Works as expected    │          │
            └────────┬─────────────┘          │
                     │                        │
                     │       Press TAB        │
                     ├───────────────────────►│
                     │                        │
                     │                  ┌─────┴────────────────┐
                     │                  │ Enter full screen    │
                     │                  │                      │
                     │                  └─────┬────────────────┘
                     │                        │
                     │                        │
            ┌────────┴─────────────┐          │
            │ Mouse hover          │          │
            │ Mouse click          │          │
            │ Works as expected    │          │
            └────────┬─────────────┘          │
                     │                        │
                     │       Press TAB        │
                     ├───────────────────────►│
                     │                        │
                     │                  ┌─────┴────────────────┐
                     │                  │ Exit full sreen      │
                     │                  │                      │
                     │                  └─────┬────────────────┘
                     │                        │
            ┌────────┴─────────────┐          │
            │ Mouse hover          │          │
            │ Mouse click          │          │
            │ Do not work on       │          │
            │   Ventura 13 MacOS   │          │
            └────────┬─────────────┘          │
                     │                        │
                     │                        │
                     │                        │
                     │                        │



This is the same behavior we see on our production application on R13 / CEF 103.

Re: Mouse events not arriving on CEF Browser View on MAC 13

PostPosted: Tue Aug 23, 2022 10:51 am
by magreenblatt
Thanks for the clarification.

Is the behavior the same if you enter/exit full screen mode using the window buttons? How does it behave in Google Chrome when you enter/exit full screen mode?

Mac 13 beta only became available for download in mid-July, so I would not expect any Chromium-related fixes before version 106 at the earliest. If the problem reproduces in Google Chrome I suggest finding/filing a bug at https://crbug.com. You can find a list of known issues here: https://bugs.chromium.org/p/chromium/is ... tura&can=1

Re: Mouse events not arriving on CEF Browser View on MAC 13

PostPosted: Tue Aug 23, 2022 10:59 am
by ccbournejr
Thanks for the response.

The full screen via the windows buttons works on R13. I only see the behavior when I use the programmatic AppKit interfaces.

I'll look to open a ticket.

Re: Mouse events not arriving on CEF Browser View on MAC 13

PostPosted: Sat Sep 03, 2022 6:54 pm
by ccbournejr
We've discovered what is happening when Chromium exits full screen in R13.
There's a method in render_widget_host_view_cocoa.mm that is attempting to discern whether a mouse event should be processed or ignored. It is not working correctly upon exiting full screen. It finds the contentView to be null.
In the code snippet below, the window has a null contentView upon exiting full screen:

Ventura beta:
first window after launch:
window 0x7fab55e0fbf0, contentView 0x7fab55a1ac50, view 0x7fab5708a400, self 0x7fab5708a400
full screen mode:
window 0x7fab55d326c0, contentView 0x7fab55a1ac50, view 0x7fab5708a400, self 0x7fab5708a400
exit full screen mode:
window 0x7fab55e0fbf0, contentView 0x0, view 0x0, self 0x7fab5708a400

Prior MacOs versions:
first window after launch:
window 0x7fa98a157870, contentView 0x7fa98973dc40, view 0x7fa98b8f8600, self 0x7fa98b8f8600
full screen mode:
window 0x7fa989758910, contentView 0x7fa98973dc40, view 0x7fa98b8f8600, self 0x7fa98b8f8600
exit full screen mode:
window 0x7fa98a157870, contentView 0x7fa98973dc40, view 0x7fa98b8f8600, self 0x7fa98b8f8600

Code: Select all
- (BOOL)shouldIgnoreMouseEvent:(NSEvent*)theEvent {
  NSWindow* window = [self window];
  // If this is a background window, don't handle mouse movement events. This
  // is the expected behavior on the Mac as evidenced by other applications.
  if ([theEvent type] == NSEventTypeMouseMoved &&
      ![self acceptsMouseEventsWhenInactive] && ![window isMainWindow] &&
      ![window isKeyWindow]) {
    return YES;
  }

  NSView* contentView = [window contentView];
  NSView* view = [contentView hitTest:[theEvent locationInWindow]];


We’ve opened a ticket with Apple and hopefully they can resolve the issue or give us further details on how we can modify the code, if need be.

Re: Mouse events not arriving on CEF Browser View on MAC 13

PostPosted: Mon Sep 12, 2022 10:37 am
by ccbournejr
We've worked around this issue (prior to having a fix from Apple) by setting the contentView to its last known value on exiting full screen.

Code: Select all
    NSView *lastpassContentView;
....
....
    NSWindow *window = [[NSApplication sharedApplication] keyWindow];
    NSView *myContentView = [window contentView];
    if (myContentView == nil && lastpassContentView != nil) {
       window.contentView = lastpassContentView;
 


I'll post when Apple releases a fix.e