[maemo-commits] [maemo-commits] r19260 - in projects/haf/trunk/clutter0.8: clutter/x11 debian
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Aug 31 12:57:44 EEST 2009
- Previous message: [maemo-commits] r19259 - projects/haf/tags/hildon-welcome
- Next message: [maemo-commits] r19261 - in projects/haf/trunk/libmatchbox2: . matchbox/core
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: aendrodi Date: 2009-08-31 12:57:37 +0300 (Mon, 31 Aug 2009) New Revision: 19260 Modified: projects/haf/trunk/clutter0.8/clutter/x11/clutter-event-x11.c projects/haf/trunk/clutter0.8/clutter/x11/clutter-x11.h projects/haf/trunk/clutter0.8/debian/changelog Log: * clutter/x11/clutter-event-x11.c: (events_queue): don't process events for more than 400 ms (clutter_event_prepare, clutter_event_check): respect clutter_x11_event_processing_blocked Modified: projects/haf/trunk/clutter0.8/clutter/x11/clutter-event-x11.c =================================================================== --- projects/haf/trunk/clutter0.8/clutter/x11/clutter-event-x11.c 2009-08-31 09:55:52 UTC (rev 19259) +++ projects/haf/trunk/clutter0.8/clutter/x11/clutter-event-x11.c 2009-08-31 09:57:37 UTC (rev 19260) @@ -62,6 +62,8 @@ #define XEMBED_UNREGISTER_ACCELERATOR 13 #define XEMBED_ACTIVATE_ACCELERATOR 14 +gboolean clutter_x11_event_processing_blocked; + static Window ParentEmbedderWin = None; typedef struct _ClutterEventSource ClutterEventSource; @@ -816,9 +818,16 @@ Display *xdisplay = backend_x11->xdpy; XEvent xevent; ClutterMainContext *clutter_context; + static GTimer *timer; clutter_context = clutter_context_get_default (); + /* Observe the elapsed time we spend on event processing not to starve + * g_timeout_add() callbacks to death. */ + if (!timer) + timer = g_timer_new (); + g_timer_start (timer); + while (!clutter_events_pending () && XPending (xdisplay)) { XNextEvent (xdisplay, &xevent); @@ -834,6 +843,10 @@ { clutter_event_free (event); } + + /* Take a break every 40 milisecs. */ + if (g_timer_elapsed (timer, NULL) >= 0.04) + break; } } @@ -897,7 +910,10 @@ clutter_threads_enter (); *timeout = -1; - retval = (clutter_events_pending () || check_xpending (backend)); + if (clutter_x11_event_processing_blocked) + retval = FALSE; + else + retval = (clutter_events_pending () || check_xpending (backend)); clutter_threads_leave (); @@ -913,7 +929,9 @@ clutter_threads_enter (); - if (event_source->event_poll_fd.revents & G_IO_IN) + if (clutter_x11_event_processing_blocked) + retval = FALSE; + else if (event_source->event_poll_fd.revents & G_IO_IN) retval = (clutter_events_pending () || check_xpending (backend)); else retval = FALSE; Modified: projects/haf/trunk/clutter0.8/clutter/x11/clutter-x11.h =================================================================== --- projects/haf/trunk/clutter0.8/clutter/x11/clutter-x11.h 2009-08-31 09:55:52 UTC (rev 19259) +++ projects/haf/trunk/clutter0.8/clutter/x11/clutter-x11.h 2009-08-31 09:57:37 UTC (rev 19260) @@ -134,6 +134,15 @@ gboolean clutter_x11_has_composite_extension (void); +/** + * clutter_x11_event_processing_blocked: + * + * As long as %TRUE the X11 backend won't start processing any new X events. + * Useful when you want to spin clutter_main() in an event filter function + * and would mind reentering it. + */ +extern gboolean clutter_x11_event_processing_blocked; + G_END_DECLS #endif /* __CLUTTER_X11_H__ */ Modified: projects/haf/trunk/clutter0.8/debian/changelog =================================================================== --- projects/haf/trunk/clutter0.8/debian/changelog 2009-08-31 09:55:52 UTC (rev 19259) +++ projects/haf/trunk/clutter0.8/debian/changelog 2009-08-31 09:57:37 UTC (rev 19260) @@ -4,6 +4,10 @@ * clutter/x11/clutter-x11-texture-pixmap.c (clutter_x11_texture_pixmap_set_redirection): Allow setting the redirection irrespective of Clutter's idea of it. + Adam: + * clutter/x11/clutter-event-x11.c: + (events_queue): don't process events for more than 400 ms + (clutter_event_prepare, clutter_event_check): respect clutter_x11_event_processing_blocked -- Gordon Williams <gordon.williams at collabora.co.uk> Mon, 24 Aug 2009 15:59:29 +0300
- Previous message: [maemo-commits] r19259 - projects/haf/tags/hildon-welcome
- Next message: [maemo-commits] r19261 - in projects/haf/trunk/libmatchbox2: . matchbox/core
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]