From 35be190a96f0063d70b7fe1ae6cb85c30ed972a3 Mon Sep 17 00:00:00 2001 From: iovar Date: Thu, 15 Nov 2007 11:29:15 +0000 Subject: Makefile.am: added poll_events.c(removed poll_damage.c) parseargs.c: added parsing for pause and stop shortcut recordmydesktop.c : shortcuts related code changes rmdthreads.c: added a hack to end the poll_events thread, since it now runs regardless of whether full-shots is specified. shortcuts.c: new method RegisterShortcuts. git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@435 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- recordmydesktop/src/rmdthreads.c | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'recordmydesktop/src/rmdthreads.c') 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(); -- cgit v1.2.1