Backed out changeset c0285428a8a0 (bug 1289251)

This commit is contained in:
Sebastian Hengst 2016-09-02 10:25:43 +02:00
Родитель 47d3ad2b27
Коммит 0f39134046
22 изменённых файлов: 66 добавлений и 716 удалений

Просмотреть файл

@ -29,7 +29,6 @@ class SourceSurface;
namespace widget {
class WinCompositorWidget;
class X11CompositorWidget;
class CompositorWidgetInitData;
// Gecko widgets usually need to communicate with the CompositorWidget with
@ -40,7 +39,7 @@ class CompositorWidgetInitData;
class CompositorWidgetDelegate;
// Platforms that support out-of-process widgets.
#if defined(XP_WIN) || defined(MOZ_X11)
#if defined(XP_WIN)
// CompositorWidgetParent should implement CompositorWidget and
// PCompositorWidgetParent.
class CompositorWidgetParent;
@ -246,9 +245,6 @@ public:
virtual WinCompositorWidget* AsWindows() {
return nullptr;
}
virtual X11CompositorWidget* AsX11() {
return nullptr;
}
/**
* Return the platform-specific delegate for the widget, if any.

Просмотреть файл

@ -1,45 +0,0 @@
/* -*- 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/. */
#include "CompositorWidgetChild.h"
#include "mozilla/Unused.h"
namespace mozilla {
namespace widget {
CompositorWidgetChild::CompositorWidgetChild(RefPtr<CompositorVsyncDispatcher> aVsyncDispatcher,
RefPtr<CompositorWidgetVsyncObserver> aVsyncObserver)
: mVsyncDispatcher(aVsyncDispatcher)
, mVsyncObserver(aVsyncObserver)
{
MOZ_ASSERT(XRE_IsParentProcess());
}
CompositorWidgetChild::~CompositorWidgetChild()
{
}
bool
CompositorWidgetChild::RecvObserveVsync()
{
mVsyncDispatcher->SetCompositorVsyncObserver(mVsyncObserver);
return true;
}
bool
CompositorWidgetChild::RecvUnobserveVsync()
{
mVsyncDispatcher->SetCompositorVsyncObserver(nullptr);
return true;
}
void
CompositorWidgetChild::NotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize)
{
Unused << SendNotifyClientSizeChanged(aClientSize);
}
} // namespace widget
} // namespace mozilla

Просмотреть файл

@ -1,38 +0,0 @@
/* -*- 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 widget_gtk_CompositorWidgetChild_h
#define widget_gtk_CompositorWidgetChild_h
#include "X11CompositorWidget.h"
#include "mozilla/widget/PCompositorWidgetChild.h"
#include "mozilla/widget/CompositorWidgetVsyncObserver.h"
namespace mozilla {
namespace widget {
class CompositorWidgetChild final
: public PCompositorWidgetChild
, public CompositorWidgetDelegate
{
public:
CompositorWidgetChild(RefPtr<CompositorVsyncDispatcher> aVsyncDispatcher,
RefPtr<CompositorWidgetVsyncObserver> aVsyncObserver);
~CompositorWidgetChild() override;
bool RecvObserveVsync() override;
bool RecvUnobserveVsync() override;
void NotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize) override;
private:
RefPtr<CompositorVsyncDispatcher> mVsyncDispatcher;
RefPtr<CompositorWidgetVsyncObserver> mVsyncObserver;
};
} // namespace widget
} // namespace mozilla
#endif // widget_gtk_CompositorWidgetChild_h

Просмотреть файл

@ -1,48 +0,0 @@
/* -*- 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/. */
#include "CompositorWidgetParent.h"
#include "mozilla/Unused.h"
namespace mozilla {
namespace widget {
CompositorWidgetParent::CompositorWidgetParent(const CompositorWidgetInitData& aInitData)
: X11CompositorWidget(aInitData)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_GPU);
}
CompositorWidgetParent::~CompositorWidgetParent()
{
}
void
CompositorWidgetParent::ObserveVsync(VsyncObserver* aObserver)
{
if (aObserver) {
Unused << SendObserveVsync();
} else {
Unused << SendUnobserveVsync();
}
mVsyncObserver = aObserver;
}
RefPtr<VsyncObserver>
CompositorWidgetParent::GetVsyncObserver() const
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_GPU);
return mVsyncObserver;
}
bool
CompositorWidgetParent::RecvNotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize)
{
NotifyClientSizeChanged(aClientSize);
return true;
}
} // namespace widget
} // namespace mozilla

