Commit 255b4632 authored by ganguin's avatar ganguin
Browse files

Bug 1661450 - 2/8 Add wayland required code getting opt-out by disabling MOZ_X11 r=stransky,rmader

Ensure shared code with MOZ_X11 and MOZ_WAYLAND remains when MOZ_X11 is
undefined

Depends on D139526

Differential Revision: https://phabricator.services.mozilla.com/D139528
parent 936e3f05
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -75,10 +75,12 @@
#include "mozilla/dom/DOMRect.h"
#include <algorithm>

#if defined(MOZ_X11) && defined(MOZ_WIDGET_GTK)
#if defined(MOZ_WIDGET_GTK)
#  include <gdk/gdk.h>
#  if defined(MOZ_X11)
#    include <gdk/gdkx.h>
#  endif
#endif

#include "Layers.h"

+3 −1
Original line number Diff line number Diff line
@@ -55,8 +55,10 @@
#define CAIRO_HAS_PDF_SURFACE 1
#endif

#ifdef MOZ_X11
#if defined(MOZ_X11) || defined(MOZ_WAYLAND)
#define CAIRO_HAS_PS_SURFACE 1
#endif
#ifdef MOZ_X11
#define CAIRO_HAS_XLIB_XRENDER_SURFACE 0
#define CAIRO_HAS_XLIB_SURFACE 1
#endif
+5 −3
Original line number Diff line number Diff line
@@ -325,7 +325,6 @@ already_AddRefed<gfxASurface> gfxPlatformGtk::CreateOffscreenSurface(

  RefPtr<gfxASurface> newSurface;
  bool needsClear = true;
#ifdef MOZ_X11
  // XXX we really need a different interface here, something that passes
  // in more context, including the display and/or target surface type that
  // we should try to match
@@ -336,7 +335,6 @@ already_AddRefed<gfxASurface> gfxPlatformGtk::CreateOffscreenSurface(
    // waste time clearing again
    needsClear = false;
  }
#endif

  if (!newSurface) {
    // We couldn't create a native surface for whatever reason;
@@ -951,8 +949,10 @@ class XrandrSoftwareVsyncSource final : public SoftwareVsyncSource {
    return rate;
  }
};
#endif

already_AddRefed<gfx::VsyncSource> gfxPlatformGtk::CreateHardwareVsyncSource() {
#ifdef MOZ_X11
  if (IsHeadless() || IsWaylandDisplay()) {
    // On Wayland we can not create a global hardware based vsync source, thus
    // use a software based one here. We create window specific ones later.
@@ -988,8 +988,10 @@ already_AddRefed<gfx::VsyncSource> gfxPlatformGtk::CreateHardwareVsyncSource() {

  RefPtr<VsyncSource> softwareVsync = new XrandrSoftwareVsyncSource();
  return softwareVsync.forget();
}
#else
  return gfxPlatform::CreateHardwareVsyncSource();
#endif
}

void gfxPlatformGtk::BuildContentDeviceData(ContentDeviceData* aOut) {
  gfxPlatform::BuildContentDeviceData(aOut);
+0 −2
Original line number Diff line number Diff line
@@ -55,10 +55,8 @@ class gfxPlatformGtk final : public gfxPlatform {

  bool AccelerateLayersByDefault() override;

#ifdef MOZ_X11
  already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource()
      override;
#endif

  bool IsX11Display() { return mIsX11Display; }
  bool IsWaylandDisplay() override {
+2 −1
Original line number Diff line number Diff line
@@ -62,7 +62,8 @@ class CompositorWidgetDelegate {
};

// Platforms that support out-of-process widgets.
#if defined(XP_WIN) || defined(MOZ_X11) || defined(MOZ_WIDGET_ANDROID)
#if defined(XP_WIN) || defined(MOZ_X11) || defined(MOZ_WIDGET_ANDROID) || \
    defined(MOZ_WAYLAND)
// CompositorWidgetParent should implement CompositorWidget and
// PCompositorWidgetParent.
class CompositorWidgetParent;
Loading