Move LASH poll timer into LASH.C.

This commit is contained in:
Jonathan Moore Liles 2008-05-15 19:53:46 -05:00
parent fabbd3e893
commit 558cec0965
5 changed files with 21 additions and 14 deletions

View File

@ -34,16 +34,29 @@
#include "Project.H" #include "Project.H"
#include "TLE.H" // all this just for quit() #include "TLE.H" // all this just for quit()
#include <FL/Fl.H>
extern TLE *tle; extern TLE *tle;
#include "debug.h" #include "debug.h"
const float lash_poll_interval = 0.2f;
void
LASH::timer_cb ( void *v )
{
((LASH*)v)->poll();
Fl::repeat_timeout( lash_poll_interval, &LASH::timer_cb, v );
}
LASH::LASH ( ) LASH::LASH ( )
{ {
Fl::add_timeout( lash_poll_interval, &LASH::timer_cb, this );
} }
LASH::~LASH ( ) LASH::~LASH ( )
{ {
Fl::remove_timeout( &LASH::timer_cb );
} }
bool bool

View File

@ -24,6 +24,8 @@
class LASH : public LASH_Client class LASH : public LASH_Client
{ {
static void timer_cb ( void *v );
public: public:
LASH ( ); LASH ( );

View File

@ -56,6 +56,9 @@ LASH_Client::init ( const char *jack_name, const char *long_name, int *argc, cha
void void
LASH_Client::poll ( void ) LASH_Client::poll ( void )
{ {
if ( ! _client )
return;
lash_event_t *e; lash_event_t *e;
while ( ( e = lash_get_event( _client ) ) ) while ( ( e = lash_get_event( _client ) ) )

View File

@ -35,7 +35,8 @@ decl {\#include <FL/Fl_File_Chooser.H>} {}
decl {\#include <FL/Fl.H>} {} decl {\#include <FL/Fl.H>} {}
decl {\#include <Fl/Fl_PNG_Image.H>} {} decl {\#include <Fl/Fl_Shared_Image.H>} {selected
}
decl {extern char project_display_name[256];} {global decl {extern char project_display_name[256];} {global
} }
@ -697,7 +698,7 @@ with fast, light, reliable alternatives.}
Fl_Box {} { Fl_Box {} {
label {the Non-DAW (Digital Audio Workstation)} label {the Non-DAW (Digital Audio Workstation)}
xywh {-1 1 499 115} align 16 xywh {-1 1 499 115} align 16
code0 {o->image( new Fl_PNG_Image( INSTALL_PREFIX "/share/pixmaps/non-daw/logo.png" ) );} code0 {o->image( Fl_Shared_Image::get( INSTALL_PREFIX "/share/pixmaps/non-daw/logo.png" ) );}
} }
} }
} }

View File

@ -85,16 +85,6 @@ ensure_dirs ( void )
return r == 0 || errno == EEXIST; return r == 0 || errno == EEXIST;
} }
const float lash_poll_interval = 0.2f;
static void
lash_cb ( void *arg )
{
lash->poll();
Fl::repeat_timeout( lash_poll_interval, lash_cb, 0 );
}
#include <FL/Fl_Shared_Image.H> #include <FL/Fl_Shared_Image.H>
int int
@ -139,8 +129,6 @@ main ( int argc, char **argv )
lash->init( APP_NAME, APP_TITLE, &argc, &argv ); lash->init( APP_NAME, APP_TITLE, &argc, &argv );
Fl::add_timeout( lash_poll_interval, lash_cb, 0 );
if ( argc > 1 ) if ( argc > 1 )
if ( ! Project::open( argv[ 1 ] ) ) if ( ! Project::open( argv[ 1 ] ) )
FATAL( "Could not open project specified on command line" ); FATAL( "Could not open project specified on command line" );