Просмотреть файл

@ -1,37 +0,0 @@
/* -*- 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 widget_gtk_CompositorWidgetParent_h
#define widget_gtk_CompositorWidgetParent_h
#include "X11CompositorWidget.h"
#include "mozilla/widget/PCompositorWidgetParent.h"
namespace mozilla {
namespace widget {
class CompositorWidgetParent final
: public PCompositorWidgetParent,
public X11CompositorWidget
{
public:
explicit CompositorWidgetParent(const CompositorWidgetInitData& aInitData);
~CompositorWidgetParent() override;
void ActorDestroy(ActorDestroyReason aWhy) override { }
void ObserveVsync(VsyncObserver* aObserver) override;
RefPtr<VsyncObserver> GetVsyncObserver() const override;
bool RecvNotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize) override;
private:
RefPtr<VsyncObserver> mVsyncObserver;
};
} // namespace widget
} // namespace mozilla
#endif // widget_gtk_CompositorWidgetParent_h

Просмотреть файл

@ -1,33 +0,0 @@
/* -*- 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/. */
#include "InProcessX11CompositorWidget.h"
#include "nsWindow.h"
namespace mozilla {
namespace widget {
/* static */ RefPtr<CompositorWidget>
CompositorWidget::CreateLocal(const CompositorWidgetInitData& aInitData, nsIWidget* aWidget)
{
return new InProcessX11CompositorWidget(aInitData, static_cast<nsWindow*>(aWidget));
}
InProcessX11CompositorWidget::InProcessX11CompositorWidget(const CompositorWidgetInitData& aInitData,
nsWindow* aWindow)
: X11CompositorWidget(aInitData, aWindow)
{
}
void
InProcessX11CompositorWidget::ObserveVsync(VsyncObserver* aObserver)
{
RefPtr<CompositorVsyncDispatcher> cvd = mWidget->GetCompositorVsyncDispatcher();
cvd->SetCompositorVsyncObserver(aObserver);
}
} // namespace widget
} // namespace mozilla

Просмотреть файл

@ -1,30 +0,0 @@
/* -*- 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 widget_gtk_InProcessX11CompositorWidgetParent_h
#define widget_gtk_InProcessX11CompositorWidgetParent_h
#include "X11CompositorWidget.h"
class nsWindow;
namespace mozilla {
namespace widget {
class InProcessX11CompositorWidget final : public X11CompositorWidget
{
public:
InProcessX11CompositorWidget(const CompositorWidgetInitData& aInitData,
nsWindow* aWindow);
// CompositorWidgetDelegate
void ObserveVsync(VsyncObserver* aObserver) override;
};
} // namespace widget
} // namespace mozilla
#endif // widget_gtk_InProcessX11CompositorWidgetParent_h

Просмотреть файл

@ -1,30 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=99: */
/* 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/. */
include protocol PCompositorBridge;
using mozilla::LayoutDeviceIntSize from "Units.h";
namespace mozilla {
namespace widget {
sync protocol PCompositorWidget
{
manager PCompositorBridge;
parent:
async __delete__();
async NotifyClientSizeChanged(LayoutDeviceIntSize aClientSize);
child:
async ObserveVsync();
async UnobserveVsync();
};
} // namespace widget
} // namespace mozilla

Просмотреть файл

@ -1,24 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=99: */
/* 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/. */
// This file is a stub, for platforms that do not yet support out-of-process
// compositing or do not need specialized types to do so.
using mozilla::LayoutDeviceIntSize from "Units.h";
namespace mozilla {
namespace widget {
struct CompositorWidgetInitData
{
uintptr_t XWindow;
nsCString XDisplayString;
LayoutDeviceIntSize InitialClientSize;
};
} // namespace widget
} // namespace mozilla

Просмотреть файл

