зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1281425 - Added nsWaylandDisplay class to support access to Wayland display, r=jhorak
MozReview-Commit-ID: 6IU5hS15MmM --HG-- extra : rebase_source : a4f8b13d2a95dbdeff315e1aea087712daece4fd
This commit is contained in:
Родитель
2cebdcb842
Коммит
a6e8113393
|
@ -0,0 +1,54 @@
|
|||
/* -*- 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 "WindowSurfaceWayland.h"
|
||||
|
||||
#include "base/message_loop.h" // for MessageLoop
|
||||
#include "base/task.h" // for NewRunnableMethod, etc
|
||||
#include "nsPrintfCString.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/Tools.h"
|
||||
#include "gfxPlatform.h"
|
||||
#include "mozcontainer.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "mozilla/StaticMutex.h"
|
||||
|
||||
#include <gdk/gdkwayland.h>
|
||||
#include <sys/mman.h>
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
bool
|
||||
nsWaylandDisplay::Matches(wl_display *aDisplay)
|
||||
{
|
||||
return mThreadId == PR_GetCurrentThread() && aDisplay == mDisplay;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsWaylandDisplay, nsISupports);
|
||||
|
||||
nsWaylandDisplay::nsWaylandDisplay(wl_display *aDisplay)
|
||||
{
|
||||
mThreadId = PR_GetCurrentThread();
|
||||
mDisplay = aDisplay;
|
||||
|
||||
// gfx::SurfaceFormat::B8G8R8A8 is a basic Wayland format
|
||||
// and is always present.
|
||||
mFormat = gfx::SurfaceFormat::B8G8R8A8;
|
||||
}
|
||||
|
||||
nsWaylandDisplay::~nsWaylandDisplay()
|
||||
{
|
||||
MOZ_ASSERT(mThreadId == PR_GetCurrentThread());
|
||||
// Owned by Gtk+, we don't need to release
|
||||
mDisplay = nullptr;
|
||||
}
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
|
@ -0,0 +1,38 @@
|
|||
/* -*- 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_WAYLAND_H
|
||||
#define _MOZILLA_WIDGET_GTK_WINDOW_SURFACE_WAYLAND_H
|
||||
|
||||
#include <prthread.h>
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
// Our general connection to Wayland display server,
|
||||
// holds our display connection and runs event loop.
|
||||
class nsWaylandDisplay : public nsISupports {
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
public:
|
||||
nsWaylandDisplay(wl_display *aDisplay);
|
||||
|
||||
wl_display* GetDisplay() { return mDisplay; };
|
||||
gfx::SurfaceFormat GetSurfaceFormat() { return mFormat; };
|
||||
bool Matches(wl_display *aDisplay);
|
||||
|
||||
private:
|
||||
virtual ~nsWaylandDisplay();
|
||||
|
||||
PRThread* mThreadId;
|
||||
gfx::SurfaceFormat mFormat;
|
||||
wl_display* mDisplay;
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // _MOZILLA_WIDGET_GTK_WINDOW_SURFACE_WAYLAND_H
|
|
@ -89,6 +89,11 @@ if CONFIG['MOZ_X11']:
|
|||
'WindowSurfaceProvider.h',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WAYLAND']:
|
||||
UNIFIED_SOURCES += [
|
||||
'WindowSurfaceWayland.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['ACCESSIBILITY']:
|
||||
UNIFIED_SOURCES += [
|
||||
'maiRedundantObjectFactory.c',
|
||||
|
|
Загрузка…
Ссылка в новой задаче