summaryrefslogtreecommitdiff
path: root/boilerplate
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2012-12-17 17:12:59 +0100
committerUli Schlachter <psychon@znc.in>2012-12-17 17:12:59 +0100
commit000a137a6554cfc350407f3b719fb4aa3a1c33c6 (patch)
treeb5b7969080ac2809e04568ef4c8e573f050187f3 /boilerplate
parent9d9aa04b60e24542b6b2a4c6bf87115db7736c2f (diff)
boilerplate-xcb: Ignore MappingNotify events
The boilerplate code makes sure that our tests didn't cause any X11 errors or X11 events, because those might confuse API users. However, when the keyboard layout changes, every connection gets a MappingNotify event. This means that the test and performance test suites failed when the keyboard layout was changed while they are running. Fix this by ignoring MappingNotifies. Reported by Arthur Huillet on IRC. Signed-off-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'boilerplate')
-rw-r--r--boilerplate/cairo-boilerplate-xcb.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/boilerplate/cairo-boilerplate-xcb.c b/boilerplate/cairo-boilerplate-xcb.c
index 979f5b59..ffefecb9 100644
--- a/boilerplate/cairo-boilerplate-xcb.c
+++ b/boilerplate/cairo-boilerplate-xcb.c
@@ -46,9 +46,15 @@ typedef struct _xcb_target_closure {
static cairo_status_t
_cairo_boilerplate_xcb_handle_errors (xcb_target_closure_t *xtc)
{
- xcb_generic_event_t *ev;
+ xcb_generic_event_t *ev = NULL;
- if ((ev = xcb_poll_for_event (xtc->c)) != NULL) {
+ /* Ignore all MappingNotify events; those might happen without us causing them */
+ do {
+ free(ev);
+ ev = xcb_poll_for_event(xtc->c);
+ } while (ev != NULL && ev->response_type == XCB_MAPPING_NOTIFY);
+
+ if (ev != NULL) {
if (ev->response_type == CAIRO_XCB_ERROR) {
xcb_generic_error_t *error = (xcb_generic_error_t *) ev;