mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 04:22:05 +00:00
wayland: Add API for disabling the event dispatching
This allows the integration of Clutter with another library, like GTK+, that is dispatching the events itself. This is implemented by calling into the cogl_wayland_renderer_set_event_dispatch_enabled() and since that function must be called on the newly created renderer the newly added clutter_wayland_disable_event_retrieval must be called before clutter_init() https://bugzilla.gnome.org/show_bug.cgi?id=704279
This commit is contained in:
parent
697f7a3359
commit
a5e44d3934
@ -1598,6 +1598,7 @@ 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
|
clutter_wayland_set_display
|
||||||
|
clutter_wayland_disable_event_retrieval
|
||||||
#endif
|
#endif
|
||||||
#ifdef CLUTTER_WINDOWING_WIN32
|
#ifdef CLUTTER_WINDOWING_WIN32
|
||||||
clutter_win32_disable_event_retrieval
|
clutter_win32_disable_event_retrieval
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
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 struct wl_display *_foreign_display = NULL;
|
||||||
|
static gboolean _no_event_dispatch = FALSE;
|
||||||
|
|
||||||
static void clutter_backend_wayland_load_cursor (ClutterBackendWayland *backend_wayland);
|
static void clutter_backend_wayland_load_cursor (ClutterBackendWayland *backend_wayland);
|
||||||
|
|
||||||
@ -240,6 +241,7 @@ clutter_backend_wayland_get_renderer (ClutterBackend *backend,
|
|||||||
|
|
||||||
renderer = cogl_renderer_new ();
|
renderer = cogl_renderer_new ();
|
||||||
|
|
||||||
|
cogl_wayland_renderer_set_event_dispatch_enabled (renderer, !_no_event_dispatch);
|
||||||
cogl_renderer_set_winsys_id (renderer, COGL_WINSYS_ID_EGL_WAYLAND);
|
cogl_renderer_set_winsys_id (renderer, COGL_WINSYS_ID_EGL_WAYLAND);
|
||||||
|
|
||||||
cogl_wayland_renderer_set_foreign_display (renderer,
|
cogl_wayland_renderer_set_foreign_display (renderer,
|
||||||
@ -352,3 +354,32 @@ clutter_wayland_set_display (struct wl_display *display)
|
|||||||
|
|
||||||
_foreign_display = display;
|
_foreign_display = display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_wayland_disable_event_retrieval:
|
||||||
|
*
|
||||||
|
* Disables the dispatch of the events in the main loop.
|
||||||
|
*
|
||||||
|
* This is useful for integrating Clutter with another library that will do the
|
||||||
|
* event dispatch; in general only a single source should be acting on changes
|
||||||
|
* on the Wayland file descriptor.
|
||||||
|
*
|
||||||
|
* <warning>This function can only be called before calling
|
||||||
|
* clutter_init().</warning>
|
||||||
|
*
|
||||||
|
* This function should not be normally used by applications.
|
||||||
|
*
|
||||||
|
* Since: 1.16
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_wayland_disable_event_retrieval (void)
|
||||||
|
{
|
||||||
|
if (_clutter_context_is_initialized ())
|
||||||
|
{
|
||||||
|
g_warning ("%s() can only be used before calling clutter_init()",
|
||||||
|
G_STRFUNC);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_no_event_dispatch = TRUE;
|
||||||
|
}
|
||||||
|
@ -52,5 +52,8 @@ struct wl_surface *clutter_wayland_stage_get_wl_surface (ClutterStage *stage);
|
|||||||
CLUTTER_AVAILABLE_IN_1_16
|
CLUTTER_AVAILABLE_IN_1_16
|
||||||
void clutter_wayland_set_display (struct wl_display *display);
|
void clutter_wayland_set_display (struct wl_display *display);
|
||||||
|
|
||||||
|
CLUTTER_AVAILABLE_IN_1_16
|
||||||
|
void clutter_wayland_disable_event_retrieval (void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
#endif /* __CLUTTER_WAYLAND_H__ */
|
#endif /* __CLUTTER_WAYLAND_H__ */
|
||||||
|
@ -1436,6 +1436,7 @@ 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
|
clutter_wayland_set_display
|
||||||
|
clutter_wayland_disable_event_retrieval
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
|
Loading…
Reference in New Issue
Block a user