mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
2008-02-21 Tomas Frydrych <tf@openedhand.com>
* clutter/x11/clutter-backend-x11.h: * clutter/x11/clutter-event-x11.c: * clutter/x11/clutter-x11.h: (clutter_x11_handle_event): (clutter_x11_disable_event_retrieval): Functions to allow to hook into external XEvent retrieval (for example when using clutter with gtk); NB: this API is tentative.
This commit is contained in:
parent
4dfe577fba
commit
a9ff224ba1
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
2008-02-21 Tomas Frydrych <tf@openedhand.com>
|
||||
|
||||
* clutter/x11/clutter-backend-x11.h:
|
||||
* clutter/x11/clutter-event-x11.c:
|
||||
* clutter/x11/clutter-x11.h:
|
||||
(clutter_x11_handle_event):
|
||||
(clutter_x11_disable_event_retrieval):
|
||||
Functions to allow to hook into external XEvent retrieval (for
|
||||
example when using clutter with gtk); NB: this API is tentative.
|
||||
|
||||
2008-02-21 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/x11/clutter-event-x11.c (event_translate): Ignore
|
||||
|
@ -66,6 +66,8 @@ struct _ClutterBackendX11
|
||||
GSource *event_source;
|
||||
GSList *event_filters;
|
||||
|
||||
gboolean no_xevent_retrieval;
|
||||
|
||||
/* props */
|
||||
Atom atom_NET_WM_PING;
|
||||
Atom atom_NET_WM_STATE;
|
||||
|
@ -163,6 +163,9 @@ _clutter_backend_x11_events_init (ClutterBackend *backend)
|
||||
ClutterEventSource *event_source;
|
||||
int connection_number;
|
||||
|
||||
if (backend_x11->no_xevent_retrieval)
|
||||
return;
|
||||
|
||||
connection_number = ConnectionNumber (backend_x11->xdpy);
|
||||
CLUTTER_NOTE (EVENT, "Connection number: %d", connection_number);
|
||||
|
||||
@ -654,6 +657,79 @@ events_queue (ClutterBackend *backend)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_x11_handle_event
|
||||
* @xevent: pointer to XEvent structure
|
||||
*
|
||||
* This function processes a single X event; it can be used to hook
|
||||
* into external X event retrieval (for example that done by GDK).
|
||||
*
|
||||
* Return: #ClutterX11FilterReturn indicating what the caller should
|
||||
* do with the original event.
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
ClutterX11FilterReturn
|
||||
clutter_x11_handle_event (XEvent *xevent)
|
||||
{
|
||||
ClutterBackend *backend;
|
||||
ClutterEvent *event;
|
||||
ClutterMainContext *clutter_context;
|
||||
|
||||
clutter_threads_enter ();
|
||||
|
||||
clutter_context = clutter_context_get_default ();
|
||||
backend = clutter_context->backend;
|
||||
|
||||
event = clutter_event_new (CLUTTER_NOTHING);
|
||||
|
||||
if (event_translate (backend, event, xevent))
|
||||
{
|
||||
/* push directly here to avoid copy of queue_put */
|
||||
g_queue_push_head (clutter_context->events_queue, event);
|
||||
}
|
||||
else
|
||||
{
|
||||
clutter_event_free (event);
|
||||
}
|
||||
|
||||
event = clutter_event_get ();
|
||||
|
||||
if (event)
|
||||
{
|
||||
/* forward the event into clutter for emission etc. */
|
||||
clutter_do_event (event);
|
||||
clutter_event_free (event);
|
||||
}
|
||||
|
||||
clutter_threads_leave ();
|
||||
|
||||
return CLUTTER_X11_FILTER_CONTINUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_x11_disable_event_retrieval
|
||||
*
|
||||
* Disables retrieval of X events in the main loop. Use to create event-less
|
||||
* canvas or in conjunction with clutter_x11_handle_event.
|
||||
*
|
||||
* This function can only be called before calling clutter_init().
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
void
|
||||
clutter_x11_disable_event_retrieval (void)
|
||||
{
|
||||
ClutterBackendX11 *backend;
|
||||
ClutterMainContext *clutter_context;
|
||||
|
||||
clutter_context = clutter_context_get_default ();
|
||||
backend = CLUTTER_BACKEND_X11 (clutter_context->backend);
|
||||
|
||||
backend->no_xevent_retrieval = TRUE;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
clutter_event_prepare (GSource *source,
|
||||
gint *timeout)
|
||||
|
@ -75,7 +75,7 @@ typedef enum {
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
typedef ClutterX11FilterReturn (*ClutterX11FilterFunc) (XEvent *xev,
|
||||
typedef ClutterX11FilterReturn (*ClutterX11FilterFunc) (XEvent *xev,
|
||||
ClutterEvent *cev,
|
||||
gpointer data);
|
||||
|
||||
@ -94,9 +94,13 @@ gboolean clutter_x11_set_stage_foreign (ClutterStage *stage,
|
||||
|
||||
void clutter_x11_add_filter (ClutterX11FilterFunc func,
|
||||
gpointer data);
|
||||
void clutter_x11_remove_filter (ClutterX11FilterFunc func,
|
||||
void clutter_x11_remove_filter (ClutterX11FilterFunc func,
|
||||
gpointer data);
|
||||
|
||||
ClutterX11FilterReturn clutter_x11_handle_event (XEvent *xevent);
|
||||
|
||||
void clutter_x11_disable_event_retrieval (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_X11_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user