@ -1,112 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/. */
#include "WindowSurfaceProvider.h"
#include "gfxPlatformGtk.h"
#include "mozilla/layers/LayersTypes.h"
#include "WindowSurfaceX11Image.h"
#include "WindowSurfaceX11SHM.h"
#include "WindowSurfaceXRender.h"
namespace mozilla {
namespace widget {
using namespace mozilla::gfx;
using namespace mozilla::layers;
WindowSurfaceProvider::WindowSurfaceProvider()
: mXDisplay(nullptr)
, mXWindow(0)
, mXVisual(nullptr)
, mXDepth(0)
, mWindowSurface(nullptr)
{
}
void WindowSurfaceProvider::Initialize(
Display* aDisplay,
Window aWindow,
Visual* aVisual,
int aDepth)
{
// We should not be initialized
MOZ_ASSERT(!mXDisplay);
// This should also be a valid initialization
MOZ_ASSERT(aDisplay && aWindow != None && aVisual);
mXDisplay = aDisplay;
mXWindow = aWindow;
mXVisual = aVisual;
mXDepth = aDepth;
}
void WindowSurfaceProvider::CleanupResources()
{
mWindowSurface = nullptr;
}
UniquePtr<WindowSurface>
WindowSurfaceProvider::CreateWindowSurface()
{
// We should be initialized
MOZ_ASSERT(mXDisplay);
// Blit to the window with the following priority:
// 1. XRender (iff XRender is enabled && we are in-process)
// 2. MIT-SHM
// 3. XPutImage
#ifdef MOZ_WIDGET_GTK
if (gfxVars::UseXRender()) {
LOGDRAW(("Drawing to nsWindow %p using XRender\n", (void*)this));
return MakeUnique<WindowSurfaceXRender>(mXDisplay, mXWindow, mXVisual, mXDepth);
}
#endif // MOZ_WIDGET_GTK
#ifdef MOZ_HAVE_SHMIMAGE
if (nsShmImage::UseShm()) {
LOGDRAW(("Drawing to nsWindow %p using MIT-SHM\n", (void*)this));
return MakeUnique<WindowSurfaceX11SHM>(mXDisplay, mXWindow, mXVisual, mXDepth);
}
#endif // MOZ_HAVE_SHMIMAGE
LOGDRAW(("Drawing to nsWindow %p using XPutImage\n", (void*)this));
return MakeUnique<WindowSurfaceX11Image>(mXDisplay, mXWindow, mXVisual, mXDepth);
}
already_AddRefed<gfx::DrawTarget>
WindowSurfaceProvider::StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion,
layers::BufferMode* aBufferMode)
{
if (aInvalidRegion.IsEmpty())
return nullptr;
if (!mWindowSurface) {
mWindowSurface = CreateWindowSurface();
if (!mWindowSurface)
return nullptr;
}
*aBufferMode = BufferMode::BUFFER_NONE;
RefPtr<DrawTarget> dt = nullptr;
if (!(dt = mWindowSurface->Lock(aInvalidRegion))) {
gfxWarningOnce() << "Failed to lock WindowSurface, falling back to XPutImage backend.";
mWindowSurface = MakeUnique<WindowSurfaceX11Image>(mXDisplay, mXWindow, mXVisual, mXDepth);
}
return dt.forget();
}
void
WindowSurfaceProvider::EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget,
LayoutDeviceIntRegion& aInvalidRegion)
{
if (mWindowSurface)
mWindowSurface->Commit(aInvalidRegion);
}
} // namespace mozilla
} // namespace widget

Просмотреть файл

