1
0
Fork 0

cogl/renderer: Expose handle_event

As it was originally the function to be used before
making it private and providing safer wrappers around it for x11/win32.

Nowadays, it is only used in x11 and only internally in mutter, exposing
a 'safer' variant costs us exposing more of x11 renderer APIs without
much benefits.

With this change, the only internal xlib renderer we need from meta is
set_foreign_display which can't be easily worked around

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
This commit is contained in:
Bilal Elmoussaoui 2024-07-28 14:58:33 +02:00 committed by Marge Bot
parent b07c772fc8
commit a9ec604eba
6 changed files with 22 additions and 35 deletions

View file

@ -73,10 +73,6 @@ struct _CoglRenderer
typedef CoglFilterReturn (* CoglNativeFilterFunc) (void *native_event,
void *data);
CoglFilterReturn
_cogl_renderer_handle_native_event (CoglRenderer *renderer,
void *event);
void
_cogl_renderer_add_native_filter (CoglRenderer *renderer,
CoglNativeFilterFunc func,

View file

@ -521,8 +521,8 @@ cogl_renderer_connect (CoglRenderer *renderer, GError **error)
}
CoglFilterReturn
_cogl_renderer_handle_native_event (CoglRenderer *renderer,
void *event)
cogl_renderer_handle_event (CoglRenderer *renderer,
void *event)
{
GSList *l, *next;

View file

@ -305,4 +305,21 @@ COGL_EXPORT void *
cogl_renderer_get_proc_address (CoglRenderer *renderer,
const char *name);
/**
* cogl_renderer_handle_event: (skip)
* @renderer: a #CoglRenderer
* @event: pointer to an event structure
*
* Processes a single event.
*
* Return value: #CoglFilterReturn. %COGL_FILTER_REMOVE indicates that
* Cogl has internally handled the event and the caller should do no
* further processing. %COGL_FILTER_CONTINUE indicates that Cogl is
* either not interested in the event, or has used the event to update
* internal state without taking any exclusive action.
*/
COGL_EXPORT CoglFilterReturn
cogl_renderer_handle_event (CoglRenderer *renderer,
void *event);
G_END_DECLS

View file

@ -465,13 +465,6 @@ cogl_xlib_renderer_get_display (CoglRenderer *renderer)
return xlib_renderer->xdpy;
}
CoglFilterReturn
cogl_xlib_renderer_handle_event (CoglRenderer *renderer,
XEvent *event)
{
return _cogl_renderer_handle_native_event (renderer, event);
}
float
_cogl_xlib_renderer_refresh_rate_for_rectangle (CoglRenderer *renderer,
int x,

View file

@ -35,25 +35,6 @@
G_BEGIN_DECLS
/**
* cogl_xlib_renderer_handle_event: (skip)
* @renderer: a #CoglRenderer
* @event: pointer to an XEvent structure
*
* This function processes a single event; it can be used to hook into
* external event retrieval (for example that done by Clutter or
* GDK).
*
* Return value: #CoglFilterReturn. %COGL_FILTER_REMOVE indicates that
* Cogl has internally handled the event and the caller should do no
* further processing. %COGL_FILTER_CONTINUE indicates that Cogl is
* either not interested in the event, or has used the event to update
* internal state without taking any exclusive action.
*/
COGL_EXPORT CoglFilterReturn
cogl_xlib_renderer_handle_event (CoglRenderer *renderer,
XEvent *event);
/**
* cogl_xlib_renderer_set_foreign_display: (skip)
* @renderer: a #CoglRenderer
@ -63,7 +44,7 @@ cogl_xlib_renderer_handle_event (CoglRenderer *renderer,
*
* Note that calling this function will automatically disable Cogl's
* event retrieval. Cogl still needs to see all of the X events so the
* application should also use cogl_xlib_renderer_handle_event() if it
* application should also use cogl_renderer_handle_event() if it
* uses this function.
*/
COGL_EXPORT void

View file

@ -59,8 +59,8 @@ meta_backend_x11_handle_event (MetaBackend *backend,
allocated_event = XGetEventData (xdisplay, &xevent->xcookie);
if (cogl_xlib_renderer_handle_event (clutter_backend->cogl_renderer,
xevent) == COGL_FILTER_REMOVE)
if (cogl_renderer_handle_event (clutter_backend->cogl_renderer,
xevent) == COGL_FILTER_REMOVE)
goto out;
stage_x11 =