Bug 1501944 - Enable to build wayland target on Gtk 3.10, r=jhorak

Differential Revision: https://phabricator.services.mozilla.com/D10369

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Martin Stransky 2018-11-01 11:09:40 +00:00
Родитель fc0a7f7e2a
Коммит 636020d26c
9 изменённых файлов: 166 добавлений и 23 удалений

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

@ -213,7 +213,7 @@ add_old_configure_assignment('MOZ_X11', True, when=toolkit_gtk)
# Wayland support
# ==============================================================
wayland_headers = pkg_check_modules('MOZ_WAYLAND', 'gtk+-wayland-3.0 >= 3.22',
wayland_headers = pkg_check_modules('MOZ_WAYLAND', 'gtk+-wayland-3.0 >= 3.10',
when=wayland)
set_config('MOZ_WAYLAND', depends_if(wayland_headers)(lambda _: True))

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

@ -15,8 +15,8 @@
#include "mozcontainer.h"
#include "nsCOMArray.h"
#include "mozilla/StaticMutex.h"
#include "mozwayland/mozwayland.h"
#include <gdk/gdkwayland.h>
#include <sys/mman.h>
#include <assert.h>
#include <fcntl.h>

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

@ -7,9 +7,9 @@
#include "mozcontainer.h"
#include <gtk/gtk.h>
#ifdef MOZ_WAYLAND
#include <gdk/gdkx.h>
#include <gdk/gdkwayland.h>
#ifdef MOZ_WAYLAND
#include "mozwayland/mozwayland.h"
#include <wayland-egl.h>
#endif
#include <stdio.h>

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

@ -9,6 +9,13 @@
#include <gtk/gtk.h>
#include <gdk/gdkwayland.h>
union wl_argument;
/* Those strucures are just placeholders and will be replaced by
* real symbols from libwayland during run-time linking. We need to make
* them explicitly visible.
*/
#pragma GCC visibility push(default)
const struct wl_interface wl_buffer_interface;
const struct wl_interface wl_callback_interface;
const struct wl_interface wl_data_device_interface;
@ -22,6 +29,7 @@ const struct wl_interface wl_seat_interface;
const struct wl_interface wl_surface_interface;
const struct wl_interface wl_subsurface_interface;
const struct wl_interface wl_subcompositor_interface;
#pragma GCC visibility pop
MOZ_EXPORT void
wl_event_queue_destroy(struct wl_event_queue *queue)
@ -35,7 +43,7 @@ wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...)
MOZ_EXPORT void
wl_proxy_marshal_array(struct wl_proxy *p, uint32_t opcode,
union wl_argument *args)
union wl_argument *args)
{
}
@ -112,6 +120,9 @@ wl_proxy_get_listener(struct wl_proxy *proxy)
return NULL;
}
typedef int (* wl_dispatcher_func_t)(const void *, void *, uint32_t,
const struct wl_message *, union wl_argument *);
MOZ_EXPORT int
wl_proxy_add_dispatcher(struct wl_proxy *proxy,
wl_dispatcher_func_t dispatcher_func,

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

@ -0,0 +1,130 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=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/. */
/* Wayland compatibility header, it makes Firefox build with
wayland-1.2 and Gtk+ 3.10.
*/
#ifndef __MozWayland_h_
#define __MozWayland_h_
#include "mozilla/Types.h"
#include <gtk/gtk.h>
#include <gdk/gdkwayland.h>
#ifdef __cplusplus
extern "C" {
#endif
MOZ_EXPORT int
wl_display_roundtrip_queue(struct wl_display *display,
struct wl_event_queue *queue);
MOZ_EXPORT uint32_t
wl_proxy_get_version(struct wl_proxy *proxy);
MOZ_EXPORT struct wl_proxy *
wl_proxy_marshal_constructor(struct wl_proxy *proxy,
uint32_t opcode,
const struct wl_interface *interface,
...);
/* We need implement some missing functions from wayland-client-protocol.h
*/
#ifndef WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM
enum wl_data_device_manager_dnd_action {
WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE = 0,
WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY = 1,
WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE = 2,
WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK = 4
};
#endif
#ifndef WL_DATA_OFFER_SET_ACTIONS
#define WL_DATA_OFFER_SET_ACTIONS 4
struct moz_wl_data_offer_listener {
void (*offer)(void *data, struct wl_data_offer *wl_data_offer,
const char *mime_type);
void (*source_actions)(void *data, struct wl_data_offer *wl_data_offer,
uint32_t source_actions);
void (*action)(void *data, struct wl_data_offer *wl_data_offer,
uint32_t dnd_action);
};
static inline void
wl_data_offer_set_actions(struct wl_data_offer *wl_data_offer,
uint32_t dnd_actions,
uint32_t preferred_action)
{
wl_proxy_marshal((struct wl_proxy *) wl_data_offer,
WL_DATA_OFFER_SET_ACTIONS, dnd_actions, preferred_action);
}
#else
typedef struct wl_data_offer_listener moz_wl_data_offer_listener;
#endif
#ifndef WL_SUBCOMPOSITOR_GET_SUBSURFACE
#define WL_SUBCOMPOSITOR_GET_SUBSURFACE 1
struct wl_subcompositor;
// Emulate what mozilla header wrapper does - make the
// wl_subcompositor_interface always visible.
#pragma GCC visibility push(default)
extern const struct wl_interface wl_subsurface_interface;
extern const struct wl_interface wl_subcompositor_interface;
#pragma GCC visibility pop
#define WL_SUBSURFACE_DESTROY 0
#define WL_SUBSURFACE_SET_POSITION 1
#define WL_SUBSURFACE_PLACE_ABOVE 2
#define WL_SUBSURFACE_PLACE_BELOW 3
#define WL_SUBSURFACE_SET_SYNC 4
#define WL_SUBSURFACE_SET_DESYNC 5
static inline struct wl_subsurface *
wl_subcompositor_get_subsurface(struct wl_subcompositor *wl_subcompositor,
struct wl_surface *surface,
struct wl_surface *parent)
{
struct wl_proxy *id;
id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_subcompositor,
WL_SUBCOMPOSITOR_GET_SUBSURFACE, &wl_subsurface_interface, NULL, surface,
parent);
return (struct wl_subsurface *) id;
}
static inline void
wl_subsurface_set_position(struct wl_subsurface *wl_subsurface,
int32_t x, int32_t y)
{
wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
WL_SUBSURFACE_SET_POSITION, x, y);
}
static inline void
wl_subsurface_set_desync(struct wl_subsurface *wl_subsurface)
{
wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
WL_SUBSURFACE_SET_DESYNC);
}
static inline void
wl_subsurface_destroy(struct wl_subsurface *wl_subsurface)
{
wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
WL_SUBSURFACE_DESTROY);
wl_proxy_destroy((struct wl_proxy *) wl_subsurface);
}
#endif
#ifdef __cplusplus
}
#endif
#endif /* __MozWayland_h_ */

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

