summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2010-10-09 19:44:49 -0700
committerJamey Sharp <jamey@minilop.net>2010-10-09 19:44:49 -0700
commitf44d4edc9b489c3e9c1876c3b71b15a509d57aef (patch)
treeda2fa7d4835da6cd3f414097428038e0352287a4
parent7cf9a16bfa0653d83726754599b5b2f27fcb0b2c (diff)
hypnomoire: Handle failed connections.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
-rw-r--r--hypnomoire.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/hypnomoire.c b/hypnomoire.c
index cab3c31..03cc7af 100644
--- a/hypnomoire.c
+++ b/hypnomoire.c
@@ -91,20 +91,6 @@ int main()
/*NOTREACHED*/
}
-void paint(int idx)
-{
- xcb_copy_area(c, windows[idx].p, windows[idx].w, white, 0, 0, 0, 0,
- windows[idx].width, windows[idx].height);
- /* FIXME: better error detection for broken pipe
- if(!xcb_sync(c, 0))
- {
- perror("xcb_sync_t failed");
- abort();
- }
- */
- xcb_aux_sync(c);
-}
-
void *run(void *param)
{
int idx = (int)param;
@@ -166,7 +152,11 @@ void *run(void *param)
xcb_poly_line(c, XCB_COORD_MODE_ORIGIN, windows[idx].p, white,
2, line);
- paint(idx);
+ xcb_copy_area(c, windows[idx].p, windows[idx].w, white, 0, 0, 0, 0,
+ windows[idx].width, windows[idx].height);
+ if(xcb_flush(c) <= 0)
+ break;
+
theta += windows[idx].angv;
while(theta > 2 * PI)
theta -= 2 * PI;