Bug 1668358 - Hide global webrtc privacy indicator on Wayland, r=emilio

The indicator never worked well on Wayland as the protocol gives us
little control about window positioning, focus etc. by design, creating
a quite bad user experience.

At the same time Wayland puts constrains on recording the display,
requiring apps to go through a "portal" where they usually have to
actively select the screen or window to share. This, crucially, allows
system compositors to show indicators itself - which all major DEs do
or at least support.

Unfortunately we can't disable the indicator at build-time as our builds
support both Wayland and X11, thus make it runtime detectable.

Differential Revision: https://phabricator.services.mozilla.com/D184193
This commit is contained in:
Robert Mader 2023-07-21 16:41:27 +00:00
parent a2ffca18d9
commit 656ef8b2ef
3 changed files with 16 additions and 4 deletions

View File

@ -73,10 +73,9 @@ const WebRTCIndicator = {
false
);
this.hideGlobalIndicator = Services.prefs.getBoolPref(
"privacy.webrtc.hideGlobalIndicator",
false
);
this.hideGlobalIndicator =
Services.prefs.getBoolPref("privacy.webrtc.hideGlobalIndicator", false) ||
Services.appinfo.isWayland;
if (this.hideGlobalIndicator) {
this.setVisibility(false);

View File

@ -1619,6 +1619,16 @@ nsXULAppInfo::GetDesktopEnvironment(nsACString& aDesktopEnvironment) {
return NS_OK;
}
NS_IMETHODIMP
nsXULAppInfo::GetIsWayland(bool* aResult) {
#ifdef MOZ_WIDGET_GTK
*aResult = GdkIsWaylandDisplay();
#else
*aResult = false;
#endif
return NS_OK;
}
NS_IMETHODIMP
nsXULAppInfo::GetProcessStartupShortcut(nsAString& aShortcut) {
#if defined(XP_WIN)

View File

@ -342,6 +342,9 @@ interface nsIXULRuntime : nsISupports
/** Returns the desktop environment identifier. Only meaningful on GTK */
readonly attribute ACString desktopEnvironment;
/** Whether we use Wayland. Only meaningful on GTK */
readonly attribute boolean isWayland;
/**
* The path of the shortcut used to start the current process, or "" if none.
*