wayland: Make the MetaWaylandCompositor type public

Allows mutter implementation to have access to the underlying wl_display.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3092>
This commit is contained in:
Corentin Noël 2023-06-26 16:08:08 +02:00 committed by Marge Bot
parent 86b77f65e7
commit 6b9efc3b0c
7 changed files with 65 additions and 10 deletions

View File

@ -69,9 +69,6 @@ void meta_context_set_unsafe_mode (MetaContext *context,
gboolean enable); gboolean enable);
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND
META_EXPORT_TEST
MetaWaylandCompositor * meta_context_get_wayland_compositor (MetaContext *context);
META_EXPORT_TEST META_EXPORT_TEST
MetaServiceChannel * meta_context_get_service_channel (MetaContext *context); MetaServiceChannel * meta_context_get_service_channel (MetaContext *context);
#endif #endif

View File

@ -242,6 +242,16 @@ meta_context_get_display (MetaContext *context)
} }
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND
/**
* meta_context_get_wayland_compositor:
* @context: The #MetaContext
*
* Get the #MetaWaylandCompositor associated with the MetaContext. The might be
* none currently associated if the context hasn't been started or if the
* requested compositor type is not %META_COMPOSITOR_TYPE_WAYLAND.
*
* Returns: (transfer none) (nullable): the #MetaWaylandCompositor
*/
MetaWaylandCompositor * MetaWaylandCompositor *
meta_context_get_wayland_compositor (MetaContext *context) meta_context_get_wayland_compositor (MetaContext *context)
{ {

View File

@ -49,6 +49,7 @@ mutter_public_headers = [
if have_wayland if have_wayland
mutter_public_headers += [ mutter_public_headers += [
'meta-wayland-client.h', 'meta-wayland-client.h',
'meta-wayland-compositor.h',
] ]
endif endif

View File

@ -0,0 +1,46 @@
/*
* Copyright 2023 Collabora Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef META_WAYLAND_COMPOSITOR_H
#define META_WAYLAND_COMPOSITOR_H
#include <glib-object.h>
#include <gio/gio.h>
#include <wayland-server.h>
#include "meta/meta-context.h"
G_BEGIN_DECLS
#define META_TYPE_WAYLAND_COMPOSITOR (meta_wayland_compositor_get_type ())
META_EXPORT
G_DECLARE_FINAL_TYPE (MetaWaylandCompositor,
meta_wayland_compositor,
META, WAYLAND_COMPOSITOR,
GObject)
META_EXPORT
MetaWaylandCompositor *meta_context_get_wayland_compositor (MetaContext *context);
META_EXPORT
struct wl_display *meta_wayland_compositor_get_wayland_display (MetaWaylandCompositor *compositor);
G_END_DECLS
#endif /* META_WAYLAND_COMPOSITOR_H */

View File

@ -26,6 +26,7 @@
#include "clutter/clutter.h" #include "clutter/clutter.h"
#include "core/window-private.h" #include "core/window-private.h"
#include "meta/meta-cursor-tracker.h" #include "meta/meta-cursor-tracker.h"
#include "meta/meta-wayland-compositor.h"
#include "wayland/meta-wayland-pointer-gestures.h" #include "wayland/meta-wayland-pointer-gestures.h"
#include "wayland/meta-wayland-presentation-time-private.h" #include "wayland/meta-wayland-presentation-time-private.h"
#include "wayland/meta-wayland-seat.h" #include "wayland/meta-wayland-seat.h"
@ -113,10 +114,6 @@ struct _MetaWaylandCompositor
GQueue committed_transactions; GQueue committed_transactions;
}; };
#define META_TYPE_WAYLAND_COMPOSITOR (meta_wayland_compositor_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandCompositor, meta_wayland_compositor,
META, WAYLAND_COMPOSITOR, GObject)
gboolean meta_wayland_compositor_is_egl_display_bound (MetaWaylandCompositor *compositor); gboolean meta_wayland_compositor_is_egl_display_bound (MetaWaylandCompositor *compositor);
#endif /* META_WAYLAND_PRIVATE_H */ #endif /* META_WAYLAND_PRIVATE_H */

View File

@ -1034,6 +1034,12 @@ meta_wayland_compositor_is_grabbed (MetaWaylandCompositor *compositor)
return meta_wayland_seat_is_grabbed (compositor->seat); return meta_wayland_seat_is_grabbed (compositor->seat);
} }
/**
* meta_wayland_compositor_get_wayland_display:
* @compositor: The #MetaWaylandCompositor
*
* Returns: (transfer none): the Wayland display object
*/
struct wl_display * struct wl_display *
meta_wayland_compositor_get_wayland_display (MetaWaylandCompositor *compositor) meta_wayland_compositor_get_wayland_display (MetaWaylandCompositor *compositor)
{ {

View File

@ -27,6 +27,7 @@
#include "core/meta-context-private.h" #include "core/meta-context-private.h"
#include "core/util-private.h" #include "core/util-private.h"
#include "meta/types.h" #include "meta/types.h"
#include "meta/meta-wayland-compositor.h"
#include "wayland/meta-wayland-text-input.h" #include "wayland/meta-wayland-text-input.h"
#include "wayland/meta-wayland-types.h" #include "wayland/meta-wayland-types.h"
@ -103,9 +104,6 @@ MetaXWaylandManager * meta_wayland_compositor_get_xwayland_manager (MetaWaylan
META_EXPORT_TEST META_EXPORT_TEST
MetaContext * meta_wayland_compositor_get_context (MetaWaylandCompositor *compositor); MetaContext * meta_wayland_compositor_get_context (MetaWaylandCompositor *compositor);
META_EXPORT_TEST
struct wl_display * meta_wayland_compositor_get_wayland_display (MetaWaylandCompositor *compositor);
gboolean meta_wayland_compositor_is_grabbed (MetaWaylandCompositor *compositor); gboolean meta_wayland_compositor_is_grabbed (MetaWaylandCompositor *compositor);
META_EXPORT_TEST META_EXPORT_TEST