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
This commit is contained in:
ganguin 2022-04-20 09:32:07 +00:00
parent fc2a921247
commit f01acfd647
8 changed files with 56 additions and 61 deletions

View File

@ -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"

View File

@ -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

View File

@ -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);

View File

@ -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 {

View File

@ -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;

View File

@ -33,7 +33,6 @@ TaskbarProgress::~TaskbarProgress() {
NS_IMETHODIMP
TaskbarProgress::SetProgressState(nsTaskbarProgressState aState,
uint64_t aCurrentValue, uint64_t aMaxValue) {
#ifdef MOZ_X11
NS_ENSURE_ARG_RANGE(aState, 0, STATE_PAUSED);
if (aState == STATE_NO_PROGRESS || aState == STATE_INDETERMINATE) {
@ -72,7 +71,6 @@ TaskbarProgress::SetProgressState(nsTaskbarProgressState aState,
("GtkTaskbarProgress::SetProgressState progress: %lu", progress));
mPrimaryWindow->SetProgress(progress);
#endif
return NS_OK;
}

View File

@ -76,10 +76,6 @@ Classes = [
'headers': ['/widget/gtk/nsApplicationChooser.h'],
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
},
]
if defined('MOZ_X11'):
Classes += [
{
'js_name': 'clipboard',
'cid': '{8b5314ba-db01-11d2-96ce-0060b0fb9956}',

View File

@ -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(); }