mirror of
https://codeberg.org/kiss-community/repo
synced 2024-08-24 23:06:19 +00:00
1365 lines
42 KiB
Diff
1365 lines
42 KiB
Diff
diff --git a/gfx/angle/checkout/include/EGL/eglplatform.h b/gfx/angle/checkout/include/EGL/eglplatform.h
|
|
index 9ebaf00a9b..59b65acd7f 100644
|
|
--- a/gfx/angle/checkout/include/EGL/eglplatform.h
|
|
+++ b/gfx/angle/checkout/include/EGL/eglplatform.h
|
|
@@ -109,7 +109,7 @@ typedef intptr_t EGLNativeDisplayType;
|
|
typedef intptr_t EGLNativePixmapType;
|
|
typedef intptr_t EGLNativeWindowType;
|
|
|
|
-#elif defined(__unix__) && defined(EGL_NO_X11)
|
|
+#elif defined(__unix__)
|
|
|
|
typedef void *EGLNativeDisplayType;
|
|
typedef khronos_uintptr_t EGLNativePixmapType;
|
|
diff --git a/gfx/cairo/cairo/src/cairo-features.h b/gfx/cairo/cairo/src/cairo-features.h
|
|
index cfed9d9a2f..fd1eb869d3 100644
|
|
--- a/gfx/cairo/cairo/src/cairo-features.h
|
|
+++ b/gfx/cairo/cairo/src/cairo-features.h
|
|
@@ -55,8 +55,8 @@
|
|
#define CAIRO_HAS_PDF_SURFACE 1
|
|
#endif
|
|
|
|
-#ifdef MOZ_X11
|
|
#define CAIRO_HAS_PS_SURFACE 1
|
|
+#ifdef MOZ_X11
|
|
#define CAIRO_HAS_XLIB_XRENDER_SURFACE 0
|
|
#define CAIRO_HAS_XLIB_SURFACE 1
|
|
#endif
|
|
diff --git a/gfx/gl/GLContextProvider.h b/gfx/gl/GLContextProvider.h
|
|
index 12d1a497b9..d30b01c144 100644
|
|
--- a/gfx/gl/GLContextProvider.h
|
|
+++ b/gfx/gl/GLContextProvider.h
|
|
@@ -55,17 +55,18 @@ namespace gl {
|
|
# define GL_CONTEXT_PROVIDER_NAME GLContextProviderX11
|
|
# include "GLContextProviderImpl.h"
|
|
# undef GL_CONTEXT_PROVIDER_NAME
|
|
-# if defined(MOZ_WAYLAND)
|
|
-# define GL_CONTEXT_PROVIDER_NAME GLContextProviderWayland
|
|
-# include "GLContextProviderImpl.h"
|
|
-# undef GL_CONTEXT_PROVIDER_NAME
|
|
-# define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderWayland
|
|
-# endif
|
|
# ifndef GL_CONTEXT_PROVIDER_DEFAULT
|
|
# define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderX11
|
|
# endif
|
|
#endif
|
|
|
|
+#if defined(MOZ_WAYLAND)
|
|
+# define GL_CONTEXT_PROVIDER_NAME GLContextProviderWayland
|
|
+# include "GLContextProviderImpl.h"
|
|
+# undef GL_CONTEXT_PROVIDER_NAME
|
|
+# define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderWayland
|
|
+#endif
|
|
+
|
|
#ifndef GL_CONTEXT_PROVIDER_DEFAULT
|
|
# define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderEGL
|
|
#endif
|
|
diff --git a/gfx/gl/GLContextProviderWayland.cpp b/gfx/gl/GLContextProviderWayland.cpp
|
|
index 3f1f926cd9..cd49dc5f17 100644
|
|
--- a/gfx/gl/GLContextProviderWayland.cpp
|
|
+++ b/gfx/gl/GLContextProviderWayland.cpp
|
|
@@ -14,7 +14,6 @@ namespace mozilla::gl {
|
|
using namespace mozilla::gfx;
|
|
using namespace mozilla::widget;
|
|
|
|
-static class GLContextProviderX11 sGLContextProviderX11;
|
|
static class GLContextProviderEGL sGLContextProviderEGL;
|
|
|
|
// Note that if there is no GTK display, `GdkIsX11Display` and
|
|
@@ -30,41 +29,24 @@ static class GLContextProviderEGL sGLContextProviderEGL;
|
|
already_AddRefed<GLContext> GLContextProviderWayland::CreateForCompositorWidget(
|
|
CompositorWidget* aCompositorWidget, bool aHardwareWebRender,
|
|
bool aForceAccelerated) {
|
|
- if (GdkIsWaylandDisplay()) {
|
|
return sGLContextProviderEGL.CreateForCompositorWidget(
|
|
aCompositorWidget, aHardwareWebRender, aForceAccelerated);
|
|
- } else {
|
|
- return sGLContextProviderX11.CreateForCompositorWidget(
|
|
- aCompositorWidget, aHardwareWebRender, aForceAccelerated);
|
|
- }
|
|
}
|
|
|
|
/*static*/
|
|
already_AddRefed<GLContext> GLContextProviderWayland::CreateHeadless(
|
|
const GLContextCreateDesc& desc, nsACString* const out_failureId) {
|
|
- if (GdkIsWaylandDisplay()) {
|
|
return sGLContextProviderEGL.CreateHeadless(desc, out_failureId);
|
|
- } else {
|
|
- return sGLContextProviderX11.CreateHeadless(desc, out_failureId);
|
|
- }
|
|
}
|
|
|
|
/*static*/
|
|
GLContext* GLContextProviderWayland::GetGlobalContext() {
|
|
- if (GdkIsWaylandDisplay()) {
|
|
return sGLContextProviderEGL.GetGlobalContext();
|
|
- } else {
|
|
- return sGLContextProviderX11.GetGlobalContext();
|
|
- }
|
|
}
|
|
|
|
/*static*/
|
|
void GLContextProviderWayland::Shutdown() {
|
|
- if (GdkIsWaylandDisplay()) {
|
|
sGLContextProviderEGL.Shutdown();
|
|
- } else {
|
|
- sGLContextProviderX11.Shutdown();
|
|
- }
|
|
}
|
|
|
|
} // namespace mozilla::gl
|
|
diff --git a/gfx/gl/moz.build b/gfx/gl/moz.build
|
|
index 7ac6b0753a..a817a6fb08 100644
|
|
--- a/gfx/gl/moz.build
|
|
+++ b/gfx/gl/moz.build
|
|
@@ -13,7 +13,7 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
|
|
elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit":
|
|
gl_provider = "EAGL"
|
|
elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
|
- if CONFIG["MOZ_EGL_XRENDER_COMPOSITE"]:
|
|
+ if CONFIG["MOZ_EGL_XRENDER_COMPOSITE"] or CONFIG["MOZ_WAYLAND"]:
|
|
gl_provider = "EGL"
|
|
else:
|
|
gl_provider = "GLX"
|
|
diff --git a/gfx/layers/AnimationHelper.h b/gfx/layers/AnimationHelper.h
|
|
index f5a57b9c4d..72091c3a4f 100644
|
|
--- a/gfx/layers/AnimationHelper.h
|
|
+++ b/gfx/layers/AnimationHelper.h
|
|
@@ -7,6 +7,7 @@
|
|
#ifndef mozilla_layers_AnimationHelper_h
|
|
#define mozilla_layers_AnimationHelper_h
|
|
|
|
+#include "X11UndefineNone.h"
|
|
#include "mozilla/dom/Nullable.h"
|
|
#include "mozilla/ComputedTimingFunction.h" // for ComputedTimingFunction
|
|
#include "mozilla/layers/AnimationStorageData.h"
|
|
@@ -15,7 +16,6 @@
|
|
#include "mozilla/TimeStamp.h" // for TimeStamp
|
|
#include "mozilla/TimingParams.h"
|
|
#include "mozilla/Types.h" // for SideBits
|
|
-#include "X11UndefineNone.h"
|
|
#include <unordered_map>
|
|
|
|
namespace mozilla {
|
|
diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp
|
|
index 1b46a2aab8..aa20d93455 100644
|
|
--- a/gfx/thebes/gfxPlatformGtk.cpp
|
|
+++ b/gfx/thebes/gfxPlatformGtk.cpp
|
|
@@ -31,7 +31,9 @@
|
|
#include "mozilla/FontPropertyTypes.h"
|
|
#include "mozilla/gfx/2D.h"
|
|
#include "mozilla/gfx/Logging.h"
|
|
+#ifdef MOZ_X11
|
|
#include "mozilla/gfx/XlibDisplay.h"
|
|
+#endif
|
|
#include "mozilla/Monitor.h"
|
|
#include "mozilla/Preferences.h"
|
|
#include "mozilla/StaticPrefs_gfx.h"
|
|
@@ -65,6 +67,7 @@
|
|
# include "mozilla/widget/nsWaylandDisplay.h"
|
|
# include "mozilla/widget/DMABufLibWrapper.h"
|
|
# include "mozilla/StaticPrefs_widget.h"
|
|
+# include "mozilla/WidgetUtilsGtk.h"
|
|
#endif
|
|
|
|
#define GDK_PIXMAP_SIZE_MAX 32767
|
|
@@ -100,7 +103,7 @@ gfxPlatformGtk::gfxPlatformGtk() {
|
|
}
|
|
|
|
mMaxGenericSubstitutions = UNINITIALIZED_VALUE;
|
|
- mIsX11Display = gfxPlatform::IsHeadless() ? false : GdkIsX11Display();
|
|
+ mIsX11Display = false;
|
|
if (XRE_IsParentProcess()) {
|
|
InitX11EGLConfig();
|
|
if (IsWaylandDisplay() || gfxConfig::IsEnabled(Feature::X11_EGL)) {
|
|
@@ -127,7 +130,6 @@ gfxPlatformGtk::gfxPlatformGtk() {
|
|
|
|
// Bug 1714483: Force disable FXAA Antialiasing on NV drivers. This is a
|
|
// temporary workaround for a driver bug.
|
|
- PR_SetEnv("__GL_ALLOW_FXAA_USAGE=0");
|
|
}
|
|
|
|
gfxPlatformGtk::~gfxPlatformGtk() {
|
|
diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build
|
|
index baa6f090a9..a1090fc1c4 100644
|
|
--- a/gfx/thebes/moz.build
|
|
+++ b/gfx/thebes/moz.build
|
|
@@ -116,7 +116,6 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
|
]
|
|
EXPORTS.mozilla.gfx += [
|
|
"PrintTargetPDF.h",
|
|
- "PrintTargetPS.h",
|
|
]
|
|
SOURCES += [
|
|
"gfxFcPlatformFontList.cpp",
|
|
@@ -124,12 +123,12 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
|
"gfxFT2Utils.cpp",
|
|
"gfxPlatformGtk.cpp",
|
|
"PrintTargetPDF.cpp",
|
|
- "PrintTargetPS.cpp",
|
|
]
|
|
|
|
if CONFIG["MOZ_X11"]:
|
|
EXPORTS += [
|
|
"gfxXlibSurface.h",
|
|
+ "PrintTargetPS.h",
|
|
]
|
|
EXPORTS.mozilla.gfx += [
|
|
"XlibDisplay.h",
|
|
@@ -137,6 +136,7 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
|
SOURCES += [
|
|
"gfxXlibSurface.cpp",
|
|
"XlibDisplay.cpp",
|
|
+ "PrintTargetPS.cpp",
|
|
]
|
|
|
|
elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
|
|
diff --git a/gfx/webrender_bindings/RenderCompositorOGLSWGL.cpp b/gfx/webrender_bindings/RenderCompositorOGLSWGL.cpp
|
|
index cf3fc3c2ca..2748887361 100644
|
|
--- a/gfx/webrender_bindings/RenderCompositorOGLSWGL.cpp
|
|
+++ b/gfx/webrender_bindings/RenderCompositorOGLSWGL.cpp
|
|
@@ -27,7 +27,9 @@
|
|
#ifdef MOZ_WIDGET_GTK
|
|
# include "mozilla/widget/GtkCompositorWidget.h"
|
|
# include <gdk/gdk.h>
|
|
+# ifdef MOZ_X11
|
|
# include <gdk/gdkx.h>
|
|
+# endif
|
|
#endif
|
|
|
|
namespace mozilla {
|
|
diff --git a/toolkit/components/remote/moz.build b/toolkit/components/remote/moz.build
|
|
index c1853a9f4d..cb6b7f0a9c 100644
|
|
--- a/toolkit/components/remote/moz.build
|
|
+++ b/toolkit/components/remote/moz.build
|
|
@@ -26,12 +26,6 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
|
"nsUnixRemoteServer.h",
|
|
"RemoteUtils.h",
|
|
]
|
|
- else:
|
|
- SOURCES += [
|
|
- "nsGTKRemoteServer.cpp",
|
|
- "nsXRemoteClient.cpp",
|
|
- "nsXRemoteServer.cpp",
|
|
- ]
|
|
CXXFLAGS += CONFIG["TK_CFLAGS"]
|
|
|
|
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
|
|
diff --git a/toolkit/components/remote/nsRemoteService.cpp b/toolkit/components/remote/nsRemoteService.cpp
|
|
index b2499d8191..0a597634b4 100644
|
|
--- a/toolkit/components/remote/nsRemoteService.cpp
|
|
+++ b/toolkit/components/remote/nsRemoteService.cpp
|
|
@@ -12,12 +12,17 @@
|
|
|
|
#ifdef MOZ_WIDGET_GTK
|
|
# include "mozilla/WidgetUtilsGtk.h"
|
|
-# include "nsGTKRemoteServer.h"
|
|
+# ifdef MOZ_X11
|
|
+# include "nsGTKRemoteServer.h"
|
|
+# include "nsXRemoteClient.h"
|
|
+# endif
|
|
# ifdef MOZ_ENABLE_DBUS
|
|
# include "nsDBusRemoteServer.h"
|
|
# include "nsDBusRemoteClient.h"
|
|
-# else
|
|
-# include "nsXRemoteClient.h"
|
|
+# endif
|
|
+# ifdef MOZ_WAYLAND
|
|
+# include <gdk/gdkwayland.h>
|
|
+# include "nsRemoteClient.h"
|
|
# endif
|
|
#elif defined(XP_WIN)
|
|
# include "nsWinRemoteServer.h"
|
|
@@ -98,11 +103,12 @@ RemoteResult nsRemoteService::StartClient(const char* aDesktopStartupID) {
|
|
return REMOTE_NOT_FOUND;
|
|
}
|
|
|
|
+ return REMOTE_NOT_FOUND;
|
|
UniquePtr<nsRemoteClient> client;
|
|
#ifdef MOZ_WIDGET_GTK
|
|
# if defined(MOZ_ENABLE_DBUS)
|
|
client = MakeUnique<nsDBusRemoteClient>();
|
|
-# else
|
|
+# elif defined(MOZ_X11)
|
|
client = MakeUnique<nsXRemoteClient>();
|
|
# endif
|
|
#elif defined(XP_WIN)
|
|
@@ -135,6 +141,7 @@ RemoteResult nsRemoteService::StartClient(const char* aDesktopStartupID) {
|
|
}
|
|
|
|
void nsRemoteService::StartupServer() {
|
|
+ return;
|
|
if (mRemoteServer) {
|
|
return;
|
|
}
|
|
@@ -146,7 +153,7 @@ void nsRemoteService::StartupServer() {
|
|
#ifdef MOZ_WIDGET_GTK
|
|
# if defined(MOZ_ENABLE_DBUS)
|
|
mRemoteServer = MakeUnique<nsDBusRemoteServer>();
|
|
-# else
|
|
+# elif defined(MOZ_X11)
|
|
mRemoteServer = MakeUnique<nsGTKRemoteServer>();
|
|
# endif
|
|
#elif defined(XP_WIN)
|
|
diff --git a/toolkit/moz.configure b/toolkit/moz.configure
|
|
index a78a32bdc0..d6bed82e1b 100644
|
|
--- a/toolkit/moz.configure
|
|
+++ b/toolkit/moz.configure
|
|
@@ -1170,35 +1170,6 @@ set_define("MOZ_RAW", depends_if("--enable-raw")(lambda _: True))
|
|
|
|
# X11
|
|
# ==============================================================
|
|
-set_config("MOZ_X11", True, when=toolkit_gtk)
|
|
-set_define("MOZ_X11", True, when=toolkit_gtk)
|
|
-
|
|
-
|
|
-@depends(webrtc, when=toolkit_gtk)
|
|
-def x11_libs(webrtc):
|
|
- libs = [
|
|
- "x11",
|
|
- "xcb",
|
|
- "xcb-shm",
|
|
- "x11-xcb",
|
|
- "xext",
|
|
- "xrandr >= 1.4.0",
|
|
- ]
|
|
- if webrtc:
|
|
- # third_party/libwebrtc/webrtc/webrtc_gn/moz.build adds those
|
|
- # manually, ensure they're available.
|
|
- libs += [
|
|
- "xcomposite",
|
|
- "xcursor",
|
|
- "xdamage",
|
|
- "xfixes",
|
|
- "xi",
|
|
- ]
|
|
- return libs
|
|
-
|
|
-
|
|
-pkg_check_modules("MOZ_X11", x11_libs, when=toolkit_gtk)
|
|
-pkg_check_modules("MOZ_X11_SM", ["ice", "sm"], cflags_only=True, when=toolkit_gtk)
|
|
|
|
|
|
# ASan Reporter Addon
|
|
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
|
|
index 60ea6966cc..38be3e9085 100644
|
|
--- a/toolkit/xre/nsAppRunner.cpp
|
|
+++ b/toolkit/xre/nsAppRunner.cpp
|
|
@@ -322,6 +322,7 @@ nsString gProcessStartupShortcut;
|
|
# endif
|
|
# ifdef MOZ_X11
|
|
# include <gdk/gdkx.h>
|
|
+# undef None
|
|
# endif /* MOZ_X11 */
|
|
# include <fontconfig/fontconfig.h>
|
|
#endif
|
|
@@ -346,7 +347,6 @@ void XRE_LibFuzzerSetDriver(LibFuzzerDriver aDriver) {
|
|
#endif // FUZZING
|
|
|
|
// Undo X11/X.h's definition of None
|
|
-#undef None
|
|
|
|
namespace mozilla {
|
|
int (*RunGTest)(int*, char**) = 0;
|
|
diff --git a/toolkit/xre/nsGDKErrorHandler.cpp b/toolkit/xre/nsGDKErrorHandler.cpp
|
|
index 421abdf12f..9335d2422c 100644
|
|
--- a/toolkit/xre/nsGDKErrorHandler.cpp
|
|
+++ b/toolkit/xre/nsGDKErrorHandler.cpp
|
|
@@ -6,14 +6,21 @@
|
|
#include "nsGDKErrorHandler.h"
|
|
|
|
#include <gtk/gtk.h>
|
|
+#ifdef MOZ_X11
|
|
#include <gdk/gdkx.h>
|
|
+#endif
|
|
+#ifdef MOZ_WAYLAND
|
|
+#include <gdk/gdkwayland.h>
|
|
+#endif
|
|
#include <errno.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "nsDebug.h"
|
|
#include "nsString.h"
|
|
+#ifdef MOZ_X11
|
|
#include "nsX11ErrorHandler.h"
|
|
+#endif
|
|
|
|
#include "prenv.h"
|
|
|
|
@@ -26,6 +33,7 @@
|
|
*/
|
|
static void GdkErrorHandler(const gchar* log_domain, GLogLevelFlags log_level,
|
|
const gchar* message, gpointer user_data) {
|
|
+#ifdef MOZ_X11
|
|
if (strstr(message, "X Window System error")) {
|
|
XErrorEvent event;
|
|
nsDependentCString buffer(message);
|
|
@@ -93,9 +101,12 @@ static void GdkErrorHandler(const gchar* log_domain, GLogLevelFlags log_level,
|
|
|
|
X11Error(event.display, &event);
|
|
} else {
|
|
+#endif
|
|
g_log_default_handler(log_domain, log_level, message, user_data);
|
|
MOZ_CRASH_UNSAFE(message);
|
|
+#ifdef MOZ_X11
|
|
}
|
|
+#endif
|
|
}
|
|
|
|
void InstallGdkErrorHandler() {
|
|
@@ -103,7 +114,9 @@ void InstallGdkErrorHandler() {
|
|
(GLogLevelFlags)(G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL |
|
|
G_LOG_FLAG_RECURSION),
|
|
GdkErrorHandler, nullptr);
|
|
+#ifdef MOZ_X11
|
|
if (PR_GetEnv("MOZ_X_SYNC")) {
|
|
XSynchronize(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), X11True);
|
|
}
|
|
+#endif
|
|
}
|
|
diff --git a/widget/CompositorWidget.h b/widget/CompositorWidget.h
|
|
index 20eb3634f3..10fb94a99f 100644
|
|
--- a/widget/CompositorWidget.h
|
|
+++ b/widget/CompositorWidget.h
|
|
@@ -62,7 +62,7 @@ class CompositorWidgetDelegate {
|
|
};
|
|
|
|
// Platforms that support out-of-process widgets.
|
|
-#if defined(XP_WIN) || defined(MOZ_X11)
|
|
+#if defined(XP_WIN) || defined(MOZ_X11) || defined(MOZ_WAYLAND)
|
|
// CompositorWidgetParent should implement CompositorWidget and
|
|
// PCompositorWidgetParent.
|
|
class CompositorWidgetParent;
|
|
diff --git a/widget/gtk/MozContainer.cpp b/widget/gtk/MozContainer.cpp
|
|
index 95832dc03d..a21d2d2b40 100644
|
|
--- a/widget/gtk/MozContainer.cpp
|
|
+++ b/widget/gtk/MozContainer.cpp
|
|
@@ -9,7 +9,9 @@
|
|
|
|
#include <glib.h>
|
|
#include <gtk/gtk.h>
|
|
+#ifdef MOZ_X11
|
|
#include <gdk/gdkx.h>
|
|
+#endif
|
|
#include <stdio.h>
|
|
#include "mozilla/WidgetUtilsGtk.h"
|
|
|
|
diff --git a/widget/gtk/components.conf b/widget/gtk/components.conf
|
|
index 38c07bd812..a125d8d275 100644
|
|
--- a/widget/gtk/components.conf
|
|
+++ b/widget/gtk/components.conf
|
|
@@ -78,7 +78,7 @@ Classes = [
|
|
},
|
|
]
|
|
|
|
-if defined('MOZ_X11'):
|
|
+if defined('MOZ_X11') or defined('MOZ_WAYLAND'):
|
|
Classes += [
|
|
{
|
|
'js_name': 'clipboard',
|
|
diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
|
|
index 291e3a78c8..7955b84d0c 100644
|
|
--- a/widget/gtk/moz.build
|
|
+++ b/widget/gtk/moz.build
|
|
@@ -101,22 +101,26 @@ if CONFIG["MOZ_WAYLAND"]:
|
|
|
|
if CONFIG["MOZ_X11"]:
|
|
UNIFIED_SOURCES += [
|
|
- "CompositorWidgetChild.cpp",
|
|
- "CompositorWidgetParent.cpp",
|
|
- "InProcessGtkCompositorWidget.cpp",
|
|
"nsClipboardX11.cpp",
|
|
"nsShmImage.cpp",
|
|
- "nsUserIdleServiceGTK.cpp",
|
|
"WindowSurfaceX11.cpp",
|
|
"WindowSurfaceX11Image.cpp",
|
|
"WindowSurfaceX11SHM.cpp",
|
|
]
|
|
- EXPORTS.mozilla.widget += [
|
|
- "CompositorWidgetChild.h",
|
|
- "CompositorWidgetParent.h",
|
|
- "GtkCompositorWidget.h",
|
|
- "InProcessGtkCompositorWidget.h",
|
|
- ]
|
|
+
|
|
+UNIFIED_SOURCES += [
|
|
+ "CompositorWidgetChild.cpp",
|
|
+ "CompositorWidgetParent.cpp",
|
|
+ "InProcessGtkCompositorWidget.cpp",
|
|
+ "nsUserIdleServiceGTK.cpp",
|
|
+]
|
|
+
|
|
+EXPORTS.mozilla.widget += [
|
|
+ "CompositorWidgetChild.h",
|
|
+ "CompositorWidgetParent.h",
|
|
+ "GtkCompositorWidget.h",
|
|
+ "InProcessGtkCompositorWidget.h",
|
|
+]
|
|
|
|
if CONFIG["NS_PRINTING"]:
|
|
UNIFIED_SOURCES += [
|
|
@@ -145,7 +149,7 @@ LOCAL_INCLUDES += [
|
|
"/widget/headless",
|
|
]
|
|
|
|
-if CONFIG["MOZ_X11"]:
|
|
+if CONFIG["MOZ_X11"] or CONFIG["MOZ_WAYLAND"]:
|
|
LOCAL_INCLUDES += [
|
|
"/widget/x11",
|
|
]
|
|
diff --git a/widget/gtk/mozgtk/mozgtk.c b/widget/gtk/mozgtk/mozgtk.c
|
|
index 677f9b3561..b8cb7de58e 100644
|
|
--- a/widget/gtk/mozgtk/mozgtk.c
|
|
+++ b/widget/gtk/mozgtk/mozgtk.c
|
|
@@ -6,6 +6,7 @@
|
|
|
|
#include "mozilla/Types.h"
|
|
|
|
+#if defined(MOZ_X11)
|
|
#include <X11/Xlib.h>
|
|
// Bug 1271100
|
|
// We need to trick system Cairo into not using the XShm extension due to
|
|
@@ -19,3 +20,4 @@
|
|
// ever can remove this workaround for system Cairo, we'll need something
|
|
// to replace it for that purpose.
|
|
MOZ_EXPORT Bool XShmQueryExtension(Display* aDisplay) { return False; }
|
|
+#endif
|
|
diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp
|
|
index ed15e549de..76f258312d 100644
|
|
--- a/widget/gtk/nsClipboard.cpp
|
|
+++ b/widget/gtk/nsClipboard.cpp
|
|
@@ -9,7 +9,9 @@
|
|
|
|
#include "nsArrayUtils.h"
|
|
#include "nsClipboard.h"
|
|
+#if defined(MOZ_X11)
|
|
#include "nsClipboardX11.h"
|
|
+#endif
|
|
#if defined(MOZ_WAYLAND)
|
|
# include "nsClipboardWayland.h"
|
|
# include "nsClipboardWaylandAsync.h"
|
|
@@ -37,7 +39,9 @@
|
|
#include "imgIContainer.h"
|
|
|
|
#include <gtk/gtk.h>
|
|
+#if defined(MOZ_X11)
|
|
#include <gtk/gtkx.h>
|
|
+#endif
|
|
|
|
#include "mozilla/Encoding.h"
|
|
|
|
@@ -106,16 +110,12 @@ nsClipboard::~nsClipboard() {
|
|
NS_IMPL_ISUPPORTS(nsClipboard, nsIClipboard, nsIObserver)
|
|
|
|
nsresult nsClipboard::Init(void) {
|
|
- if (widget::GdkIsX11Display()) {
|
|
- mContext = new nsRetrievalContextX11();
|
|
-#if defined(MOZ_WAYLAND)
|
|
- } else if (widget::GdkIsWaylandDisplay()) {
|
|
+ if (widget::GdkIsWaylandDisplay()) {
|
|
if (StaticPrefs::widget_wayland_async_clipboard_enabled_AtStartup()) {
|
|
mContext = new nsRetrievalContextWaylandAsync();
|
|
} else {
|
|
mContext = new nsRetrievalContextWayland();
|
|
}
|
|
-#endif
|
|
} else {
|
|
NS_WARNING("Missing nsRetrievalContext for nsClipboard!");
|
|
return NS_OK;
|
|
@@ -351,13 +351,6 @@ nsClipboard::GetData(nsITransferable* aTransferable, int32_t aWhichClipboard) {
|
|
}
|
|
#endif
|
|
|
|
- // Filter out MIME types on X11 to prevent unwanted conversions,
|
|
- // see Bug 1611407
|
|
- if (widget::GdkIsX11Display()) {
|
|
- if (!FilterImportedFlavors(aWhichClipboard, flavors)) {
|
|
- return NS_OK;
|
|
- }
|
|
- }
|
|
|
|
for (uint32_t i = 0; i < flavors.Length(); i++) {
|
|
nsCString& flavorStr = flavors[i];
|
|
diff --git a/widget/gtk/nsDeviceContextSpecG.cpp b/widget/gtk/nsDeviceContextSpecG.cpp
|
|
index 3948c15cc5..968252b896 100644
|
|
--- a/widget/gtk/nsDeviceContextSpecG.cpp
|
|
+++ b/widget/gtk/nsDeviceContextSpecG.cpp
|
|
@@ -6,7 +6,9 @@
|
|
#include "nsDeviceContextSpecG.h"
|
|
|
|
#include "mozilla/gfx/PrintTargetPDF.h"
|
|
+#ifdef MOZ_X11
|
|
#include "mozilla/gfx/PrintTargetPS.h"
|
|
+#endif
|
|
#include "mozilla/Logging.h"
|
|
#include "mozilla/Services.h"
|
|
|
|
@@ -46,7 +48,9 @@ using namespace mozilla;
|
|
using mozilla::gfx::IntSize;
|
|
using mozilla::gfx::PrintTarget;
|
|
using mozilla::gfx::PrintTargetPDF;
|
|
+#ifdef MOZ_X11
|
|
using mozilla::gfx::PrintTargetPS;
|
|
+#endif
|
|
|
|
nsDeviceContextSpecGTK::nsDeviceContextSpecGTK()
|
|
: mGtkPrintSettings(nullptr), mGtkPageSetup(nullptr) {}
|
|
@@ -119,12 +123,15 @@ already_AddRefed<PrintTarget> nsDeviceContextSpecGTK::MakePrintTarget() {
|
|
return PrintTargetPDF::CreateOrNull(stream, size);
|
|
}
|
|
|
|
+#ifdef MOZ_X11
|
|
int32_t orientation = mPrintSettings->GetSheetOrientation();
|
|
return PrintTargetPS::CreateOrNull(
|
|
stream, size,
|
|
orientation == nsIPrintSettings::kPortraitOrientation
|
|
? PrintTargetPS::PORTRAIT
|
|
: PrintTargetPS::LANDSCAPE);
|
|
+#endif
|
|
+ return nullptr;
|
|
}
|
|
|
|
#define DECLARE_KNOWN_MONOCHROME_SETTING(key_, value_) {"cups-" key_, value_},
|
|
diff --git a/widget/gtk/nsDragService.cpp b/widget/gtk/nsDragService.cpp
|
|
index fcd4236261..659c06260c 100644
|
|
--- a/widget/gtk/nsDragService.cpp
|
|
+++ b/widget/gtk/nsDragService.cpp
|
|
@@ -23,7 +23,11 @@
|
|
#include "prthread.h"
|
|
#include <dlfcn.h>
|
|
#include <gtk/gtk.h>
|
|
+#ifdef MOZ_X11
|
|
#include <gdk/gdkx.h>
|
|
+#else
|
|
+#include <gdk/gdkwayland.h>
|
|
+#endif
|
|
#include "nsCRT.h"
|
|
#include "mozilla/BasicEvents.h"
|
|
#include "mozilla/Services.h"
|
|
@@ -34,7 +38,6 @@
|
|
#include "mozilla/WidgetUtilsGtk.h"
|
|
#include "GRefPtr.h"
|
|
|
|
-#include "gfxXlibSurface.h"
|
|
#include "gfxContext.h"
|
|
#include "nsImageToPixbuf.h"
|
|
#include "nsPresContext.h"
|
|
@@ -52,6 +55,8 @@
|
|
#ifdef MOZ_WAYLAND
|
|
# include "nsClipboardWayland.h"
|
|
# include "gfxPlatformGtk.h"
|
|
+#else
|
|
+#include "gfxXlibSurface.h"
|
|
#endif
|
|
|
|
using namespace mozilla;
|
|
diff --git a/widget/gtk/nsGtkKeyUtils.cpp b/widget/gtk/nsGtkKeyUtils.cpp
|
|
index f4c7030a37..a54d14988f 100644
|
|
--- a/widget/gtk/nsGtkKeyUtils.cpp
|
|
+++ b/widget/gtk/nsGtkKeyUtils.cpp
|
|
@@ -12,10 +12,12 @@
|
|
#include <gdk/gdkkeysyms.h>
|
|
#include <algorithm>
|
|
#include <gdk/gdk.h>
|
|
-#include <gdk/gdkx.h>
|
|
#include <dlfcn.h>
|
|
#include <gdk/gdkkeysyms-compat.h>
|
|
+#ifdef MOZ_X11
|
|
+#include <gdk/gdkx.h>
|
|
#include <X11/XKBlib.h>
|
|
+#endif
|
|
#include "X11UndefineNone.h"
|
|
#include "IMContextWrapper.h"
|
|
#include "WidgetUtils.h"
|
|
@@ -51,7 +53,7 @@ LazyLogModule gKeymapWrapperLog("KeymapWrapperWidgets");
|
|
|
|
KeymapWrapper* KeymapWrapper::sInstance = nullptr;
|
|
guint KeymapWrapper::sLastRepeatableHardwareKeyCode = 0;
|
|
-Time KeymapWrapper::sLastRepeatableKeyTime = 0;
|
|
+GTime KeymapWrapper::sLastRepeatableKeyTime = 0;
|
|
KeymapWrapper::RepeatState KeymapWrapper::sRepeatState =
|
|
KeymapWrapper::NOT_PRESSED;
|
|
|
|
@@ -346,9 +348,11 @@ KeymapWrapper::KeymapWrapper()
|
|
|
|
g_object_ref(mGdkKeymap);
|
|
|
|
+#ifdef MOZ_X11
|
|
if (GdkIsX11Display()) {
|
|
InitXKBExtension();
|
|
}
|
|
+#endif
|
|
|
|
Init();
|
|
}
|
|
@@ -365,16 +369,19 @@ void KeymapWrapper::Init() {
|
|
mModifierKeys.Clear();
|
|
memset(mModifierMasks, 0, sizeof(mModifierMasks));
|
|
|
|
+#ifdef MOZ_X11
|
|
if (GdkIsX11Display()) {
|
|
InitBySystemSettingsX11();
|
|
- }
|
|
+ } else {
|
|
+#endif
|
|
#ifdef MOZ_WAYLAND
|
|
- else {
|
|
InitBySystemSettingsWayland();
|
|
- }
|
|
#endif
|
|
|
|
+#ifdef MOZ_X11
|
|
+ }
|
|
gdk_window_add_filter(nullptr, FilterEvents, this);
|
|
+#endif
|
|
|
|
MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
|
|
("%p Init, CapsLock=0x%X, NumLock=0x%X, "
|
|
@@ -387,6 +394,7 @@ void KeymapWrapper::Init() {
|
|
GetModifierMask(SUPER), GetModifierMask(HYPER)));
|
|
}
|
|
|
|
+#ifdef MOZ_X11
|
|
void KeymapWrapper::InitXKBExtension() {
|
|
PodZero(&mKeyboardState);
|
|
|
|
@@ -619,6 +627,7 @@ void KeymapWrapper::InitBySystemSettingsX11() {
|
|
XFreeModifiermap(xmodmap);
|
|
XFree(xkeymap);
|
|
}
|
|
+#endif
|
|
|
|
#ifdef MOZ_WAYLAND
|
|
void KeymapWrapper::SetModifierMask(xkb_keymap* aKeymap,
|
|
@@ -776,7 +785,9 @@ void KeymapWrapper::InitBySystemSettingsWayland() {
|
|
#endif
|
|
|
|
KeymapWrapper::~KeymapWrapper() {
|
|
+#ifdef MOZ_X11
|
|
gdk_window_remove_filter(nullptr, FilterEvents, this);
|
|
+#endif
|
|
if (mOnKeysChangedSignalHandle) {
|
|
g_signal_handler_disconnect(mGdkKeymap, mOnKeysChangedSignalHandle);
|
|
}
|
|
@@ -787,6 +798,7 @@ KeymapWrapper::~KeymapWrapper() {
|
|
MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("%p Destructor", this));
|
|
}
|
|
|
|
+#ifdef MOZ_X11
|
|
/* static */
|
|
GdkFilterReturn KeymapWrapper::FilterEvents(GdkXEvent* aXEvent,
|
|
GdkEvent* aGdkEvent,
|
|
@@ -900,6 +912,7 @@ GdkFilterReturn KeymapWrapper::FilterEvents(GdkXEvent* aXEvent,
|
|
|
|
return GDK_FILTER_CONTINUE;
|
|
}
|
|
+#endif
|
|
|
|
static void ResetBidiKeyboard() {
|
|
// Reset the bidi keyboard settings for the new GdkKeymap
|
|
@@ -1760,6 +1773,7 @@ void KeymapWrapper::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent,
|
|
// state. It means if there're some pending modifier key press or
|
|
// key release events, the result isn't what we want.
|
|
guint modifierState = aGdkKeyEvent->state;
|
|
+#ifdef MOZ_X11
|
|
GdkDisplay* gdkDisplay = gdk_display_get_default();
|
|
if (aGdkKeyEvent->is_modifier && GdkIsX11Display(gdkDisplay)) {
|
|
Display* display = gdk_x11_display_get_xdisplay(gdkDisplay);
|
|
@@ -1777,6 +1791,7 @@ void KeymapWrapper::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent,
|
|
}
|
|
}
|
|
}
|
|
+#endif
|
|
InitInputEvent(aKeyEvent, modifierState);
|
|
|
|
switch (aGdkKeyEvent->keyval) {
|
|
@@ -2023,6 +2038,7 @@ bool KeymapWrapper::IsLatinGroup(guint8 aGroup) {
|
|
return result;
|
|
}
|
|
|
|
+#ifdef MOZ_X11
|
|
bool KeymapWrapper::IsAutoRepeatableKey(guint aHardwareKeyCode) {
|
|
uint8_t indexOfArray = aHardwareKeyCode / 8;
|
|
MOZ_ASSERT(indexOfArray < ArrayLength(mKeyboardState.auto_repeats),
|
|
@@ -2030,6 +2046,7 @@ bool KeymapWrapper::IsAutoRepeatableKey(guint aHardwareKeyCode) {
|
|
char bitMask = 1 << (aHardwareKeyCode % 8);
|
|
return (mKeyboardState.auto_repeats[indexOfArray] & bitMask) != 0;
|
|
}
|
|
+#endif
|
|
|
|
/* static */
|
|
bool KeymapWrapper::IsBasicLatinLetterOrNumeral(uint32_t aCharCode) {
|
|
diff --git a/widget/gtk/nsGtkKeyUtils.h b/widget/gtk/nsGtkKeyUtils.h
|
|
index 07d60c27a6..43df8095fd 100644
|
|
--- a/widget/gtk/nsGtkKeyUtils.h
|
|
+++ b/widget/gtk/nsGtkKeyUtils.h
|
|
@@ -13,7 +13,9 @@
|
|
#include "nsTArray.h"
|
|
|
|
#include <gdk/gdk.h>
|
|
+#ifdef MOZ_X11
|
|
#include <X11/XKBlib.h>
|
|
+#endif
|
|
#ifdef MOZ_WAYLAND
|
|
# include <gdk/gdkwayland.h>
|
|
# include <xkbcommon/xkbcommon.h>
|
|
@@ -315,7 +317,9 @@ class KeymapWrapper {
|
|
* See a call of XkbSelectEventDetails() with XkbControlsNotify in
|
|
* InitXKBExtension().
|
|
*/
|
|
+#ifdef MOZ_X11
|
|
XKeyboardState mKeyboardState;
|
|
+#endif
|
|
|
|
/**
|
|
* Pointer of the singleton instance.
|
|
@@ -326,7 +330,7 @@ class KeymapWrapper {
|
|
* Auto key repeat management.
|
|
*/
|
|
static guint sLastRepeatableHardwareKeyCode;
|
|
- static Time sLastRepeatableKeyTime;
|
|
+ static GTime sLastRepeatableKeyTime;
|
|
enum RepeatState { NOT_PRESSED, FIRST_PRESS, REPEATING };
|
|
static RepeatState sRepeatState;
|
|
|
|
diff --git a/widget/gtk/nsPrintDialogGTK.cpp b/widget/gtk/nsPrintDialogGTK.cpp
|
|
index 0050af3af3..c2c02e59ff 100644
|
|
--- a/widget/gtk/nsPrintDialogGTK.cpp
|
|
+++ b/widget/gtk/nsPrintDialogGTK.cpp
|
|
@@ -26,7 +26,11 @@
|
|
#include "nsIObserverService.h"
|
|
|
|
// for gdk_x11_window_get_xid
|
|
+#ifdef MOZ_X11
|
|
#include <gdk/gdkx.h>
|
|
+#else
|
|
+#include <gdk/gdkwayland.h>
|
|
+#endif
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <fcntl.h>
|
|
@@ -525,6 +529,7 @@ static void wayland_window_handle_exported(GdkWindow* window,
|
|
static gboolean window_export_handle(GtkWindow* window,
|
|
GtkWindowHandleExported callback,
|
|
gpointer user_data) {
|
|
+#ifdef MOZ_X11
|
|
if (GdkIsX11Display()) {
|
|
GdkWindow* gdk_window = gtk_widget_get_window(GTK_WIDGET(window));
|
|
char* handle_str;
|
|
@@ -535,8 +540,9 @@ static gboolean window_export_handle(GtkWindow* window,
|
|
g_free(handle_str);
|
|
return true;
|
|
}
|
|
+#endif
|
|
#ifdef MOZ_WAYLAND
|
|
- else if (GdkIsWaylandDisplay()) {
|
|
+ if (GdkIsWaylandDisplay()) {
|
|
GdkWindow* gdk_window = gtk_widget_get_window(GTK_WIDGET(window));
|
|
WaylandWindowHandleExportedData* data;
|
|
|
|
diff --git a/widget/gtk/nsUserIdleServiceGTK.cpp b/widget/gtk/nsUserIdleServiceGTK.cpp
|
|
index 884d52a6ca..b084a2f827 100644
|
|
--- a/widget/gtk/nsUserIdleServiceGTK.cpp
|
|
+++ b/widget/gtk/nsUserIdleServiceGTK.cpp
|
|
@@ -17,6 +17,7 @@ using mozilla::LogLevel;
|
|
|
|
static mozilla::LazyLogModule sIdleLog("nsIUserIdleService");
|
|
|
|
+#ifdef MOZ_X11
|
|
typedef bool (*_XScreenSaverQueryExtension_fn)(Display* dpy, int* event_base,
|
|
int* error_base);
|
|
|
|
@@ -25,12 +26,14 @@ typedef XScreenSaverInfo* (*_XScreenSaverAllocInfo_fn)(void);
|
|
typedef void (*_XScreenSaverQueryInfo_fn)(Display* dpy, Drawable drw,
|
|
XScreenSaverInfo* info);
|
|
|
|
-static bool sInitialized = false;
|
|
static _XScreenSaverQueryExtension_fn _XSSQueryExtension = nullptr;
|
|
static _XScreenSaverAllocInfo_fn _XSSAllocInfo = nullptr;
|
|
static _XScreenSaverQueryInfo_fn _XSSQueryInfo = nullptr;
|
|
+#endif
|
|
+static bool sInitialized = false;
|
|
|
|
static void Initialize() {
|
|
+#ifdef MOZ_X11
|
|
if (!mozilla::widget::GdkIsX11Display()) {
|
|
return;
|
|
}
|
|
@@ -57,16 +60,18 @@ static void Initialize() {
|
|
MOZ_LOG(sIdleLog, LogLevel::Warning, ("Failed to get XSSAllocInfo!\n"));
|
|
if (!_XSSQueryInfo)
|
|
MOZ_LOG(sIdleLog, LogLevel::Warning, ("Failed to get XSSQueryInfo!\n"));
|
|
-
|
|
+#endif
|
|
sInitialized = true;
|
|
}
|
|
|
|
-nsUserIdleServiceGTK::nsUserIdleServiceGTK() : mXssInfo(nullptr) {
|
|
+nsUserIdleServiceGTK::nsUserIdleServiceGTK() {
|
|
Initialize();
|
|
}
|
|
|
|
nsUserIdleServiceGTK::~nsUserIdleServiceGTK() {
|
|
+#ifdef MOZ_X11
|
|
if (mXssInfo) XFree(mXssInfo);
|
|
+#endif
|
|
|
|
// It is not safe to unload libXScrnSaver until each display is closed because
|
|
// the library registers callbacks through XESetCloseDisplay (Bug 397607).
|
|
@@ -88,6 +93,7 @@ bool nsUserIdleServiceGTK::PollIdleTime(uint32_t* aIdleTime) {
|
|
// Ask xscreensaver about idle time:
|
|
*aIdleTime = 0;
|
|
|
|
+#ifdef MOZ_X11
|
|
// We might not have a display (cf. in xpcshell)
|
|
Display* dplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
|
|
if (!dplay) {
|
|
@@ -107,6 +113,7 @@ bool nsUserIdleServiceGTK::PollIdleTime(uint32_t* aIdleTime) {
|
|
*aIdleTime = mXssInfo->idle;
|
|
return true;
|
|
}
|
|
+#endif
|
|
// If we get here, we couldn't get to XScreenSaver:
|
|
MOZ_LOG(sIdleLog, LogLevel::Warning, ("XSSQueryExtension returned false!\n"));
|
|
return false;
|
|
diff --git a/widget/gtk/nsUserIdleServiceGTK.h b/widget/gtk/nsUserIdleServiceGTK.h
|
|
index 9b9ba31846..8f83aee584 100644
|
|
--- a/widget/gtk/nsUserIdleServiceGTK.h
|
|
+++ b/widget/gtk/nsUserIdleServiceGTK.h
|
|
@@ -9,6 +9,7 @@
|
|
#define nsUserIdleServiceGTK_h__
|
|
|
|
#include "nsUserIdleService.h"
|
|
+#ifdef MOZ_X11
|
|
#include <X11/Xlib.h>
|
|
#include <X11/Xutil.h>
|
|
#include <gdk/gdkx.h>
|
|
@@ -21,6 +22,7 @@ typedef struct {
|
|
unsigned long idle; // milliseconds idle
|
|
unsigned long event_mask; // event stuff
|
|
} XScreenSaverInfo;
|
|
+#endif
|
|
|
|
class nsUserIdleServiceGTK : public nsUserIdleService {
|
|
public:
|
|
@@ -40,7 +42,9 @@ class nsUserIdleServiceGTK : public nsUserIdleService {
|
|
|
|
private:
|
|
~nsUserIdleServiceGTK();
|
|
+#ifdef MOZ_X11
|
|
XScreenSaverInfo* mXssInfo;
|
|
+#endif
|
|
|
|
protected:
|
|
nsUserIdleServiceGTK();
|
|
diff --git a/widget/gtk/nsWidgetFactory.cpp b/widget/gtk/nsWidgetFactory.cpp
|
|
index d649c7e0bf..2f0f6223a4 100644
|
|
--- a/widget/gtk/nsWidgetFactory.cpp
|
|
+++ b/widget/gtk/nsWidgetFactory.cpp
|
|
@@ -20,9 +20,7 @@
|
|
#include "nsHTMLFormatConverter.h"
|
|
#include "HeadlessClipboard.h"
|
|
#include "IMContextWrapper.h"
|
|
-#ifdef MOZ_X11
|
|
# include "nsClipboard.h"
|
|
-#endif
|
|
#include "TaskbarProgress.h"
|
|
#include "nsFilePicker.h"
|
|
#include "nsSound.h"
|
|
@@ -36,7 +34,6 @@
|
|
using namespace mozilla;
|
|
using namespace mozilla::widget;
|
|
|
|
-#ifdef MOZ_X11
|
|
NS_IMPL_COMPONENT_FACTORY(nsIClipboard) {
|
|
nsCOMPtr<nsIClipboard> inst;
|
|
if (gfxPlatform::IsHeadless()) {
|
|
@@ -51,7 +48,6 @@ NS_IMPL_COMPONENT_FACTORY(nsIClipboard) {
|
|
|
|
return inst.forget().downcast<nsISupports>();
|
|
}
|
|
-#endif
|
|
|
|
nsresult nsWidgetGtk2ModuleCtor() { return nsAppShellInit(); }
|
|
|
|
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|
index 620e2f47f2..5205576310 100644
|
|
--- a/widget/gtk/nsWindow.cpp
|
|
+++ b/widget/gtk/nsWindow.cpp
|
|
@@ -58,7 +58,6 @@
|
|
#include "mozilla/UniquePtrExtensions.h"
|
|
#include "mozilla/WidgetUtils.h"
|
|
#include "mozilla/WritingModes.h"
|
|
-#include "mozilla/X11Util.h"
|
|
#include "mozilla/XREAppData.h"
|
|
#include "NativeKeyBindings.h"
|
|
#include "nsAppDirectoryServiceDefs.h"
|
|
@@ -90,7 +89,6 @@
|
|
#include "ScreenHelperGTK.h"
|
|
#include "SystemTimeConverter.h"
|
|
#include "WidgetUtilsGtk.h"
|
|
-#include "mozilla/X11Util.h"
|
|
|
|
#ifdef ACCESSIBILITY
|
|
# include "mozilla/a11y/LocalAccessible.h"
|
|
@@ -98,18 +96,21 @@
|
|
# include "nsAccessibilityService.h"
|
|
#endif
|
|
|
|
+#include "GLContextEGL.h" // for GLContextEGL::FindVisual()
|
|
#ifdef MOZ_X11
|
|
+# include "mozilla/X11Util.h"
|
|
# include <gdk/gdkkeysyms-compat.h>
|
|
# include <X11/Xatom.h>
|
|
# include <X11/extensions/XShm.h>
|
|
# include <X11/extensions/shape.h>
|
|
# include "gfxXlibSurface.h"
|
|
# include "GLContextGLX.h" // for GLContextGLX::FindVisual()
|
|
-# include "GLContextEGL.h" // for GLContextEGL::FindVisual()
|
|
# include "WindowSurfaceX11Image.h"
|
|
# include "WindowSurfaceX11SHM.h"
|
|
#endif
|
|
#ifdef MOZ_WAYLAND
|
|
+# include <gdk/gdk.h>
|
|
+# include <gdk/gdkkeysyms-compat.h>
|
|
# include "nsIClipboard.h"
|
|
# include "nsView.h"
|
|
#endif
|
|
@@ -119,7 +120,9 @@ using namespace mozilla::gfx;
|
|
using namespace mozilla::layers;
|
|
using namespace mozilla::widget;
|
|
using mozilla::gl::GLContextEGL;
|
|
+#ifdef MOZ_X11
|
|
using mozilla::gl::GLContextGLX;
|
|
+#endif
|
|
|
|
// Don't put more than this many rects in the dirty region, just fluff
|
|
// out to the bounding-box if there are more
|
|
@@ -276,6 +279,7 @@ bool nsWindow::sTransparentMainWindow = false;
|
|
|
|
namespace mozilla {
|
|
|
|
+#ifdef MOZ_X11
|
|
class CurrentX11TimeGetter {
|
|
public:
|
|
explicit CurrentX11TimeGetter(GdkWindow* aWindow)
|
|
@@ -323,6 +327,7 @@ class CurrentX11TimeGetter {
|
|
GdkWindow* mWindow;
|
|
TimeStamp mAsyncUpdateStart;
|
|
};
|
|
+#endif
|
|
|
|
} // namespace mozilla
|
|
|
|
@@ -2526,6 +2531,7 @@ void nsWindow::SetSizeMode(nsSizeMode aMode) {
|
|
}
|
|
|
|
static bool GetWindowManagerName(GdkWindow* gdk_window, nsACString& wmName) {
|
|
+#ifdef MOZ_X11
|
|
if (!GdkIsX11Display()) {
|
|
return false;
|
|
}
|
|
@@ -2593,6 +2599,8 @@ static bool GetWindowManagerName(GdkWindow* gdk_window, nsACString& wmName) {
|
|
|
|
wmName = reinterpret_cast<const char*>(prop_return);
|
|
return true;
|
|
+#endif
|
|
+ return false;
|
|
}
|
|
|
|
#define kDesktopMutterSchema "org.gnome.mutter"
|
|
@@ -2645,7 +2653,7 @@ static bool WorkspaceManagementDisabled(GdkWindow* gdk_window) {
|
|
|
|
void nsWindow::GetWorkspaceID(nsAString& workspaceID) {
|
|
workspaceID.Truncate();
|
|
-
|
|
+#ifdef MOZ_X11
|
|
if (!GdkIsX11Display() || !mShell) {
|
|
return;
|
|
}
|
|
@@ -2684,9 +2692,11 @@ void nsWindow::GetWorkspaceID(nsAString& workspaceID) {
|
|
LOG(" got workspace ID %d", (int32_t)wm_desktop[0]);
|
|
workspaceID.AppendInt((int32_t)wm_desktop[0]);
|
|
g_free(wm_desktop);
|
|
+#endif
|
|
}
|
|
|
|
void nsWindow::MoveToWorkspace(const nsAString& workspaceIDStr) {
|
|
+#ifdef MOZ_X11
|
|
nsresult rv = NS_OK;
|
|
int32_t workspaceID = workspaceIDStr.ToInteger(&rv);
|
|
|
|
@@ -2731,6 +2741,7 @@ void nsWindow::MoveToWorkspace(const nsAString& workspaceIDStr) {
|
|
|
|
XFlush(xdisplay);
|
|
LOG(" moved to workspace");
|
|
+#endif
|
|
}
|
|
|
|
using SetUserTimeFunc = void (*)(GdkWindow*, guint32);
|
|
@@ -2771,9 +2782,7 @@ guint32 nsWindow::GetLastUserInputTime() {
|
|
// button and key releases. Therefore use the most recent of
|
|
// gdk_x11_display_get_user_time and the last time that we have seen.
|
|
GdkDisplay* gdkDisplay = gdk_display_get_default();
|
|
- guint32 timestamp = GdkIsX11Display(gdkDisplay)
|
|
- ? gdk_x11_display_get_user_time(gdkDisplay)
|
|
- : gtk_get_current_event_time();
|
|
+ guint32 timestamp = gtk_get_current_event_time();
|
|
|
|
if (sLastUserInputTime != GDK_CURRENT_TIME &&
|
|
TimestampIsNewerThan(sLastUserInputTime, timestamp)) {
|
|
@@ -2937,6 +2946,7 @@ void nsWindow::UpdateClientOffsetFromFrameExtents() {
|
|
return;
|
|
}
|
|
|
|
+#ifdef MOZ_X11
|
|
GdkAtom cardinal_atom = gdk_x11_xatom_to_atom(XA_CARDINAL);
|
|
|
|
GdkAtom type_returned;
|
|
@@ -2962,6 +2972,7 @@ void nsWindow::UpdateClientOffsetFromFrameExtents() {
|
|
|
|
mClientOffset = nsIntPoint(left, top);
|
|
}
|
|
+#endif
|
|
|
|
// Send a WindowMoved notification. This ensures that BrowserParent
|
|
// picks up the new client offset and sends it to the child process
|
|
@@ -2973,13 +2984,12 @@ void nsWindow::UpdateClientOffsetFromFrameExtents() {
|
|
}
|
|
|
|
LayoutDeviceIntPoint nsWindow::GetClientOffset() {
|
|
- return GdkIsX11Display()
|
|
- ? LayoutDeviceIntPoint::FromUnknownPoint(mClientOffset)
|
|
- : LayoutDeviceIntPoint(0, 0);
|
|
+ return LayoutDeviceIntPoint(0, 0);
|
|
}
|
|
|
|
gboolean nsWindow::OnPropertyNotifyEvent(GtkWidget* aWidget,
|
|
GdkEventProperty* aEvent) {
|
|
+#ifdef MOZ_X11
|
|
if (aEvent->atom == gdk_atom_intern("_NET_FRAME_EXTENTS", FALSE)) {
|
|
UpdateClientOffsetFromFrameExtents();
|
|
return FALSE;
|
|
@@ -2990,6 +3000,7 @@ gboolean nsWindow::OnPropertyNotifyEvent(GtkWidget* aWidget,
|
|
if (GetCurrentTimeGetter()->PropertyNotifyHandler(aWidget, aEvent)) {
|
|
return TRUE;
|
|
}
|
|
+#endif
|
|
return FALSE;
|
|
}
|
|
|
|
@@ -3127,9 +3138,11 @@ void* nsWindow::GetNativeData(uint32_t aDataType) {
|
|
return GetToplevelWidget();
|
|
|
|
case NS_NATIVE_WINDOW_WEBRTC_DEVICE_ID:
|
|
+#ifdef MOZ_X11
|
|
if (GdkIsX11Display()) {
|
|
return (void*)GDK_WINDOW_XID(gdk_window_get_toplevel(mGdkWindow));
|
|
}
|
|
+#endif
|
|
NS_WARNING(
|
|
"nsWindow::GetNativeData(): NS_NATIVE_WINDOW_WEBRTC_DEVICE_ID is not "
|
|
"handled on Wayland!");
|
|
@@ -3150,14 +3163,14 @@ void* nsWindow::GetNativeData(uint32_t aDataType) {
|
|
return nullptr;
|
|
case NS_NATIVE_EGL_WINDOW: {
|
|
void* eglWindow = nullptr;
|
|
+#ifdef MOZ_X11
|
|
if (GdkIsX11Display()) {
|
|
eglWindow = mGdkWindow ? (void*)GDK_WINDOW_XID(mGdkWindow) : nullptr;
|
|
}
|
|
+#endif
|
|
#ifdef MOZ_WAYLAND
|
|
- else {
|
|
eglWindow = moz_container_wayland_get_egl_window(
|
|
mContainer, FractionalScaleFactor());
|
|
- }
|
|
#endif
|
|
LOG("Get NS_NATIVE_EGL_WINDOW window %p", eglWindow);
|
|
return eglWindow;
|
|
@@ -3477,8 +3490,7 @@ gboolean nsWindow::OnExposeEvent(cairo_t* cr) {
|
|
nsIWidgetListener* listener = GetListener();
|
|
if (!listener) return FALSE;
|
|
|
|
- LOG("received expose event %p 0x%lx (rects follow):\n", mGdkWindow,
|
|
- GdkIsX11Display() ? gdk_x11_window_get_xid(mGdkWindow) : 0);
|
|
+ LOG("received expose event %p 0x%lx (rects follow):\n", mGdkWindow, 0);
|
|
LayoutDeviceIntRegion exposeRegion;
|
|
if (!ExtractExposeRegion(exposeRegion, cr)) {
|
|
return FALSE;
|
|
@@ -4020,6 +4032,7 @@ void nsWindow::OnMotionNotifyEvent(GdkEventMotion* aEvent) {
|
|
MOZ_ASSERT(gdk_window, "gdk_window_get_toplevel should not return null");
|
|
|
|
bool canDrag = true;
|
|
+#ifdef MOZ_X11
|
|
if (GdkIsX11Display()) {
|
|
// Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=789054
|
|
// To avoid crashes disable double-click on WM without _NET_WM_MOVERESIZE.
|
|
@@ -4030,6 +4043,7 @@ void nsWindow::OnMotionNotifyEvent(GdkEventMotion* aEvent) {
|
|
canDrag = false;
|
|
}
|
|
}
|
|
+#endif
|
|
|
|
if (canDrag) {
|
|
gdk_window_begin_move_drag(gdk_window, 1, aEvent->x_root, aEvent->y_root,
|
|
@@ -4481,16 +4495,20 @@ TimeStamp nsWindow::GetEventTimeStamp(guint32 aEventTime) {
|
|
int64_t tick =
|
|
BaseTimeDurationPlatformUtils::TicksFromMilliseconds(timestampTime);
|
|
eventTimeStamp = TimeStamp::FromSystemTime(tick);
|
|
- } else {
|
|
+ }
|
|
+#ifdef MOZ_X11
|
|
+ else {
|
|
CurrentX11TimeGetter* getCurrentTime = GetCurrentTimeGetter();
|
|
MOZ_ASSERT(getCurrentTime,
|
|
"Null current time getter despite having a window");
|
|
eventTimeStamp =
|
|
TimeConverter().GetTimeStampFromSystemTime(aEventTime, *getCurrentTime);
|
|
}
|
|
+#endif
|
|
return eventTimeStamp;
|
|
}
|
|
|
|
+#ifdef MOZ_X11
|
|
mozilla::CurrentX11TimeGetter* nsWindow::GetCurrentTimeGetter() {
|
|
MOZ_ASSERT(mGdkWindow, "Expected mGdkWindow to be set");
|
|
if (MOZ_UNLIKELY(!mCurrentTimeGetter)) {
|
|
@@ -4498,6 +4516,7 @@ mozilla::CurrentX11TimeGetter* nsWindow::GetCurrentTimeGetter() {
|
|
}
|
|
return mCurrentTimeGetter.get();
|
|
}
|
|
+#endif
|
|
|
|
gboolean nsWindow::OnKeyPressEvent(GdkEventKey* aEvent) {
|
|
LOG("OnKeyPressEvent [%p]\n", (void*)this);
|
|
@@ -5259,7 +5278,7 @@ void nsWindow::ConfigureGdkWindow() {
|
|
}
|
|
|
|
LOG(" finished, new GdkWindow %p XID 0x%lx\n", mGdkWindow,
|
|
- GdkIsX11Display() ? gdk_x11_window_get_xid(mGdkWindow) : 0);
|
|
+ 0);
|
|
}
|
|
|
|
void nsWindow::ReleaseGdkWindow() {
|
|
@@ -5912,6 +5931,7 @@ void nsWindow::NativeMoveResize(bool aMoved, bool aResized) {
|
|
return;
|
|
}
|
|
|
|
+#ifdef MOZ_X11
|
|
// Set position to hidden window on X11 may fail, so save the position
|
|
// and move it when it's shown.
|
|
if (aMoved && GdkIsX11Display() && IsPopup() &&
|
|
@@ -5920,6 +5940,7 @@ void nsWindow::NativeMoveResize(bool aMoved, bool aResized) {
|
|
mHiddenPopupPositioned = true;
|
|
mPopupPosition = topLeft;
|
|
}
|
|
+#endif
|
|
|
|
if (IsWaylandPopup()) {
|
|
NativeMoveResizeWaylandPopup(aMoved, aResized);
|
|
@@ -6655,6 +6676,7 @@ void nsWindow::UpdateTitlebarTransparencyBitmap() {
|
|
cairo_surface_destroy(surface);
|
|
}
|
|
|
|
+#ifdef MOZ_X11
|
|
if (!mNeedsShow) {
|
|
Display* xDisplay = GDK_WINDOW_XDISPLAY(mGdkWindow);
|
|
Window xDrawable = GDK_WINDOW_XID(mGdkWindow);
|
|
@@ -6675,6 +6697,7 @@ void nsWindow::UpdateTitlebarTransparencyBitmap() {
|
|
|
|
XFreePixmap(xDisplay, maskPixmap);
|
|
}
|
|
+#endif
|
|
}
|
|
|
|
void nsWindow::GrabPointer(guint32 aTime) {
|
|
@@ -6949,7 +6972,7 @@ static bool IsFullscreenSupported(GtkWidget* aShell) {
|
|
GdkScreen* screen = gtk_widget_get_screen(aShell);
|
|
GdkAtom atom = gdk_atom_intern("_NET_WM_STATE_FULLSCREEN", FALSE);
|
|
return gdk_x11_screen_supports_net_wm_hint(screen, atom);
|
|
-#elif
|
|
+#else
|
|
return true;
|
|
#endif
|
|
}
|
|
@@ -8215,6 +8238,7 @@ bool nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent, GdkWindow** aWindow,
|
|
return false;
|
|
}
|
|
|
|
+#ifdef MOZ_X11
|
|
if (GdkIsX11Display()) {
|
|
// Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=789054
|
|
// To avoid crashes disable double-click on WM without _NET_WM_MOVERESIZE.
|
|
@@ -8230,6 +8254,7 @@ bool nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent, GdkWindow** aWindow,
|
|
}
|
|
}
|
|
}
|
|
+#endif
|
|
|
|
// FIXME: It would be nice to have the widget position at the time
|
|
// of the event, but it's relatively unlikely that the widget has
|
|
@@ -8941,10 +8966,14 @@ void nsWindow::GetCompositorWidgetInitData(
|
|
XFlush(display);
|
|
displayName = nsCString(XDisplayString(display));
|
|
}
|
|
-#endif
|
|
*aInitData = mozilla::widget::GtkCompositorWidgetInitData(
|
|
(mXWindow != X11None) ? mXWindow : (uintptr_t) nullptr, displayName,
|
|
mIsShaped, GdkIsX11Display(), GetClientSize());
|
|
+#else
|
|
+ *aInitData = mozilla:widget::GtkCompositorWidgetInitData(
|
|
+ (uintptr_t) nullptr, nsCString(), 0, 0, GetClientSize()
|
|
+ );
|
|
+#endif
|
|
}
|
|
|
|
#ifdef MOZ_X11
|
|
diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h
|
|
index 74d914328e..b6de3587a7 100644
|
|
--- a/widget/gtk/nsWindow.h
|
|
+++ b/widget/gtk/nsWindow.h
|
|
@@ -95,7 +95,9 @@ typedef struct _GdkEventTouchpadPinch GdkEventTouchpadPinch;
|
|
|
|
namespace mozilla {
|
|
class TimeStamp;
|
|
+#ifdef MOZ_X11
|
|
class CurrentX11TimeGetter;
|
|
+#endif
|
|
|
|
} // namespace mozilla
|
|
|
|
@@ -277,7 +279,9 @@ class nsWindow final : public nsBaseWidget {
|
|
|
|
WidgetEventTime GetWidgetEventTime(guint32 aEventTime);
|
|
mozilla::TimeStamp GetEventTimeStamp(guint32 aEventTime);
|
|
+#ifdef MOZ_X11
|
|
mozilla::CurrentX11TimeGetter* GetCurrentTimeGetter();
|
|
+#endif
|
|
|
|
virtual void SetInputContext(const InputContext& aContext,
|
|
const InputContextAction& aAction) override;
|
|
diff --git a/widget/moz.build b/widget/moz.build
|
|
index 4724d667d8..48d0b4b1b6 100644
|
|
--- a/widget/moz.build
|
|
+++ b/widget/moz.build
|
|
@@ -262,7 +262,7 @@ if CONFIG["MOZ_INSTRUMENT_EVENT_LOOP"]:
|
|
|
|
EXPORTS.ipc = ["nsGUIEventIPC.h"]
|
|
|
|
-if CONFIG["MOZ_X11"]:
|
|
+if CONFIG["MOZ_X11"] or CONFIG["MOZ_WAYLAND"]:
|
|
DIRS += ["x11"]
|
|
|
|
if toolkit in ("cocoa", "windows"):
|
|
@@ -309,7 +309,7 @@ if toolkit == "windows":
|
|
"windows/PCompositorWidget.ipdl",
|
|
"windows/PlatformWidgetTypes.ipdlh",
|
|
]
|
|
-elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk" and CONFIG["MOZ_X11"]:
|
|
+elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
|
IPDL_SOURCES = [
|
|
"gtk/PCompositorWidget.ipdl",
|
|
"gtk/PlatformWidgetTypes.ipdlh",
|