mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -05:00
wayland: add support for connecting to a foreign display
This allows the reuse of the display connection and hence objects with existing code that is using Wayland. https://bugzilla.gnome.org/show_bug.cgi?id=703566
This commit is contained in:
parent
5b614cda1c
commit
8df5aba361
@ -1597,6 +1597,7 @@ clutter_vertex_new
|
|||||||
clutter_wayland_input_device_get_wl_seat
|
clutter_wayland_input_device_get_wl_seat
|
||||||
clutter_wayland_stage_get_wl_shell_surface
|
clutter_wayland_stage_get_wl_shell_surface
|
||||||
clutter_wayland_stage_get_wl_surface
|
clutter_wayland_stage_get_wl_surface
|
||||||
|
clutter_wayland_set_display
|
||||||
#endif
|
#endif
|
||||||
#ifdef CLUTTER_WINDOWING_WIN32
|
#ifdef CLUTTER_WINDOWING_WIN32
|
||||||
clutter_win32_disable_event_retrieval
|
clutter_win32_disable_event_retrieval
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include "wayland/clutter-device-manager-wayland.h"
|
#include "wayland/clutter-device-manager-wayland.h"
|
||||||
#include "wayland/clutter-event-wayland.h"
|
#include "wayland/clutter-event-wayland.h"
|
||||||
#include "wayland/clutter-stage-wayland.h"
|
#include "wayland/clutter-stage-wayland.h"
|
||||||
|
#include "wayland/clutter-wayland.h"
|
||||||
#include "cogl/clutter-stage-cogl.h"
|
#include "cogl/clutter-stage-cogl.h"
|
||||||
|
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
@ -59,6 +60,8 @@
|
|||||||
|
|
||||||
G_DEFINE_TYPE (ClutterBackendWayland, clutter_backend_wayland, CLUTTER_TYPE_BACKEND);
|
G_DEFINE_TYPE (ClutterBackendWayland, clutter_backend_wayland, CLUTTER_TYPE_BACKEND);
|
||||||
|
|
||||||
|
static struct wl_display *_foreign_display = NULL;
|
||||||
|
|
||||||
static void clutter_backend_wayland_load_cursor (ClutterBackendWayland *backend_wayland);
|
static void clutter_backend_wayland_load_cursor (ClutterBackendWayland *backend_wayland);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -175,7 +178,10 @@ clutter_backend_wayland_post_parse (ClutterBackend *backend,
|
|||||||
ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend);
|
ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend);
|
||||||
|
|
||||||
/* TODO: expose environment variable/commandline option for this... */
|
/* TODO: expose environment variable/commandline option for this... */
|
||||||
backend_wayland->wayland_display = wl_display_connect (NULL);
|
backend_wayland->wayland_display = _foreign_display;
|
||||||
|
if (backend_wayland->wayland_display == NULL)
|
||||||
|
backend_wayland->wayland_display = wl_display_connect (NULL);
|
||||||
|
|
||||||
if (!backend_wayland->wayland_display)
|
if (!backend_wayland->wayland_display)
|
||||||
{
|
{
|
||||||
g_set_error (error, CLUTTER_INIT_ERROR,
|
g_set_error (error, CLUTTER_INIT_ERROR,
|
||||||
@ -322,3 +328,31 @@ static void
|
|||||||
clutter_backend_wayland_init (ClutterBackendWayland *backend_wayland)
|
clutter_backend_wayland_init (ClutterBackendWayland *backend_wayland)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_wayland_set_display
|
||||||
|
* @display: pointer to a wayland display
|
||||||
|
*
|
||||||
|
* Sets the display connection Clutter should use; must be called
|
||||||
|
* before clutter_init(), clutter_init_with_args() or other functions
|
||||||
|
* pertaining Clutter's initialization process.
|
||||||
|
*
|
||||||
|
* If you are parsing the command line arguments by retrieving Clutter's
|
||||||
|
* #GOptionGroup with clutter_get_option_group() and calling
|
||||||
|
* g_option_context_parse() yourself, you should also call
|
||||||
|
* clutter_wayland_set_display() before g_option_context_parse().
|
||||||
|
*
|
||||||
|
* Since: 1.16
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_wayland_set_display (struct wl_display *display)
|
||||||
|
{
|
||||||
|
if (_clutter_context_is_initialized ())
|
||||||
|
{
|
||||||
|
g_warning ("%s() can only be used before calling clutter_init()",
|
||||||
|
G_STRFUNC);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_foreign_display = display;
|
||||||
|
}
|
||||||
|
@ -48,6 +48,9 @@ struct wl_shell_surface *clutter_wayland_stage_get_wl_shell_surface (ClutterStag
|
|||||||
|
|
||||||
CLUTTER_AVAILABLE_IN_1_10
|
CLUTTER_AVAILABLE_IN_1_10
|
||||||
struct wl_surface *clutter_wayland_stage_get_wl_surface (ClutterStage *stage);
|
struct wl_surface *clutter_wayland_stage_get_wl_surface (ClutterStage *stage);
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
|
CLUTTER_AVAILABLE_IN_1_16
|
||||||
|
void clutter_wayland_set_display (struct wl_display *display);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
#endif /* __CLUTTER_WAYLAND_H__ */
|
#endif /* __CLUTTER_WAYLAND_H__ */
|
||||||
|
@ -1429,6 +1429,7 @@ clutter_glx_texture_pixmap_get_type
|
|||||||
clutter_wayland_input_device_get_wl_seat
|
clutter_wayland_input_device_get_wl_seat
|
||||||
clutter_wayland_stage_get_wl_shell_surface
|
clutter_wayland_stage_get_wl_shell_surface
|
||||||
clutter_wayland_stage_get_wl_surface
|
clutter_wayland_stage_get_wl_surface
|
||||||
|
clutter_wayland_set_display
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
|
Loading…
Reference in New Issue
Block a user