From 96ea114b88a58ee8998090199b5392173a3ac289 Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Sun, 21 Jul 2013 15:44:17 +0000 Subject: Remove Modules that are not linked to the build for license issues. --- app/fvwm/modules/FvwmAnimate/ChangeLog | 27 - app/fvwm/modules/FvwmAnimate/FvwmAnimate.1 | 131 --- app/fvwm/modules/FvwmAnimate/FvwmAnimate.c | 1277 ---------------------------- app/fvwm/modules/FvwmAnimate/FvwmAnimate.h | 35 - app/fvwm/modules/FvwmAudio/FvwmAudio.1 | 128 --- app/fvwm/modules/FvwmAudio/FvwmAudio.c | 529 ------------ app/fvwm/modules/FvwmAudio/README | 37 - app/fvwm/modules/FvwmAudio/README.say | 7 - app/fvwm/modules/FvwmEvent/ChangeLog | 26 - app/fvwm/modules/FvwmEvent/FvwmEvent.1 | 251 ------ app/fvwm/modules/FvwmEvent/FvwmEvent.c | 519 ----------- app/fvwm/modules/FvwmEvent/Imakefile | 6 - 12 files changed, 2973 deletions(-) delete mode 100644 app/fvwm/modules/FvwmAnimate/ChangeLog delete mode 100644 app/fvwm/modules/FvwmAnimate/FvwmAnimate.1 delete mode 100644 app/fvwm/modules/FvwmAnimate/FvwmAnimate.c delete mode 100644 app/fvwm/modules/FvwmAnimate/FvwmAnimate.h delete mode 100644 app/fvwm/modules/FvwmAudio/FvwmAudio.1 delete mode 100644 app/fvwm/modules/FvwmAudio/FvwmAudio.c delete mode 100644 app/fvwm/modules/FvwmAudio/README delete mode 100644 app/fvwm/modules/FvwmAudio/README.say delete mode 100644 app/fvwm/modules/FvwmEvent/ChangeLog delete mode 100644 app/fvwm/modules/FvwmEvent/FvwmEvent.1 delete mode 100644 app/fvwm/modules/FvwmEvent/FvwmEvent.c delete mode 100644 app/fvwm/modules/FvwmEvent/Imakefile (limited to 'app/fvwm/modules') diff --git a/app/fvwm/modules/FvwmAnimate/ChangeLog b/app/fvwm/modules/FvwmAnimate/ChangeLog deleted file mode 100644 index f26c07513..000000000 --- a/app/fvwm/modules/FvwmAnimate/ChangeLog +++ /dev/null @@ -1,27 +0,0 @@ -1999-01-25 Steven Michael ROBBINS - - * FvwmAnimate.c: Include config.h first. Remove include of - as not all systems have this. - -1998-11-11 Dan Espen - - * FvwmAnimate.c: Fix bug that stopped zoom3d from being picked. - In general, strcasecmp is now being used instead of strncasecmp. - -Tue Nov 10 22:17:50 1998 DanEspen - - * FvwmAnimate.c: Handle missing arg on first entry in cmd table. - -Sat Nov 7 09:43:59 1998 DanEspen - - * FvwmAnimate.c: Make color a fully documented and customizable feature. - -1998-11-06 Paul D. Smith - - * Makefile.am (FvwmAnimate_DEPENDENCIES): Add a dependency on - libfvwm.a. - -1998-11-04 Dan Espen - - * FvwmAnimate.c: Fixed bug where AnimateResizeLine was - drawing 5 segments when it only wanted 4. diff --git a/app/fvwm/modules/FvwmAnimate/FvwmAnimate.1 b/app/fvwm/modules/FvwmAnimate/FvwmAnimate.1 deleted file mode 100644 index 8143084d7..000000000 --- a/app/fvwm/modules/FvwmAnimate/FvwmAnimate.1 +++ /dev/null @@ -1,131 +0,0 @@ -.TH FvwmAnimate 1.1 "October 1998" -.UC -.SH NAME -\fBFvwmAnimate\fP \- the Fvwm2 Animate module -.SH SYNOPSIS -\fBFvwmAnimate\fP is spawned by fvwm2, so no command line invocation will work. -From within the .fvwm2rc file, \fBFvwmAnimate\fP is spawned as follows: -.nf -.sp -Module FvwmAnimate -.sp -.fi -or from within an fvwm2 pop-up menu: -.nf -.sp -DestroyMenu Module-Popup -AddToMenu Module-Popup "Modules" Title -AddToMenu Module-Popup "Fvwm Animate Icons" Module FvwmAnimate OptionalName -.sp -.fi - -.SH DESCRIPTION -The \fBFvwmAnimate\fP module animates iconification and deiconification. -There are currenly 6 different animation effects. - -.SH INVOCATION -No command line invocation is possible. -\fBFvwmAnimate\fP must be invoked by the -\fBfvwm2\fP window manager. -When invoked with the \fIOptionalName\fP argument, the \fIOptionalName\fP -is used to find configuration commands, configuraton files, -and name the internally generated menus and forms instead of "FvwmAnimate". -During startup, FvwmAnimate defines menus and forms for configuring and -controlling FvwmAnimate. The default menu name is "MenuFvwmAnimate" -and the form name is "FormFvwmAnimate". -If the optional name is used, the menu would be "Menu" -and the form would be "Form". -.sp -Assuming you already had a builtin menu called "Module-Popup", -you could use FvwmAnimate by configuring it like this: -.nf -.sp -AddToFunc "InitFunction" "I" Module FvwmAnimate -AddToFunc "RestartFunction" "I" Module FvwmAnimate -AddToMenu "Module-Popup" "Control Animation" Popup MenuFvwmAnimate -.sp -.fi - -.SH CONFIGURATION OPTIONS -Since the popup menu "MenuFvwmAnimate" allows complete control of -the \fBFvwmAnimate\fP module, you don't really have to know what any -of the configuration commands are. This section describes them anyway. - -\fBFvwmAnimate\fP reads the same \fI.fvwm2rc\fP file as \fBfvwm2\fP -reads when it starts up. -In addition, \fBFvwmAnimate\fP reads the file $HOME/.FvwmAnimate, -and accepts commands from fvwm2 and its modules as it runs. - -If \fIOptionalName\fP is used to start FvwmAnimate, the optional name -is used in all commands, messages, menus and forms generated by FvwmAnimate -and -in the configuration file name. Unlike other fvwm2 modules, there is -little reason to use the optional name. - -.IP "*FvwmAnimateColor \fBcolor\fP" -Tells \fBFvwmAnimate\fP what color to draw with. -The color is "XOR'ed" (exclusive ORed) onto the background. -Depending on the display type you are using, the effect this -causes will vary. Especially on 8-bit displays, it helps if the background -is a solid color. You have to experiment with this to see how it works. - -The default color is not really a color and can be entered as "Black^White", -or more simply "None". This is the same as the default XOR mask used -by fvwm2 for move and resize frames. - -Other colors can be specified using standard X color notation. Ie. color -names like "LightBlue", or RGB values like "#FFFFFF". - -.IP "*FvwmAnimateDelay \fBmsecs\fP" -Tells \fBFvwmAnimate\fP how many milliseconds to sleep -between frames of animation. - -.IP "*FvwmAnimateIterations \fBiterations\fP" -Tells \fBFvwmAnimate\fP how many steps to break the animation into. - -.IP "*FvwmAnimateTwist \fBtwist\fP" -Tells \fBFvwmAnimate\fP how many revolutions to twist the iconification frame. - -.IP "*FvwmAnimateWidth \fBwidth\fP" -Tells \fBFvwmAnimate\fP how wide a line to draw with. -The default width of 0 (zero) is a fast line of Width 1. - -.IP "*FvwmAnimateEffect \fBmode\fP" -Tells \fBFvwmAnimate\fP which animation effect to use. -Currently the effects are : -\fIFrame\fP, -\fILines\fP, -\fIFlip\fP, -\fITurn\fP, -\fIZoom3D\fP, -\fITwist\fP -\fIRandom\fP, -and -\fINone\fP. -\fINone\fP is normally set in the configuration file, in-case FvwmAnimate -is started automatically, but an individual user doesn't want it running. - -.IP "*FvwmAnimateStop" -Tells \fBFvwmAnimate\fP to stop. - -.IP "*FvwmAnimateSave" -Tells \fBFvwmAnimate\fP to save the current configuration in a file -named ".FvwmAnimate" in the users home directory. This same file is -read automatically by FvwmAnimate during startup. - -.SH ORIGIN -\fBFvwmAnimate\fP is based on the \fBAnimate\fP module from Afterstep 1.5pre6. -Porting to \fBfvwm2\fP and lots of other changes were done by -\fIDan Espen\fP . -Below are the original author and acknowledgments. - -.SH AUTHOR -\fIAlfredo Kengi Kojima\fP - -.SH ACKNOWLEDGMENTS -These people have contributed to \fBFvwmAnimate\fP: - -.IP "\fIKaj Groner\fP " -Twisty iconification, configuration file parsing, man page. - -.IP "\fIFrank Scheelen " diff --git a/app/fvwm/modules/FvwmAnimate/FvwmAnimate.c b/app/fvwm/modules/FvwmAnimate/FvwmAnimate.c deleted file mode 100644 index 4000b2e92..000000000 --- a/app/fvwm/modules/FvwmAnimate/FvwmAnimate.c +++ /dev/null @@ -1,1277 +0,0 @@ -/* - * FvwmAnimate! Animation module for Fvwm - * - * Copyright (c) 1997 Frank Scheelen - * Copyright (c) 1996 Alfredo Kengi Kojima (kojima@inf.ufrgs.br) - * Copyright (c) 1996 Kaj Groner - * Added .steprc parsing and twisty iconify. - * - * Copyright (c) 1998 Dan Espen - * Changed to run under fvwm2. Lots of changes made. - * This used to only animate iconify on M_CONFIGURE_WINDOW. - * This module no longer reads M_CONFIGURE_WINDOW. - * I added args to M_ICONIFY so iconification takes one message. - * The arg parsing is completely redone using library functions. - * I also added args to M_DEICONIFY to eliminate the need to read the - * window size. - * Added AnimateResizeLines animation effect. - * Changed option "resize" to "effect", (resize still works). - * Changed effect "zoom" to "frame", (zoom still works). - * Added myfprintf double parens debugging trick. - * Changed so that commands can be sent to this module while it is - * running. - * Changed so that this module creates its own built in menu. - * Added Stop, Save commands. - * Changed so this this module uses FvwmForm for complete control on all - * settings. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include /* for O_WRONLY */ -#include /* For timing things time() */ -#include /* For time() */ -#include "../../fvwm/module.h" -#include "../../libs/fvwmlib.h" -#include "FvwmAnimate.h" - -#define AS_PI 3.14159265358979323846 - -static Display *dpy; -static int scr; -static Window root; -static GC DrawGC; -static char *MyName; -static int MyNameLen; -static int Channel[2]; -static XColor xcol; -static unsigned long color; /* color for animation */ -static XGCValues gcv; -static int animate_none = 0; /* count bypassed animations */ -static char stop_recvd = 'n'; /* got stop command */ -static char prior_color = 'n'; /* in case color changes */ -static char running = 'n'; /* whether we are initiialized or not */ -static char custom_recvd = 'n'; /* got custom command */ - -/* here is the old double parens trick. */ -/* #define DEBUG */ -#ifdef DEBUG -#define myfprintf(X) \ - fprintf X;\ - fflush (stderr); -#else -#define myfprintf(X) -#endif - - -/* #define DEBUG_ANIMATION */ -#ifdef DEBUG_ANIMATION -#define myaprintf(X) \ - fprintf X;\ - fflush (stderr); -#else -#define myaprintf(X) -#endif - -/* Macros for creating and sending commands: - CMD1X - Myname+1 - CMD10 - Myname+1,MyName - CMD11 - Myname+1,MyName+1 */ -#define CMD1X(TEXT) \ - sprintf(cmd,TEXT,MyName+1);\ - SendText(Channel,cmd,0); -#define CMD10(TEXT) \ - sprintf(cmd,TEXT,MyName+1,MyName);\ - SendText(Channel,cmd,0); -#define CMD11(TEXT) \ - sprintf(cmd,TEXT,MyName+1,MyName+1);\ - SendText(Channel,cmd,0); - -static void Loop(); -static void ParseOptions(); -static void ParseConfigLine(char *); -static void CreateDrawGC(); -static void DefineMe(); -static void SaveConfig(); -static void StopCmd(); -static void AnimateResizeZoom(int, int, int, int, int, int, int, int); -static void AnimateResizeLines(int, int, int, int, int, int, int, int); -static void AnimateResizeFlip(int, int, int, int, int, int, int, int); -static void AnimateResizeTurn(int, int, int, int, int, int, int, int); -static void AnimateResizeRandom(int, int, int, int, int, int, int, int); -static void AnimateResizeZoom3D(int, int, int, int, int, int, int, int); -static void AnimateResizeNone(int, int, int, int, int, int, int, int); -static void AnimateResizeTwist(int, int, int, int, int, int, int, int); -static void DefineForm(); - -struct ASAnimate Animate = { NULL, ANIM_ITERATIONS, ANIM_DELAY, - ANIM_TWIST, ANIM_WIDTH, - AnimateResizeTwist, ANIM_TIME }; - -/* We now have so many effects, that I feel the need for a table. */ -typedef struct AnimateEffects { - char *name; - char *alias; - void (*function)(int, int, int, int, int, int, int, int); - char *button; /* used to set custom form */ -} ae; -/* Note None and Random must be the first 2 entries. */ -struct AnimateEffects effects[] = { - {"None",0,AnimateResizeNone}, - {"Random",0,AnimateResizeRandom}, - {"Flip",0,AnimateResizeFlip}, - {"Frame","Zoom",AnimateResizeZoom}, - {"Frame3D","Zoom3D",AnimateResizeZoom3D}, - {"Lines",0,AnimateResizeLines}, - {"Turn",0,AnimateResizeTurn}, - {"Twist",0,AnimateResizeTwist} -}; -#define NUM_EFFECTS sizeof(effects) / sizeof(struct AnimateEffects) - -/* - * This makes a twisty iconify/deiconify animation for a window, similar to - * MacOS. Parameters specify the position and the size of the initial - * window and the final window - */ -static void AnimateResizeTwist(int x, int y, int w, int h, - int fx, int fy, int fw, int fh) -{ - float cx, cy, cw, ch; - float xstep, ystep, wstep, hstep; - XPoint points[5]; - float angle, angle_finite, a, d; - - x += w/2; - y += h/2; - fx += fw/2; - fy += fh/2; - - xstep = (float)(fx-x)/Animate.iterations; - ystep = (float)(fy-y)/Animate.iterations; - wstep = (float)(fw-w)/Animate.iterations; - hstep = (float)(fh-h)/Animate.iterations; - - cx = (float)x; - cy = (float)y; - cw = (float)w; - ch = (float)h; - a = atan(ch/cw); - d = sqrt((cw/2)*(cw/2)+(ch/2)*(ch/2)); - - angle_finite = 2*AS_PI*Animate.twist; - for (angle=0;; angle+=(float)(2*AS_PI*Animate.twist/Animate.iterations)) { - if (angle > angle_finite) - angle = angle_finite; - points[0].x = cx+cos(angle-a)*d; - points[0].y = cy+sin(angle-a)*d; - points[1].x = cx+cos(angle+a)*d; - points[1].y = cy+sin(angle+a)*d; - points[2].x = cx+cos(angle-a+AS_PI)*d; - points[2].y = cy+sin(angle-a+AS_PI)*d; - points[3].x = cx+cos(angle+a+AS_PI)*d; - points[3].y = cy+sin(angle+a+AS_PI)*d; - points[4].x = cx+cos(angle-a)*d; - points[4].y = cy+sin(angle-a)*d; - XGrabServer(dpy); - XDrawLines(dpy, root, DrawGC, points, 5, CoordModeOrigin); - XFlush(dpy); - usleep(Animate.delay*1000); - XDrawLines(dpy, root, DrawGC, points, 5, CoordModeOrigin); - XUngrabServer(dpy); - cx+=xstep; - cy+=ystep; - cw+=wstep; - ch+=hstep; - a = atan(ch/cw); - d = sqrt((cw/2)*(cw/2)+(ch/2)*(ch/2)); - if (angle >= angle_finite) - break; - } - XFlush(dpy); -} - -/* - * Add even more 3D feel to AfterStep by doing a flipping iconify. - * Parameters specify the position and the size of the initial and the - * final window. - * - * Idea: how about texture mapped, user definable free 3D movement - * during a resize? That should get X on its knees all right! :) - */ -void AnimateResizeFlip(int x, int y, int w, int h, int fx, int fy, int fw, int fh) -{ - float cx, cy, cw, ch; - float xstep, ystep, wstep, hstep; - XPoint points[5]; - - float distortx; - float distortch; - float midy; - - float angle, angle_finite; - - xstep = (float) (fx - x) / Animate.iterations; - ystep = (float) (fy - y) / Animate.iterations; - wstep = (float) (fw - w) / Animate.iterations; - hstep = (float) (fh - h) / Animate.iterations; - - cx = (float) x; - cy = (float) y; - cw = (float) w; - ch = (float) h; - - angle_finite = 2 * AS_PI * Animate.twist; - for (angle = 0;; angle += (float) (2 * AS_PI * Animate.twist / Animate.iterations)) { - if (angle > angle_finite) - angle = angle_finite; - - distortx = (cw / 10) - ((cw / 5) * sin(angle)); - distortch = (ch / 2) * cos(angle); - midy = cy + (ch / 2); - - points[0].x = cx + distortx; - points[0].y = midy - distortch; - points[1].x = cx + cw - distortx; - points[1].y = points[0].y; - points[2].x = cx + cw + distortx; - points[2].y = midy + distortch; - points[3].x = cx - distortx; - points[3].y = points[2].y; - points[4].x = points[0].x; - points[4].y = points[0].y; - - XGrabServer(dpy); - XDrawLines(dpy, root, DrawGC, points, 5, CoordModeOrigin); - XFlush(dpy); - usleep(Animate.delay * 1000); - XDrawLines(dpy, root, DrawGC, points, 5, CoordModeOrigin); - XUngrabServer(dpy); - cx += xstep; - cy += ystep; - cw += wstep; - ch += hstep; - if (angle >= angle_finite) - break; - } - XFlush(dpy); -} - - -/* - * And another one, this time around the Y-axis. - */ -void AnimateResizeTurn(int x, int y, int w, int h, int fx, int fy, int fw, int fh) -{ - float cx, cy, cw, ch; - float xstep, ystep, wstep, hstep; - XPoint points[5]; - - float distorty; - float distortcw; - float midx; - - float angle, angle_finite; - - xstep = (float) (fx - x) / Animate.iterations; - ystep = (float) (fy - y) / Animate.iterations; - wstep = (float) (fw - w) / Animate.iterations; - hstep = (float) (fh - h) / Animate.iterations; - - cx = (float) x; - cy = (float) y; - cw = (float) w; - ch = (float) h; - - angle_finite = 2 * AS_PI * Animate.twist; - for (angle = 0;; angle += (float) (2 * AS_PI * Animate.twist / Animate.iterations)) { - if (angle > angle_finite) - angle = angle_finite; - - distorty = (ch / 10) - ((ch / 5) * sin(angle)); - distortcw = (cw / 2) * cos(angle); - midx = cx + (cw / 2); - - points[0].x = midx - distortcw; - points[0].y = cy + distorty; - points[1].x = midx + distortcw; - points[1].y = cy - distorty; - points[2].x = points[1].x; - points[2].y = cy + ch + distorty; - points[3].x = points[0].x; - points[3].y = cy + ch - distorty; - points[4].x = points[0].x; - points[4].y = points[0].y; - - XGrabServer(dpy); - XDrawLines(dpy, root, DrawGC, points, 5, CoordModeOrigin); - XFlush(dpy); - usleep(Animate.delay * 1000); - XDrawLines(dpy, root, DrawGC, points, 5, CoordModeOrigin); - XUngrabServer(dpy); - cx += xstep; - cy += ystep; - cw += wstep; - ch += hstep; - if (angle >= angle_finite) - break; - } - XFlush(dpy); -} - -/* - * This makes a zooming iconify/deiconify animation for a window, like most - * any other icon animation out there. Parameters specify the position and - * the size of the initial window and the final window - */ -static void AnimateResizeZoom(int x, int y, int w, int h, - int fx, int fy, int fw, int fh) -{ - float cx, cy, cw, ch; - float xstep, ystep, wstep, hstep; - int i; - - xstep = (float)(fx-x)/Animate.iterations; - ystep = (float)(fy-y)/Animate.iterations; - wstep = (float)(fw-w)/Animate.iterations; - hstep = (float)(fh-h)/Animate.iterations; - - cx = (float)x; - cy = (float)y; - cw = (float)w; - ch = (float)h; - for (i=0; i - */ -void AnimateResizeZoom3D(int x, int y, int w, int h, int fx, int fy, int fw, int fh) -{ - float cx, cy, cw, ch; - float xstep, ystep, wstep, hstep, srca, dsta; - int i; - - xstep = (float) (fx - x) / Animate.iterations; - ystep = (float) (fy - y) / Animate.iterations; - wstep = (float) (fw - w) / Animate.iterations; - hstep = (float) (fh - h) / Animate.iterations; - dsta = (float) (fw + fh); - srca = (float) (w + h); - - cx = (float) x; - - cy = (float) y; - cw = (float) w; - ch = (float) h; - - if (dsta <= srca) - /* We are going from a Window to an Icon */ - { - for (i = 0; i < Animate.iterations; i++) { - XGrabServer(dpy); - XDrawRectangle(dpy, root, DrawGC, (int) cx, (int) cy, (int) cw, - (int) ch); - XDrawRectangle(dpy, root, DrawGC, (int) fx, (int) fy, (int) fw, - (int) fh); - XDrawLine(dpy, root, DrawGC, (int) cx, (int) cy, fx, fy); - XDrawLine(dpy, root, DrawGC, ((int) cx + (int) cw), (int) cy, - (fx + fw), fy); - XDrawLine(dpy, root, DrawGC, ((int) cx + (int) cw), - ((int) cy + (int) ch), (fx + fw), (fy + fh)); - XDrawLine(dpy, root, DrawGC, (int) cx, ((int) cy + (int) ch), fx, - (fy + fh)); - XFlush(dpy); - usleep(Animate.delay); - XDrawRectangle(dpy, root, DrawGC, (int) cx, (int) cy, (int) cw, - (int) ch); - XDrawRectangle(dpy, root, DrawGC, (int) fx, (int) fy, (int) fw, - (int) fh); - XDrawLine(dpy, root, DrawGC, (int) cx, (int) cy, fx, fy); - XDrawLine(dpy, root, DrawGC, ((int) cx + (int) cw), (int) cy, - (fx + fw), fy); - XDrawLine(dpy, root, DrawGC, ((int) cx + (int) cw), - ((int) cy + (int) ch), (fx + fw), (fy + fh)); - XDrawLine(dpy, root, DrawGC, (int) cx, ((int) cy + (int) ch), fx, - (fy + fh)); - XUngrabServer(dpy); - cx += xstep; - cy += ystep; - cw += wstep; - ch += hstep; - } - } - if (dsta > srca) { -/* We are going from an Icon to a Window */ - for (i = 0; i < Animate.iterations; i++) { - XGrabServer(dpy); - XDrawRectangle(dpy, root, DrawGC, (int) cx, (int) cy, (int) cw, - (int) ch); - XDrawRectangle(dpy, root, DrawGC, x, y, w, h); - XDrawLine(dpy, root, DrawGC, (int) cx, (int) cy, x, y); - XDrawLine(dpy, root, DrawGC, ((int) cx + (int) cw), (int) cy, - (x + w), y); - XDrawLine(dpy, root, DrawGC, ((int) cx + (int) cw), ((int) cy + - (int) ch), (x + w), (y + h)); - XDrawLine(dpy, root, DrawGC, (int) cx, ((int) cy + (int) ch), x, - (y + h)); - XFlush(dpy); - usleep(Animate.delay); - XDrawRectangle(dpy, root, DrawGC, (int) cx, (int) cy, (int) cw, - (int) ch); - XDrawRectangle(dpy, root, DrawGC, x, y, w, h); - XDrawLine(dpy, root, DrawGC, (int) cx, (int) cy, x, y); - XDrawLine(dpy, root, DrawGC, ((int) cx + (int) cw), (int) cy, - (x + w), y); - XDrawLine(dpy, root, DrawGC, ((int) cx + (int) cw), - ((int) cy + (int) ch), (x + w), (y + h)); - XDrawLine(dpy, root, DrawGC, (int) cx, ((int) cy + (int) ch), x, - (y + h)); - XUngrabServer(dpy); - cx += xstep; - cy += ystep; - cw += wstep; - ch += hstep; - } - } - XFlush(dpy); -} - -/* - * This picks one of the animations and calls it. - */ -void AnimateResizeRandom(int x, int y, int w, int h, int fx, int fy, int fw, int fh) -{ - /* Note, first 2 effects "None" and "Random" should never be chosen */ - effects[(rand() + (x * y + w * h + fx)) % (NUM_EFFECTS - 2) + 2].function - (x, y, w, h, fx, fy, fw, fh); -} - -/* - * This animation creates 4 lines from each corner of the initial window, - * to each corner of the final window. - * - * Parameters specify the position and the size of the initial window and - * the final window. - * - * Starting with x/y w/h, need to draw sets of 4 line segs from initial - * to final window. - * - * The variable "ants" controls whether each iteration is drawn and then - * erased vs. draw all the segments and then come back and erase them. - * - * Currently I have this hardcoded as the later. The word "ants" is - * used, because if "ants" is set to 0 and the number of iterations is - * high, it looks a little like ants crawling across the screen. - */ -static void AnimateResizeLines(int x, int y, int w, int h, - int fx, int fy, int fw, int fh) { - int i, j; - int ants = 1, ant_ctr; - typedef struct { - XSegment seg[4]; /* draw 4 unconnected lines */ - XSegment incr[4]; /* x/y increments */ - } Endpoints; - Endpoints ends[2]; - - /* define the array occurances */ -#define UR seg[0] -#define UL seg[1] -#define LR seg[2] -#define LL seg[3] -#define BEG ends[0] -#define INC ends[1] - - if (ants == 1) { /* if draw then erase */ - XGrabServer(dpy); /* grab for whole animation */ - } - for (ant_ctr=0;ant_ctr<=ants;ant_ctr++) { - /* Put args into arrays: */ - BEG.UR.x1 = x; /* upper left */ - BEG.UR.y1 = y; - /* Temporarily put width and height in Lower Left slot. - Changed to Lower Left x/y later. */ - BEG.LL.x1 = w; - BEG.LL.y1 = h; - - /* Use final positions to calc increments. */ - INC.UR.x1 = fx; - INC.UR.y1 = fy; - INC.LL.x1 = fw; - INC.LL.y1 = fh; - - /* The lines look a little better if they start and end a little in - from the edges. Allowing tuning might be overkill. */ - for (i=0;i<2;i++) { /* for begin and endpoints */ - if (ends[i].LL.x1 > 40) { /* if width > 40 */ - ends[i].LL.x1 -=16; /* reduce width a little */ - ends[i].UR.x1 += 8; /* move in a little */ - } - if (ends[i].LL.y1 > 40) { /* if height > 40 */ - ends[i].LL.y1 -=16; /* reduce height a little */ - ends[i].UR.y1 += 8; /* move down a little */ - } - /* Upper Left, Use x from Upper Right + width */ - ends[i].UL.x1 = ends[i].UR.x1 + ends[i].LL.x1; - ends[i].UL.y1 = ends[i].UR.y1; /* copy y */ - /* Lower Right, Use y from Upper Right + height */ - ends[i].LR.x1 = ends[i].UR.x1; /* copy x */ - ends[i].LR.y1 = ends[i].UR.y1 + ends[i].LL.y1; - /* Now width and height have been used, change LL to endpoints. */ - ends[i].LL.x1 += ends[i].UR.x1; - ends[i].LL.y1 += ends[i].UR.y1; - } - /* Now put the increment in the end x/y slots */ - for (i=0;i<4;i++) { /* for each of 4 line segs */ - INC.seg[i].x2 = (INC.seg[i].x1 - BEG.seg[i].x1)/Animate.iterations; - INC.seg[i].y2 = (INC.seg[i].y1 - BEG.seg[i].y1)/Animate.iterations; - } - for (i=0; i4) { - step = h*4/Animate.iterations; - if (step==0) { - step = 2; - } - for (i=h; i>=2; i-=step) { - XDrawRectangle(dpy, root, DrawGC, x, y, w, i); - XFlush(dpy); - usleep(ANIM_DELAY2*600); - XDrawRectangle(dpy, root, DrawGC, x, y, w, i); - y+=step/2; - } - } - if (w<2) return; - step = w*4/Animate.iterations; - if (step==0) { - step = 2; - } - for (i=w; i>=0; i-=step) { - XDrawRectangle(dpy, root, DrawGC, x, y, i, 2); - XFlush(dpy); - usleep(ANIM_DELAY2*1000); - XDrawRectangle(dpy, root, DrawGC, x, y, i, 2); - x+=step/2; - } - usleep(100000); - XFlush(dpy); -} -#endif - -void DeadPipe(int foo) { - myfprintf((stderr,"Dead Pipe, errno %d\n",foo)); - exit(0); -} - -int main(int argc, char **argv) { - char *s; - char mask_mesg[20]; - char cmd[200]; /* really big area for a command */ - - /* Save our program name - for error events */ - if ((s=strrchr(argv[0], '/'))) /* strip path */ - s++; - else /* no slash */ - s = argv[0]; - if(argc==7) /* if override name */ - s = argv[6]; /* use arg as name */ - MyNameLen=strlen(s)+1; /* account for '*' */ - MyName = safemalloc(MyNameLen+1); /* account for \0 */ - *MyName='*'; - strcpy(MyName+1, s); /* append name */ - - myfprintf((stderr,"%s: Starting, argv[0] is %s, len %d\n",MyName+1, - argv[0],MyNameLen)); - - if ((argc != 6)&&(argc != 7)) { /* Now MyName is defined */ - fprintf(stderr,"%s Version "VERSION" should only be executed by fvwm!\n", - MyName+1); - exit(1); - } - signal (SIGPIPE, DeadPipe); /* Dead pipe == Fvwm died */ - - Channel[0] = atoi(argv[1]); - Channel[1] = atoi(argv[2]); - - dpy = XOpenDisplay(""); - if (dpy==NULL) { - fprintf(stderr,"%s: could not open display\n",MyName+1); - exit(1); - } - root = DefaultRootWindow(dpy); - scr = DefaultScreen(dpy); - - sprintf(cmd,"read .%s Quiet",MyName+1); /* read quiet modules config */ - SendText(Channel,cmd,0); - ParseOptions(); /* get cmds fvwm2 has parsed */ - - sprintf(mask_mesg,"SET_MASK %lu\n",(unsigned long) - (M_ICONIFY|M_DEICONIFY - |M_LOCKONSEND|M_SENDCONFIG|M_CONFIG_INFO)); - SendInfo(Channel, mask_mesg, 0); /* tell fvwm about our mask */ - CreateDrawGC(); /* create initial GC */ - SendText(Channel,"Nop",0); - DefineMe(); - running = 'y'; /* out of initialization phase */ - Loop(); /* start running */ - exit (0); /* Never gets here! */ -} - -/* - * Wait for some event like iconify, deiconify and stuff. - */ -static void Loop() { - unsigned long header[HEADER_SIZE], *body; - int c; /* size of message body */ - clock_t time_start; /* for time() */ - clock_t time_end; /* for time() */ - clock_t time_accum; - struct tms time_buffer; /* for time() */ - char cmd[200]; - - myfprintf((stderr,"Starting event loop\n")); - while (1) { - c=ReadFvwmPacket(Channel[1], header, &body); - myfprintf((stderr,"Header[2] is %d, read %d\n", (int)header[2],c)); - if (c>0) { /* if message has body */ - switch (header[1]) { /* check message type */ - case M_DEICONIFY: - if (header[2] < 15 /* If not all info needed, */ - || (int)body[5] == 0) { /* or a "noicon" icon */ - break; /* don't animate it */ - } - if (Animate.time != 0) { - time_start = times(&time_buffer); - } - Animate.resize((int)body[3], /* t->icon_x_loc */ - (int)body[4], /* t->icon_y_loc */ - (int)body[5], /* t->icon_p_width */ - (int)body[6], /* t->icon_p_height */ - (int)body[7], /* t->frame_x */ - (int)body[8], /* t->frame_y */ - (int)body[9], /* t->frame_width */ - (int)body[10]); /* t->frame_height */ - if (Animate.time != 0) { - time_end = times(&time_buffer); - time_accum = time_end - time_start; - } - myaprintf((stderr, - "DE_Iconify, args %d+%d+%dx%d %d+%d+%dx%d. took %dx%d\n", - (int)body[3], /* t->icon_x_loc */ - (int)body[4], /* t->icon_y_loc */ - (int)body[5], /* t->icon_p_width */ - (int)body[6], /* t->icon_p_height */ - (int)body[7], /* t->frame_x */ - (int)body[8], /* t->frame_y */ - (int)body[9], /* t->frame_width */ - (int)body[10], /* t->frame_height */ - (int)time_accum,1)); -#if 0 - /* So far, clk_tck seems to be non-portable...dje */ -/* (int)time_accum,(int)CLK_TCK)); */ -#endif - break; - case M_ICONIFY: - /* In Afterstep, this logic waited for M_CONFIGURE_WINDOW - before animating. To this time, I don't know why. - (One is sent right after the other.) - */ - if (header[2] < 15 /* if not enough info */ - || (int)body[3] == -10000 /* or a transient window */ - || (int)body[5] == 0) { /* or a "noicon" icon */ - break; /* don't animate it */ - } - if (Animate.time != 0) { - time_start = times(&time_buffer); - } - Animate.resize((int)body[7], /* t->frame_x */ - (int)body[8], /* t->frame_y */ - (int)body[9], /* t->frame_width */ - (int)body[10], /* t->frame_height */ - (int)body[3], /* t->icon_x_loc */ - (int)body[4], /* t->icon_y_loc */ - (int)body[5], /* t->icon_p_width */ - (int)body[6]); /* t->icon_p_height */ - if (Animate.time != 0) { - time_end = times(&time_buffer); - time_accum = time_end - time_start; - } - myaprintf((stderr, - "Iconify, args %d+%d+%dx%d %d+%d+%dx%d. Took %d\n", - (int)body[7], /* t->frame_x */ - (int)body[8], /* t->frame_y */ - (int)body[9], /* t->frame_width */ - (int)body[10], /* t->frame_height */ - (int)body[3], /* t->icon_x_loc */ - (int)body[4], /* t->icon_y_loc */ - (int)body[5], /* t->icon_p_width */ - (int)body[6], - (int)time_accum)); - break; - case M_CONFIG_INFO: - myfprintf((stderr,"Got command: %s\n", (char *)&body[3])); - ParseConfigLine((char *)&body[3]); - break; - } /* end switch header */ - free(body); /* get rid of message body */ - } /* end message had a body */ - myfprintf((stderr,"Sending unlock\n")); - SendInfo(Channel, "UNLOCK 1\n", 0); /* fvwm can continue now! */ - if ((Animate.resize == AnimateResizeNone /* If no animation desired */ - && animate_none >= 1) /* and 1 animation(s) */ - || (stop_recvd == 'y')) { /* or stop cmd */ - /* This still isn't perfect, if the user turns off animation, - they would expect the menu to change on the spot. - On the otherhand, the menu shouldn't change if the module is - still running. - This logic is dependent on fvwm sending iconify messages - to make this module exit. Currently it is sending messages - even when "Style NoIcon" is on for everything. - */ - StopCmd(); /* update menu */ - myfprintf((stderr,"Exiting, animate none count %d, stop recvd %c\n", - animate_none, (int)stop_recvd)); - exit (0); /* and stop */ - } /* end stopping */ - /* The execution of the custom command has to be delayed, - because we first had to send the UNLOCK response. - */ - if (custom_recvd == 'y') { - custom_recvd = 'n'; - DefineForm(); - CMD1X("Module FvwmForm Form%s"); - } - } /* end while forever */ -} - -/***************************************************************************** - * - * This routine is responsible for reading and parsing the config file - * Used FvwmEvent as a model. - * - ****************************************************************************/ -#include -static char *table[]= { - "Color", -#define Color_arg 0 - "Custom", -#define Custom_arg 1 - "Delay", -#define Delay_arg 2 - "Effect", -#define Effect_arg 3 - "Iterations", -#define Iterations_arg 4 - "Resize", -#define Resize_arg 5 - "Save", -#define Save_arg 6 - "Stop", -#define Stop_arg 7 - "Time", -#define Time_arg 8 - "Twist", -#define Twist_arg 9 - "Width" -#define Width_arg 10 -}; /* Keep list in alphabetic order, using binary search! */ -static void ParseOptions() { - char *buf; - - myfprintf((stderr,"Reading options\n")); - while (GetConfigLine(Channel,&buf), buf != NULL) { - ParseConfigLine(buf); - } /* end config lines */ -} /* end function */ - - -void ParseConfigLine(char *buf) { - char **e, *p, *q; - unsigned seed; - long curtime; - int i; - - if (buf[strlen(buf)-1] == '\n') { /* if line ends with newline */ - buf[strlen(buf)-1] = '\0'; /* strip off \n */ - } - /* Search for MyName (normally *FvwmAnimate) */ - if (strncasecmp(buf, MyName, MyNameLen) == 0) {/* If its for me */ - myfprintf((stderr,"Found line for me: %s\n", buf)); - p = buf+MyNameLen; /* starting point */ - q = NULL; - if ((e = FindToken(p,table,char *))) { /* config option ? */ - if ((strcasecmp(*e,"Stop") != 0) - && (strcasecmp(*e,"Custom") != 0) - && (strcasecmp(*e,"Save") != 0)) { /* no arg commands */ - p+=strlen(*e); /* skip matched token */ - q=GetArgument(&p); - if (!q) { /* If arg not found */ - fprintf(stderr,"%s: %s%s needs a parameter\n", - MyName+1, MyName+1,*e); - return; - } - } - - switch (e - (char**)table) { - case Stop_arg: /* Stop command */ - if (running == 'y') { /* if not a stored command */ - stop_recvd = 'y'; /* remember to stop */ - } - break; - case Save_arg: /* Save command */ - SaveConfig(); - break; - case Custom_arg: /* Custom command */ - if (running == 'y') { /* if not a stored command */ - custom_recvd = 'y'; /* remember someone asked */ - } - break; - case Color_arg: /* Color */ - if (Animate.color) { - free(Animate.color); /* release storage holding color name */ - Animate.color = 0; /* show its gone */ - } - if ((strcasecmp(q,"None") != 0) /* If not color "none" */ - && (strcasecmp(q,"Black^White") != 0) - && (strcasecmp(q,"White^Black") != 0)) { - Animate.color = (char *)strdup(q); /* make copy of name */ - } - CreateDrawGC(); /* update GC */ - break; - case Delay_arg: /* Delay */ - Animate.delay = atoi(q); - break; - case Iterations_arg: /* Iterations */ - Animate.iterations = atoi(q); - break; - case Effect_arg: /* Effect */ - case Resize_arg: /* -or - Resize */ - for (i=0; i < NUM_EFFECTS; i++) { - if (strcasecmp(q, effects[i].name)==0 - || (effects[i].alias - && strcasecmp(q, effects[i].alias)==0)) { - Animate.resize = effects[i].function; - break; - } /* end match */ - } /* end all effects */ - if (i > NUM_EFFECTS) { /* If not found */ - fprintf(stderr, "%s: Unknown Effect '%s'\n", MyName+1, q); - } - /* Logically, you would only reset these when you got a command - of None, or Random, but it doesn't really matter. */ - animate_none = 0; - curtime = time(NULL); - seed = (unsigned) curtime % INT_MAX; - srand(seed); - break; - case Time_arg: /* Time in milliseconds */ - Animate.time = (clock_t)atoi(q); - break; - case Twist_arg: /* Twist */ - Animate.twist = atof(q); - break; - case Width_arg: /* Width */ - Animate.width = atoi(q); - CreateDrawGC(); /* update GC */ - break; - default: - fprintf(stderr,"%s: unknown action %s\n",MyName+1,*e); - break; - } - } else { /* Match Myname, but a space */ - fprintf(stderr,"%s: unknown command: %s\n",MyName+1,buf); - } - if(q) { /* if parsed an arg */ - free(q); /* free its memory */ - } - } /* config line for me */ -} /* end function */ - -/* create GC for drawing the various animations */ -/* Called during start-up, and whenever the color or line width changes. */ -static void CreateDrawGC() { - - myfprintf((stderr,"Creating GC\n")); - if (DrawGC != NULL) { - XFreeGC(dpy,DrawGC); /* free old GC */ - } - if (prior_color == 'y') { /* if there was a previous color */ - /* - * Prior color if allocated is always freed. Don't worry about the - * fact that the color may not have changed. - */ - XFreeColors(dpy, DefaultColormap(dpy,scr), - &xcol.pixel, - 1, /* # of pixels */ - 0); /* # of planes */ - prior_color = 'n'; /* no more prior color */ - } - - color = (BlackPixel(dpy,scr) ^ WhitePixel(dpy,scr)); /* From builtins.c: */ - gcv.function = GXxor; /* default is to xor the lines */ - if (Animate.color) { /* if color called for */ - if (XParseColor(dpy,DefaultColormap(dpy,scr),Animate.color, &xcol)) { - if (XAllocColor(dpy, DefaultColormap(dpy,scr), &xcol)) { - prior_color = 'y'; /* remember to free it */ - color = xcol.pixel; - /* gcv.function = GXequiv; Afterstep used this. */ - } else { - fprintf(stderr,"%s: could not allocate color '%s'\n", - MyName+1,Animate.color); - } - } else { - fprintf(stderr,"%s: could not parse color '%s'\n", - MyName+1,Animate.color); - } - } - gcv.line_width = Animate.width; - gcv.foreground = color; - gcv.background = color; - myfprintf((stderr,"Color is %ld\n",gcv.foreground)); - gcv.subwindow_mode = IncludeInferiors; - DrawGC=XCreateGC(dpy, root, GCFunction|GCForeground|GCLineWidth|GCBackground - |GCSubwindowMode, &gcv); -} - -/* - * Send commands to fvwm to define this modules menus. - * - * When I first wrote this, I thought it might be a good idea to call the - * menu "FvwmAnimate", just like the module name. To my surprise, I - * found that fvwm2 treats menus just like functions. In fact I could no - * longer start FvwmAnimate because it kept finding the menu instead of - * the function. This probably should be fixed, but for now, the - * generated menu is called "MenuFvwmAnimate", or "Menu". - * dje, 10/11/98. - */ -static void DefineMe() { - char cmd[200]; /* really big area for a command */ - myfprintf((stderr,"defining menu\n")); - - CMD1X("DestroyMenu Menu%s"); - CMD1X("DestroyMenu MenuIterations%s"); - CMD1X("DestroyMenu MenuEffects%s"); - CMD1X("DestroyMenu MenuWidth%s"); - CMD1X("DestroyMenu MenuTwist%s"); - CMD1X("DestroyMenu MenuDelay%s"); - CMD1X("DestroyMenu MenuColor%s"); - - CMD1X("AddToMenu Menu%s \"Animation Main Menu\" Title"); - CMD11("AddToMenu Menu%s \"&E. Effects\" Popup MenuEffects%s"); - CMD11("AddToMenu Menu%s \"&I. Iterations\" Popup MenuIterations%s"); - CMD11("AddToMenu Menu%s \"&T. Twists\" Popup MenuTwist%s"); - CMD11("AddToMenu Menu%s \"&L. Line Width\" Popup MenuWidth%s"); - CMD11("AddToMenu Menu%s \"&D. Delays\" Popup MenuDelay%s"); - CMD11("AddToMenu Menu%s \"&X. Color for XOR\" Popup MenuColor%s"); - CMD10("AddToMenu Menu%s \"&C. Custom Settings\" %sCustom"); - CMD10("AddToMenu Menu%s \"&S. Save Config\" %sSave"); - CMD10("AddToMenu Menu%s \"&Z. Stop Animation\" %sStop"); - CMD11("AddToMenu Menu%s \"&R. Restart Animation\" FuncRestart%s"); - - /* Define function for stopping and restarting Animation. */ - CMD1X("DestroyFunc FuncRestart%s"); - CMD10("AddToFunc FuncRestart%s \"I\" %sStop"); - CMD11("AddToFunc FuncRestart%s \"I\" Module FvwmAnimate %s"); - - /* Define the sub menus. */ - CMD1X("AddToMenu MenuIterations%s \"Iterations\" Title"); - CMD10("AddToMenu MenuIterations%s \"&1. Iterations 1\" %sIterations 1"); - CMD10("AddToMenu MenuIterations%s \"&2. Iterations 2\" %sIterations 2"); - CMD10("AddToMenu MenuIterations%s \"&3. Iterations 4\" %sIterations 4"); - CMD10("AddToMenu MenuIterations%s \"&4. Iterations 8\" %sIterations 8"); - CMD10("AddToMenu MenuIterations%s \"&5. Iterations 16\" %sIterations 16"); - CMD10("AddToMenu MenuIterations%s \"&6. Iterations 32\" %sIterations 32"); - - CMD1X("AddToMenu MenuWidth%s \"Line Width\" Title"); - CMD10("AddToMenu MenuWidth%s \"&1. Line Width 0 (fast)\" %sWidth 0"); - CMD10("AddToMenu MenuWidth%s \"&2. Line Width 1\" %sWidth 1"); - CMD10("AddToMenu MenuWidth%s \"&3. Line Width 2\" %sWidth 2"); - CMD10("AddToMenu MenuWidth%s \"&4. Line Width 4\" %sWidth 4"); - CMD10("AddToMenu MenuWidth%s \"&5. Line Width 6\" %sWidth 6"); - CMD10("AddToMenu MenuWidth%s \"&6. Line Width 8\" %sWidth 8"); - - CMD1X("AddToMenu MenuTwist%s \"Twists (Twist, Turn, Flip only)\" Title"); - CMD10("AddToMenu MenuTwist%s \"&1. Twist .25\" %sTwist .25"); - CMD10("AddToMenu MenuTwist%s \"&2. Twist .50\" %sTwist .50"); - CMD10("AddToMenu MenuTwist%s \"&3. Twist 1\" %sTwist 1"); - CMD10("AddToMenu MenuTwist%s \"&4. Twist 2\" %sTwist 2"); - - CMD1X("AddToMenu MenuDelay%s \"Delays\" Title"); - CMD10("AddToMenu MenuDelay%s \"&1. Delay 1/1000 sec\" %sDelay 1"); - CMD10("AddToMenu MenuDelay%s \"&2. Delay 1/100 sec\" %sDelay 10"); - CMD10("AddToMenu MenuDelay%s \"&3. Delay 1/10 sec\" %sDelay 100"); - - /* Same as the colors at the front of the colorlimiting table */ - CMD1X("AddToMenu MenuColor%s \"Colors\" Title"); - CMD10("AddToMenu MenuColor%s \"&1. Color Black^White\" %sColor None"); - CMD10("AddToMenu MenuColor%s \"&2. Color White\" %sColor white"); - CMD10("AddToMenu MenuColor%s \"&3. Color Black\" %sColor black"); - CMD10("AddToMenu MenuColor%s \"&4. Color Grey\" %sColor grey"); - CMD10("AddToMenu MenuColor%s \"&5. Color Green\" %sColor green"); - CMD10("AddToMenu MenuColor%s \"&6. Color Blue\" %sColor blue"); - CMD10("AddToMenu MenuColor%s \"&7. Color Red\" %sColor red"); - CMD10("AddToMenu MenuColor%s \"&8. Color Cyan\" %sColor cyan"); - CMD10("AddToMenu MenuColor%s \"&9. Color Yellow\" %sColor yellow"); - CMD10("AddToMenu MenuColor%s \"&A. Color Magenta\" %sColor magenta"); - CMD10("AddToMenu MenuColor%s \"&B. Color DodgerBlue\" %sColor DodgerBlue"); - CMD10("AddToMenu MenuColor%s \"&C. Color SteelBlue\" %sColor SteelBlue"); - CMD10("AddToMenu MenuColor%s \"&D. Color Chartreuse\" %sColor chartreuse"); - CMD10("AddToMenu MenuColor%s \"&E. Color Wheat\" %sColor wheat"); - CMD10("AddToMenu MenuColor%s \"&F. Color Turquoise\" %sColor turquoise"); - - CMD1X("AddToMenu MenuEffects%s \"Effects\" Title"); - CMD10("AddToMenu MenuEffects%s \"&1. Effect Random\" %sEffect Random"); - CMD10("AddToMenu MenuEffects%s \"&2. Effect Flip\" %sEffect Flip"); - CMD10("AddToMenu MenuEffects%s \"&3. Effect Frame\" %sEffect Frame"); - CMD10("AddToMenu MenuEffects%s \"&4. Effect Frame3D\" %sEffect Frame3D"); - CMD10("AddToMenu MenuEffects%s \"&5. Effect Lines\" %sEffect Lines"); - CMD10("AddToMenu MenuEffects%s \"&6. Effect Turn\" %sEffect Turn"); - CMD10("AddToMenu MenuEffects%s \"&7. Effect Twist\" %sEffect Twist"); - CMD10("AddToMenu MenuEffects%s \"&N. Effect None\" %sEffect None"); - - /* Still to be done: - Use of FvwmForms for Help. (Need to fix line spacing in FvwmForms first). - */ -} - -/* Write the current config into a file. */ -static void SaveConfig() { - FILE *config_file; - int i; - char filename[100]; /* more than enough room */ - char msg[200]; /* even more room for msg */ - /* Need to use logic to create fully qualified file name same as in - read.c, right now, this logic only works well if fvwm is started - from the users home directory. - */ - sprintf(filename,".%s",MyName+1); - config_file = fopen(filename,"w"); - if (config_file == NULL) { - sprintf(msg, - "%s: Open config file <%s> for write failed. \ -Save not done! Error\n", - MyName+1, filename); - perror(msg); - return; - } - fprintf(config_file,"# This file created by %s\n\n",MyName+1); - for (i=0; i < NUM_EFFECTS; i++) { - if (effects[i].function == Animate.resize) { - fprintf(config_file,"*%sEffect %s\n",MyName+1,effects[i].name); - break; - } /* found match */ - } /* all possible effects */ - fprintf(config_file,"*%sIterations %d\n",MyName+1,Animate.iterations); - fprintf(config_file,"*%sWidth %d\n",MyName+1,Animate.width); - fprintf(config_file,"*%sTwist %f\n",MyName+1,Animate.twist); - fprintf(config_file,"*%sDelay %d\n",MyName+1,Animate.delay); - if (Animate.color) { - fprintf(config_file,"*%sColor %s\n",MyName+1,Animate.color); - } - /* Note, add "time" if that ever works. dje. 10/14/98 */ - fclose(config_file); -} - -/* Stop is different than KillModule in that it gives this module a chance to - alter the builtin menu before it exits. -*/ -static void StopCmd() { - char cmd[200]; - myfprintf((stderr,"%s: Defining startup menu in preparation for stop\n", - MyName+1)); - CMD1X("DestroyMenu Menu%s"); - CMD11("AddToMenu Menu%s \"%s\" Title"); - CMD11("AddToMenu Menu%s \"&0. Start FvwmAnimate\" Module %s"); -} -static void DefineForm() { - int i; - char cmd[200]; - myfprintf((stderr,"Defining form Form%s\n", MyName+1)); - CMD1X("DestroyModuleConfig Form%s*"); - CMD1X("*Form%sWarpPointer"); - CMD1X("*Form%sFont 9x15bold"); - CMD1X("*Form%sButtonFont 8x13bold"); - CMD1X("*Form%sInputFont 9x15bold"); - CMD1X("*Form%sFore white"); - CMD1X("*Form%sBack cornflowerblue"); - CMD1X("*Form%sItemFore green"); - CMD1X("*Form%sLine center"); - CMD11("*Form%sText \"Custom settings for %s\""); - CMD1X("*Form%sLine left"); - CMD1X("*Form%sText \"\""); - CMD1X("*Form%sLine left"); - CMD1X("*Form%sFore Black"); - CMD1X("*Form%sText \"Effect:\""); - CMD1X("*Form%sSelection meth single"); - for (i=0; i < NUM_EFFECTS; i++) { /* for all effects */ - effects[i].button="off"; /* init the button setting */ - if (Animate.resize == effects[i].function) { /* compare to curr setting */ - effects[i].button="on"; /* turn on one button */ - } /* end if curr setting */ - } /* end all buttons */ - /* Macro for a command with one var */ -#define CMD1V(TEXT,VAR) \ - sprintf(cmd,TEXT,MyName+1,VAR);\ - SendText(Channel,cmd,0); - - /* There is a cleaner way (using the array) for this...dje */ - CMD1V("*Form%sChoice RANDOM RANDOM %s \"Random\"",effects[1].button); - CMD1V("*Form%sChoice FLIP FLIP %s \"Flip\"",effects[2].button); - CMD1V("*Form%sChoice FRAME FRAME %s \"Frame\"",effects[3].button); - CMD1V("*Form%sChoice FRAME3D FRAME3D %s \"Frame3d\"",effects[4].button); - CMD1V("*Form%sChoice LINES LINES %s \"Lines\"",effects[5].button); - CMD1V("*Form%sChoice TURN TURN %s \"Turn\"",effects[6].button); - CMD1V("*Form%sChoice TWIST TWIST %s \"Twist\"",effects[7].button); - CMD1X("*Form%sLine left"); - CMD1X("*Form%sText \"\""); - CMD1X("*Form%sLine left"); - CMD1X("*Form%sText \"Iterations:\""); - CMD1V("*Form%sInput Iterations 5 \"%d\"",Animate.iterations); - CMD1X("*Form%sText \"Twists:\""); - CMD1V("*Form%sInput Twists 10 \"%f\"",Animate.twist); - CMD1X("*Form%sText \"Linewidth:\""); - CMD1V("*Form%sInput Linewidth 3 \"%d\"",Animate.width); - CMD1X("*Form%sText \"Delays:\""); - CMD1V("*Form%sInput Delays 5 \"%d\"",Animate.delay); - CMD1X("*Form%sLine left"); - CMD1X("*Form%sText \"\""); - CMD1X("*Form%sLine left"); - CMD1X("*Form%sText \"Color:\""); - CMD1V("*Form%sInput Color 20 \"%s\"", - Animate.color ? Animate.color : "Black^White"); - CMD1X("*Form%sLine left"); - CMD1X("*Form%sText \"\""); - /* - F1 - Apply, F2 - Apply and Save, F3 - Reset, F4 - Dismiss - */ - - CMD1X("*Form%sLine expand"); - CMD1X("*Form%sButton continue \"F1 - Apply\" F1"); - CMD11("*Form%sCommand *%sIterations $(Iterations)"); - CMD11("*Form%sCommand *%sTwist $(Twists)"); - CMD11("*Form%sCommand *%sWidth $(Linewidth)"); - CMD11("*Form%sCommand *%sDelay $(Delays)"); - CMD11("*Form%sCommand *%sColor $(Color)"); - CMD11("*Form%sCommand *%sEffect $(RANDOM?Random)\ -$(FLIP?Flip)\ -$(FRAME?Frame)\ -$(FRAME3D?Frame3d)\ -$(LINES?Lines)\ -$(TURN?Turn)\ -$(TWIST?Twist)"); - - CMD1X("*Form%sButton continue \"F2 - Apply & Save\" F2"); - CMD11("*Form%sCommand *%sIterations $(Iterations)"); - CMD11("*Form%sCommand *%sTwist $(Twists)"); - CMD11("*Form%sCommand *%sWidth $(Linewidth)"); - CMD11("*Form%sCommand *%sColor $(Color)"); - CMD11("*Form%sCommand *%sEffect $(RANDOM?Random)\ -$(FLIP?Flip)\ -$(FRAME?Frame)\ -$(FRAME3D?Frame3d)\ -$(LINES?Lines)\ -$(TURN?Turn)\ -$(TWIST?Twist)"); - CMD11("*Form%sCommand *%sSave"); - - CMD1X("*Form%sButton restart \"F3 - Reset\" F3"); - - CMD1X("*Form%sButton quit \"F4 - Dismiss\" F4"); - CMD1X("*Form%sCommand Nop"); -} diff --git a/app/fvwm/modules/FvwmAnimate/FvwmAnimate.h b/app/fvwm/modules/FvwmAnimate/FvwmAnimate.h deleted file mode 100644 index 938e17183..000000000 --- a/app/fvwm/modules/FvwmAnimate/FvwmAnimate.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef _ANIMATE_H_ -#define _ANIMATE_H_ - -/* Animation granularity. How many iterations use for the animation. */ -#define ANIM_ITERATIONS 12 - -/* delay for each iteration of the animation in ms */ -#define ANIM_DELAY 1 - -/* delay for each iteration of the close animation in ms */ -#define ANIM_DELAY2 20 - -/* distance to spin frame around, 1.0 is one revolution. - with large values you should up ANIM_ITERATIONS as well */ -#define ANIM_TWIST 0.5 - -/* default line width */ -#define ANIM_WIDTH 0 - -/* default time */ -#define ANIM_TIME 0 - -struct ASAnimate { - char *color; - int iterations; - int delay; - float twist; - int width; - void (*resize)(int, int, int, int, int, int, int, int); - clock_t time; -}; - -extern struct ASAnimate Animate; - -#endif /* _ANIMATE_H_ */ diff --git a/app/fvwm/modules/FvwmAudio/FvwmAudio.1 b/app/fvwm/modules/FvwmAudio/FvwmAudio.1 deleted file mode 100644 index d42e0d0c7..000000000 --- a/app/fvwm/modules/FvwmAudio/FvwmAudio.1 +++ /dev/null @@ -1,128 +0,0 @@ -.\" t -.\" @(#)FvwmAudio.1 3/28/94 -.TH FvwmAudio 1.0 "Mar 28 1994" -.UC -.SH NAME -\fBFvwmAudio\fP \- the FVWM Audio module -.SH NOTICE -\fBFvwmAudio\fP has been superceded by \fBFvwnEvent\fP and is no longer -supported. Please start using \fBFvwmEvent\fP as soon as possible. -.sp -.SH SYNOPSIS -\fBFvwmAudio\fP is spawned by \fBfvwm\fP, so no command line invocation will -work. From within the \fI.fvwmrc\fP file, \fBFvwmAudio\fP is spawned as -follows: -.nf -.sp -Module FvwmAudio -.sp -.fi -or from within an fvwm pop-up menu: -.nf -.sp -AddToMenu Module-Popup "Modules" Title -+ "Audio" Module FvwmAudio -+ "Auto" Module FvwmAuto 200 -+ "Buttons" Module FvwmButtons -+ "Ident" Module FvwmIdent -+ "Banner" Module FvwmBanner -+ "Pager" Module FvwmPager 0 3 -.sp -.fi -.SH DESCRIPTION -The \fBFvwmAudio\fP module communicates with the Fvwm window manager -to bind audio sounds to window manager actions. Different audio -queues may be assigned to any window manager action. \fBFvwmAudio\fP -can be used with any independent audio player, and therefore requires -no special audio library APIs of its own. Simple in its design, it -merely binds the audio filenames to particular actions and forks off -the audio player program with the appropriate filename when that -action occurs. - -\fBFvwmAudio\fP can also have builtin support for the rplay library. - -.SH CONFIGURATION OPTIONS -\fBFvwmAudio\fP reads the same \fI.fvwm2rc\fP file as \fBfvwm(1)\fP -reads when it starts up, and looks for certain configuration options: - -.IP "*FvwmAudioPlayCmd \fI/usr/bin/X11/demos/auplay\fP" -This determines the independent audio player program that will -actually play the sounds. If the play command is set to -\fIbuiltin-rplay\fP then the builtin rplay support will be used. For -example: -.sp -*FvwmAudioPlayCmd \fIbuiltin-rplay\fP - -.IP "*FvwmAudioDir \fI/usr/lib/sounds\fP" -Specifies the directory to look for the audio files. This option is -ignored when rplay is used. - -.IP "*FvwmAudioDelay \fI5\fP" -Specifies that sound events will only be played if they occur at least -5 seconds after the previous event. Sounds events that occur during -the delay period are ignored. This option is useful if you don't want -several sounds playing at the same time. The default delay is 0 which -disables the audio delay. - -.IP "*FvwmAudioRplayHost \fIhostname\fP" -Specifies what host the sounds will play on. The \fIhostname\fP can -also be an environment variable such as $HOSTDISPLAY. This option is -only valid with builtin rplay support. - -.IP "*FvwmAudioRplayPriority \fI0\fP" -Specifies what priority will be assigned to the sounds when they are -played. This option is only valid with builtin rplay support. - -.IP "*FvwmAudioRplayVolume \fI127\fP" -Specifies what volume will be assigned to the sounds when they are -played. This option is only valid with builtin rplay support. - -.IP "*FvwmAudio \fIwindow-manager_action audio_filename\fP" -Binds particular window manager actions to sound queues. -.nf -.sp -*FvwmAudio startup TaDa.au -*FvwmAudio shutdown Elvis_Left.au -*FvwmAudio unknown doh.au -*FvwmAudio add_window drip.au -*FvwmAudio raise_window swoosh.au -*FvwmAudio lower_window swoosh.au -*FvwmAudio focus_change boing.au -*FvwmAudio destroy_window explosion.au -*FvwmAudio iconify ploop.au -*FvwmAudio deiconify ploop.au -*FvwmAudio toggle_paging fwop.au -*FvwmAudio new_page beam_trek.au -*FvwmAudio new_desk beam_trek.au -*FvwmAudio configure_window huh.au -*FvwmAudio window_name beep.au -*FvwmAudio icon_name beep.au -*FvwmAudio res_class beep.au -*FvwmAudio res_name beep.au -*FvwmAudio end_windowlist twang.au -.sp -.fi -.SH INVOCATION -The invocation method was shown in the synopsis section. No command -line invocation is possible. \fBFvwmAudio\fP must be invoked by the -\fBfvwm\fP window manager. -.sp -.SH BUGS -It's REALLY noisy when fvwm starts and restarts. -.sp -.SH COPYRIGHTS -This module is heavily based on a similar Fvwm module called -\fBFvwmSound\fP by Mark Boyns. \fBFvwmAudio\fP simply takes Mark's -original program and extends it to make it generic enough to work with -any audio player. The concept for interfacing this module to the -Window Manager, is original work by Robert Nation. - -Copyright 1994, Mark Boyns and Mark Scott. No guarantees or -warranties or anything are provided or implied in any way whatsoever. -Use this program at your own risk. Permission to use this program for -any purpose is given, as long as the copyright is kept intact. -.sp -.SH AUTHORS -Mark Boyns (\fIboyns@sdsu.edu\fP) -.sp -Mark Scott (\fImscott@mcd.mot.com\fP) diff --git a/app/fvwm/modules/FvwmAudio/FvwmAudio.c b/app/fvwm/modules/FvwmAudio/FvwmAudio.c deleted file mode 100644 index 811004fea..000000000 --- a/app/fvwm/modules/FvwmAudio/FvwmAudio.c +++ /dev/null @@ -1,529 +0,0 @@ -/* - * Copyright (C) 1994 Mark Boyns (boyns@sdsu.edu) and - * Mark Scott (mscott@mcd.mot.com) - * - * FvwmAudio version 1.1 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* ChangeLog - - - * merged bug fix from Christophe MARTIN - - FvwmAudio doesn't read messages it is not interrested in, - thus desynchronize, - - keep time stamp even if no sound is played - - minimize malloc/free - - mark boyns ok-ed this patch, I reviewed it and put out those ugly - #defines for RESYNC and READ_BODY by reordering the control structures - - * made FvwmAudio insensitive to its name -> can be symlinked. - corrected some error message deficiencies, code for quoted 'sound' - parameters shamelessly stolen from FvwmButtons/parse.c (with minimal - adjustments) - FvwmAudio now supports rsynth's say command: - *FvwmAudioPlayCmd say - *FvwmAudio add_window "add window" - *FvwmAudio raise_window 'raise window' - -- 08/07/96 Albrecht Kadlec (albrecht@auto.tuwien.ac.at) - - * Fixed FvwmAudio to reflect the changes made to the module protocol. - - * Szijarto Szabolcs provided FvwmSound code that used - $HOSTDISPLAY for the rplay host. The code has been added to FvwmAudio. - - * Fixed bugs reported by beta testers, thanks! - - * Builtin rplay support has been added to FvwmAudio. This support is - enabled when FvwmAudio is compiled with HAVE_RPLAY defined and when - FvwmAudioPlayCmd is set to builtin-rplay. I guess it's safe to say - that FvwmSound is now obsolete. -- Mark Boyns 5/7/94 - - * FvwmAudio is based heavily on an Fvwm module "FvwmSound" by Mark Boyns - and the real credit for this really goes to him for the concept. - I just stripped out the "rplay" library dependencies to allow generic - audio play command support. - - */ - -/* - * This module is based on FvwmModuleDebugger which has the following - * copyright: - * - * This module, and the entire ModuleDebugger program, and the concept for - * interfacing this module to the Window Manager, are all original work - * by Robert Nation - * - * Copyright 1994, Robert Nation. No guarantees or warantees or anything - * are provided or implied in any way whatsoever. Use this program at your - * own risk. Permission to use this program for any purpose is given, - * as long as the copyright is kept intact. - */ - -#include "config.h" -#include "../../fvwm/module.h" -#include "fvwmlib.h" - -/* - * fvwm includes: - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_RPLAY -#include -#undef M_ERROR /* Solaris fix */ -#endif - -#define BUILTIN_STARTUP MAX_MESSAGES -#define BUILTIN_SHUTDOWN MAX_MESSAGES+1 -#define BUILTIN_UNKNOWN MAX_MESSAGES+2 -#define MAX_BUILTIN 3 - -#define BUFSIZE 512 - -/* globals */ -char *MyName; -int MyNameLen; -int fd_width; -int fd[2]; -char audio_play_cmd_line[BUFSIZE], audio_play_dir[BUFSIZE]; -time_t audio_delay = 0, /* seconds */ - last_time = 0, - now; - -#ifdef HAVE_RPLAY -int rplay_fd = -1; -#endif - -/* prototypes */ -void Loop(int *); -void process_message(unsigned long,unsigned long *); -void DeadPipe(int); -void config(void); -void done(int); -int audio_play(short); - -/* define the message table */ -char *messages[MAX_MESSAGES+MAX_BUILTIN] = -{ - "new_page", - "new_desk", - "add_window", - "raise_window", - "lower_window", - "configure_window", - "focus_change", - "destroy_window", - "iconify", - "deiconify", - "window_name", - "icon_name", - "res_class", - "res_name", - "end_windowlist", - "icon_location", - "map", - "error", - "config_info", - "end_config_info", - "icon_file", - "default_icon", - "string", - "mini_icon", - "windowshade", - "dewindowshade", -/* add builtins here */ - "startup", - "shutdown", - "unknown" -}; - -/* define the sound table */ -char *sound_table[MAX_MESSAGES+MAX_BUILTIN]; - -#ifdef HAVE_RPLAY -/* define the rplay table */ -RPLAY *rplay_table[MAX_MESSAGES+MAX_BUILTIN]; -#endif - -int main(int argc, char **argv) -{ - char *temp, *s; - - /* Save our program name - for error messages */ - temp = argv[0]; - s=strrchr(argv[0], '/'); - if (s != NULL) - temp = s + 1; - - MyNameLen=strlen(temp)+1; /* acoount for '*' */ - MyName = safemalloc(MyNameLen+1); /* account for \0 */ - strcpy(MyName,"*"); - strcat(MyName, temp); - - if ((argc != 6)&&(argc != 7)) /* Now Myname is defined */ - { - fprintf(stderr,"%s Version %s should only be executed by fvwm!\n", - MyName+1, VERSION); - exit(1); - } - - /* Dead pipe == Fvwm died */ - signal (SIGPIPE, DeadPipe); - - fd[0] = atoi(argv[1]); - fd[1] = atoi(argv[2]); - - audio_play_dir[0] = '\0'; - audio_play_cmd_line[0] = '\0'; - - /* - * Read the sound configuration. - */ - config(); - - /* - * Play the startup sound. - */ - audio_play(BUILTIN_STARTUP); - SendText(fd,"Nop",0); - Loop(fd); - return 0; -} - -/*********************************************************************** - * - * Procedure: - * config - read the sound configuration file. - * - ***********************************************************************/ -void config(void) -{ - char *buf; - char *message; - char *sound; - char *p; - int i, found; -#ifdef HAVE_RPLAY - int volume = RPLAY_DEFAULT_VOLUME; - int priority = RPLAY_DEFAULT_PRIORITY; - char host[128]; - - strcpy(host, rplay_default_host()); -#endif - - /* - * Intialize all the sounds. - */ - for (i = 0; i < MAX_MESSAGES+MAX_BUILTIN; i++) { - sound_table[i] = NULL; -#ifdef HAVE_RPLAY - rplay_table[i] = NULL; -#endif - } - - - GetConfigLine(fd,&buf); - while (buf != NULL) - { - if (buf[0] == '*') /* this check is obsolete */ - /* - included in the next if */ - { - buf[strlen(buf)-1] = '\0'; /* strip off \n */ - /* - * Search for MyName (normally *FvwmAudio) - */ - if (strncasecmp(buf, MyName, MyNameLen) == 0) - { - p = strtok(buf+MyNameLen, " \t"); - - if (strcasecmp(p, "PlayCmd") == 0) { - p = strtok(NULL, "\n"); /* allow parameters */ - if (p && *p) { - strcpy(audio_play_cmd_line, p); - } - } - else if (strcasecmp(p, "Dir") == 0) { - p = strtok(NULL, " \t"); - if (p && *p) { - strcpy(audio_play_dir, p); - } - } - else if (strcasecmp(p, "Delay") == 0) { - p = strtok(NULL, " \t"); - if (p && *p) { - audio_delay = atoi(p); - } - } - -#ifdef HAVE_RPLAY - /* - * Check for rplay configuration options. - */ - else if (strcasecmp(p, "RplayHost") == 0) - { - p = strtok(NULL, " \t"); - if (p && *p) - { - /* - * Check for environment variables like $HOSTDISPLAY. - */ - if (*p == '$') - { - char *c1, *c2; - c2 = host; - for (c1 = (char *)getenv(p+1); *c1 && (*c1 != ':'); c1++) - { - *c2++ = *c1; - } - *c2 = '\0'; - } - else - { - strcpy(host, p); - } - } - } - else if (strcasecmp(p, "RplayVolume") == 0) - { - p = strtok(NULL, " \t"); - if (p && *p) { - volume = atoi(p); - } - } - else if (strcasecmp(p, "RplayPriority") == 0) - { - p = strtok(NULL, " \t"); - if (p && *p) { - priority = atoi(p); - } - } -#endif - /* - * *FvwmAudio - * for builtin rplay - * - * or - * - * *FvwmAudio <"any quoted parameters"> - * can be (mis)used to call FvwmAudioPlayCmd - * with arbitrary parameters e.g: rsynth/say "window raised" - * - * can even be used to call arbitrary commands, - * if the following wrapper is used as FvwmAudioPlayCmd - * - * #!/bin/tcsh - * ${argv[1-]} - */ - else { - message = p; - p=strtok(NULL, ""); /* get rest of line */ - sound = PeekToken(p); /* extract next parameter */ - - if (!message || !*message || !sound || !*sound) - { - fprintf(stderr,"%s: incomplete event definition %s\n", - MyName+1, buf); - GetConfigLine(fd,&buf); - continue; - } - - found = 0; - - for (i = 0; !found && i < MAX_MESSAGES+MAX_BUILTIN; i++) - { - if (strcasecmp(message, messages[i]) == 0) { -#ifdef HAVE_RPLAY - rplay_table[i] = rplay_create(RPLAY_PLAY); - rplay_set(rplay_table[i], RPLAY_APPEND, - RPLAY_SOUND, sound, - RPLAY_PRIORITY, priority, - RPLAY_VOLUME, volume, - NULL); -#endif - sound_table[i]=sound; - found++; - } - } - if (!found) fprintf(stderr,"%s: unknown message type: %s\n", - MyName+1, message); - } - } - } - GetConfigLine(fd,&buf); - } - -#ifdef HAVE_RPLAY - /* - * Builtin rplay support is enabled when FvwmAudioPlayCmd == builtin-rplay. - */ - if (strcasecmp(audio_play_cmd_line, "builtin-rplay") == 0) - { - rplay_fd = rplay_open(host); - if (rplay_fd < 0) - { - rplay_perror("rplay_open"); - done(1); - } - } -#endif -} - -/*********************************************************************** - * - * Procedure: - * Loop - wait for data to process - * - ***********************************************************************/ -void Loop(int *fd) -{ - unsigned long header[HEADER_SIZE], body[ MAX_BODY_SIZE ]; - int body_length,count,count2=0, total; - long code; - - while (1) - { - if ((count = read(fd[1],header, - HEADER_SIZE*sizeof(unsigned long))) <= 0) - done(0); - - /* Ignore messages that occur during the delay period. */ - now = time(0); - - body_length = header[2]-HEADER_SIZE; - - if( header[ 0 ] != START_FLAG ) - continue; /* should find something better for resyncing */ - - - /* read the message so we are still synchronized */ - - total = 0; - while(total < body_length*sizeof(unsigned long)) - { - if((count2=read(fd[1],&body[total], - body_length*sizeof(unsigned long)-total)) >0) - total += count2; - else - if(count2 < 0) - done(0); - } - - if (now < (last_time + audio_delay)) - continue; /* quash message */ - - /* - * code will equal the number of shifts in the - * base-2 header[1] number. Could use log here - * but this should be fast enough. - */ - code = -1; - while (header[1]) - { - code++; - header[1] >>= 1; - } - - /* - * Play the sound. - */ - if (code >= 0 && code < MAX_MESSAGES) - audio_play(code); - else - audio_play(BUILTIN_UNKNOWN); - } -} - -/*********************************************************************** - * - * Procedure: - * SIGPIPE handler - SIGPIPE means fvwm is dying - * - ***********************************************************************/ -void DeadPipe(int nonsense) -{ - done(1); -} - -/*********************************************************************** - * - * Procedure: - * done - common exit point for FvwmAudio. - * - ***********************************************************************/ -void done(int n) -{ - if (n == 0) - audio_play(BUILTIN_SHUTDOWN); /* only play if no error... */ - exit(n); -} - -/*********************************************************************** - * - * Procedure: - * - * audio_play - actually plays sound from lookup table - * - **********************************************************************/ -int audio_play(short sound) -{ - static char buf[BUFSIZE]; - int ret; - -#ifdef HAVE_RPLAY - if (rplay_fd != -1) - { - if (rplay_table[sound]) - { - if (rplay(rplay_fd, rplay_table[sound]) >= 0) - last_time = now; - else - rplay_perror("rplay"); - } - return 0; - } -#endif - if (sound_table[sound]) - { - memset(buf,0,BUFSIZE); - - /* - * Don't use audio_play_dir if it's NULL or if the sound file - * is an absolute pathname. - */ - if (audio_play_dir[0] == '\0' || sound_table[sound][0] == '/') - sprintf(buf,"%s %s", audio_play_cmd_line, sound_table[sound]); - else - sprintf(buf,"%s %s/%s &", audio_play_cmd_line, audio_play_dir, - sound_table[sound]); - - if( ! ( ret = system(buf))) - last_time = now; - return ret; - } - return 1; -} - diff --git a/app/fvwm/modules/FvwmAudio/README b/app/fvwm/modules/FvwmAudio/README deleted file mode 100644 index cb5a712d9..000000000 --- a/app/fvwm/modules/FvwmAudio/README +++ /dev/null @@ -1,37 +0,0 @@ -This is the first version of the FvwmAudio module. This program must -be compiled in the fvwm/modules/FvwmAudio directory. - -This module can play different sounds depending on message types. - -The following can be specified in your .fvwmrc: - -Here's a sample: -*FvwmAudioPlayCmd /usr/bin/X11/demos/auplay -*FvwmAudioDir /usr/lib/sounds -*FvwmAudio startup Cheers.au -*FvwmAudio shutdown Goodbye.au -*FvwmAudio unknown doh.au -*FvwmAudio add_window drip.au -*FvwmAudio raise_window beep_pure_saw.au -*FvwmAudio lower_window beep_pure_saw.au -*FvwmAudio focus_change tap2.au -*FvwmAudio destroy_window beep_drop_of_water.au -*FvwmAudio iconify ploop.au -*FvwmAudio deiconify beep_kind_warning.au - -Note that startup, shutdown, and unknown are builtin sound events that are -played when the module begins, ends, and when an unknown message is received. - -Sounds can be played using any independent audio player that can accept -filenames a command line argument. - -This version of FvwmAudio has builtin rplay support which does not need to -invoke an external audio player to play sounds. The rplay support is -enabled when FvwmAudio is compiled with HAVE_RPLAY defined (see the Imakefile) -and when FvwmAudioPlayCmd is set to builtin-rplay. rplay can be obtained -via anonymous ftp at ftp.sdsu.edu in the /pub/rplay directory and at -ftp.x.org in the /contrib/audio/rplay directory. - -Send questions and comments to Mark Boyns and - Mark Scott - diff --git a/app/fvwm/modules/FvwmAudio/README.say b/app/fvwm/modules/FvwmAudio/README.say deleted file mode 100644 index 2d8f2095a..000000000 --- a/app/fvwm/modules/FvwmAudio/README.say +++ /dev/null @@ -1,7 +0,0 @@ -Due to a patch from Albrecht Kadlec, there is now support for the rsynth -'say' command and arbitrary strings instead of sound file names: - - *FvwmAudioCommand /rsynth/say - *FvwmAudio close "window closed" - - \ No newline at end of file diff --git a/app/fvwm/modules/FvwmEvent/ChangeLog b/app/fvwm/modules/FvwmEvent/ChangeLog deleted file mode 100644 index 3141c918a..000000000 --- a/app/fvwm/modules/FvwmEvent/ChangeLog +++ /dev/null @@ -1,26 +0,0 @@ -1999-01-08 Paul D. Smith - - * FvwmEvent.c (main): Remove USE_POSIX/USE_BSD stuff and rely on - HAVE_SIGACTION to choose between new- and old-style signal - handling. - (TerminateHandler): Use the autoconf'd return type for signal - handlers. - -1998-12-17 Dominik Vogt - - * Parse.c (PeekArgument): malloc -> safemalloc - -1998-11-24 Paul D. Smith - - * Parse.h (LFindToken): Remove this macro. It's not used, and it - uses a non-standard function lfind(). Best to not use it at all. - (search.h): Removed #include. - -Tue Nov 10 22:20:21 1998 DanEspen - - * FvwmEvent.c (config): Fix logic on test for cmd needs a - parameter. Thes test for "table != e" was incorrect. Only try to - strip off trailing newline when there is a newline on the command. - It was stripping the last character when commands came in from - FvwmTalk. - diff --git a/app/fvwm/modules/FvwmEvent/FvwmEvent.1 b/app/fvwm/modules/FvwmEvent/FvwmEvent.1 deleted file mode 100644 index 39a6f193d..000000000 --- a/app/fvwm/modules/FvwmEvent/FvwmEvent.1 +++ /dev/null @@ -1,251 +0,0 @@ -.\" t -.\" @(#)FvwmEvent.1 3/28/94 -.TH FvwmEvent 1.0 "Apr 22 1998" -.UC -.SH NAME -\fBFvwmEvent\fP \- the FVWM Event module -.SH SYNOPSIS -\fBFvwmEvent\fP is a more versatile replacement for \fBFvwmAudio\fP. -It can in general be used to hook any \fBfvwm2\fP function or program to any -window manager event. e.g: Delete unwanted netscape-popups or -application error popups as they appear, play sounds, log events to a -file and the like. Be creative, You'll find a use for it. - -\fBFvwmEvent\fP is spawned by \fBfvwm2(1)\fP, so no command line invocation will -work. From within the \fI.fvwm2rc\fP file, \fBFvwmEvent\fP is spawned as -follows: -.nf -.sp -Module FvwmEvent -.sp -.fi -or from within an \fBfvwm2\fP pop-up menu: -.nf -.sp -DestroyMenu Module-Popup -AddToMenu Module-Popup "Modules" Title -+ "Event" Module FvwmEvent -+ "Auto" Module FvwmAuto 200 -+ "Buttons" Module FvwmButtons -+ "Ident" Module FvwmIdent -+ "Banner" Module FvwmBanner -+ "Pager" Module FvwmPager 0 3 -.sp -.fi -.SH DESCRIPTION -The \fBFvwmEvent\fP module communicates with the \fBfvwm2\fP window manager -to bind \fIactions\fP to window manager \fIevents\fP. Different actions -may be assigned to distinct window manager events. - -\fBFvwmEvent\fP can be used to bind sound files to events like -\fBFvwmAudio\fP (RiP) did. It can be used for logging event traces to -a log file, while debugging \fBfvwm2\fP. - -\fBFvwmEvent\fP can also have builtin support for the rplay library. -(heritage of FvwmAudio) - -.SH CONFIGURATION OPTIONS -\fBFvwmEvent\fP reads the same \fI.fvwm2rc\fP file as \fBfvwm2\fP -reads when it starts up, and looks for certain configuration options: - -.IP "*FvwmEventCmd \fIcommand\fP" -This determines the \fBfvwm2\fP function that is to be called with the -event parameters. -You might want to do one of the following (details below): -.nf -.sp - *FvwmEventCmd \fIbuiltin-rplay\fP - play sounds - *FvwmEventCmd - execute distinct fvwm2 functions - *FvwmEventCmd exec - execute distinct external programs -.sp -.fi -This version of \fBFvwmEvent\fP has builtin \fBrplay\fP support which does not -need to invoke an external audio player to play sounds. The rplay -support is enabled when \fBFvwmEvent\fP is compiled with \fIHAVE_RPLAY\fP defined -(see the Imakefile) and when \fBFvwmEventCmd\fP is set to \fIbuiltin-rplay\fP. - -For example: -.nf -.sp - *FvwmEventCmd \fIbuiltin-rplay\fP - *FvwmEvent add_window drip.au - -rplay can be obtained via anonymous ftp at - -or -.sp -.fi -\fBFvwmEvent\fP also has support for any other external program. -e.g: the rsynth 'say' command: -.nf -.sp - *FvwmEventCmd /rsynth/say - *FvwmEvent destroy_window "window closed" -.sp -.fi -You can also use \fBfvwm2\fP's builtin \fIEcho\fP command as -\fIFvwmEventCmd\fP to obtain debug output for \fBfvwm2\fP events quietly. -I used this setup to debug FvwmAuto: -.nf -.sp - *FvwmEventCmd \fIEcho\fP - *FvwmEvent focus_change "focus change" - *FvwmEvent raise_window "raise window" -.sp -.fi -You can even call different shell commands for each event just by setting -.nf -.sp - *FvwmEventCmd exec - *FvwmEvent add_window killname "APPL ERROR" -.sp -.fi -.IP "*FvwmEvent \fIwindow-manager-event action-or-filename\fP" -Binds particular actions to window manager events. -.nf -.sp -e.g. for audio-events: - - *FvwmEvent startup TaDa.au - *FvwmEvent shutdown Elvis_Left.au - *FvwmEvent unknown doh.au - - *FvwmEvent new_page beam_trek.au - *FvwmEvent new_desk beam_trek.au - *FvwmEvent add_window drip.au - *FvwmEvent raise_window swoosh.au - *FvwmEvent lower_window swoosh.au - *FvwmEvent configure_window hammer.au - *FvwmEvent focus_change boing.au - *FvwmEvent destroy_window explosion.au - *FvwmEvent iconify ploop.au - *FvwmEvent deiconify ploop.au - *FvwmEvent window_name huh.au - *FvwmEvent icon_name beep.au - *FvwmEvent res_class beep.au - *FvwmEvent res_name beep.au - *FvwmEvent end_windowlist twang.au - - *FvwmEvent icon_location beep.au - *FvwmEvent map beep.au - *FvwmEvent error beep.au - *FvwmEvent config_info beep.au - *FvwmEvent end_config_info beep.au - *FvwmEvent icon_file beep.au - *FvwmEvent default_icon beep.au - *FvwmEvent string plapper.au - - *FvwmEvent mini_icon beep.au - *FvwmEvent windowshade beep.au - *FvwmEvent dewindowshade beep.au -.sp -.fi -Provided \fBfvwm2\fP supports it (not yet), there's an additional event to -replace all \fBfvwm2\fP beeps with a sound: -.nf -.sp - *FvwmEvent beep beep.au -.sp -.fi -The toggle_paging event will be supported, as soon, as it's -resurrected by \fBfvwm2\fP: -.nf -.sp - *FvwmEvent toggle_paging fwop.au -.sp -.fi -.IP "*FvwmEventDelay \fI5\fP" -Specifies that an event-action will only be executed if it occurs at -least 5 seconds after the previous event. Events that occur during -the delay period are ignored. This option is useful if you don't want -several sounds playing at the same time. The default delay is 0 which -disables the Event delay. - - -.SH RPLAY OPTIONS -The following options are only valid with builtin rplay support. -i.e: when \fBFvwmEvent\fP was compiled with \fIHAVE_RPLAY\fP defined -(see the Imakefile). They are used only if \fBFvwmEventCmd\fP is set -to \fIbuiltin-rplay\fP. - - -.IP "*FvwmEventRplayHost \fIhostname\fP" -Specifies what host the rplay sounds will play on. The \fIhostname\fP -can also be an environment variable such as $HOSTDISPLAY. - -.IP "*FvwmEventRplayPriority \fI0\fP" -Specifies what priority will be assigned to the rplay sounds when they -are played. - -.IP "*FvwmEventRplayVolume \fI127\fP" -Specifies what volume will be assigned to the sounds when they are -played. - -.SH INVOCATION -The invocation method was shown in the synopsis section. No command -line invocation is possible. \fBFvwmEvent\fP must be invoked by the -\fBfvwm2\fP window manager. -.sp - -.SH FvwmAudio Compatibility - -FvwmAudioPlayCmd used to call an external program. -FvwmEventCmd calls an \fBfvwm2\fP function. External programs can be called -using the \fBfvwm2\fP exec function "exec program". - -FvwmAudioDir has been removed due to the fact that the parameters -don't have to be files any more. -use: -.nf -.sp - DestroyFunc mysay - AddToFunc mysay "I" exec /rsynth/say /rsynth/audiofiles/$1 - - *FvwmEventCmd mysay -.sp -.fi -.SH BUGS -It's REALLY noisy when \fBfvwm2\fP starts and restarts using an audio player. -FvwmEventDelay helps a little bit. - -The parameters inherent to several events are not accessible. This -might be implemented in the future so that the command executed by -fvwm2 looks like FvwmEventCmd FvwmEvent-parameters -event-specific-parameters. - -Simple \fBFvwmAuto\fP could then be emulated by: -.nf - *FvwmEventCmd - *FvwmEvent raise-window Raise -.sp -.fi -.SH COPYRIGHTS -This module has evolved of \fBFvwmAudio\fP, which in term is heavily based -on a similar Fvwm module called \fBFvwmSound\fP by Mark -Boyns. \fBFvwmAudio\fP simply took Mark's original program and -extended it to make it generic enough to work with any Audio -player. Due to different requests to do specific things on specific events, -\fBFvwmEvent\fP took this one step further and now calls any -\fBfvwm2\fP function, or builtin-rplay. If \fBfvwm2\fP's Exec function -is used, any external program can be called with any parameter. - -The concept for interfacing this module to the Window Manager, is -original work by Robert Nation. - -Copyright 1998 Albrecht Kadlec. -Copyright 1994, Mark Boyns and Mark Scott. No guarantees or -warranties or anything are provided or implied in any way whatsoever. -Use this program at your own risk. Permission to use and modify this -program for any purpose is given, as long as the copyright is kept intact. - - -.sp -.SH AUTHORS -.nf -1994 FvwmSound Mark Boyns (\fIboyns@sdsu.edu\fP) -1994 FvwmAudio Mark Scott (\fImscott@mcd.mot.com\fP) -1996 FvwmAudio Albrecht Kadlec -1998 FvwmEvent Albrecht Kadlec (\fIalbrecht@auto.tuwien.ac.at\fP) diff --git a/app/fvwm/modules/FvwmEvent/FvwmEvent.c b/app/fvwm/modules/FvwmEvent/FvwmEvent.c deleted file mode 100644 index 661c988ce..000000000 --- a/app/fvwm/modules/FvwmEvent/FvwmEvent.c +++ /dev/null @@ -1,519 +0,0 @@ -/*#define DEBUG - * - * Copyright (C) 1994 Mark Boyns (boyns@sdsu.edu) and - * Mark Scott (mscott@mcd.mot.com) - * 1996-1998 Albrecht Kadlec (albrecht@auto.tuwien.ac.at) - * - * FvwmEvent version 1.0 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* ChangeLog - - * renamed & cleaned up so that FvwmEvent (TaDa !!) is a general event - handler module. - -- 21.04.98 Albrecht Kadlec (albrecht@auto.tuwien.ac.at) - - * changed parsing to use new library functions - - * merged bug fix from Christophe MARTIN - - FvwmAudio doesn't read messages it is not interrested in, - thus desynchronize, - - keep time stamp even if no sound is played - - minimize malloc/free - - mark boyns ok-ed this patch, I reviewed it and put out those ugly - #defines for RESYNC and READ_BODY by reordering the control structures - -- Albrecht Kadlec (albrecht@auto.tuwien.ac.at) - - * made FvwmAudio insensitive to its name -> can be symlinked. - corrected some error message deficiencies, code for quoted 'sound' - parameters shamelessly stolen from FvwmButtons/parse.c (with minimal - adjustments) - FvwmAudio now supports rsynth's say command: - *FvwmAudioPlayCmd say - *FvwmAudio add_window "add window" - *FvwmAudio raise_window 'raise window' - -- 08/07/96 Albrecht Kadlec (albrecht@auto.tuwien.ac.at) - - * Fixed FvwmAudio to reflect the changes made to the module protocol. - - * Szijarto Szabolcs provided FvwmSound code that used - $HOSTDISPLAY for the rplay host. The code has been added to FvwmAudio. - - * Fixed bugs reported by beta testers, thanks! - - * Builtin rplay support has been added to FvwmAudio. This support is - enabled when FvwmAudio is compiled with HAVE_RPLAY defined and when - FvwmAudioPlayCmd is set to builtin-rplay. I guess it's safe to say - that FvwmSound is now obsolete. -- Mark Boyns 5/7/94 - - * FvwmAudio is based heavily on an Fvwm module "FvwmSound" by Mark Boyns - and the real credit for this really goes to him for the concept. - I just stripped out the "rplay" library dependencies to allow generic - audio play command support. - - */ - -/* - * This module is based on FvwmModuleDebugger which has the following - * copyright: - * - * This module, and the entire ModuleDebugger program, and the concept for - * interfacing this module to the Window Manager, are all original work - * by Robert Nation - * - * Copyright 1994, Robert Nation. No guarantees or warantees or anything - * are provided or implied in any way whatsoever. Use this program at your - * own risk. Permission to use this program for any purpose is given, - * as long as the copyright is kept intact. - */ - -#include "config.h" -#include "../../fvwm/module.h" -#include "fvwmlib.h" - -/* - * fvwm includes: - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * rplay includes: - */ -#ifdef HAVE_RPLAY -#include -#undef M_ERROR /* Solaris fix */ -#endif - -#include "ModParse.h" - -#ifdef DEBUG -#define INFO(x) fprintf(stderr,x) -#else -#define INFO(x) -#endif - -#define BUILTIN_STARTUP MAX_MESSAGES -#define BUILTIN_SHUTDOWN MAX_MESSAGES+1 -#define BUILTIN_UNKNOWN MAX_MESSAGES+2 -#define MAX_BUILTIN 3 - -#define BUFSIZE 512 - -/* globals */ -char *MyName; -int MyNameLen; -int fd[2]; -char cmd_line[BUFSIZE]=""; -time_t audio_delay = 0, /* seconds */ - last_time = 0, - now; - -#ifdef HAVE_RPLAY -int rplay_fd = -1; -#endif - -/* prototypes */ -int execute_event(short); -void config(void); -void DeadPipe(int) __attribute__((__noreturn__)); - -static RETSIGTYPE TerminateHandler(int); - -/* define the event table */ -char *events[MAX_MESSAGES+MAX_BUILTIN] = -{ - "new_page", - "new_desk", - "add_window", - "raise_window", - "lower_window", - "configure_window", - "focus_change", - "destroy_window", - "iconify", - "deiconify", - "window_name", - "icon_name", - "res_class", - "res_name", - "end_windowlist", - "icon_location", - "map", - "error", - "config_info", - "end_config_info", - "icon_file", - "default_icon", - "string", -#ifdef M_BELL - "beep", -#endif -#ifdef M_TOGGLEPAGE - "togglepage", -#endif - "mini_icon", - "windowshade", - "dewindowshade", - "locksonsend", - "sendconfig", -/* add builtins here */ - "startup", - "shutdown", - "unknown" -}; - -/* define the action table */ -char *action_table[MAX_MESSAGES+MAX_BUILTIN]; - -#ifdef HAVE_RPLAY -/* define the rplay table */ -RPLAY *rplay_table[MAX_MESSAGES+MAX_BUILTIN]; -#endif - -static volatile sig_atomic_t isTerminated = False; - -int main(int argc, char **argv) -{ - char *s; - unsigned long header[HEADER_SIZE], body[MAX_BODY_SIZE]; - int total, remaining, count, event; - -INFO("--- started ----\n"); - - /* Save our program name - for error events */ - - if ((s=strrchr(argv[0], '/'))) /* strip path */ - s++; - else /* no slash */ - s = argv[0]; - - MyNameLen=strlen(s)+1; /* account for '*' */ - MyName = safemalloc(MyNameLen+1); /* account for \0 */ - *MyName='*'; - strcpy(MyName+1, s); /* append name */ - - if ((argc != 6)&&(argc != 7)) /* Now MyName is defined */ - { - fprintf(stderr,"%s Version "VERSION" should only be executed by fvwm!\n", - MyName+1); - exit(1); - } - - INFO("--- installing signal server\n"); - -#ifdef HAVE_SIGACTION - { - struct sigaction sigact; - - sigemptyset(&sigact.sa_mask); -# ifdef SA_INTERRUPT - sigact.sa_flags = SA_INTERRUPT; -# else - sigact.sa_flags = 0; -# endif - sigact.sa_handler = TerminateHandler; - - sigaction(SIGPIPE,&sigact,NULL); /* Dead pipe == Fvwm died */ - sigaction(SIGTERM,&sigact,NULL); /* "polite" termination signal */ - } -#else - /* We don't have sigaction(), so fall back to less robust methods. */ - signal(SIGPIPE, TerminateHandler); - signal(SIGTERM, TerminateHandler); -#endif - - fd[0] = atoi(argv[1]); - fd[1] = atoi(argv[2]); - -INFO("--- configuring\n"); - - config(); /* configure events */ - execute_event(BUILTIN_STARTUP); /* Startup event */ - - SendText(fd,"Nop",0); /* what for ? */ - - - /* main loop */ - -INFO("--- waiting\n"); - while ( !isTerminated ) - { - if ((count = read(fd[1],header, - HEADER_SIZE*sizeof(unsigned long))) <= 0) - exit(0); -/* if this read is interrrupted EINTR, the wrong event is triggered !!! */ - - if( header[0] != START_FLAG ) - continue; /* should find something better for resyncing */ - - /* Ignore events that occur during the delay period. */ - now = time(0); - - /* junk the event body */ - total=0; - remaining = (header[2] - HEADER_SIZE) * sizeof(unsigned long); - while (remaining) - { - if((count=read(fd[1],&body[total],remaining)) < 0) - exit(0); - remaining -= count; - total +=count; - } - - if (now < last_time + audio_delay) - continue; /* quash event */ - - /* - * event will equal the number of shifts in the - * base-2 header[1] number. Could use log here - * but this should be fast enough. - */ - event = -1; - while (header[1]) - { - event++; - header[1] >>= 1; - } - if (event < 0 || event >= MAX_MESSAGES) - event=BUILTIN_UNKNOWN; - - execute_event(event); /* execute action */ - } /* while */ - - execute_event(BUILTIN_SHUTDOWN); - return 0; -} - - -/*********************************************************************** - * - * Procedure: - * - * execute_event - actually executes the actions from lookup table - * - **********************************************************************/ -int execute_event(short event) -{ - 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"); - return 0; - } else /* avoid invalid second execute */ -#endif - if (action_table[event]) - { - sprintf(buf,"%s %s", cmd_line, action_table[event]); -#if 1 -INFO(buf); -INFO("\n"); - - SendText(fd,buf,0); /* let fvwm2 execute the function */ - last_time = now; -#else - if( ! ( ret = system(buf))) /* directly execute external program */ - last_time = now; - return ret; -#endif - } - return 1; -} - - -/*********************************************************************** - * - * Procedure: - * config - read the configuration file. - * - ***********************************************************************/ - -char *table[]= -{ - "Cmd", - "Delay" -#ifdef HAVE_RPLAY - , - "RplayHost", - "RplayPriority", - "RplayVolume" -#endif -}; /* define entries here, if this list becomes unsorted, use LFindToken */ - - -void config(void) -{ - char *buf, *event, *action, *p, *q, **e; - int i, found; -#ifdef HAVE_RPLAY - int volume = RPLAY_DEFAULT_VOLUME, - priority = RPLAY_DEFAULT_PRIORITY; - char host[128]; - - strcpy(host, rplay_default_host()); -#endif - - /* Intialize all the actions */ - - for (i = 0; i < MAX_MESSAGES+MAX_BUILTIN; i++) - { - action_table[i] = NULL; -#ifdef HAVE_RPLAY - rplay_table[i] = NULL; -#endif - } - - while (GetConfigLine(fd,&buf), buf != NULL) - { - if (buf[strlen(buf)-1] == '\n') { /* if line ends with newline */ - buf[strlen(buf)-1] = '\0'; /* strip off \n */ - } - - /* Search for MyName (normally *FvwmAudio) */ - if (strncasecmp(buf, MyName, MyNameLen) == 0) - { - p = buf+MyNameLen; -INFO(buf); -INFO("\n"); - if ((e= FindToken(p,table,char *))) /* config option ? */ - { - p+=strlen(*e); /* skip matched token */ - q=GetArgument(&p); - if (!q) - { - fprintf(stderr,"%s: %s%s needs a parameter\n", - MyName+1, MyName+1,*e); - continue; - } - - switch (e - (char**)table) - { - case 0: if (q) strcpy(cmd_line, q); /* Cmd */ - else *cmd_line='\0'; -INFO("cmd_line = ->"); -INFO(cmd_line); -INFO("<-\n"); - break; - case 1: audio_delay = atoi(q); break; /* Delay */ -#ifdef HAVE_RPLAY - case 2: if (*q == '$') /* RPlayHost */ - { /* Check for $HOSTDISPLAY */ - char *c1= (char *)getenv(q+1), *c2= host; - while (c1 && *c1 != ':') - *c2++ = *c1++; - *c2 = '\0'; - } - else - strcpy(host, q); - break; - case 3: priority = atoi(q); break; /* RplayPriority */ - case 4: volume = atoi(q); break; /* RplayVolume */ -#endif - } - } - else /* test for isspace(*p) ??? */ - { - event = GetArgument(&p); - action = GetArgument(&p); -INFO(event); -INFO(" "); -INFO(action); -INFO("\n"); - if (!event || !*event || !action || !*action) - { - fprintf(stderr,"%s: incomplete event definition %s\n", - MyName+1, buf); - continue; - } - for (found = 0,i = 0; !found && i < MAX_MESSAGES+MAX_BUILTIN; - i++) - { -INFO(events[i]); -INFO("\n"); - - if (MatchToken(event, events[i])) - { -#ifdef HAVE_RPLAY - rplay_table[i] = rplay_create(RPLAY_PLAY); - rplay_set(rplay_table[i], RPLAY_APPEND, - RPLAY_SOUND, action, - RPLAY_PRIORITY, priority, - RPLAY_VOLUME, volume, - NULL); -#endif - action_table[i]=action; - found=1; -INFO("found\n"); - } - } - if (!found) fprintf(stderr,"%s: unknown event type: %s\n", - MyName+1, event); - } - } -/*else INFO("NO CONFIG\n");*/ - } - -#ifdef HAVE_RPLAY - /* - * Builtin rplay support is enabled when FvwmAudioPlayCmd == builtin-rplay. - */ - if (strcasecmp(cmd_line, "builtin-rplay") == 0) - if ((rplay_fd = rplay_open(host)) < 0) - { - rplay_perror("rplay_open"); - exit(1); - } -#endif -} - -/*********************************************************************** - * - * Procedure: - * SIGPIPE handler - SIGPIPE means fvwm is dying - * - ***********************************************************************/ -static RETSIGTYPE -TerminateHandler(int nonsense) -{ - isTerminated = True; -} - -/*********************************************************************** - * - * Procedure: - * Externally callable procedure to quit - * - ***********************************************************************/ -void DeadPipe(int flag) -{ - execute_event(BUILTIN_SHUTDOWN); - exit(flag); -} diff --git a/app/fvwm/modules/FvwmEvent/Imakefile b/app/fvwm/modules/FvwmEvent/Imakefile deleted file mode 100644 index b93f657ef..000000000 --- a/app/fvwm/modules/FvwmEvent/Imakefile +++ /dev/null @@ -1,6 +0,0 @@ -# $OpenBSD: Imakefile,v 1.1 2006/11/26 10:53:46 matthieu Exp $ - -FVWMTOP=../.. -#include "../../Fvwm.tmpl" - -FvwmSimpleModuleTarget(FvwmEvent) -- cgit v1.2.3