@ -1,69 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 _MOZILLA_WIDGET_GTK_WINDOW_SURFACE_PROVIDER_H
#define _MOZILLA_WIDGET_GTK_WINDOW_SURFACE_PROVIDER_H
#include "mozilla/widget/WindowSurface.h"
#include "mozilla/gfx/Types.h"
#include "mozilla/gfx/2D.h"
#include "Units.h"
#include <X11/Xlib.h> // for Window, Display, Visual, etc.
namespace mozilla {
namespace widget {
/*
* Holds the logic for creating WindowSurface's for a GTK nsWindow.
* The main purpose of this class is to allow sharing of logic between
* nsWindow and X11CompositorWidget, for when OMTC is enabled or disabled.
*/
class WindowSurfaceProvider final
{
public:
WindowSurfaceProvider();
/**
* Initializes the WindowSurfaceProvider by giving it the window
* handle and display to attach to. WindowSurfaceProvider doesn't
* own the Display, Window, etc, and they must continue to exist
* while WindowSurfaceProvider is used.
*/
void Initialize(
Display* aDisplay,
Window aWindow,
Visual* aVisual,
int aDepth);
/**
* Releases any surfaces created by this provider.
* This is used by X11CompositorWidget to get rid
* of resources before we close the display connection.
*/
void CleanupResources();
already_AddRefed<gfx::DrawTarget>
StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion,
layers::BufferMode* aBufferMode);
void EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget,
LayoutDeviceIntRegion& aInvalidRegion);
private:
UniquePtr<WindowSurface> CreateWindowSurface();
Display* mXDisplay;
Window mXWindow;
Visual* mXVisual;
int mXDepth;
UniquePtr<WindowSurface> mWindowSurface;
};
} // namespace widget
} // namespace mozilla
#endif // _MOZILLA_WIDGET_GTK_WINDOW_SURFACE_PROVIDER_H

Просмотреть файл

@ -1,108 +0,0 @@
/* -*- 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/. */
#include "X11CompositorWidget.h"
#include "gfxPlatformGtk.h"
#include "mozilla/layers/CompositorThread.h"
#include "mozilla/widget/InProcessCompositorWidget.h"
#include "mozilla/widget/PlatformWidgetTypes.h"
#include "nsWindow.h"
namespace mozilla {
namespace widget {
X11CompositorWidget::X11CompositorWidget(const CompositorWidgetInitData& aInitData,
nsWindow* aWindow)
: mWidget(aWindow)
{
// If we have a nsWindow, then grab the already existing display connection
// If we don't, then use the init data to connect to the display
if (aWindow) {
mXDisplay = (Display*)aWindow->GetNativeData(NS_NATIVE_COMPOSITOR_DISPLAY);
} else {
mXDisplay = XOpenDisplay(aInitData.XDisplayString().get());
}
mXWindow = (Window)aInitData.XWindow();
// Grab the window's visual and depth
XWindowAttributes windowAttrs;
XGetWindowAttributes(mXDisplay, mXWindow, &windowAttrs);
Visual* visual = windowAttrs.visual;
int depth = windowAttrs.depth;
// Initialize the window surface provider
mProvider.Initialize(
mXDisplay,
mXWindow,
visual,
depth
);
mClientSize = aInitData.InitialClientSize();
}
X11CompositorWidget::~X11CompositorWidget()
{
mProvider.CleanupResources();
// If we created our own display connection, we need to destroy it
if (!mWidget && mXDisplay) {
XCloseDisplay(mXDisplay);
mXDisplay = nullptr;
}
}
already_AddRefed<gfx::DrawTarget>
X11CompositorWidget::StartRemoteDrawing()
{
return nullptr;
}
void
X11CompositorWidget::EndRemoteDrawing()
{
}
already_AddRefed<gfx::DrawTarget>
X11CompositorWidget::StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion,
layers::BufferMode* aBufferMode)
{
return mProvider.StartRemoteDrawingInRegion(aInvalidRegion,
aBufferMode);
}
void X11CompositorWidget::EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget,
LayoutDeviceIntRegion& aInvalidRegion)
{
mProvider.EndRemoteDrawingInRegion(aDrawTarget,
aInvalidRegion);
}
nsIWidget* X11CompositorWidget::RealWidget()
{
return mWidget;
}
void
X11CompositorWidget::NotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize)
{
mClientSize = aClientSize;
}
LayoutDeviceIntSize
X11CompositorWidget::GetClientSize()
{
return mClientSize;
}
uintptr_t
X11CompositorWidget::GetWidgetKey()
{
return reinterpret_cast<uintptr_t>(mWidget);
}
} // namespace widget
} // namespace mozilla

Просмотреть файл

