From 7f13f18df65051edb9975f9ae85a90eed096675f Mon Sep 17 00:00:00 2001 From: stransky Date: Fri, 12 Jan 2024 08:31:34 +0000 Subject: [PATCH] Bug 1791417 [Wayland] Don't advertise selection clipboard support if it's disabled r=emilio Differential Revision: https://phabricator.services.mozilla.com/D198141 --- widget/gtk/nsClipboard.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp index 76ee17c3cf51..571b43f1cc60 100644 --- a/widget/gtk/nsClipboard.cpp +++ b/widget/gtk/nsClipboard.cpp @@ -14,6 +14,7 @@ #endif #if defined(MOZ_WAYLAND) # include "nsClipboardWayland.h" +# include "nsWaylandDisplay.h" #endif #include "nsGtkUtils.h" #include "nsIURI.h" @@ -194,7 +195,13 @@ nsRetrievalContext::~nsRetrievalContext() { nsClipboard::nsClipboard() : nsBaseClipboard(mozilla::dom::ClipboardCapabilities( - true /* supportsSelectionClipboard */, +#ifdef MOZ_WAYLAND + widget::GdkIsWaylandDisplay() + ? widget::WaylandDisplayGet()->IsPrimarySelectionEnabled() + : true, +#else + true, /* supportsSelectionClipboard */ +#endif false /* supportsFindClipboard */, false /* supportsSelectionCache */)) { g_signal_connect(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), "owner-change",