[maemo-commits] [maemo-commits] r19222 - projects/haf/branches/clutter/bug.134557.and.starvation/clutter/x11
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Thu Aug 27 16:07:48 EEST 2009
- Previous message: [maemo-commits] r19221 - in projects/haf/tags/ke-recv/3.19-7: debian src
- Next message: [maemo-commits] r19223 - in projects/haf/branches/libmatchbox2/bug.134557: . debian matchbox/comp-mgr matchbox/core
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: aendrodi
Date: 2009-08-27 16:07:28 +0300 (Thu, 27 Aug 2009)
New Revision: 19222
Modified:
projects/haf/branches/clutter/bug.134557.and.starvation/clutter/x11/clutter-event-x11.c
projects/haf/branches/clutter/bug.134557.and.starvation/clutter/x11/clutter-x11.h
Log:
updated with the latest patch
Modified: projects/haf/branches/clutter/bug.134557.and.starvation/clutter/x11/clutter-event-x11.c
===================================================================
--- projects/haf/branches/clutter/bug.134557.and.starvation/clutter/x11/clutter-event-x11.c 2009-08-27 12:22:41 UTC (rev 19221)
+++ projects/haf/branches/clutter/bug.134557.and.starvation/clutter/x11/clutter-event-x11.c 2009-08-27 13:07:28 UTC (rev 19222)
@@ -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,19 +818,20 @@
Display *xdisplay = backend_x11->xdpy;
XEvent xevent;
ClutterMainContext *clutter_context;
- struct timeval now;
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);
- gettimeofday(&now, NULL);
event = clutter_event_new (CLUTTER_NOTHING);
if (event_translate (backend, event, &xevent))
@@ -841,6 +844,7 @@
clutter_event_free (event);
}
+ /* Take a break every 40 milisecs. */
if (g_timer_elapsed (timer, NULL) >= 0.04)
break;
}
@@ -896,7 +900,6 @@
return CLUTTER_X11_FILTER_CONTINUE;
}
-int events_blocked;
static gboolean
clutter_event_prepare (GSource *source,
gint *timeout)
@@ -907,9 +910,10 @@
clutter_threads_enter ();
*timeout = -1;
- if (events_blocked)
- return FALSE;
- 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 ();
@@ -925,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/branches/clutter/bug.134557.and.starvation/clutter/x11/clutter-x11.h
===================================================================
--- projects/haf/branches/clutter/bug.134557.and.starvation/clutter/x11/clutter-x11.h 2009-08-27 12:22:41 UTC (rev 19221)
+++ projects/haf/branches/clutter/bug.134557.and.starvation/clutter/x11/clutter-x11.h 2009-08-27 13:07:28 UTC (rev 19222)
@@ -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__ */
- Previous message: [maemo-commits] r19221 - in projects/haf/tags/ke-recv/3.19-7: debian src
- Next message: [maemo-commits] r19223 - in projects/haf/branches/libmatchbox2/bug.134557: . debian matchbox/comp-mgr matchbox/core
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