@ -1,66 +0,0 @@
/* -*- 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 widget_gtk_X11CompositorWidget_h
#define widget_gtk_X11CompositorWidget_h
#include "mozilla/widget/CompositorWidget.h"
#include "WindowSurfaceProvider.h"
class nsIWidget;
class nsWindow;
namespace mozilla {
namespace widget {
class CompositorWidgetDelegate
{
public:
virtual void NotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize) = 0;
};
class X11CompositorWidget
: public CompositorWidget
, public CompositorWidgetDelegate
{
public:
X11CompositorWidget(const CompositorWidgetInitData& aInitData,
nsWindow* aWindow = nullptr);
~X11CompositorWidget();
// CompositorWidget Overrides
already_AddRefed<gfx::DrawTarget> StartRemoteDrawing() override;
void EndRemoteDrawing() override;
already_AddRefed<gfx::DrawTarget>
StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion,
layers::BufferMode* aBufferMode) override;
void EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget,
LayoutDeviceIntRegion& aInvalidRegion) override;
uintptr_t GetWidgetKey() override;
void NotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize) override;
LayoutDeviceIntSize GetClientSize() override;
nsIWidget* RealWidget() override;
X11CompositorWidget* AsX11() override { return this; }
CompositorWidgetDelegate* AsDelegate() override { return this; }
protected:
nsWindow* mWidget;
private:
LayoutDeviceIntSize mClientSize;
Display* mXDisplay;
Window mXWindow;
WindowSurfaceProvider mProvider;
};
} // namespace widget
} // namespace mozilla
#endif // widget_gtk_X11CompositorWidget_h

Просмотреть файл

@ -45,17 +45,7 @@ SOURCES += [
if CONFIG['MOZ_X11']:
UNIFIED_SOURCES += [
'CompositorWidgetChild.cpp',
'CompositorWidgetParent.cpp',
'InProcessX11CompositorWidget.cpp',
'nsIdleServiceGTK.cpp',
'X11CompositorWidget.cpp',
]
EXPORTS.mozilla.widget += [
'CompositorWidgetChild.h',
'CompositorWidgetParent.h',
'InProcessX11CompositorWidget.h',
'X11CompositorWidget.h',
]
if CONFIG['NS_PRINTING']:
@ -73,14 +63,10 @@ if CONFIG['MOZ_X11']:
UNIFIED_SOURCES += [
'nsClipboard.cpp',
'nsDragService.cpp',
'WindowSurfaceProvider.cpp',
'WindowSurfaceX11.cpp',
'WindowSurfaceX11Image.cpp',
'WindowSurfaceXRender.cpp',
]
EXPORTS.mozilla.widget += [
'WindowSurfaceProvider.h',
]
if CONFIG['ACCESSIBILITY']:
UNIFIED_SOURCES += [

Просмотреть файл

@ -10,11 +10,8 @@
#include "nsApplicationChooser.h"
#include "WidgetUtils.h"
#include "nsIMIMEInfo.h"
#include "nsIWidget.h"
#include "nsCExternalHandlerService.h"
#include "nsComponentManagerUtils.h"
#include "nsGtkUtils.h"
#include "nsPIDOMWindow.h"
using namespace mozilla;

Просмотреть файл

@ -7,11 +7,7 @@
#define nsApplicationChooser_h__
#include <gtk/gtk.h>
#include "nsCOMPtr.h"
#include "nsIApplicationChooser.h"
#include "nsString.h"
class nsIWidget;
class nsApplicationChooser final : public nsIApplicationChooser
{

Просмотреть файл

@ -10,7 +10,6 @@
#include "nsGtkUtils.h"
#include "nsIWidget.h"
#include "WidgetUtils.h"
#include "nsPIDOMWindow.h"
NS_IMPL_ISUPPORTS(nsColorPicker, nsIColorPicker)

Просмотреть файл

@ -16,7 +16,6 @@
#include "nsReadableUtils.h"
#include "nsStringEnumerator.h"
#include "nsIServiceManager.h"
#include "nsThreadUtils.h"
#include "nsPSPrinters.h"
#include "nsPaperPS.h" /* Paper size list */

Просмотреть файл

