[Pkg-wmaker-commits] [wmmixer] 06/24: Import Upstream version 1.1
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Sun Aug 27 13:12:52 UTC 2017
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmmixer.
commit 6512e4f33d9870975fa6c0f17071e9db3c7eaa04
Author: Doug Torrance <dtorrance at piedmont.edu>
Date: Sun Aug 27 09:11:15 2017 -0400
Import Upstream version 1.1
---
CHANGES | 61 +++++
INSTALL | 9 +
Imakefile | 13 -
Makefile | 39 +++
README | 95 +------
home.wmmixer | 2 +-
wmmixer.1 | 89 ++++++
wmmixer.cc | 870 +++++++++++++++++++++++++++++++----------------------------
wmmixer.h | 158 +++++++++++
9 files changed, 822 insertions(+), 514 deletions(-)
diff --git a/CHANGES b/CHANGES
new file mode 100644
index 0000000..b07bbf4
--- /dev/null
+++ b/CHANGES
@@ -0,0 +1,61 @@
+wmmixer - A mixer designed for WindowMaker
+
+RELEASE HISTORY:
+================
+
+Release 0.1 07/02/98 Finally reached a state I am prepared to put my
+ name to.
+ No KNOWN bugs.
+
+Release 0.2 12/02/98 Fixed nasty memory hole.
+
+Release 0.3 24/02/98 Fixed bug relating to manual window positioning.
+
+Release 0.4 04/03/98 Reduced CPU Load (thanks to aseltine at cs.umass.edu).
+ Support for NetBSD (you may need to make it use -lossaudio when linking).
+ (thanks to Geir.I.Jensen at runit.sintef.no)
+ Only updates when it has to now.
+
+Release 0.5 05/03/98 Better support for NetBSD and FreeBSD.
+ Fixed bug relating to cards with no volume channel.
+ (thanks to dalroi at wit401310.student.utwente.nl)
+ Fixed bug relating to hiding "Rec" checkbox on FreeBSD.
+ (thanks to dalroi at wit401310.student.utwente.nl)
+
+Release 0.6 12/03/98 Fixed setRec() in mixctl.h.
+ (thanks to Geir.I.Jensen at runit.sintef.no)
+ Now works on 8bpp displays with full colormaps.
+ (thanks to devernay at istar.fr on the mailing-list)
+ Now configurable through a ~/.wmmixer file.
+ (suggested by steeve at minet.net)
+ New channel symbols.
+ (thanks to steeve at minet.net)
+
+Release 0.7 25/04/98 Better checking of supported channels.
+ Now GPL.
+ Sensible CPU load.
+ New FAQ.
+ New mixctl.h.
+ New look.
+ (thanks to warp at xs4all.nl)
+
+Release 0.8 06/05/98 Removed broken display code.
+ Added "-b back_color" command line argument.
+
+Release 1.0 05/09/98 Added a little error checking.
+Beta1 More delicate volume leds fit in better with other apps.
+ Added "-a" command line argument for AfterStep users.
+ Added "-position position" command line argument.
+ Command line arguments, "-a", "-w" and "-s" are now toggle,
+ so if you enable one at compile-time, you can override
+ it at run-time.
+ Added command to configuration file format.
+
+Release 1.1 3 Apr 2002 Adopted as obviously orhpaned:
+ Gordon Fraser <gordon at debian.org>
+ Added mouse-wheel support
+ Rewrote parts of the X handling to make it work
+ with the KDE Dock Application Bar
+ Added manpage
+ Changed to GNU getopt command line parsing
+ Added simple Makefile, get rid of imake
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..265a0cd
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,9 @@
+wmmixer - A mixer designed for WindowMaker
+
+INSTALLING:
+===========
+
+make
+make install
+
+
diff --git a/Imakefile b/Imakefile
deleted file mode 100644
index 45426d2..0000000
--- a/Imakefile
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifdef NetBSDArchitecture
-OSSAUDIO = -lossaudio
-#else
-OSSAUDIO =
-#endif
-
-DEPLIBS = $(DEPXLIB)
-LOCAL_LIBRARIES = $(XPMLIB) $(XLIB) $(OSSAUDIO)
-
-SRCS = wmmixer.cc
-OBJS = wmmixer.o
-
-ComplexProgramTarget(wmmixer)
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f2c489d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,39 @@
+# $Id: Makefile,v 1.0 2002/04/02 19:38:22 gordon Exp $
+
+prefix = /usr/local
+exec_prefix = ${prefix}
+bindir = ${exec_prefix}/bin
+mandir = ${prefix}/share/man
+
+DESTDIR =
+
+CFLAGS = -O2 -Wall -pedantic
+LIBS = -L/usr/X11R6/lib -lX11 -lXpm -lXext
+
+all: wmmixer
+
+wmmixer: wmmixer.cc
+ $(CC) $(LIBS) -o $@ $^
+
+install: install-bin install-doc
+
+install-bin: wmmixer
+ install -D -s -m 755 $< $(DESTDIR)$(bindir)/wmmixer
+
+install-doc: wmmixer.1
+ install -D -m 644 $< $(DESTDIR)$(mandir)/man1/wmmixer.1
+
+uninstall: uninstall-bin uninstall-doc
+
+uninstall-bin:
+ rm -f $(DESTDIR)$(bindir)/wmmixer
+
+uninstall-doc:
+ rm -f $(DESTDIR)$(mandir)/man1/wmmixer.1
+
+clean:
+ rm -f *.o wmmixer
+
+.PHONY: all clean dist-clean install install-bin install-doc \
+ uninstall uninstall-bin uninstall-doc
+
diff --git a/README b/README
index 9a28c00..c6b2b7d 100644
--- a/README
+++ b/README
@@ -1,6 +1,10 @@
wmmixer - A mixer designed for WindowMaker
-05/09/98 Release 1.0 Beta1
+3 Apr 2002 Release 1.1
+
Copyright (C) 1998 Sam Hawker <shawkie at geocities.com>
+Copyright (C) 2002 Gordon Fraser <gordon at debian.org>
+
+
This software comes with ABSOLUTELY NO WARRANTY
This software is free software, and you are welcome to redistribute it
under certain conditions
@@ -21,22 +25,11 @@ See the COPYING file for details.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-THE AUTHOR:
-===========
-
-Sam Hawker (17/m/uk)
-
-shawkie at geocities.com
-http://www.geocities.com/SiliconValley/Vista/2471/
+AUTHORS:
+========
-
-INSTALLING:
-===========
-
-xmkmf
-make
-strip wmmixer
-make install
+Original Author: Sam Hawker <shawkie at geocities.com>
+Current Author: Gordon Fraser <gordon at debian.org>
CONFIGURATION:
@@ -62,6 +55,9 @@ represents an unrecognised channel).
Click and/or drag the volume display to set channel volume.
There is a also a button to set recording sources.
+See the program's manpage ('man wmmixer') for detailed listings of the
+available options.
+
AFTERSTEP USERS:
================
@@ -75,7 +71,7 @@ wmcdplay off the edge of the screen while it gets swallowed.
To put wmmount in your Wharf, add the following line in the appropriate
part of your .steprc
-*Wharf wmmount nil MaxSwallow "wmmount" wmmount -a -position -0-0 &
+*Wharf wmmixer nil MaxSwallow "wmmount" wmmixer -a -g -0-0 &
It is also possible (by editing and recompiling the afterstep sources),
to make Wharf handle the new 56x56 pixel window properly - yes, I add
@@ -93,68 +89,3 @@ AfterStep-1.0/modules/Wharf. Locate this:
}
and change the 55 and 57 to 56's. Save and compile."
-
-
-BUILD PROBLEMS:
-===============
-
-You may have trouble linking wmmixer with the compiler supplied on some
-recent Linux distributions (eg. Debian 2.0 & RedHat 5.1).
-It can be made to build by adding the following line to the top of the
-Imakefile, before executing xmkmf:
-
-CC = c++
-
-I am not sure of the effect this has on memory usage, etc.
-
-
-RELEASE HISTORY:
-================
-
-Release 0.1 07/02/98 Finally reached a state I am prepared to put my
- name to.
- No KNOWN bugs.
-
-Release 0.2 12/02/98 Fixed nasty memory hole.
-
-Release 0.3 24/02/98 Fixed bug relating to manual window positioning.
-
-Release 0.4 04/03/98 Reduced CPU Load (thanks to aseltine at cs.umass.edu).
- Support for NetBSD (you may need to make it use -lossaudio when linking).
- (thanks to Geir.I.Jensen at runit.sintef.no)
- Only updates when it has to now.
-
-Release 0.5 05/03/98 Better support for NetBSD and FreeBSD.
- Fixed bug relating to cards with no volume channel.
- (thanks to dalroi at wit401310.student.utwente.nl)
- Fixed bug relating to hiding "Rec" checkbox on FreeBSD.
- (thanks to dalroi at wit401310.student.utwente.nl)
-
-Release 0.6 12/03/98 Fixed setRec() in mixctl.h.
- (thanks to Geir.I.Jensen at runit.sintef.no)
- Now works on 8bpp displays with full colormaps.
- (thanks to devernay at istar.fr on the mailing-list)
- Now configurable through a ~/.wmmixer file.
- (suggested by steeve at minet.net)
- New channel symbols.
- (thanks to steeve at minet.net)
-
-Release 0.7 25/04/98 Better checking of supported channels.
- Now GPL.
- Sensible CPU load.
- New FAQ.
- New mixctl.h.
- New look.
- (thanks to warp at xs4all.nl)
-
-Release 0.8 06/05/98 Removed broken display code.
- Added "-b back_color" command line argument.
-
-Release 0.1 05/09/98 Added a little error checking.
-Beta1 More delicate volume leds fit in better with other apps.
- Added "-a" command line argument for AfterStep users.
- Added "-position position" command line argument.
- Command line arguments, "-a", "-w" and "-s" are now toggle,
- so if you enable one at compile-time, you can override
- it at run-time.
- Added command to configuration file format.
\ No newline at end of file
diff --git a/home.wmmixer b/home.wmmixer
index 9bb2d46..c35352d 100644
--- a/home.wmmixer
+++ b/home.wmmixer
@@ -1,5 +1,5 @@
# wmmixer - A mixer designed for WindowMaker
-# 05/09/98 Release 1.0 Beta1
+# 3 Apr 2002 Release 1.1
# Copyright (C) 1998 Sam Hawker <shawkie at geocities.com>
# This software comes with ABSOLUTELY NO WARRANTY
# This software is free software, and you are welcome to redistribute it
diff --git a/wmmixer.1 b/wmmixer.1
new file mode 100644
index 0000000..becb2b4
--- /dev/null
+++ b/wmmixer.1
@@ -0,0 +1,89 @@
+.TH wmmixer 1 "April 02, 2002" Debian "Windowmaker Mixer Application"
+
+.SH NAME
+wmmixer \- A mixer application designed for WindowMaker
+.SH DESCRIPTION
+\fBwmmixer\fP is a mixer application designed for WindowMaker, although
+there is nothing in the program that makes it require WindowMaker, except
+maybe the NeXTStep look and the fact that it
+properly docks. It can be used with other window managers without problems.
+.SH SYNOPSIS
+.B wmmixer [options]
+.SH OPTIONS
+This program follows the usual GNU command line syntax, with long options
+starting with two dashes ('\-\-'). A summary of options is included below.
+.TP
+.B \-d, \-\-display <\fIstring\fP>
+Attempt to open a window on the named X display. In the absence of this
+option
+the display specified by the
+.B DISPLAY
+environment variable is used.
+.TP
+.B \-g, \-\-geometry <\fIstring\fP>
+geometry to use, e.g. +100+100 to place it at 100/100
+.TP
+.B \-h, \-\-help
+show help text and exit.
+.TP
+.B \-v, \-\-version
+show program version and exit.
+.TP
+.B \-w, \-\-withdrawn
+run the application in withdrawn mode. This is for use with WindowMaker or
+other window managers supporting docks (e.g. KDE)
+.TP
+.B \-a, \-\-afterstep
+use smaller window (for AfterStep Wharf)
+.TP
+.B \-s, \-\-shaped
+shaped window
+.TP
+.B \-l, \-\-led\-color <\fIstring\fP>
+use the specified color for led, e.g. red, green, blue
+.TP
+.B \-b, \-\-back\-color <\fIstring\fP>
+use the specified color for backgrounds, e.g. red, green, blue
+.TP
+.B \-m, \-\-mix\-device <\fIstring\fP>
+use specified device (rather than /dev/mixer)
+.TP
+.B \-r, \-\-scrollwheel <\fInumber\fP>
+Set the volume increase/decrease when using the mouse wheel (default: 2)
+.TP
+For backward compatibility the following obsolete options are still supported:
+
+.TP
+.B \-help
+show help text and exit.
+.TP
+.B \-display
+attempt to open a window on the named X display
+.TP
+.B \-position
+geometry to use, e.g. +100+100 to place it at 100/100
+
+.SH USAGE
+All available channels on your soundcard's mixer are accessible with
+\fIwmmixer\fP. Most common channels are identified with an appropriate icon.
+Controls include a stereo (mono where appropriate) volume control and a
+recording source toggle button.
+
+Press the "<" and ">" arrow buttons to select a channel.
+The icon identifies the current channel (a volume symbol with a question
+mark represents an unrecognised channel).
+Click and/or drag the volume display to set channel volume.
+There is a also a button to set recording sources.
+
+
+.SH CONFIGURATION
+Users can configure wmmixer to suit their requirements by means of a
+\fI~/.wmmixer\fP file. A commented example can be found in /usr/share/doc/wmmixer on Debian systems, and would be a good starting point
+
+
+.SH AUTHOR
+wmmixer was originally written by Sam Hawker <shawkie at geocities.com>,
+and then adopted by Gordon Fraser <gordon at debian.org>.
+
+This manual page was written by Gordon Fraser <gordon at debian.org>.
+
diff --git a/wmmixer.cc b/wmmixer.cc
index d3be080..5675718 100644
--- a/wmmixer.cc
+++ b/wmmixer.cc
@@ -6,323 +6,274 @@
// under certain conditions
// See the README file for a more complete notice.
+// 02/04/02 Gordon Fraser <gordon at debian.org>
+// * GNU getopt
+// * Mousewheel support
+// * X handling rewrite
-// Defines, includes and global variables
-// --------------------------------------
-
-// User defines - standard
-#define WINDOWMAKER false
-#define USESHAPE false
-#define AFTERSTEP false
-#define NORMSIZE 64
-#define ASTEPSIZE 56
-#define NAME "wmmixer"
-#define CLASS "WMMixer"
-
-// User defines - custom
-#define MIXERDEV "/dev/mixer"
-#define BACKCOLOR "#282828"
-#define LEDCOLOR "green"
-
-// Includes - standard
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-// Includes - custom
-#include "mixctl.h"
-
-// X-Windows includes - standard
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xproto.h>
-#include <X11/xpm.h>
-#include <X11/extensions/shape.h>
-
-// Pixmaps - standard
-Pixmap pm_main;
-Pixmap pm_tile;
-Pixmap pm_disp;
-Pixmap pm_mask;
-
-// Pixmaps - custom
-Pixmap pm_icon;
-Pixmap pm_nrec;
-
-// Xpm images - standard
-#include "XPM/wmmixer.xpm"
-#include "XPM/tile.xpm"
-
-// Xpm images - custom
-#include "XPM/icons.xpm"
-#include "XPM/norec.xpm"
-
-// Variables for command-line arguments - standard
-bool wmaker=WINDOWMAKER;
-bool ushape=USESHAPE;
-bool astep=AFTERSTEP;
-char display[256]="";
-char position[256]="";
-int winsize;
-
-// Variables for command-line arguments - custom
-char mixdev[256]=MIXERDEV;
-char backcolor[256]=BACKCOLOR;
-char ledcolor[256]=LEDCOLOR;
-
-// X-Windows basics - standard
-Atom _XA_GNUSTEP_WM_FUNC;
-Atom deleteWin;
-Display *d_display;
-Window w_icon;
-Window w_main;
-Window w_root;
-Window w_activewin;
-
-// X-Windows basics - custom
-GC gc_gc;
-unsigned long color[4];
-
-
-// Misc custom global variables
-// ----------------------------
-
-// Current state information
-int curchannel=0;
-bool curshowrec;
-bool currec;
-int curleft;
-int curright;
-
-// For buttons
-int btnstate=0;
-#define BTNNEXT 1
-#define BTNPREV 2
-#define BTNREC 4
-
-// For repeating next and prev buttons
-#define RPTINTERVAL 5
-int rpttimer=0;
-
-// For draggable volume control
-bool dragging=false;
-
-int channels=0;
-int channel[20];
-int icon[20]={0, 7, 8, 2, 1, 6, 4, 5, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9};
-
-MixCtl *mixctl;
-
-
-// Procedures and functions
-// ------------------------
-
-// Procedures and functions - standard
-void initXWin(int argc, char **argv);
-void freeXWin();
-void createWin(Window *win, int x, int y);
-unsigned long getColor(char *colorname);
-unsigned long mixColor(char *colorname1, int prop1, char *colorname2, int prop2);
-
-// Procedures and functions - custom
-void scanArgs(int argc, char **argv);
-void readFile();
-void checkVol(bool forced=true);
-void pressEvent(XButtonEvent *xev);
-void releaseEvent(XButtonEvent *xev);
-void motionEvent(XMotionEvent *xev);
-void repaint();
-void update();
-void drawLeft();
-void drawRight();
-void drawBtns(int btns);
-void drawBtn(int x, int y, int w, int h, bool down);
+#include "wmmixer.h"
// Implementation
// --------------
+
int main(int argc, char **argv)
{
- scanArgs(argc, argv);
- initXWin(argc, argv);
-
- XGCValues gcv;
- unsigned long gcm;
- gcm=GCGraphicsExposures;
- gcv.graphics_exposures=false;
- gc_gc=XCreateGC(d_display, w_root, gcm, &gcv);
-
- color[0]=mixColor(ledcolor, 0, backcolor, 100);
- color[1]=mixColor(ledcolor, 100, backcolor, 0);
- color[2]=mixColor(ledcolor, 60, backcolor, 40);
- color[3]=mixColor(ledcolor, 25, backcolor, 75);
-
- XpmAttributes xpmattr;
- XpmColorSymbol xpmcsym[4]={{"back_color", NULL, color[0]},
- {"led_color_high", NULL, color[1]},
- {"led_color_med", NULL, color[2]},
- {"led_color_low", NULL, color[3]}};
- xpmattr.numsymbols=4;
- xpmattr.colorsymbols=xpmcsym;
- xpmattr.exactColors=false;
- xpmattr.closeness=40000;
- xpmattr.valuemask=XpmColorSymbols | XpmExactColors | XpmCloseness;
- XpmCreatePixmapFromData(d_display, w_root, wmmixer_xpm, &pm_main, &pm_mask, &xpmattr);
- XpmCreatePixmapFromData(d_display, w_root, tile_xpm, &pm_tile, NULL, &xpmattr);
- XpmCreatePixmapFromData(d_display, w_root, icons_xpm, &pm_icon, NULL, &xpmattr);
- XpmCreatePixmapFromData(d_display, w_root, norec_xpm, &pm_nrec, NULL, &xpmattr);
- pm_disp=XCreatePixmap(d_display, w_root, 64, 64, DefaultDepth(d_display, DefaultScreen(d_display)));
-
- if(wmaker || ushape || astep)
- XShapeCombineMask(d_display, w_activewin, ShapeBounding, winsize/2-32, winsize/2-32, pm_mask, ShapeSet);
- else
- XCopyArea(d_display, pm_tile, pm_disp, gc_gc, 0, 0, 64, 64, 0, 0);
-
- XSetClipMask(d_display, gc_gc, pm_mask);
- XCopyArea(d_display, pm_main, pm_disp, gc_gc, 0, 0, 64, 64, 0, 0);
- XSetClipMask(d_display, gc_gc, None);
-
- mixctl=new MixCtl(mixdev);
-
- if(!mixctl->openOK())
- fprintf(stderr,"%s : Unable to open mixer device '%s'.\n", NAME, mixdev);
- else{
- for(int i=0;i<mixctl->getNrDevices();i++){
- if(i==20){
- fprintf(stderr,"%s : Sorry, can only use channels 0-19\n", NAME);
- break;
- }
- if(mixctl->getSupport(i)){
- channel[channels]=i;
- channels++;
- }
+ scanArgs(argc, argv);
+ initXWin(argc, argv);
+
+ mixctl=new MixCtl(mixdev);
+
+ if(!mixctl->openOK())
+ fprintf(stderr,"%s : Unable to open mixer device '%s'.\n", NAME, mixdev);
+ else{
+ icon = new int[mixctl->getNrDevices()];
+ channel = new int[mixctl->getNrDevices()];
+
+ initialize_icon(mixctl->getNrDevices());
+
+ for(int i=0;i<mixctl->getNrDevices();i++){
+ if(mixctl->getSupport(i)){
+ channel[channels]=i;
+ channels++;
}
- }
-
- readFile();
-
- if(channels==0)
- fprintf(stderr,"%s : Sorry, no supported channels found.\n", NAME);
- else{
- checkVol(true);
-
- XEvent xev;
- XSelectInput(d_display, w_activewin, ExposureMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask);
- XMapWindow(d_display, w_main);
-
- bool done=false;
- while(!done){
- while(XPending(d_display)){
- XNextEvent(d_display, &xev);
- switch(xev.type){
- case Expose:
- repaint();
- break;
- case ButtonPress:
- pressEvent(&xev.xbutton);
- break;
- case ButtonRelease:
- releaseEvent(&xev.xbutton);
- break;
- case MotionNotify:
- motionEvent(&xev.xmotion);
- break;
- case ClientMessage:
- if(xev.xclient.data.l[0]==deleteWin)
- done=true;
- break;
- }
- }
-
- if(btnstate & (BTNPREV | BTNNEXT)){
- rpttimer++;
- if(rpttimer>=RPTINTERVAL){
- if(btnstate & BTNNEXT)
- curchannel++;
- else
- curchannel--;
- if(curchannel<0)
- curchannel=channels-1;
- if(curchannel>=channels)
- curchannel=0;
- checkVol(true);
- rpttimer=0;
- }
- }
- else
- checkVol(false);
- XFlush(d_display);
- usleep(50000);
+ }
+ }
+
+ readFile();
+
+ if(channels==0)
+ fprintf(stderr,"%s : Sorry, no supported channels found.\n", NAME);
+ else{
+ checkVol(true);
+
+ XEvent xev;
+ XSelectInput(d_display, w_main, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
+ XSelectInput(d_display, w_icon, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
+ XMapWindow(d_display, w_main);
+
+ bool done=false;
+ while(!done){
+ while(XPending(d_display)){
+ XNextEvent(d_display, &xev);
+ switch(xev.type){
+ case Expose:
+ repaint();
+ break;
+ case ButtonPress:
+ pressEvent(&xev.xbutton);
+ break;
+ case ButtonRelease:
+ releaseEvent(&xev.xbutton);
+ break;
+ case MotionNotify:
+ motionEvent(&xev.xmotion);
+ break;
+ case ClientMessage:
+ if(xev.xclient.data.l[0]==deleteWin)
+ done=true;
+ break;
+ }
}
- }
- XFreeGC(d_display, gc_gc);
- XFreePixmap(d_display, pm_main);
- XFreePixmap(d_display, pm_tile);
- XFreePixmap(d_display, pm_disp);
- XFreePixmap(d_display, pm_mask);
- XFreePixmap(d_display, pm_icon);
- XFreePixmap(d_display, pm_nrec);
- freeXWin();
- delete mixctl;
- return 0;
+
+ if(btnstate & (BTNPREV | BTNNEXT)){
+ rpttimer++;
+ if(rpttimer>=RPTINTERVAL){
+ if(btnstate & BTNNEXT)
+ curchannel++;
+ else
+ curchannel--;
+ if(curchannel<0)
+ curchannel=channels-1;
+ if(curchannel>=channels)
+ curchannel=0;
+ checkVol(true);
+ rpttimer=0;
+ }
+ }
+ else
+ checkVol(false);
+ XFlush(d_display);
+ usleep(50000);
+ }
+ }
+ freeXWin();
+ delete mixctl;
+ return 0;
}
-void initXWin(int argc, char **argv){
- winsize=astep ? ASTEPSIZE : NORMSIZE;
+void initialize_icon(int num) {
+
+ int i;
+
+ icon[0] = 0;
+ icon[1] = 7;
+ icon[2] = 8;
+ icon[3] = 2;
+ icon[4] = 1;
+ icon[5] = 6;
+ icon[6] = 4;
+ icon[7] = 5;
+ icon[8] = 3;
+ for(i=9;i<num;i++)
+ icon[i] = 9;
+}
- if((d_display=XOpenDisplay(display))==NULL){
- fprintf(stderr,"%s : Unable to open X display '%s'.\n", NAME, XDisplayName(display));
- exit(1);
- }
- _XA_GNUSTEP_WM_FUNC=XInternAtom(d_display, "_GNUSTEP_WM_FUNCTION", false);
- deleteWin=XInternAtom(d_display, "WM_DELETE_WINDOW", false);
-
- w_root=DefaultRootWindow(d_display);
-
- XWMHints wmhints;
- XSizeHints shints;
- shints.x=0;
- shints.y=0;
- shints.flags=0;
- bool pos=(XWMGeometry(d_display, DefaultScreen(d_display), position, NULL, 0, &shints, &shints.x, &shints.y,
- &shints.width, &shints.height, &shints.win_gravity) & (XValue | YValue));
- shints.min_width=winsize;
- shints.min_height=winsize;
- shints.max_width=winsize;
- shints.max_height=winsize;
- shints.base_width=winsize;
- shints.base_height=winsize;
- shints.flags=PMinSize | PMaxSize | PBaseSize;
-
- createWin(&w_main, shints.x, shints.y);
-
- if(wmaker || astep || pos)
- shints.flags |= USPosition;
- if(wmaker){
- wmhints.initial_state=WithdrawnState;
- wmhints.flags=WindowGroupHint | StateHint | IconWindowHint;
- createWin(&w_icon, shints.x, shints.y);
- w_activewin=w_icon;
- wmhints.icon_window=w_icon;
- }
- else{
- wmhints.initial_state=NormalState;
- wmhints.flags=WindowGroupHint | StateHint;
- w_activewin=w_main;
+void initXWin(int argc, char **argv){
+ int d_depth;
+ int screen;
+ int x_fd;
+ int dummy = 0;
+
+ XWMHints wmhints;
+ XSizeHints shints;
+ XClassHint classHint;
+ XTextProperty name;
+ char *wname = argv[0];
+ XGCValues gcv;
+ unsigned long gcm;
+
+ winsize=astep ? ASTEPSIZE : NORMSIZE;
+
+ if((d_display=XOpenDisplay(display))==NULL) {
+ fprintf(stderr,"%s : Unable to open X display '%s'.\n", NAME, XDisplayName(display));
+ exit(1);
+ }
+
+ screen = DefaultScreen(d_display);
+ w_root = RootWindow(d_display, screen);
+ d_depth = DefaultDepth(d_display, screen);
+ x_fd = XConnectionNumber(d_display);
+
+ _XA_GNUSTEP_WM_FUNC=XInternAtom(d_display, "_GNUSTEP_WM_FUNCTION", false);
+ deleteWin=XInternAtom(d_display, "WM_DELETE_WINDOW", false);
+
+ w_root = RootWindow(d_display, screen);
+
+ shints.x = 0;
+ shints.y = 0;
+ // shints.flags = USSize;
+ shints.flags = 0; // Gordon
+
+ back_pix = getColor("white");
+ fore_pix = getColor("black");
+
+ bool pos=(XWMGeometry(d_display, DefaultScreen(d_display), position, NULL, 0, &shints, &shints.x, &shints.y,
+ &shints.width, &shints.height, &dummy) & (XValue | YValue));
+ shints.min_width = winsize;
+ shints.min_height = winsize;
+ shints.max_width = winsize;
+ shints.max_height = winsize;
+ shints.base_width = winsize;
+ shints.base_height = winsize;
+ shints.width = winsize;
+ shints.height = winsize;
+ shints.flags=PMinSize | PMaxSize | PBaseSize; // Gordon
+
+
+ w_main = XCreateSimpleWindow(d_display, w_root, shints.x, shints.y,
+ shints.width, shints.height, 0, fore_pix, back_pix);
+
+ w_icon = XCreateSimpleWindow(d_display, w_root, shints.x, shints.y,
+ shints.width, shints.height, 0, fore_pix, back_pix);
+
+ XSetWMNormalHints(d_display, w_main, &shints);
+
+
+ wmhints.icon_x = shints.x;
+ wmhints.icon_y = shints.y;
+
+ if(wmaker || astep || pos)
+ shints.flags |= USPosition;
+
+ if(wmaker){
+ wmhints.initial_state = WithdrawnState;
+ wmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint;
+ wmhints.icon_window = w_icon;
+
+ wmhints.icon_x = shints.x;
+ wmhints.icon_y = shints.y;
+ wmhints.window_group = w_main;
+ } else {
+ wmhints.initial_state = NormalState;
+ wmhints.flags = WindowGroupHint | StateHint;
+ }
+
+ classHint.res_name=NAME;
+ classHint.res_class=CLASS;
+
+ XSetClassHint(d_display, w_main, &classHint);
+ XSetClassHint(d_display, w_icon, &classHint);
+
+
+ if (XStringListToTextProperty(&wname, 1, &name) == 0) {
+ fprintf(stderr, "%s: can't allocate window name\n", wname);
+ exit(1);
}
- wmhints.window_group=w_main;
- XSetWMHints(d_display, w_main, &wmhints);
- XSetWMNormalHints(d_display, w_main, &shints);
- XSetCommand(d_display, w_main, argv, argc);
- XStoreName(d_display, w_main, NAME);
- XSetIconName(d_display, w_main, NAME);
- XSetWMProtocols(d_display, w_activewin, &deleteWin, 1);
+
+ XSetWMName(d_display, w_main, &name);
+
+ gcm = GCForeground | GCBackground | GCGraphicsExposures;
+ gcv.graphics_exposures = 0;
+ gcv.foreground = fore_pix;
+ gcv.background = back_pix;
+ gc_gc=XCreateGC(d_display, w_root, gcm, &gcv);
+
+ XSetWMHints(d_display, w_main, &wmhints);
+
+ XSetCommand(d_display, w_main, argv, argc);
+
+ XSetWMProtocols(d_display, w_main, &deleteWin, 1); // Close
+
+ color[0]=mixColor(ledcolor, 0, backcolor, 100);
+ color[1]=mixColor(ledcolor, 100, backcolor, 0);
+ color[2]=mixColor(ledcolor, 60, backcolor, 40);
+ color[3]=mixColor(ledcolor, 25, backcolor, 75);
+
+ XpmAttributes xpmattr;
+ XpmColorSymbol xpmcsym[4]={{"back_color", NULL, color[0]},
+ {"led_color_high", NULL, color[1]},
+ {"led_color_med", NULL, color[2]},
+ {"led_color_low", NULL, color[3]}};
+ xpmattr.numsymbols = 4;
+ xpmattr.colorsymbols=xpmcsym;
+ xpmattr.exactColors=false;
+ xpmattr.closeness=40000;
+ xpmattr.valuemask=XpmColorSymbols | XpmExactColors | XpmCloseness;
+
+
+ XpmCreatePixmapFromData(d_display, w_root, wmmixer_xpm, &pm_main, &pm_mask, &xpmattr);
+ XpmCreatePixmapFromData(d_display, w_root, tile_xpm, &pm_tile, NULL, &xpmattr);
+ XpmCreatePixmapFromData(d_display, w_root, icons_xpm, &pm_icon, NULL, &xpmattr);
+ XpmCreatePixmapFromData(d_display, w_root, norec_xpm, &pm_nrec, NULL, &xpmattr);
+ pm_disp = XCreatePixmap(d_display, w_root, 64, 64, d_depth);
+
+ if(wmaker || ushape || astep) {
+ XShapeCombineMask(d_display, w_icon, ShapeBounding, winsize/2-32, winsize/2-32, pm_mask, ShapeSet);
+ XShapeCombineMask(d_display, w_main, ShapeBounding, winsize/2-32, winsize/2-32, pm_mask, ShapeSet);
+ } else {
+ XCopyArea(d_display, pm_tile, pm_disp, gc_gc, 0, 0, 64, 64, 0, 0);
+ }
+
+
+ XSetClipMask(d_display, gc_gc, pm_mask);
+ XCopyArea(d_display, pm_main, pm_disp, gc_gc, 0, 0, 64, 64, 0, 0);
+ XSetClipMask(d_display, gc_gc, None);
+
+ XStoreName(d_display, w_main, NAME);
+ XSetIconName(d_display, w_main, NAME);
}
void freeXWin(){
+ XFreeGC(d_display, gc_gc);
+ XFreePixmap(d_display, pm_main);
+ XFreePixmap(d_display, pm_tile);
+ XFreePixmap(d_display, pm_disp);
+ XFreePixmap(d_display, pm_mask);
+ XFreePixmap(d_display, pm_icon);
+ XFreePixmap(d_display, pm_nrec);
+
XDestroyWindow(d_display, w_main);
if(wmaker)
XDestroyWindow(d_display, w_icon);
@@ -331,7 +282,12 @@ void freeXWin(){
void createWin(Window *win, int x, int y){
XClassHint classHint;
- *win=XCreateSimpleWindow(d_display, w_root, x, y, winsize, winsize, 0, 0, 0);
+ if((*win=XCreateSimpleWindow(d_display, w_root, x, y, winsize, winsize, 0, back_pix, fore_pix)) == 0) {
+ fprintf(stderr,"Fail: XCreateSimpleWindow\n");
+ exit(-1);
+ }
+
+
classHint.res_name=NAME;
classHint.res_class=CLASS;
XSetClassHint(d_display, *win, &classHint);
@@ -364,68 +320,74 @@ unsigned long mixColor(char *colorname1, int prop1, char *colorname2, int prop2)
}
void scanArgs(int argc, char **argv){
- for(int i=1;i<argc;i++){
- if(strcmp(argv[i], "-h")==0 || strcmp(argv[i], "-help")==0 || strcmp(argv[i], "--help")==0){
- fprintf(stderr, "wmmixer - A mixer designed for WindowMaker\n05/09/98 Release 1.0 Beta1\n");
- fprintf(stderr, "Copyright (C) 1998 Sam Hawker <shawkie at geocities.com>\n");
- fprintf(stderr, "This software comes with ABSOLUTELY NO WARRANTY\n");
- fprintf(stderr, "This software is free software, and you are welcome to redistribute it\n");
- fprintf(stderr, "under certain conditions\n");
- fprintf(stderr, "See the README file for a more complete notice.\n\n");
- fprintf(stderr, "usage:\n\n %s [options]\n\noptions:\n\n",argv[0]);
- fprintf(stderr, " -h | -help | --help display this help screen\n");
- fprintf(stderr, " -w use WithdrawnState (for WindowMaker)\n");
- fprintf(stderr, " -s shaped window\n");
- fprintf(stderr, " -a use smaller window (for AfterStep Wharf)\n");
- fprintf(stderr, " -l led_color use the specified color for led display\n");
- fprintf(stderr, " -b back_color use the specified color for backgrounds\n");
- fprintf(stderr, " -d mix_device use specified device (rather than /dev/mixer)\n");
- fprintf(stderr, " -position position set window position (see X manual pages)\n");
- fprintf(stderr, " -display display select target display (see X manual pages)\n\n");
- exit(0);
- }
- if(strcmp(argv[i], "-w")==0)
- wmaker=!wmaker;
- if(strcmp(argv[i], "-s")==0)
- ushape=!ushape;
- if(strcmp(argv[i], "-a")==0)
- astep=!astep;
- if(strcmp(argv[i], "-d")==0){
- if(i<argc-1){
- i++;
- sprintf(mixdev, "%s", argv[i]);
- }
- continue;
- }
- if(strcmp(argv[i], "-l")==0){
- if(i<argc-1){
- i++;
- sprintf(ledcolor, "%s", argv[i]);
- }
- continue;
- }
- if(strcmp(argv[i], "-b")==0){
- if(i<argc-1){
- i++;
- sprintf(backcolor, "%s", argv[i]);
- }
- continue;
- }
- if(strcmp(argv[i], "-position")==0){
- if(i<argc-1){
- i++;
- sprintf(position, "%s", argv[i]);
- }
- continue;
- }
- if(strcmp(argv[i], "-display")==0){
- if(i<argc-1){
- i++;
- sprintf(display, "%s", argv[i]);
- }
- continue;
- }
- }
+ static struct option long_opts[] = {
+ {"help", 0, NULL, 'h'},
+ {"version", 0, NULL, 'v'},
+ {"display", 1, NULL, 'd'},
+ {"geometry", 1, NULL, 'g'},
+ {"withdrawn", 0, NULL, 'w'},
+ {"afterstep", 0, NULL, 'a'},
+ {"shaped", 0, NULL, 's'},
+ {"led-color", 1, NULL, 'l'},
+ {"back-color", 1, NULL, 'b'},
+ {"mix-device", 1, NULL, 'm'},
+ {"scrollwheel",1, NULL, 'r'},
+ {NULL, 0, NULL, 0 }};
+ int i, opt_index = 0;
+
+
+ // For backward compatibility
+ for(i=1; i<argc; i++) {
+ if(strcmp("-position", argv[i]) == 0) {
+ sprintf(argv[i], "%s", "-g");
+ } else if(strcmp("-help", argv[i]) == 0) {
+ sprintf(argv[i], "%s", "-h");
+ } else if(strcmp("-display", argv[i]) == 0) {
+ sprintf(argv[i], "%s", "-d");
+ }
+ }
+
+ while ((i = getopt_long(argc, argv, "hvd:g:wasl:b:m:r:", long_opts, &opt_index)) != -1) {
+ switch (i) {
+ case 'h':
+ case ':':
+ case '?':
+ usage(argv[0]);
+ break;
+ case 'v':
+ version();
+ break;
+ case 'd':
+ sprintf(display, "%s", optarg);
+ break;
+ case 'g':
+ sprintf(position, "%s", optarg);
+ break;
+ case 'w':
+ wmaker = 1;
+ break;
+ case 'a':
+ astep = 1;
+ break;
+ case 's':
+ ushape = 1;
+ break;
+ case 'l':
+ sprintf(ledcolor, "%s", optarg);
+ break;
+ case 'b':
+ sprintf(backcolor, "%s", optarg);
+ break;
+ case 'm':
+ sprintf(mixdev, "%s", optarg);
+ break;
+ case 'r':
+ if(atoi(optarg)>0)
+ wheel_scroll = atoi(optarg);
+ break;
+ }
+ }
+
}
void readFile(){
@@ -543,7 +505,7 @@ void checkVol(bool forced=true){
}
}
-void pressEvent(XButtonEvent *xev){
+void pressEvent(XButtonEvent *xev) {
int x=xev->x-(winsize/2-32);
int y=xev->y-(winsize/2-32);
if(x>=5 && y>=33 && x<=16 && y<=43){
@@ -566,16 +528,36 @@ void pressEvent(XButtonEvent *xev){
checkVol(true);
return;
}
- if(x>=37 && x<=56 && y>=8 && y<=56){
- int v=((60-y)*100)/(2*25);
- dragging=true;
- if(x<=50)
- mixctl->setLeft(channel[curchannel], v);
- if(x>=45)
- mixctl->setRight(channel[curchannel], v);
- mixctl->writeVol(channel[curchannel]);
- checkVol(false);
- return;
+ if(x>=37 && x<=56 && y>=8 && y<=56) {
+ int v = 0;
+ if(xev->button < 4) {
+ v = ((60-y)*100)/(2*25);
+ dragging=true;
+
+ } else if(xev->button == 4) {
+ if(x>50)
+ v = mixctl->readRight(channel[curchannel]) + wheel_scroll;
+ else if(x<45)
+ v = mixctl->readLeft(channel[curchannel]) + wheel_scroll;
+ else
+ v = (mixctl->readLeft(channel[curchannel]) + mixctl->readRight(channel[curchannel]))/2 + wheel_scroll;
+
+ } else if(xev->button == 5) {
+ if(x>50)
+ v = mixctl->readRight(channel[curchannel]) - wheel_scroll;
+ else if(x<45)
+ v = mixctl->readLeft(channel[curchannel]) - wheel_scroll;
+ else
+ v = (mixctl->readLeft(channel[curchannel]) + mixctl->readRight(channel[curchannel]))/2 - wheel_scroll;
+
+ }
+ if(x<=50)
+ mixctl->setLeft(channel[curchannel], v);
+ if(x>=45)
+ mixctl->setRight(channel[curchannel], v);
+ mixctl->writeVol(channel[curchannel]);
+ checkVol(false);
+ return;
}
if(x>=5 && y>=47 && x<=28 && y<=57){
mixctl->setRec(channel[curchannel], !mixctl->readRec(channel[curchannel], false));
@@ -607,58 +589,110 @@ void motionEvent(XMotionEvent *xev){
}
}
-void repaint(){
- XCopyArea(d_display, pm_disp, w_activewin, gc_gc, 0, 0, 64, 64, winsize/2-32, winsize/2-32);
- XEvent xev;
- while(XCheckTypedEvent(d_display, Expose, &xev));
+void repaint() {
+ flush_expose(w_icon);
+ XCopyArea(d_display, pm_disp, w_icon, gc_gc, 0, 0, 64, 64, winsize/2-32, winsize/2-32);
+ flush_expose(w_main);
+ XCopyArea(d_display, pm_disp, w_main, gc_gc, 0, 0, 64, 64, winsize/2-32, winsize/2-32);
+
+ XEvent xev;
+ while(XCheckTypedEvent(d_display, Expose, &xev));
}
-void update(){
- XCopyArea(d_display, pm_icon, pm_disp, gc_gc, icon[channel[curchannel]]*22, 0, 22, 22, 6, 5);
- drawLeft();
- drawRight();
- drawBtns(BTNREC);
+void update() {
+ if(wmaker || ushape || astep) {
+ XShapeCombineMask(d_display, w_icon, ShapeBounding, winsize/2-32, winsize/2-32, pm_mask, ShapeSet);
+ XShapeCombineMask(d_display, w_main, ShapeBounding, winsize/2-32, winsize/2-32, pm_mask, ShapeSet);
+ } else {
+ XCopyArea(d_display, pm_tile, pm_disp, gc_gc, 0, 0, 64, 64, 0, 0);
+ }
+
+ XSetClipMask(d_display, gc_gc, pm_mask);
+ XCopyArea(d_display, pm_main, pm_disp, gc_gc, 0, 0, 64, 64, 0, 0);
+ XSetClipMask(d_display, gc_gc, None);
+
+ XCopyArea(d_display, pm_icon, pm_disp, gc_gc, icon[channel[curchannel]]*22, 0, 22, 22, 6, 5);
+ drawLeft();
+ drawRight();
+ drawBtns(BTNREC | BTNNEXT | BTNPREV);
}
-void drawLeft(){
- XSetForeground(d_display, gc_gc, color[1]);
- for(int i=0;i<25;i++){
- if(i==(curleft*25)/100)
- XSetForeground(d_display, gc_gc, color[3]);
- XFillRectangle(d_display, pm_disp, gc_gc, 37, 55-2*i, 9, 1);
- }
+void drawLeft() {
+ XSetForeground(d_display, gc_gc, color[1]);
+ for(int i=0;i<25;i++){
+ if(i==(curleft*25)/100)
+ XSetForeground(d_display, gc_gc, color[3]);
+ XFillRectangle(d_display, pm_disp, gc_gc, 37, 55-2*i, 9, 1);
+ }
}
-void drawRight(){
- XSetForeground(d_display, gc_gc, color[1]);
- for(int i=0;i<25;i++){
- if(i==(curright*25)/100)
- XSetForeground(d_display, gc_gc, color[3]);
- XFillRectangle(d_display, pm_disp, gc_gc, 48, 55-2*i, 9, 1);
- }
+void drawRight() {
+ XSetForeground(d_display, gc_gc, color[1]);
+ for(int i=0;i<25;i++){
+ if(i==(curright*25)/100)
+ XSetForeground(d_display, gc_gc, color[3]);
+ XFillRectangle(d_display, pm_disp, gc_gc, 48, 55-2*i, 9, 1);
+ }
}
-void drawBtns(int btns){
- if(btns & BTNPREV)
- drawBtn(5, 33, 12, 11, (btnstate & BTNPREV));
- if(btns & BTNNEXT)
- drawBtn(17, 33, 12, 11, (btnstate & BTNNEXT));
- if(btns & BTNREC){
- drawBtn(5, 47, 24, 11, (btnstate & BTNREC));
- if(!curshowrec)
- XCopyArea(d_display, pm_nrec, pm_disp, gc_gc, 0, 0, 6, 7, 14, 49);
- else
- XCopyArea(d_display, pm_main, pm_disp, gc_gc, 14, 49, 6, 7, 14, 49);
- }
+void drawBtns(int btns) {
+ if(btns & BTNPREV)
+ drawBtn(5, 33, 12, 11, (btnstate & BTNPREV));
+ if(btns & BTNNEXT)
+ drawBtn(17, 33, 12, 11, (btnstate & BTNNEXT));
+ if(btns & BTNREC){
+ drawBtn(5, 47, 24, 11, (btnstate & BTNREC));
+ if(!curshowrec)
+ XCopyArea(d_display, pm_nrec, pm_disp, gc_gc, 0, 0, 6, 7, 14, 49);
+ else
+ XCopyArea(d_display, pm_main, pm_disp, gc_gc, 14, 49, 6, 7, 14, 49);
+ }
}
-void drawBtn(int x, int y, int w, int h, bool down){
- if(!down)
- XCopyArea(d_display, pm_main, pm_disp, gc_gc, x, y, w, h, x, y);
- else{
- XCopyArea(d_display, pm_main, pm_disp, gc_gc, x, y, 1, h-1, x+w-1, y+1);
- XCopyArea(d_display, pm_main, pm_disp, gc_gc, x+w-1, y+1, 1, h-1, x, y);
- XCopyArea(d_display, pm_main, pm_disp, gc_gc, x, y, w-1, 1, x+1, y+h-1);
- XCopyArea(d_display, pm_main, pm_disp, gc_gc, x+1, y+h-1, w-1, 1, x, y);
- }
+void drawBtn(int x, int y, int w, int h, bool down) {
+ if(!down)
+ XCopyArea(d_display, pm_main, pm_disp, gc_gc, x, y, w, h, x, y);
+ else {
+ XCopyArea(d_display, pm_main, pm_disp, gc_gc, x, y, 1, h-1, x+w-1, y+1);
+ XCopyArea(d_display, pm_main, pm_disp, gc_gc, x+w-1, y+1, 1, h-1, x, y);
+ XCopyArea(d_display, pm_main, pm_disp, gc_gc, x, y, w-1, 1, x+1, y+h-1);
+ XCopyArea(d_display, pm_main, pm_disp, gc_gc, x+1, y+h-1, w-1, 1, x, y);
+ }
}
+
+void usage(const char *name) {
+ printf("Usage: %s [options]\n", name);
+ printf(" -h, --help display this help screen\n");
+ printf(" -v, --version display program version\n");
+ printf(" -d, --display <string> display to use (see X manual pages)\n");
+ printf(" -g, --geometry +XPOS+YPOS geometry to use (see X manual pages)\n");
+ printf(" -w, --withdrawn run the application in withdrawn mode\n");
+ printf(" (for WindowMaker, etc)\n");
+ printf(" -a, --afterstep use smaller window (for AfterStep Wharf)\n");
+ printf(" -s, --shaped shaped window\n");
+ printf(" -l, --led-color <string> use the specified color for led display\n");
+ printf(" -b, --back-color <string> use the specified color for backgrounds\n");
+ printf(" -m, --mix-device use specified device (rather than /dev/mixer)\n");
+ printf(" -r, --scrollwheel <number> volume increase/decrease with mouse wheel (default: 2)\n");
+ printf("\nFor backward compatibility the following obsolete options are still supported:\n");
+ printf(" -help display this help screen\n");
+ printf(" -position geometry to use (see X manual pages)\n");
+ printf(" -display display to use (see X manual pages)\n");
+ exit(0);
+}
+
+void version() {
+ printf("wmmixer version 1.0\n");
+ exit(0);
+}
+
+static int flush_expose(Window w) {
+ XEvent dummy;
+ int i=0;
+
+ while (XCheckTypedWindowEvent(d_display, w, Expose, &dummy))
+ i++;
+
+ return i;
+}
+
diff --git a/wmmixer.h b/wmmixer.h
new file mode 100644
index 0000000..a95a2bb
--- /dev/null
+++ b/wmmixer.h
@@ -0,0 +1,158 @@
+// wmmixer - A mixer designed for WindowMaker
+// 05/09/98 Release 1.0 Beta1
+// Copyright (C) 1998 Sam Hawker <shawkie at geocities.com>
+// This software comes with ABSOLUTELY NO WARRANTY
+// This software is free software, and you are welcome to redistribute it
+// under certain conditions
+// See the README file for a more complete notice.
+
+// 02/04/02 Gordon Fraser <gordon at debian.org>
+// * GNU getopt
+// * Mousewheel support
+// * X handling rewrite
+
+
+// Defines, includes and global variables
+// --------------------------------------
+
+// User defines - standard
+#define WINDOWMAKER false
+#define USESHAPE false
+#define AFTERSTEP false
+#define NORMSIZE 64
+#define ASTEPSIZE 56
+#define NAME "wmmixer"
+#define CLASS "WMMixer"
+
+// User defines - custom
+#define MIXERDEV "/dev/mixer"
+#define BACKCOLOR "#282828"
+#define LEDCOLOR "green"
+
+// Includes - standard
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <getopt.h>
+
+// Includes - custom
+#include "mixctl.h"
+
+// X-Windows includes - standard
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xproto.h>
+#include <X11/xpm.h>
+#include <X11/extensions/shape.h>
+
+// Pixmaps - standard
+Pixmap pm_main;
+Pixmap pm_tile;
+Pixmap pm_disp;
+Pixmap pm_mask;
+
+// Pixmaps - custom
+Pixmap pm_icon;
+Pixmap pm_nrec;
+
+// Xpm images - standard
+#include "XPM/wmmixer.xpm"
+#include "XPM/tile.xpm"
+
+// Xpm images - custom
+#include "XPM/icons.xpm"
+#include "XPM/norec.xpm"
+
+// Variables for command-line arguments - standard
+bool wmaker=WINDOWMAKER;
+bool ushape=USESHAPE;
+bool astep=AFTERSTEP;
+char display[256]="";
+char position[256]="";
+int winsize;
+
+// Variables for command-line arguments - custom
+char mixdev[256]=MIXERDEV;
+char backcolor[256]=BACKCOLOR;
+char ledcolor[256]=LEDCOLOR;
+
+// X-Windows basics - standard
+Atom _XA_GNUSTEP_WM_FUNC;
+Atom deleteWin;
+Display *d_display;
+Window w_icon;
+Window w_main;
+Window w_root;
+
+// X-Windows basics - custom
+GC gc_gc;
+unsigned long color[4];
+
+
+// Misc custom global variables
+// ----------------------------
+
+// Current state information
+int curchannel=0;
+bool curshowrec;
+bool currec;
+int curleft;
+int curright;
+
+// For buttons
+int btnstate=0;
+#define BTNNEXT 1
+#define BTNPREV 2
+#define BTNREC 4
+
+// For repeating next and prev buttons
+#define RPTINTERVAL 5
+int rpttimer=0;
+
+// For draggable volume control
+bool dragging=false;
+
+int channels=0;
+int *channel;
+int *icon;
+
+MixCtl *mixctl;
+
+Pixel back_pix;
+Pixel fore_pix;
+
+// Default scroll amount
+int wheel_scroll = 2;
+
+
+// Procedures and functions
+// ------------------------
+
+// Procedures and functions - standard
+void initXWin(int argc, char **argv);
+void freeXWin();
+void createWin(Window *win, int x, int y);
+unsigned long getColor(char *colorname);
+unsigned long mixColor(char *colorname1, int prop1, char *colorname2, int prop2);
+
+// Procedures and functions - custom
+void scanArgs(int argc, char **argv);
+void readFile();
+void checkVol(bool forced=true);
+void pressEvent(XButtonEvent *xev);
+void releaseEvent(XButtonEvent *xev);
+void motionEvent(XMotionEvent *xev);
+void repaint();
+void update();
+void drawLeft();
+void drawRight();
+void drawBtns(int btns);
+void drawBtn(int x, int y, int w, int h, bool down);
+void initialize_icon(int num);
+static int flush_expose(Window w);
+void version(void);
+void usage(const char *);
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmmixer.git
More information about the Pkg-wmaker-commits
mailing list