Subject: FvwmAudio compatability

From: Michael Han <[email-masked]>
Date: Sun, 02 May 1999 22:14:58 -0700

Here's a patch that does FvwmAudio compatability in FvwmEvent. It
seems to be working okay now... Hrmm, on second thought, maybe it'd be
easier to catch these options and do some magic using a function in
Fvwm's core? Anyway, the Changelog entry is right here:

1999-05-02  Michael Han  <[email-masked]>

        * FvwmEvent/FvwmEvent.c: changes to main(), config(), and
        execute_event() for FvwmAudio compatability, namely the
        PlayCmd and Dir commands.
-- 
[email-masked]                         http://www.best.com/~mikehan/
coffee achiever                              San Francisco, California
"It is better for people to think your [sic] a fool, than for you to open
your mouth and remove all doubts." - some fool

*** FvwmEvent.c.orig	Sun May  2 18:19:09 1999
--- FvwmEvent.c	Sun May  2 21:47:44 1999
***************
*** 1,5 ****
! /*#define DEBUG
!  *
   * Copyright (C) 1994 Mark Boyns ([email-masked]) and
   *                    Mark Scott ([email-masked])
   *		 1996-1998 Albrecht Kadlec ([email-masked])
--- 1,5 ----
! #define DEBUG
! /*
   * Copyright (C) 1994 Mark Boyns ([email-masked]) and
   *                    Mark Scott ([email-masked])
   *		 1996-1998 Albrecht Kadlec ([email-masked])
***************
*** 129,134 ****
--- 129,136 ----
          last_time = 0,
          now;
  Bool	PassID = False;	/* don't tag on the windowID by default */
+ Bool	audio_compat = False;
+ char	audio_dir[BUFSIZE]="";
  
  #ifdef HAVE_RPLAY
  int	rplay_fd = -1;
***************
*** 248,258 ****
--- 250,264 ----
  	s++;
      else				/* no slash */
  	s = argv[0];
+     if ( argc==7 )
+ 	s = argv[6];			/* use an alias */
  
      MyNameLen=strlen(s)+1;		/* account for '*' */
      MyName = safemalloc(MyNameLen+1);	/* account for \0 */
      *MyName='*';
      strcpy(MyName+1, s);		/* append name */