@ -5,8 +5,6 @@
#include "nsScreenGtk.h"
#include "nsIWidget.h"
#include <gdk/gdk.h>
#ifdef MOZ_X11
#include <gdk/gdkx.h>

Просмотреть файл

@ -117,7 +117,6 @@ using namespace mozilla::widget;
#include "mozilla/layers/CompositorThread.h"
#ifdef MOZ_X11
#include "X11CompositorWidget.h"
#include "gfxXlibSurface.h"
#include "WindowSurfaceX11Image.h"
#include "WindowSurfaceX11SHM.h"
@ -2490,13 +2489,6 @@ nsWindow::OnSizeAllocate(GtkAllocation *aAllocation)
mBounds.SizeTo(size);
#ifdef MOZ_X11
// Notify the X11CompositorWidget of a ClientSizeChange
if (mCompositorWidgetDelegate) {
mCompositorWidgetDelegate->NotifyClientSizeChanged(GetClientSize());
}
#endif
// Gecko permits running nested event loops during processing of events,
// GtkWindow callers of gtk_widget_size_allocate expect the signal
// handlers to return sometime in the near future.
@ -3998,8 +3990,6 @@ nsWindow::Create(nsIWidget* aParent,
GdkVisual* gdkVisual = gdk_window_get_visual(mGdkWindow);
mXVisual = gdk_x11_visual_get_xvisual(gdkVisual);
mXDepth = gdk_visual_get_depth(gdkVisual);
mSurfaceProvider.Initialize(mXDisplay, mXWindow, mXVisual, mXDepth);
}
#endif
@ -4101,14 +4091,6 @@ nsWindow::NativeResize()
gdk_window_resize(mGdkWindow, size.width, size.height);
}
#ifdef MOZ_X11
// Notify the X11CompositorWidget of a ClientSizeChange
// This is different than OnSizeAllocate to catch initial sizing
if (mCompositorWidgetDelegate) {
mCompositorWidgetDelegate->NotifyClientSizeChanged(GetClientSize());
}
#endif
// Does it need to be shown because bounds were previously insane?
if (mNeedsShow && mIsShown) {
NativeShow(true);
@ -4157,14 +4139,6 @@ nsWindow::NativeMoveResize()
topLeft.x, topLeft.y, size.width, size.height);
}
#ifdef MOZ_X11
// Notify the X11CompositorWidget of a ClientSizeChange
// This is different than OnSizeAllocate to catch initial sizing
if (mCompositorWidgetDelegate) {
mCompositorWidgetDelegate->NotifyClientSizeChanged(GetClientSize());
}
#endif
// Does it need to be shown because bounds were previously insane?
if (mNeedsShow && mIsShown) {
NativeShow(true);
@ -6561,14 +6535,34 @@ nsWindow::GetDrawTargetForGdkDrawable(GdkDrawable* aDrawable,
already_AddRefed<DrawTarget>
nsWindow::StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion, BufferMode* aBufferMode)
{
return mSurfaceProvider.StartRemoteDrawingInRegion(aInvalidRegion, aBufferMode);
if (aInvalidRegion.IsEmpty())
return nullptr;
if (!mWindowSurface) {
mWindowSurface = CreateWindowSurface();
if (!mWindowSurface)
return nullptr;
}
*aBufferMode = BufferMode::BUFFER_NONE;
RefPtr<DrawTarget> dt = nullptr;
if (!(dt = mWindowSurface->Lock(aInvalidRegion))) {
#ifdef MOZ_X11
if (mIsX11Display) {
gfxWarningOnce() << "Failed to lock WindowSurface, falling back to XPutImage backend.";
mWindowSurface = MakeUnique<WindowSurfaceX11Image>(mXDisplay, mXWindow, mXVisual, mXDepth);
}
#endif // MOZ_X11
}
return dt.forget();
}
void
nsWindow::EndRemoteDrawingInRegion(DrawTarget* aDrawTarget,
LayoutDeviceIntRegion& aInvalidRegion)
{
mSurfaceProvider.EndRemoteDrawingInRegion(aDrawTarget, aInvalidRegion);
if (mWindowSurface)
mWindowSurface->Commit(aInvalidRegion);
}
// Code shared begin BeginMoveDrag and BeginResizeDrag
@ -7005,15 +6999,45 @@ nsWindow::RoundsWidgetCoordinatesTo()
return GdkScaleFactor();
}
void nsWindow::GetCompositorWidgetInitData(mozilla::widget::CompositorWidgetInitData* aInitData)
UniquePtr<WindowSurface>
nsWindow::CreateWindowSurface()
{
#ifdef MOZ_X11
Display* xDisplay = (Display*)GetNativeData(NS_NATIVE_COMPOSITOR_DISPLAY);
char* xDisplayString = XDisplayString(xDisplay);
if (!mGdkWindow)
return nullptr;
*aInitData = mozilla::widget::CompositorWidgetInitData(
mXWindow,
nsCString(xDisplayString),
GetClientSize());
#endif
// TODO: Add path for Wayland. We can't use gdk_cairo_create as it's not
// threadsafe.
if (!mIsX11Display)
return nullptr;
#ifdef MOZ_X11
// Blit to the window with the following priority:
// 1. XRender (iff XRender is enabled)
// 2. MIT-SHM
// 3. XPutImage
#ifdef MOZ_WIDGET_GTK
if (gfxVars::UseXRender()) {
LOGDRAW(("Drawing to nsWindow %p using XRender\n", (void*)this));
return MakeUnique<WindowSurfaceXRender>(mXDisplay, mXWindow, mXVisual, mXDepth);
}
#endif // MOZ_WIDGET_GTK
Display* display;
if (CompositorThreadHolder::IsInCompositorThread()) {
display = gfxPlatformGtk::GetPlatform()->GetCompositorDisplay();
} else {
display = mXDisplay;
}
#ifdef MOZ_HAVE_SHMIMAGE
if (nsShmImage::UseShm()) {
LOGDRAW(("Drawing to nsWindow %p using MIT-SHM\n", (void*)this));
return MakeUnique<WindowSurfaceX11SHM>(display, mXWindow, mXVisual, mXDepth);
}
#endif // MOZ_HAVE_SHMIMAGE
LOGDRAW(("Drawing to nsWindow %p using XPutImage\n", (void*)this));
return MakeUnique<WindowSurfaceX11Image>(display, mXWindow, mXVisual, mXDepth);
#endif // MOZ_X11
}

