ShowDevTools pop up window width and height is 0

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.

ShowDevTools pop up window width and height is 0

Postby vlbg21 » Sun Aug 30, 2020 4:34 pm

When I open a devtools, the default size is 0 - attached.
Build: v8.3.11+g1fac1e5+chromium-83.0.4103.61_windows64

Parent browser is using views framework. I just pass a blank CefWindowInfo because I think it was being ignored.
Code: Select all
browser->GetHost()->ShowDevTools(CefWindowInfo(), client, CefBrowserSettings(), CefPoint());


How can I set the window size of devtools? Thanks in advanced.
Attachments
Untitled.png
Untitled.png (3.5 KiB) Viewed 4021 times
vlbg21
Newbie
 
Posts: 4
Joined: Sun Aug 30, 2020 4:22 pm

Re: ShowDevTools pop up window width and height is 0

Postby amaitland » Sun Aug 30, 2020 7:24 pm

Call `SetAsPopup` e.g.

Code: Select all
CefWindowInfo windowInfo;
windowInfo.SetAsPopup(NULL, "DevTools");


Then pass in `windowInfo` as param
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am

Re: ShowDevTools pop up window width and height is 0

Postby magreenblatt » Sun Aug 30, 2020 7:25 pm

How does it behave with “cefclient --use-views”?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: ShowDevTools pop up window width and height is 0

Postby vlbg21 » Mon Aug 31, 2020 6:07 am

amaitland wrote:Call `SetAsPopup` e.g.

Code: Select all
CefWindowInfo windowInfo;
windowInfo.SetAsPopup(NULL, "DevTools");


Then pass in `windowInfo` as param


It's ignored.

magreenblatt wrote:How does it behave with “cefclient --use-views”?


It's working in cefclient. It's manually creating a new window, but I don't quite get how is the browser created for ShowDevTools connected to the created window.
Or does the browser for showdevtools automatically attach to a child window? - I'll try this

from client_handler.cc
Code: Select all
  // Test if the DevTools browser already exists.
  bool has_devtools = host->HasDevTools();
  if (!has_devtools) {
    // Create a new RootWindow for the DevTools browser that will be created
    // by ShowDevTools().
    has_devtools = CreatePopupWindow(browser, true, CefPopupFeatures(),
                                     windowInfo, client, settings);
  }

  if (has_devtools) {
    // Create the DevTools browser if it doesn't already exist.
    // Otherwise, focus the existing DevTools browser and inspect the element
    // at |inspect_element_at| if non-empty.
    host->ShowDevTools(windowInfo, client, settings, inspect_element_at);
  }
vlbg21
Newbie
 
Posts: 4
Joined: Sun Aug 30, 2020 4:22 pm

Re: ShowDevTools pop up window width and height is 0

Postby vlbg21 » Mon Aug 31, 2020 7:22 am

Ok I got it, the window delegate is linked in CefBrowserViewDelegate::OnPopupBrowserCreated.

In my case, i just instantiated a new window delegate for popup_browser_view.
Code: Select all
CefWindow::CreateTopLevelWindow(new ::WindowDelegate(popup_browser_view));


Thanks!
vlbg21
Newbie
 
Posts: 4
Joined: Sun Aug 30, 2020 4:22 pm


Return to Support Forum

Who is online

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