X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=src%2Fwmnotify.c;h=069ce37e53e5bb074f2284831bb3171733fcad3d;hb=53d45f29a7d94c747a1e833169f19073bcec0120;hp=74ccda1627c7b4909fa4f4f2e6b892bf4ed3acdc;hpb=f86c044343a6ebb0bef30e68a0daa82d91f9b68a;p=dockapps%2Fwmnotify.git diff --git a/src/wmnotify.c b/src/wmnotify.c index 74ccda1..069ce37 100644 --- a/src/wmnotify.c +++ b/src/wmnotify.c @@ -50,6 +50,8 @@ static bool manual_check = TRUE; /* Used to signal TimerThread to quit. Inactive for now. */ static bool quit = FALSE; +static int double_click_notif = FALSE; + /* TimerThread ID */ static pthread_t timer_thread; @@ -110,6 +112,16 @@ DisplayClosedMailbox( void ) } +static void +DisplayExecuteCommandNotification( void ) +{ + /* Visual notification that the double-click was catched. */ + copyXPMArea( EXEC_CMD_IMG_SRC_X, EXEC_CMD_IMG_SRC_Y, + MAILBOX_SIZE_X, MAILBOX_SIZE_Y, MAILBOX_DEST_X, MAILBOX_DEST_Y ); + RedrawWindow(); +} + + static void ExecuteCommand( char *argv[] ) { @@ -120,7 +132,7 @@ ExecuteCommand( char *argv[] ) if( argv[0] == NULL ) { return; } - + pid = fork(); /* fork a child process. */ if( pid < 0) { @@ -178,6 +190,8 @@ DoubleClick( void ) /* Starting external mail client. */ ExecuteCommand( wmnotify_infos.mail_client_argv ); + double_click_notif = TRUE; + /* Sending a signal to awake the TimerThread() thread. This was previously done with a mutex variable (animation_stop), but this caused a bug when the following sequence was encountered: @@ -196,6 +210,12 @@ DoubleClick( void ) ErrorLocation( __FILE__, __LINE__ ); exit( EXIT_FAILURE ); } + + DisplayExecuteCommandNotification(); + sleep(1); + DisplayClosedMailbox(); + + double_click_notif = FALSE; } else { fprintf( stderr, "%s: Warning: No email-client defined.\n", PACKAGE ); @@ -354,8 +374,10 @@ TimerThread( /*@unused@*/ void *arg ) } animation_running = FALSE; animation_stop = FALSE; - /* Before exiting, be sure to put NO MAIL image back in place... */ - DisplayClosedMailbox(); + if( double_click_notif == FALSE ) { + /* Before exiting, be sure to put NO MAIL image back in place... */ + DisplayClosedMailbox(); + } } /* If sleep() returns because the requested time has elapsed, the value returned will be