diff options
Diffstat (limited to 'recordmydesktop/src/rmdthreads.c')
-rw-r--r-- | recordmydesktop/src/rmdthreads.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/recordmydesktop/src/rmdthreads.c b/recordmydesktop/src/rmdthreads.c index 6e4bf34..f8e9ef4 100644 --- a/recordmydesktop/src/rmdthreads.c +++ b/recordmydesktop/src/rmdthreads.c @@ -39,7 +39,7 @@ void rmdThreads(ProgData *pdata){ - pthread_t poll_damage_t, + pthread_t poll_events_t, image_capture_t, image_encode_t, image_cache_t, @@ -47,7 +47,7 @@ void rmdThreads(ProgData *pdata){ sound_encode_t, sound_cache_t, flush_to_ogg_t; - + Window dummy_w; if(pdata->args.delay>0){ fprintf(stderr,"Will sleep for %d seconds now.\n",pdata->args.delay); @@ -55,11 +55,10 @@ void rmdThreads(ProgData *pdata){ } /*start threads*/ - if(!pdata->args.full_shots) - pthread_create(&poll_damage_t, - NULL, - (void *)PollDamage, - (void *)pdata); + pthread_create(&poll_events_t, + NULL, + (void *)PollEvents, + (void *)pdata); pthread_create(&image_capture_t, NULL, (void *)GetFrame, @@ -152,9 +151,29 @@ void rmdThreads(ProgData *pdata){ pthread_join(flush_to_ogg_t,NULL); fprintf(stderr,"."); - - if(!pdata->args.full_shots) - pthread_join(poll_damage_t,NULL); + /* + * HACK ALERT + * This window (dummy_w) is created + * only so that we will receive a final + * create notify event. This is needed + * especially for the full_shots mode were + * there are no damage events and the + * poll_events thread might get stuck indefinatelly. + * XFlush is also needed in order to get the event + * before the current thread gets stuck at the join call. + * The second XFlush should be unnecesary. + */ + + dummy_w=XCreateSimpleWindow(pdata->dpy, + pdata->specs.root, + 1,1,1,1,0, + pdata->specs.bpixel, + pdata->specs.wpixel); + XFlush(pdata->dpy); + XDestroyWindow(pdata->dpy,dummy_w); + XFlush(pdata->dpy); + + pthread_join(poll_events_t,NULL); //Now that we are done with recording we cancel the timer CancelTimer(); |