From 3f5d20573bd0aac953bd2db2d72997ff44365caf Mon Sep 17 00:00:00 2001 From: enselic Date: Sat, 13 Sep 2008 11:39:35 +0000 Subject: The global int pointer 'Running' is just a hack for global access of ProgData::running. We can get rid of this global. include/rmdtypes.h: Put ProgData in JackData so that the libjack stuff can access progam state. src/recordmydesktop.c: Initialize ProgData member of JackData. src/rmd_jack.c: Use ProgData instead of the global. src/register_callbacks.[ch]: Pass ProgData to the registering of signal handlers and put a local version of the Running-global hack in this file. src/rmd_rescue.c: Get rid of Running-logic and pass ProgData to RegisterCallbacks() src/rmdthreads.c: Pass ProgData to RegisterCallbacks() src/initialize_data.c: Get rid of Running-logic. include/recordmydesktop.h: Remove the Running-global. git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@528 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- recordmydesktop/include/recordmydesktop.h | 2 +- recordmydesktop/include/rmdtypes.h | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'recordmydesktop/include') diff --git a/recordmydesktop/include/recordmydesktop.h b/recordmydesktop/include/recordmydesktop.h index adbc233..1a5c3fa 100644 --- a/recordmydesktop/include/recordmydesktop.h +++ b/recordmydesktop/include/recordmydesktop.h @@ -50,7 +50,7 @@ u_int32_t *yblocks, /**Globals*/ //I've read somewhere that I'll go to hell for using globals... -int Paused,*Running,Aborted,PauseStateChanged; +int Paused, Aborted, PauseStateChanged; pthread_cond_t *time_cond,*pause_cond; pthread_mutex_t pause_mutex,time_mutex; unsigned char Yr[256],Yg[256],Yb[256], diff --git a/recordmydesktop/include/rmdtypes.h b/recordmydesktop/include/rmdtypes.h index 7fdb59b..5d31fda 100644 --- a/recordmydesktop/include/rmdtypes.h +++ b/recordmydesktop/include/rmdtypes.h @@ -103,6 +103,9 @@ typedef int boolean; #define FALSE (0) #define TRUE (!FALSE) +// Forward declarations +typedef struct _ProgData ProgData; + typedef struct _DisplaySpecs{ //this struct holds some basic information int screen; //about the display,needed mostly for unsigned int width; //validity checks at startup @@ -243,6 +246,7 @@ typedef struct _SndBuffer{ #ifdef HAVE_JACK_H typedef struct _JackData{ + ProgData *pdata; //pointer to prog data void *jack_lib_handle; //handle for jack library (loaded with dlopen). jack_client_t *client; unsigned int buffersize, //buffer size for every port in frames. @@ -269,7 +273,7 @@ typedef struct _HotKey{ //Hold info about the shortcuts //It's usage is mostly to be given as an argument to the //threads,so they will have access to the program data, avoiding //at the same time usage of any globals. -typedef struct _ProgData{ +struct _ProgData { /**recordMyDesktop specific structs*/ ProgArgs args; //the program arguments DisplaySpecs specs; //Display specific information @@ -345,7 +349,7 @@ typedef struct _ProgData{ int sound_handle; u_int32_t periodsize; #endif -}ProgData; +}; //This is the header of every frame. -- cgit v1.2.1