@ -24,6 +24,7 @@
#include "mozilla/RefPtr.h"
#include "mozilla/TimeStamp.h"
#include "nsDragService.h"
#include "mozwayland/mozwayland.h"
#include "imgIContainer.h"
@ -32,12 +33,8 @@
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <gtk/gtk.h>
#include <gdk/gdkwayland.h>
#include <errno.h>
#include "wayland/gtk-primary-selection-client-protocol.h"
const char*
nsRetrievalContextWayland::sTextMimeTypes[TEXT_MIME_TYPES_NUM] =
{
@ -291,7 +288,7 @@ data_offer_action(void *data,
* the compositor after matching the source/destination
* side actions.
*/
static const struct wl_data_offer_listener data_offer_listener = {
static const moz_wl_data_offer_listener data_offer_listener = {
data_offer_offer,
data_offer_source_actions,
data_offer_action
@ -300,7 +297,8 @@ static const struct wl_data_offer_listener data_offer_listener = {
WaylandDataOffer::WaylandDataOffer(wl_data_offer* aWaylandDataOffer)
: mWaylandDataOffer(aWaylandDataOffer)
{
wl_data_offer_add_listener(mWaylandDataOffer, &data_offer_listener, this);
wl_data_offer_add_listener(mWaylandDataOffer,
(struct wl_data_offer_listener *)&data_offer_listener, this);
}
WaylandDataOffer::~WaylandDataOffer(void)

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

@ -9,6 +9,7 @@
#define __nsClipboardWayland_h_
#include "nsIClipboard.h"
#include "mozwayland/mozwayland.h"
#include "wayland/gtk-primary-selection-client-protocol.h"
#include <gtk/gtk.h>

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

@ -536,6 +536,12 @@ typedef void (*GtkWindowHandleExported) (GtkWindow *window,
const char *handle,
gpointer user_data);
#ifdef MOZ_WAYLAND
#if !GTK_CHECK_VERSION(3,22,0)
typedef void (*GdkWaylandWindowExported) (GdkWindow *window,
const char *handle,
gpointer user_data);
#endif
typedef struct {
GtkWindow *window;
WindowHandleExported callback;

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

@ -8,6 +8,15 @@
#ifndef __nsWindow_h__
#define __nsWindow_h__
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#ifdef MOZ_X11
#include <gdk/gdkx.h>
#include "X11UndefineNone.h"
#endif /* MOZ_X11 */
#ifdef MOZ_WAYLAND
#include <gdk/gdkwayland.h>
#endif
#include "mozcontainer.h"
#include "mozilla/RefPtr.h"
#include "mozilla/UniquePtr.h"
@ -16,20 +25,8 @@
#include "nsGkAtoms.h"
#include "nsRefPtrHashtable.h"
#include "nsIFrame.h"
#include "nsBaseWidget.h"
#include "CompositorWidget.h"
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#ifdef MOZ_X11
#include <gdk/gdkx.h>
#include "X11UndefineNone.h"
#endif /* MOZ_X11 */
#ifdef MOZ_WAYLAND
#include <gdk/gdkwayland.h>
#endif
#include "mozilla/widget/WindowSurface.h"
#include "mozilla/widget/WindowSurfaceProvider.h"