From 8056739cb47b5f7e2d268061d3904438210f3caa Mon Sep 17 00:00:00 2001 From: Sebastian Ratz Date: Wed, 2 Oct 2024 15:02:41 +0200 Subject: [PATCH] Edge: Disable the internal status bar to align with other Browser impls Only disable this if ICoreWebView2_12 is available and we can send out proper StatusTextEvents. If not (unlikely case, very old WebView2 version) we keep the internal status bar enabled. --- .../win32/org/eclipse/swt/browser/Edge.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/Edge.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/Edge.java index 6a7b817f90..157cc12fe9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/Edge.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/Edge.java @@ -540,6 +540,13 @@ void setupBrowser(int hr, long pv) { webView.get_Settings(ppv); settings = new ICoreWebView2Settings(ppv[0]); + if (webViewProvider.isWebView_12Available()) { + // Align with other Browser implementations: + // Disable internal status bar on the bottom left of the Browser control + // Send out StatusTextEvents via handleStatusBarTextChanged for SWT consumers + settings.put_IsStatusBarEnabled(false); + } + long[] token = new long[1]; IUnknown handler; handler = newCallback(this::handleCloseRequested); @@ -900,12 +907,12 @@ int handleStatusBarTextChanged(long pView, long pArgs) { long ppsz[] = new long[1]; webViewProvider.getWebView_12(true).get_StatusBarText(ppsz); String text = wstrToString(ppsz[0], true); - StatusTextEvent newEvent5 = new StatusTextEvent(browser); - newEvent5.display = browser.getDisplay(); - newEvent5.widget = browser; - newEvent5.text = text; + StatusTextEvent statusTextEvent = new StatusTextEvent(browser); + statusTextEvent.display = browser.getDisplay(); + statusTextEvent.widget = browser; + statusTextEvent.text = text; for (StatusTextListener statusTextListener : statusTextListeners) { - statusTextListener.changed(newEvent5); + statusTextListener.changed(statusTextEvent); } return COM.S_OK; }