Skip to content

Commit 44113d7

Browse files
committed
DevTools - now shown as popup (visible in taskbar).
- Pass null for CefWindowInfo.SetAsPopup parent handle - Add optional params to IWebBrowser/IBrowser.ShowDevTools extension methods. Anyone wishing to use the old behaviour can do something like var host = browser.GetBrowserHost(); var windowInfo = new WindowInfo(); windowInfo.SetAsPopup(host.GetWindowHandle(), "DevTools"); browser.ShowDevTools(windowInfo); Resolves #2997
1 parent 1550251 commit 44113d7

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

CefSharp.Core/Internals/CefBrowserHostWrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void CefBrowserHostWrapper::ShowDevTools(IWindowInfo^ windowInfo, int inspectEle
159159

160160
if (windowInfo == nullptr)
161161
{
162-
nativeWindowInfo.SetAsPopup(_browserHost->GetWindowHandle(), "DevTools");
162+
nativeWindowInfo.SetAsPopup(NULL, "DevTools");
163163
}
164164
else
165165
{

CefSharp/WebBrowserExtensions.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -760,23 +760,29 @@ public static Task<bool> PrintToPdfAsync(this IWebBrowser browser, string path,
760760
/// Open developer tools in its own window.
761761
/// </summary>
762762
/// <param name="cefBrowser">The ChromiumWebBrowser instance this method extends</param>
763-
public static void ShowDevTools(this IBrowser cefBrowser)
763+
/// <param name="windowInfo">window info used for showing dev tools</param>
764+
/// <param name="inspectElementAtX">x coordinate (used for inspectElement)</param>
765+
/// <param name="inspectElementAtY">y coordinate (used for inspectElement)</param>
766+
public static void ShowDevTools(this IBrowser cefBrowser, IWindowInfo windowInfo = null, int inspectElementAtX = 0, int inspectElementAtY = 0)
764767
{
765768
var host = cefBrowser.GetHost();
766769
ThrowExceptionIfBrowserHostNull(host);
767770

768-
host.ShowDevTools();
771+
host.ShowDevTools(windowInfo, inspectElementAtX, inspectElementAtY);
769772
}
770773

771774
/// <summary>
772775
/// Open developer tools in its own window.
773776
/// </summary>
774777
/// <param name="browser">The ChromiumWebBrowser instance this method extends</param>
775-
public static void ShowDevTools(this IWebBrowser browser)
778+
/// <param name="windowInfo">window info used for showing dev tools</param>
779+
/// <param name="inspectElementAtX">x coordinate (used for inspectElement)</param>
780+
/// <param name="inspectElementAtY">y coordinate (used for inspectElement)</param>
781+
public static void ShowDevTools(this IWebBrowser browser, IWindowInfo windowInfo = null, int inspectElementAtX = 0, int inspectElementAtY = 0)
776782
{
777783
var cefBrowser = browser.GetBrowser();
778784
cefBrowser.ThrowExceptionIfBrowserNull();
779-
cefBrowser.ShowDevTools();
785+
cefBrowser.ShowDevTools(windowInfo, inspectElementAtX, inspectElementAtY);
780786
}
781787

782788
/// <summary>

0 commit comments

Comments
 (0)