+     if (strcasecmp("FvwmAudio", s) == 0)
+     	audio_compat = True;		/* catch the FvwmAudio alias */
  
      if ((argc != 6)&&(argc != 7))	/* Now MyName is defined */
      {
***************
*** 357,368 ****
  int execute_event(short event, unsigned long *body)
  {
      static char buf[BUFSIZE];
  
  #ifdef HAVE_RPLAY
      if (rplay_fd != -1)		/* this is the sign that rplay is used */
      {
  	if (rplay_table[event])
! 	    if (rplay(rplay_fd, rplay_table[event]) >= 0)
  		last_time = now;
  	    else
  		rplay_perror("rplay");
--- 363,380 ----
  int execute_event(short event, unsigned long *body)
  {
      static char buf[BUFSIZE];
+ #ifdef HAVE_RPLAY
+     char *rplay_sound[BUFSIZE]="";
+ #endif
  
  #ifdef HAVE_RPLAY
      if (rplay_fd != -1)		/* this is the sign that rplay is used */
      {
  	if (rplay_table[event])
! 	{
! 	    strcpy(rplay_sound, audio_dir);
! 	    strcat(rplay_sound, rplay_table[event]);
! 	    if (rplay(rplay_fd, rplay_sound) >= 0)
  		last_time = now;
  	    else
  		rplay_perror("rplay");
***************
*** 372,380 ****
      if (action_table[event])
      {
          if(PassID && (action_arg[event] != -1))
!           sprintf(buf,"%s %s %d", cmd_line, action_table[event], body[action_arg[event]]);
          else
!           sprintf(buf,"%s %s", cmd_line, action_table[event]);
  INFO(buf);
  INFO("\n");
  	SendText(fd,buf,0);		/* let fvwm2 execute the function */
--- 384,393 ----
      if (action_table[event])
      {
          if(PassID && (action_arg[event] != -1))
!           sprintf(buf,"%s %s%s %d", cmd_line, audio_dir, action_table[event],
! 		  body[action_arg[event]]);
          else
!           sprintf(buf,"%s %s%s", cmd_line, audio_dir, action_table[event]);
  INFO(buf);
  INFO("\n");
  	SendText(fd,buf,0);		/* let fvwm2 execute the function */
***************
*** 395,401 ****
  {
      "Cmd",
      "Delay",
!     "PassID"
  #ifdef HAVE_RPLAY
  	,
      "RplayHost",
--- 408,416 ----
  {
      "Cmd",
      "Delay",
!     "Dir",
!     "PassID",
!     "PlayCmd"
  #ifdef HAVE_RPLAY
  	,
      "RplayHost",
***************
*** 453,461 ****
  INFO("<-\n");
                                                          break;
  		case 1: if (q) audio_delay = atoi(q);	break; /* Delay */
! 		case 2: PassID = True;			break;
  #ifdef HAVE_RPLAY
! 		case 3: if (q && (*q == '$'))		       /* RPlayHost */
  			{			 /* Check for $HOSTDISPLAY */
  			  char *c1= (char *)getenv(q+1), *c2= host;
  			  while (c1 && *c1 != ':')
--- 468,501 ----
  INFO("<-\n");
                                                          break;
  		case 1: if (q) audio_delay = atoi(q);	break; /* Delay */
! 		case 2:	if (! audio_compat)		       /* Dir */
! 			    fprintf(stderr,
! 			    "%s: Dir supported only when invoked as FvwmAudio\n",
! 			    MyName+1,MyName+1);
! 			else
! 			    if (q)
! 			    {
! 				strcpy(audio_dir, q);
! 				strcat(audio_dir, "/");
! 			    }
! 							break;
! 		case 3: PassID = True;			break; /* PassID */
! 		case 4:	if (! audio_compat)		       /* PlayCmd */
! 			    fprintf(stderr,
! 			    "%s: PlayCmd supported only when invoked as FvwmAudio\n",
! 			    MyName+1,MyName+1);
! 			else
! 			    if (q)
! 			    {
! 			    	strcpy(cmd_line, "exec ");
! 				strcat(cmd_line, q);
! 			    }
! INFO("cmd_line = ->");
! INFO(cmd_line);
! INFO("<-\n");
! 							break;
  #ifdef HAVE_RPLAY
! 		case 5: if (q && (*q == '$'))		       /* RPlayHost */
  			{			 /* Check for $HOSTDISPLAY */
  			  char *c1= (char *)getenv(q+1), *c2= host;
  			  while (c1 && *c1 != ':')
***************
*** 465,472 ****
  			else
  			  strcpy(host, q);
  		                                        break;
! 		case 4: if (q) priority = atoi(q);	break; /* RplayPriority */
! 		case 5: if (q) volume = atoi(q);	break; /* RplayVolume */
  #endif
  		}
  	    }
--- 505,512 ----
  			else
  			  strcpy(host, q);
  		                                        break;
! 		case 6: if (q) priority = atoi(q);	break; /* RplayPriority */
! 		case 7: if (q) volume = atoi(q);	break; /* RplayVolume */
  #endif
  		}
  	    }

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 3 May 1999 11:21:07 +0200

On Sun, May 02, 1999 at 10:14:58PM -0700, [email-masked] wrote:
> This message is MIME encoded
> 
> --A_MIME_separator
> Content-Type: text/plain; charset=us-ascii
> 

Can you create a patch for the FvwmEvent man page too?

Bye

Dominik ^_^

-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, [email-masked]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Albrecht Kadlec <[email-masked]>
Date: 06 May 1999 12:52:04 +0200

> > Fvwm's core? Anyway, the Changelog entry is right here:

When I looked at FvwmAudio & FvwmAuto, I saw the similarities & thought of
Emacs's hook functions.

I simplified & generalized these two modules into FvwmEvent.
(with some audio compatibility stuff.

My aims for the long run were:
	a) an Fvwm internal "play" command
	b) Fvwm internal event-handling.

This would be more generic, therefore more usefull and much smaller than
the module solution.

It wasn't possible then.
Maybe it's the time for this, now.

Sorry, I can't follow the whole list these days.
If there're questions, Cc:' me.
 
> Can you create a patch for the FvwmEvent man page too?

best regards,
BTW: maybe I'll get a newer fvwm2 at last (still using 2.0.47 :-) )
-- 
Albrecht Kadlec
Vienna University of Technology / Department of Automation
----------------------------------------------------------
It's getting late, for scribbling and scratching on the paper.
Something's gonna give under this pressure,
and the cracks are already beginning to show,
It's too late.				-- Marillion
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]