summaryrefslogtreecommitdiffstats
path: root/widget/gtk/WidgetUtilsGtk.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /widget/gtk/WidgetUtilsGtk.h
parentInitial commit. (diff)
downloadfirefox-upstream/124.0.1.tar.xz
firefox-upstream/124.0.1.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'widget/gtk/WidgetUtilsGtk.h')
-rw-r--r--widget/gtk/WidgetUtilsGtk.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/widget/gtk/WidgetUtilsGtk.h b/widget/gtk/WidgetUtilsGtk.h
new file mode 100644
index 0000000000..ffd7425ae5
--- /dev/null
+++ b/widget/gtk/WidgetUtilsGtk.h
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef WidgetUtilsGtk_h__
+#define WidgetUtilsGtk_h__
+
+#include "nsString.h"
+#include "nsTArray.h"
+#include "mozilla/MozPromise.h"
+
+#include <stdint.h>
+
+typedef struct _GdkDisplay GdkDisplay;
+typedef struct _GdkDevice GdkDevice;
+typedef struct _GError GError;
+typedef union _GdkEvent GdkEvent;
+class nsWindow;
+
+namespace mozilla::widget {
+
+class WidgetUtilsGTK {
+ public:
+ /* See WidgetUtils::IsTouchDeviceSupportPresent(). */
+ static int32_t IsTouchDeviceSupportPresent();
+};
+
+bool IsMainWindowTransparent();
+
+bool GdkIsWaylandDisplay(GdkDisplay* display);
+bool GdkIsX11Display(GdkDisplay* display);
+
+bool GdkIsWaylandDisplay();
+bool GdkIsX11Display();
+
+bool IsXWaylandProtocol();
+
+GdkDevice* GdkGetPointer();
+
+// Sets / returns the last mouse press event we processed.
+void SetLastMousePressEvent(GdkEvent*);
+GdkEvent* GetLastMousePressEvent();
+
+// Return the snap's instance name, or null when not running as a snap.
+const char* GetSnapInstanceName();
+bool IsRunningUnderSnap();
+bool IsRunningUnderFlatpak();
+bool IsPackagedAppFileExists();
+inline bool IsRunningUnderFlatpakOrSnap() {
+ return IsRunningUnderFlatpak() || IsRunningUnderSnap();
+}
+
+enum class PortalKind {
+ FilePicker,
+ MimeHandler,
+ Settings,
+ Location,
+ OpenUri,
+};
+bool ShouldUsePortal(PortalKind);
+
+// Tries to get a descriptive identifier for the desktop environment that the
+// program is running under. Always normalized to lowercase.
+// See the implementation for the different environment variables and desktop
+// information we try to use.
+//
+// If we can't find a reasonable environment, the empty string is returned.
+const nsCString& GetDesktopEnvironmentIdentifier();
+bool IsGnomeDesktopEnvironment();
+bool IsKdeDesktopEnvironment();
+
+// Parse text/uri-list
+nsTArray<nsCString> ParseTextURIList(const nsACString& data);
+
+using FocusRequestPromise = MozPromise<nsCString, bool, false>;
+RefPtr<FocusRequestPromise> RequestWaylandFocusPromise();
+
+bool IsCancelledGError(GError* aGError);
+
+} // namespace mozilla::widget
+
+#endif // WidgetUtilsGtk_h__