[SOLVED]Should subprocess source code same with main process

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.

[SOLVED]Should subprocess source code same with main process

Postby slothsimon » Wed Feb 08, 2017 9:05 pm

Hi guys, I am struggling to integrate cef into a game. I used separate sub-process exe according to wiki.

So the background is I have BrowserApp & BrowserHandler source code both in game project and sub-process project of VS.

What I want to know is Should the sub-process source code be same with the main application's? If different, will any bad problems happen? Because I have no idea how to use one project's source file from another project...But I don't want to maintain two copies in different places which seems to be a bad idea.

BTW, another question is when the main application is full-screen, after the web page pops up the active window will not change from main app to the popup. How to make the active window change into the popup window?

Thank you!
Last edited by slothsimon on Mon Feb 13, 2017 10:59 pm, edited 1 time in total.
slothsimon
Newbie
 
Posts: 9
Joined: Wed Feb 08, 2017 8:44 pm

Re: Should sub-process source code same with main process?

Postby magreenblatt » Thu Feb 09, 2017 10:29 am

slothsimon wrote:Should the sub-process source code be same with the main application's[/b]? [b]If different, will any bad problems happen?

CefApp::OnRegisterCustomSchemes needs to be implemented the same way in every process. Other than that just follow the instructions at https://bitbucket.org/chromiumembedded/ ... t-function

slothsimon wrote:when the main application is full-screen, after the web page pops up the active window will not change from main app to the popup. How to make the active window change into the popup window?

What OS and CEF version? How are you making the main window full-screen? How are you making the popup window?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Should sub-process source code same with main process?

Postby slothsimon » Thu Feb 09, 2017 8:55 pm

What OS and CEF version? How are you making the main window full-screen? How are you making the popup window?


OS: Windows 7 64bit
CEF version: 2623 binary release version
The code used to making popup window:
Code: Select all
void BrowserApp::OpenURL(const std::string& url){
   CEF_REQUIRE_UI_THREAD();

   CefWindowInfo window_info;

   window_info.SetAsPopup(NULL, "WebBrowser");

   CefRefPtr<BrowserHandler> handler(new BrowserHandler());

   CefBrowserSettings browser_settings;

   std::string urltmp = url;

   if (urltmp.empty())
      urltmp = "about:blank";

   CefBrowserHost::CreateBrowser(window_info, handler.get(), urltmp,
      browser_settings, NULL);   
}


And the way to fullsceen, I actually don't know the mechanism. I enter the game to choose full-screen option. I checked the source code, it seems like use console command like following:
Code: Select all
   wxString StrCommand;
   StrCommand.Printf(TEXT("setres %dx%d%s"), width, height, bFullscreen?TEXT("f"):TEXT(""));
   GetGame()->ExecConsoleCommand( StrCommand.GetData() );
Last edited by slothsimon on Mon Feb 13, 2017 10:43 pm, edited 1 time in total.
slothsimon
Newbie
 
Posts: 9
Joined: Wed Feb 08, 2017 8:44 pm

Re: Should sub-process source code same with main process?

Postby slothsimon » Mon Feb 13, 2017 10:17 pm

I figured it out by myself. The reason why the active window won't be changed to the popup is the whole screen is controlled by D3D when entering fullscreen. Even I let the browser be the child window of the game window, it will not show the browser window.

As I know, there are tow possible ways. I want to share with your guys because I stuck here for a long time.
    1. use non-exclusive fullscreen mode, but it will reduce the application's performance
    2. use off-screen rendering, but there are lots of stuff to implement
slothsimon
Newbie
 
Posts: 9
Joined: Wed Feb 08, 2017 8:44 pm


Return to Support Forum

Who is online

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