[MacOS] embedding cefsimple browser into another window

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.

[MacOS] embedding cefsimple browser into another window

Postby linuxcef9 » Thu Oct 26, 2023 1:04 am

I want to create a parent window using NSView* in another process and embed cef window inside it, making cef a child window.

For that, I have created one sample window in my application using native cocoa framework. Cefsimple app is running as separate process.
My application is invoking cefsimple and passing sample window handle(NSView*) to cefsimple while invoking.
In cefsimple, I am using sample window handle NSView* (parent_view) to make cef window as a child of sample window from another process as follow:

Code: Select all
void SimpleApp::OnContextInitialized() {
        …
        window_info.SetAsChild(CAST_NSVIEW_TO_CEF_WINDOW_HANDLE(parent_view), rect);
        …
   }


With above code, CEF browser window is not getting embedded in sample window. Am I missing anything in macOS implementation?

if I create sample window in same process (cefsimple) then cef browser window is getting embedded into this sample window with above code.
It’s not working only when sample window is created in different process. It works perfectly fine with Linux(X11 window id) and Windows OS implementation but not working with MacOS.

Is this something not supported in macOS?
If that is the case, then what approach we take to embed cefsimple window into another process window?
linuxcef9
Expert
 
Posts: 143
Joined: Tue Nov 06, 2018 3:08 pm

Re: [MacOS] embedding cefsimple browser into another window

Postby magreenblatt » Thu Oct 26, 2023 10:56 am

It may be possible, but likely complicated. There is some related discussion at https://github.com/chromiumembedded/cef ... 1465030769
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: [MacOS] embedding cefsimple browser into another window

Postby linuxcef9 » Fri Oct 27, 2023 7:45 am

[Approach#1]
I will debug it further to see if I can go with same approach for embedding CEF window, by passing NSview from my application to CEFSimple.

[Approach#2]
Also, If I create sample window in same process (cefsimple) then cef browser window is getting embedded into this sample window with SetAsChild() call.
Can I handle UI events (drag, resize window etc.) in cefsimple app to manipulate newly created sample window (which in turn make changes in CEF window)?
Assuming message queue/passing is implemented between my application and cefsimple. And my application is sending all UI events to cefsimple.

[Approach#3]
If approach#2 is not feasible, the last approach I can think of is to create a sample window in my application and render the CEF video to this sample window using IOSurface through IPC.

Can you please share your thoughts on above approaches?
linuxcef9
Expert
 
Posts: 143
Joined: Tue Nov 06, 2018 3:08 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 203 guests