mirror of
https://github.com/brl/mutter.git
synced 2024-12-12 14:20:17 +00: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>
|
2008-02-21 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
* clutter/x11/clutter-event-x11.c (event_translate): Ignore
|
* clutter/x11/clutter-event-x11.c (event_translate): Ignore
|
||||||
|
@ -66,6 +66,8 @@ struct _ClutterBackendX11
|
|||||||
GSource *event_source;
|
GSource *event_source;
|
||||||
GSList *event_filters;
|
GSList *event_filters;
|
||||||
|
|
||||||
|
gboolean no_xevent_retrieval;
|
||||||
|
|
||||||
/* props */
|
/* props */
|
||||||
Atom atom_NET_WM_PING;
|
Atom atom_NET_WM_PING;
|
||||||
Atom atom_NET_WM_STATE;
|
Atom atom_NET_WM_STATE;
|
||||||
|
@ -163,6 +163,9 @@ _clutter_backend_x11_events_init (ClutterBackend *backend)
|
|||||||
ClutterEventSource *event_source;
|
ClutterEventSource *event_source;
|
||||||
int connection_number;
|
int connection_number;
|
||||||
|
|
||||||
|
if (backend_x11->no_xevent_retrieval)
|
||||||
|
return;
|
||||||
|
|
||||||
connection_number = ConnectionNumber (backend_x11->xdpy);
|
connection_number = ConnectionNumber (backend_x11->xdpy);
|
||||||
CLUTTER_NOTE (EVENT, "Connection number: %d", connection_number);
|
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
|
static gboolean
|
||||||
clutter_event_prepare (GSource *source,
|
clutter_event_prepare (GSource *source,
|
||||||
gint *timeout)
|
gint *timeout)
|
||||||
|
@ -97,6 +97,10 @@ void clutter_x11_add_filter (ClutterX11FilterFunc func,
|
|||||||
void clutter_x11_remove_filter (ClutterX11FilterFunc func,
|
void clutter_x11_remove_filter (ClutterX11FilterFunc func,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
|
ClutterX11FilterReturn clutter_x11_handle_event (XEvent *xevent);
|
||||||
|
|
||||||
|
void clutter_x11_disable_event_retrieval (void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_X11_H__ */
|
#endif /* __CLUTTER_X11_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user