Просмотреть файл

@ -25,7 +25,6 @@
#endif /* MOZ_X11 */
#include "mozilla/widget/WindowSurface.h"
#include "mozilla/widget/WindowSurfaceProvider.h"
#ifdef ACCESSIBILITY
#include "mozilla/a11y/Accessible.h"
@ -346,8 +345,6 @@ public:
nsIObserver* aObserver) override;
#endif
virtual void GetCompositorWidgetInitData(mozilla::widget::CompositorWidgetInitData* aInitData) override;
// HiDPI scale conversion
gint GdkScaleFactor();
@ -453,12 +450,13 @@ private:
nsRefPtrHashtable<nsPtrHashKey<GdkEventSequence>, mozilla::dom::Touch> mTouches;
#endif
mozilla::UniquePtr<mozilla::widget::WindowSurface> mWindowSurface;
#ifdef MOZ_X11
Display* mXDisplay;
Window mXWindow;
Visual* mXVisual;
int mXDepth;
mozilla::widget::WindowSurfaceProvider mSurfaceProvider;
#endif
// Upper bound on pending ConfigureNotify events to be dispatched to the
@ -549,6 +547,8 @@ private:
virtual int32_t RoundsWidgetCoordinatesTo() override;
mozilla::UniquePtr<mozilla::widget::WindowSurface> CreateWindowSurface();
/**
* |mIMContext| takes all IME related stuff.
*

Просмотреть файл

@ -257,11 +257,6 @@ if toolkit == 'windows':
'windows/PCompositorWidget.ipdl',
'windows/PlatformWidgetTypes.ipdlh',
]
elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT'] and CONFIG['MOZ_X11']:
IPDL_SOURCES = [
'gtk/PCompositorWidget.ipdl',
'gtk/PlatformWidgetTypes.ipdlh',
]
else:
IPDL_SOURCES = [
'PCompositorWidget.ipdl',