[Pkg-wmaker-commits] [wmmixer] 04/24: Import Upstream version 1.0beta1

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 4f0f87759c9b350f6d5371cbb39a844a825d838f
Author: Doug Torrance <dtorrance at piedmont.edu>
Date:   Sun Aug 27 09:11:14 2017 -0400

    Import Upstream version 1.0beta1
---
 .wmmixer                       |  74 ----
 FAQ                            |  31 --
 Imakefile                      |   8 +-
 README                         | 147 +++++---
 XPM/{symbols.xpm => icons.xpm} |   2 +-
 XPM/wmmixer.xpm                | 122 +++----
 home.wmmixer                   |  69 ++++
 mixctl.h                       |  33 +-
 wmmixer.cc                     | 759 +++++++++++++++++++++++------------------
 9 files changed, 668 insertions(+), 577 deletions(-)

diff --git a/.wmmixer b/.wmmixer
deleted file mode 100644
index 07825f9..0000000
--- a/.wmmixer
+++ /dev/null
@@ -1,74 +0,0 @@
-# wmmixer - a mixer designed for WindowMaker
-# 07/05/98  Release 0.8
-# 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.
-
-# User config file. Should be placed in ~/
-# Comments and blank lines mostly allowed
-
-# The format of this file is a series of commands:
-
-# addchannel %i
-#    adds a channel to the sequence. %i specifies a channel.
-#    these are the values from my <linux/soundcard.h>:
-#       SOUND_MIXER_VOLUME    0
-#       SOUND_MIXER_BASS      1
-#       SOUND_MIXER_TREBLE    2
-#       SOUND_MIXER_SYNTH     3
-#       SOUND_MIXER_PCM       4
-#       SOUND_MIXER_SPEAKER   5
-#       SOUND_MIXER_LINE      6
-#       SOUND_MIXER_MIC       7
-#       SOUND_MIXER_CD        8
-#    there are a few more, but these are the important ones (and are
-#    those identified with appropriate symbols)
-
-# setmono %i
-#    only valid at some point after an addchannel command.
-#    sets both left and right volumes for the last channel added.
-#    the channel may be mono or stereo.
-#    the value specified must be an integer in the range 0 to 100
-
-# setleft %i
-#    only valid at some point after an addchannel command.
-#    sets left volume for the last channel added.
-#    do not use on a mono channel.
-#    the value specified must be an integer in the range 0 to 100
-
-# setright %i
-#    only valid at some point after an addchannel command.
-#    sets right volume for the last channel added.
-#    do not use on a mono channel.
-#    the value specified must be an integer in the range 0 to 100
-
-# setrecsrc TRUE | FALSE
-#    only valid at some point after an addchannel command.
-#    enable or disable recording from the last channel added.
-#    ignored if the channel does not support it.
-#    the value is "TRUE" or "FALSE"
-#
-#    (setrecsrc entries are used to build a complete recsrc mask
-#    and a single instruction then sent to the mixer device, so
-#    order of entries is unimportant)
-
-# At least one channel must be added!
-
-addchannel 0
-
-addchannel 3
-
-addchannel 4
-
-addchannel 6
-
-addchannel 7
-
-addchannel 8
-
-
-
-
-
diff --git a/FAQ b/FAQ
deleted file mode 100644
index f0ed8bb..0000000
--- a/FAQ
+++ /dev/null
@@ -1,31 +0,0 @@
-wmmixer - a mixer designed for WindowMaker
-07/05/98  Release 0.8
-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.
-
-If this FAQ does not answer your question, or the suggested solution does
-not work, or cannot be implemented, please, email me.
-
-
-Frequently Asked Questions
-==========================
-
-   How do I make wmmount use it's application icon as it's window?
-      Start wmmixer with the "-w" command line option.
-
-   Why does wmmixer still not sit properly in Afterstep's Wharf?
-      Because the Wharf does not allow windows to use the full 64x64 pixels
-      which wmmixer needs.
-
-
-
-
-
-
-
-
-
-
diff --git a/Imakefile b/Imakefile
index aec76e6..45426d2 100644
--- a/Imakefile
+++ b/Imakefile
@@ -1,12 +1,10 @@
-XPMLIB = -lXpm
-DEPLIBS = $(DEPXLIB) 
-
-OSSAUDIO =
-
 #ifdef NetBSDArchitecture
 OSSAUDIO = -lossaudio
+#else
+OSSAUDIO =
 #endif
 
+DEPLIBS = $(DEPXLIB) 
 LOCAL_LIBRARIES = $(XPMLIB) $(XLIB) $(OSSAUDIO)
 
 SRCS = wmmixer.cc
diff --git a/README b/README
index cf29017..9a28c00 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
-wmmixer - a mixer designed for WindowMaker
-07/05/98  Release 0.8
+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
@@ -24,7 +24,8 @@ See the COPYING file for details.
 THE AUTHOR:
 ===========
 
-Sam Hawker
+Sam Hawker (17/m/uk)
+
 shawkie at geocities.com
 http://www.geocities.com/SiliconValley/Vista/2471/
 
@@ -36,66 +37,124 @@ xmkmf
 make
 strip wmmixer
 make install
-cp .wmmixer ~/.wmmixer      (if you like. this file is very optional)
+
+
+CONFIGURATION:
+==============
+
+Users can configure wmmixer to suit their requirements by means of a ~/.wmmixer
+file. A commented example is supplied, and would be a good starting point.
+
+cp home.wmmixer ~/.wmmixer
 
 
 USAGE:
 ======
 
-wmmixer is based on the same interface used in my wmcdplay and wmmount programs.
-it uses my own mixer control class (see mixctl.h)
+You can access all the channels on your soundcard's mixer with wmmixer. 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.
+
+
+AFTERSTEP USERS:
+================
+(thanks to tygris at erols.com)
+
+This release includes in a new command line option.
+The effect this has is to enable shape support (it implies "-s"), and
+to reduce the size of the window to 56x56 pixels.
+The "-position position" option has also been added, so you can push
+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 &
+
+It is also possible (by editing and recompiling the afterstep sources),
+to make Wharf handle the new 56x56 pixel window properly - yes, I add
+an option to use a 56x56 pixel window, even though the AfterStep Wharf
+really wants 55x57 pixel ones.
+
+I am told (by tygris at erols.com):
+
+"Locate Wharf.c (or is it Wharf.cc?)  Should be in
+AfterStep-1.0/modules/Wharf.  Locate this:
+
+            if (Buttons[button].maxsize) {
+              Buttons[button].icons[0].w = 55;
+              Buttons[button].icons[0].h = 57;
+            }
+
+and change the 55 and 57 to 56's.  Save and compile."
+
+
+BUILD PROBLEMS:
+===============
 
-it controls all mixer channels (in stereo and with recsrc button where
-appropriate), although only a few will be identified with an icon.
+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:
 
-it can now be configured to control/show only specific channels, through a
-~/.wmmixer file.
+CC = c++
 
-click on the "<" and ">" buttons to select a different device/channel
-the icon identifies the current device (a volume symbol
-with a question mark represents an unknown device - commonly igain/ogain)
-click / drag the volume display to set channel volume.
-there is a also a button to set recording sources
+I am not sure of the effect this has on memory usage, etc.
 
-what else can i say, enjoy!
 
 RELEASE HISTORY:
 ================
 
-release 0.1    07/02/98   Finally reached a state i am prepared to put my
+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.2    12/02/98   Fixed nasty memory hole.
 
-release 0.3    24/02/98   Fixed bug relating to manual window positioning
+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.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
+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
+                          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
\ No newline at end of file
+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/XPM/symbols.xpm b/XPM/icons.xpm
similarity index 99%
rename from XPM/symbols.xpm
rename to XPM/icons.xpm
index dcda9c9..d34aac7 100644
--- a/XPM/symbols.xpm
+++ b/XPM/icons.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * symbols_xpm[] = {
+static char * icons_xpm[] = {
 "220 22 4 1",
 " 	c #282828 s back_color",
 ".	c #00ffff s led_color_high",
diff --git a/XPM/wmmixer.xpm b/XPM/wmmixer.xpm
index 8effca6..537436c 100644
--- a/XPM/wmmixer.xpm
+++ b/XPM/wmmixer.xpm
@@ -2,71 +2,71 @@
 static char * wmmixer_xpm[] = {
 "64 64 7 1",
 " 	c None",
-".	c #000000",
-"X	c #282828 s back_color",
-"o	c #C7C3C7",
-"O	c #F7F3FF",
-"+	c #86828E",
-"@	c #AEAAAE",
+".	c #000000000000",
+"X	c #AEBAAAAAAEBA",
+"o	c #28A228A228A2 s back_color",
+"O	c #208120812081",
+"+	c #F7DEF3CEFFFF",
+"@	c #861782078E38",
 "                                                                ",
 "                                                                ",
 "                                                                ",
 "                                                                ",
-"    ..........................     .........................    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .XXXXXXXXXXXXXXXXXXXXXXXXo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    oooooooooooooooooooooooooo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"                                   .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"                                   .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"                                   .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"                                   .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    ..........................     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .OOOOOOOOOOO+OOOOOOOOOOO+o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@@@@@@@@.O@@@@@@@@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@@@@.@@@.O@@@.@@@@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@@@..@@@.O@@@..@@@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@@...@@@.O@@@...@@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@....@@@.O@@@....@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@@...@@@.O@@@...@@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@@@..@@@.O@@@..@@@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@@@@.@@@.O@@@.@@@@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@@@@@@@@.O@@@@@@@@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .+...........+...........o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    oooooooooooooooooooooooooo     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"                                   .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    ..........................     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .OOOOOOOOOOOOOOOOOOOOOOO+o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@@@@@@@@@@@@@@@@@@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@@@@@@@@@@@.@@@@@@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@@@@@@@... at .@@@@@@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@@@@@@.. at ...@@@@@@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@@@@@@.@@@..@@@@@@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@@@@@@.. at ...@@@@@@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@@@@@@@... at .@@@@@@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@@@@@@@@@@@.@@@@@@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .O@@@@@@@@@@@@@@@@@@@@@@.o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    .+.......................o     .XXXXXXXXXXXXXXXXXXXXXXXo    ",
-"    oooooooooooooooooooooooooo     ooooooooooooooooooooooooo    ",
+"    .........................X     ........................X    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .OooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    .ooooooooooooooooooooooooX     .oooooooooooooooooooooooX    ",
+"    XXXXXXXXXXXXXXXXXXXXXXXXXX     .oooooooooooooooooooooooX    ",
+"                                   .oooooooooooooooooooooooX    ",
+"                                   .oooooooooooooooooooooooX    ",
+"                                   .oooooooooooooooooooooooX    ",
+"                                   .oooooooooooooooooooooooX    ",
+"    ..........................     .oooooooooooooooooooooooX    ",
+"    .+++++++++++ at +++++++++++@X     .oooooooooooooooooooooooX    ",
+"    .+XXXXXXXXXX.+XXXXXXXXXX.X     .OooooooooooooooooooooooX    ",
+"    .+XXXXXX.XXX.+XXX.XXXXXX.X     .OooooooooooooooooooooooX    ",
+"    .+XXXXX..XXX.+XXX..XXXXX.X     .OooooooooooooooooooooooX    ",
+"    .+XXXX...XXX.+XXX...XXXX.X     .oooooooooooooooooooooooX    ",
+"    .+XXX....XXX.+XXX....XXX.X     .oooooooooooooooooooooooX    ",
+"    .+XXXX...XXX.+XXX...XXXX.X     .oooooooooooooooooooooooX    ",
+"    .+XXXXX..XXX.+XXX..XXXXX.X     .oooooooooooooooooooooooX    ",
+"    .+XXXXXX.XXX.+XXX.XXXXXX.X     .oooooooooooooooooooooooX    ",
+"    .+XXXXXXXXXX.+XXXXXXXXXX.X     .oooooooooooooooooooooooX    ",
+"    . at ...........@...........X     .oooooooooooooooooooooooX    ",
+"    XXXXXXXXXXXXXXXXXXXXXXXXXX     .oooooooooooooooooooooooX    ",
+"                                   .oooooooooooooooooooooooX    ",
+"    ..........................     .oooooooooooooooooooooooX    ",
+"    .+++++++++++++++++++++++ at X     .oooooooooooooooooooooooX    ",
+"    .+XXXXXXXXXXXXXXXXXXXXXX.X     .oooooooooooooooooooooooX    ",
+"    .+XXXXXXXXXXXXX.XXXXXXXX.X     .oooooooooooooooooooooooX    ",
+"    .+XXXXXXXXX...X.XXXXXXXX.X     .oooooooooooooooooooooooX    ",
+"    .+XXXXXXXX..X...XXXXXXXX.X     .oooooooooooooooooooooooX    ",
+"    .+XXXXXXXX.XXX..XXXXXXXX.X     .oooooooooooooooooooooooX    ",
+"    .+XXXXXXXX..X...XXXXXXXX.X     .oooooooooooooooooooooooX    ",
+"    .+XXXXXXXXX...X.XXXXXXXX.X     .oooooooooooooooooooooooX    ",
+"    .+XXXXXXXXXXXXX.XXXXXXXX.X     .oooooooooooooooooooooooX    ",
+"    .+XXXXXXXXXXXXXXXXXXXXXX.X     .oooooooooooooooooooooooX    ",
+"    . at .......................X     .oooooooooooooooooooooooX    ",
+"    XXXXXXXXXXXXXXXXXXXXXXXXXX     XXXXXXXXXXXXXXXXXXXXXXXXX    ",
 "                                                                ",
 "                                                                ",
 "                                                                ",
diff --git a/home.wmmixer b/home.wmmixer
new file mode 100644
index 0000000..9bb2d46
--- /dev/null
+++ b/home.wmmixer
@@ -0,0 +1,69 @@
+# 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.
+
+# User config file
+# Should be saved as ~/.wmmixer
+# Comments and blank lines mostly allowed
+
+# The format of this file is a series of commands:
+
+# addchannel %i
+#    Adds a channel to the sequence. %i specifies a channel.
+#    These are the values from my <linux/soundcard.h>:
+#       SOUND_MIXER_VOLUME    0
+#       SOUND_MIXER_BASS      1
+#       SOUND_MIXER_TREBLE    2
+#       SOUND_MIXER_SYNTH     3
+#       SOUND_MIXER_PCM       4
+#       SOUND_MIXER_SPEAKER   5
+#       SOUND_MIXER_LINE      6
+#       SOUND_MIXER_MIC       7
+#       SOUND_MIXER_CD        8
+#    There are a few more, but these are the important ones (and are
+#    those identified with appropriate icons).
+#    Ths channel added becomes the current channel for subsequent
+#    setmono, setleft, setright and setrecsrc commands.
+
+# setchannel %i
+#    Similar to addchannel, except the channel is not actually added
+#    to the sequence, merely made the current channel for subsequent
+#    setmono, setleft, setright and setrecsrc commands.
+
+# setmono %i
+#    Sets both left and right volumes for the current channel.
+#    The channel may be mono or stereo.
+#    The value specified must be an integer in the range 0 to 100.
+
+# setleft %i
+#    Sets left volume for the current channel.
+#    Do not use on a mono channel.
+#    The value specified must be an integer in the range 0 to 100.
+
+# setright %i
+#    Sets right volume for the current channel.
+#    Do not use on a mono channel.
+#    The value specified must be an integer in the range 0 to 100.
+
+# setrecsrc TRUE | FALSE
+#    Enable or disable recording from the current channel.
+#    Ignored if the channel does not support it.
+#    The value is TRUE or FALSE.
+
+# At least one channel must be added!
+
+addchannel 0
+
+addchannel 3
+
+addchannel 4
+
+addchannel 6
+
+addchannel 7
+
+addchannel 8
diff --git a/mixctl.h b/mixctl.h
index d56b2f7..6530460 100644
--- a/mixctl.h
+++ b/mixctl.h
@@ -1,5 +1,5 @@
-// mixctl.h - defines MixCtl class to provide easy control of audio mixer functions.
-// 07/05/98  Release 0.5
+// mixctl.h - MixCtl class provides control of audio mixer functions
+// 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
@@ -15,7 +15,6 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <malloc.h>
 #ifdef __NetBSD__
 #include <soundcard.h>
 #endif
@@ -26,18 +25,13 @@
 #include <linux/soundcard.h>
 #endif
 
-#ifndef TRUE
-#define FALSE 0
-#define TRUE 1
-#endif
-
 class MixCtl
 {
 public:
    MixCtl(char *dname){
       device=(char *)malloc(sizeof(char)*(strlen(dname)+1));
       strcpy(device,dname);
-      if(mixfdopen=(mixfd=open(device,O_NONBLOCK))!=-1){
+      if(mixfdopen=(mixfd=open(device,O_RDONLY | O_NONBLOCK))!=-1){
          nrdevices=SOUND_MIXER_NRDEVICES;
          char *devnames[]=SOUND_DEVICE_NAMES;
          char *devlabels[]=SOUND_DEVICE_LABELS;
@@ -66,6 +60,9 @@ public:
          close(mixfd);
       }
    }
+   bool openOK(){
+      return mixfdopen;
+   }
    void doStatus(){
       ioctl(mixfd, SOUND_MIXER_READ_RECSRC, &recsrc);
       for(int i=0;i<nrdevices;i++){
@@ -198,21 +195,3 @@ private:
    int recsrc;          // devices which are being recorded from
    struct MixDev *mixdevs;
 };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/wmmixer.cc b/wmmixer.cc
index 24103bf..d3be080 100644
--- a/wmmixer.cc
+++ b/wmmixer.cc
@@ -1,25 +1,39 @@
-// wmmixer - a mixer designed for WindowMaker
-// 07/05/98  Release 0.8
+// 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.
 
-#define WINDOWMAKER FALSE
-#define USESHAPE FALSE
-#define NAME "wmmixer"
-#define CLASS "WMMixer"
 
-#define DEFAULTDEVICE "/dev/mixer"
-#define BACKCOLOR "#282828"
-#define LEDCOLOR "green"
+// 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>
@@ -27,73 +41,95 @@
 #include <X11/xpm.h>
 #include <X11/extensions/shape.h>
 
-#include "mixctl.h"
+// Pixmaps - standard
+Pixmap pm_main;
+Pixmap pm_tile;
+Pixmap pm_disp;
+Pixmap pm_mask;
 
-Pixmap back;
-Pixmap tile;
-Pixmap disp;
-Pixmap mask;
-Pixmap symb;
-Pixmap nrec;
-
-unsigned long fcolor,bcolor;
+// Pixmaps - custom
+Pixmap pm_icon;
+Pixmap pm_nrec;
 
+// Xpm images - standard
 #include "XPM/wmmixer.xpm"
 #include "XPM/tile.xpm"
-#include "XPM/symbols.xpm"
+
+// Xpm images - custom
+#include "XPM/icons.xpm"
 #include "XPM/norec.xpm"
 
-bool wmaker = WINDOWMAKER;
-bool ushape = USESHAPE;
-char txtdpy[256] = "";
-char txtdev[256] = DEFAULTDEVICE;
-char ledcol[256] = LEDCOLOR;
-char bckcol[256] = BACKCOLOR;
+// 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];
 
-Display *dpy;
-Window Win[2];
-Window Root;
-XWMHints *hints;
-GC WinGC;
-int activeWin;
 
-int curDev=0;
-int curShowRec;
-int curRec;
-int curLeft;
-int curRight;
+// Misc custom global variables 
+// ----------------------------
 
-// For new buttons
+// 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
+#define BTNNEXT  1
+#define BTNPREV  2
+#define BTNREC   4
 
-// With repeat next/prev if you hold down mouse button
-#define btnrepeat 5
-int btntimer=0;
+// For repeating next and prev buttons
+#define RPTINTERVAL   5
+int rpttimer=0;
 
-int Channels=0;
-int Channel[20];
-int sympic[20]={0,7,8,2,1,6,4,5,3,9,9,9,9,9,9,9,9,9,9,9};
+// For draggable volume control
+bool dragging=false;
 
-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;
 
-// Standard dock-app stuff
-void initXWin(int argc, char *argv[]);
+
+// Procedures and functions
+// ------------------------
+
+// Procedures and functions - standard
+void initXWin(int argc, char **argv);
 void freeXWin();
-void createWin(Window *win);
-unsigned long getColor(char *colorName, float dim);
+void createWin(Window *win, int x, int y);
+unsigned long getColor(char *colorname);
+unsigned long mixColor(char *colorname1, int prop1, char *colorname2, int prop2);
 
-// Custom dock-app stuff
-void scanArgs(int argc, char *argv[]);
+// Procedures and functions - custom
+void scanArgs(int argc, char **argv);
 void readFile();
-void checkVol(bool forced=TRUE);
+void checkVol(bool forced=true);
 void pressEvent(XButtonEvent *xev);
 void releaseEvent(XButtonEvent *xev);
 void motionEvent(XMotionEvent *xev);
@@ -104,251 +140,288 @@ void drawRight();
 void drawBtns(int btns);
 void drawBtn(int x, int y, int w, int h, bool down);
 
-int main(int argc,char *argv[])
+
+// Implementation
+// --------------
+
+int main(int argc, char **argv)
 {
-   scanArgs(argc,argv);
-   initXWin(argc,argv);
+   scanArgs(argc, argv);
+   initXWin(argc, argv);
 
    XGCValues gcv;
    unsigned long gcm;
-   gcm = GCForeground|GCBackground|GCGraphicsExposures;
-   gcv.graphics_exposures = False;
-   WinGC = XCreateGC(dpy, Root, gcm, &gcv);
-
-   XpmAttributes pixatt;
-   XpmColorSymbol ledcols[4]={{"led_color_high", NULL, 0},
-                              {"led_color_med",  NULL, 0},
-                              {"led_color_low",  NULL, 0},
-                              {"back_color",     NULL, 0}};
-   ledcols[0].pixel=getColor(ledcol, 1.00);
-   ledcols[1].pixel=getColor(ledcol, 1.65);
-   ledcols[2].pixel=getColor(ledcol, 2.60);
-   ledcols[3].pixel=getColor(bckcol, 1.00);
-   pixatt.numsymbols=4;
-   pixatt.colorsymbols=ledcols;
-   pixatt.exactColors=FALSE;
-   pixatt.closeness=40000;
-   pixatt.valuemask=XpmColorSymbols | XpmExactColors | XpmCloseness;
-   XpmCreatePixmapFromData(dpy, Root, wmmixer_xpm, &back, &mask, &pixatt);
-   XpmCreatePixmapFromData(dpy, Root, tile_xpm, &tile, NULL, &pixatt);
-   XpmCreatePixmapFromData(dpy, Root, symbols_xpm, &symb, NULL, &pixatt);
-   XpmCreatePixmapFromData(dpy, Root, norec_xpm, &nrec, NULL, &pixatt);
-   disp = XCreatePixmap(dpy, Root, 64, 64, DefaultDepth(dpy,DefaultScreen(dpy)));
-
-   fcolor=ledcols[0].pixel;
-   bcolor=ledcols[2].pixel;
-
-   // Install mask or copy background tile
-   if(wmaker || ushape)
-      XShapeCombineMask(dpy, Win[activeWin], ShapeBounding, 0, 0, mask, ShapeSet);
+   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(dpy, tile, disp, WinGC, 0,0,64,64,0,0);
+      XCopyArea(d_display, pm_tile, pm_disp, gc_gc, 0, 0, 64, 64, 0, 0);
 
-   // Copy background
-   XSetClipMask(dpy, WinGC, mask);
-   XCopyArea(dpy, back, disp, WinGC, 0,0,64,64,0,0);
-   XSetClipMask(dpy, WinGC, None);
+   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(txtdev);
+   mixctl=new MixCtl(mixdev);
 
-   for(int i=0;i<mixctl->getNrDevices();i++){
-      if(mixctl->getSupport(i)){
-         Channel[Channels]=i;
-         Channels++;
+   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++;
+         }
       }
    }
 
    readFile();
 
-   if(Channels==0)
-      fprintf(stderr,"Sorry, no supported channels found\n");
+   if(channels==0)
+      fprintf(stderr,"%s : Sorry, no supported channels found.\n", NAME);
    else{
-      checkVol(TRUE);
+      checkVol(true);
 
-      XEvent event;
-      XSelectInput(dpy, Win[activeWin], ExposureMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask);
-      XMapWindow(dpy, Win[0]);
+      XEvent xev;
+      XSelectInput(d_display, w_activewin, ExposureMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask);
+      XMapWindow(d_display, w_main);
 
-      bool finished=FALSE;
-      while(!finished){
-         while(XPending(dpy)){
-            XNextEvent(dpy,&event);
-            switch(event.type){
+      bool done=false;
+      while(!done){
+         while(XPending(d_display)){
+            XNextEvent(d_display, &xev);
+            switch(xev.type){
              case Expose:
                 repaint();
              break;
              case ButtonPress:
-                pressEvent(&event.xbutton);
+                pressEvent(&xev.xbutton);
              break;
              case ButtonRelease:
-                releaseEvent(&event.xbutton);
+                releaseEvent(&xev.xbutton);
              break;
              case MotionNotify:
-                motionEvent(&event.xmotion);
+                motionEvent(&xev.xmotion);
              break;
              case ClientMessage:
-                if(event.xclient.data.l[0]==deleteWin)
-                   finished=TRUE;
+                if(xev.xclient.data.l[0]==deleteWin)
+                   done=true;
              break;
             }
          }
 
-         // Repeat next/prev
-         if(btnstate & (btnPrev | btnNext)){
-            btntimer++;
-            if(btntimer>=btnrepeat){
-               if(btnstate & btnNext)
-                  curDev++;
+         if(btnstate & (BTNPREV | BTNNEXT)){
+            rpttimer++;
+            if(rpttimer>=RPTINTERVAL){
+               if(btnstate & BTNNEXT)
+                  curchannel++;
                else
-                  curDev--;
-               if(curDev<0)
-                  curDev=Channels-1;
-               if(curDev>=Channels)
-                  curDev=0;
-               checkVol(TRUE);      // forced because of changed mount point
-               btntimer=0;
+                  curchannel--;
+               if(curchannel<0)
+                  curchannel=channels-1;
+               if(curchannel>=channels)
+                  curchannel=0;
+               checkVol(true);
+               rpttimer=0;
             }
          }
-         else{
-            // Check volume, and update as needed
-            checkVol(FALSE);
-         }
-         XFlush(dpy);
-         usleep(50000L);
+         else
+            checkVol(false);
+         XFlush(d_display);
+         usleep(50000);
       }
    }
-   XFreeGC(dpy, WinGC);
-   XFreePixmap(dpy, disp);
-   XFreePixmap(dpy, mask);
-   XFreePixmap(dpy, back);
-   XFreePixmap(dpy, tile);
-   XFreePixmap(dpy, symb);
-   XFreePixmap(dpy, nrec);
+   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;
 }
 
-void initXWin(int argc, char *argv[]){
-   if((dpy=XOpenDisplay(txtdpy))==NULL){
-      fprintf(stderr,"You're probably trying to run an X app from the console, you idiot! RTFM\n");
+void initXWin(int argc, char **argv){
+   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);
    }
-   _XA_GNUSTEP_WM_FUNC = XInternAtom(dpy, "_GNUSTEP_WM_FUNCTION", False);
-   deleteWin = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
-   Root=DefaultRootWindow(dpy);
-   createWin(&Win[0]);
-   createWin(&Win[1]);
-   XWMHints hints;
+   _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;
-   hints.window_group = Win[0];
-   shints.min_width=64;
-   shints.min_height=64;
-   shints.max_width=64;
-   shints.max_height=64;
    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){
-      hints.initial_state = WithdrawnState;
-      hints.icon_window = Win[1];
-      hints.flags = WindowGroupHint | StateHint | IconWindowHint;
-      shints.flags = PMinSize | PMaxSize | PPosition;
-      activeWin=1;
+      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{
-      hints.initial_state = NormalState;
-      hints.flags = WindowGroupHint | StateHint;
-      shints.flags = PMinSize | PMaxSize;
-      activeWin=0;
+      wmhints.initial_state=NormalState;
+      wmhints.flags=WindowGroupHint | StateHint;
+      w_activewin=w_main;
    }
-   XSetWMHints(dpy, Win[0], &hints);
-   XSetWMNormalHints(dpy, Win[0], &shints);
-   XSetCommand(dpy, Win[0], argv, argc);
-   XStoreName(dpy, Win[0], NAME);
-   XSetIconName(dpy, Win[0], NAME);
-   XSetWMProtocols(dpy, Win[activeWin], &deleteWin, 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);
 }
 
 void freeXWin(){
-   XDestroyWindow(dpy, Win[0]);
-   XDestroyWindow(dpy, Win[1]);
-   XCloseDisplay(dpy);
+   XDestroyWindow(d_display, w_main);
+   if(wmaker)
+      XDestroyWindow(d_display, w_icon);
+   XCloseDisplay(d_display);
 }
 
-void createWin(Window *win){
+void createWin(Window *win, int x, int y){
    XClassHint classHint;
-   *win = XCreateSimpleWindow(dpy, Root, 10, 10, 64, 64,0,0,0);
-   classHint.res_name = NAME;
-   classHint.res_class = CLASS;
-   XSetClassHint(dpy, *win, &classHint);
+   *win=XCreateSimpleWindow(d_display, w_root, x, y, winsize, winsize, 0, 0, 0);
+   classHint.res_name=NAME;
+   classHint.res_class=CLASS;
+   XSetClassHint(d_display, *win, &classHint);
 }
 
-unsigned long getColor(char *colorName, float dim)
-{
-   XColor Color;
-   XWindowAttributes Attributes;
-
-   XGetWindowAttributes(dpy, Root, &Attributes);
-   Color.pixel = 0;
-
-   XParseColor (dpy, Attributes.colormap, colorName, &Color);
-   Color.red=(unsigned short)(Color.red/dim);
-   Color.blue=(unsigned short)(Color.blue/dim);
-   Color.green=(unsigned short)(Color.green/dim);
-   Color.flags=DoRed | DoGreen | DoBlue;
-   XAllocColor (dpy, Attributes.colormap, &Color);
+unsigned long getColor(char *colorname){
+   XColor color;
+   XWindowAttributes winattr;
+   XGetWindowAttributes(d_display, w_root, &winattr);
+   color.pixel=0;
+   XParseColor(d_display, winattr.colormap, colorname, &color);
+   color.flags=DoRed | DoGreen | DoBlue;
+   XAllocColor(d_display, winattr.colormap, &color);
+   return color.pixel;
+}
 
-   return Color.pixel;
+unsigned long mixColor(char *colorname1, int prop1, char *colorname2, int prop2){
+   XColor color, color1, color2;
+   XWindowAttributes winattr;
+   XGetWindowAttributes(d_display, w_root, &winattr);
+   XParseColor(d_display, winattr.colormap, colorname1, &color1);
+   XParseColor(d_display, winattr.colormap, colorname2, &color2);
+   color.pixel=0;
+   color.red=(color1.red*prop1+color2.red*prop2)/(prop1+prop2);
+   color.green=(color1.green*prop1+color2.green*prop2)/(prop1+prop2);
+   color.blue=(color1.blue*prop1+color2.blue*prop2)/(prop1+prop2);
+   color.flags=DoRed | DoGreen | DoBlue;
+   XAllocColor(d_display, winattr.colormap, &color);
+   return color.pixel;
 }
 
-void scanArgs(int argc, char *argv[]){
+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\n07/05/98  Release 0.8\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,"   -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,"   -display display       select target display (see X manual pages)\n\n");
+      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=TRUE;
-      if(strcmp(argv[i],"-s")==0)
-         ushape=TRUE;
-      if(strcmp(argv[i],"-d")==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(txtdev,"%s",argv[i]);
+            sprintf(mixdev, "%s", argv[i]);
          }
          continue;
       }
-      if(strcmp(argv[i],"-l")==0){
+      if(strcmp(argv[i], "-l")==0){
 	 if(i<argc-1){
             i++;
-            sprintf(ledcol,"%s",argv[i]);
+            sprintf(ledcolor, "%s", argv[i]);
 	 }
          continue;
       }
-      if(strcmp(argv[i],"-b")==0){
+      if(strcmp(argv[i], "-b")==0){
 	 if(i<argc-1){
             i++;
-            sprintf(bckcol,"%s",argv[i]);
+            sprintf(backcolor, "%s", argv[i]);
 	 }
          continue;
       }
-      if(strcmp(argv[i],"-display")==0){
+      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(txtdpy,"%s",argv[i]);
+            sprintf(display, "%s", argv[i]);
          }
          continue;
       }
@@ -360,90 +433,110 @@ void readFile(){
    char rcfilen[256];
    char buf[256];
    int done;
-   sprintf(rcfilen,"%s/.wmmixer",getenv("HOME"));
-   if((rcfile=fopen(rcfilen,"r"))!=NULL){
-      Channels=0;
+   int current=-1;
+   sprintf(rcfilen, "%s/.wmmixer", getenv("HOME"));
+   if((rcfile=fopen(rcfilen, "r"))!=NULL){
+      channels=0;
       do{
-         fgets(buf,250,rcfile);
+         fgets(buf, 250, rcfile);
          if((done=feof(rcfile))==0){
             buf[strlen(buf)-1]=0;
-            if(strncmp(buf,"addchannel ",strlen("addchannel "))==0){
-               sscanf(buf,"addchannel %i",&Channel[Channels]);
-               if(Channel[Channels]<mixctl->getNrDevices()){
-                  if(mixctl->getSupport(Channel[Channels]))
-                     Channels++;
+            if(strncmp(buf, "addchannel ", strlen("addchannel "))==0){
+               sscanf(buf, "addchannel %i", &current);
+               if(current>=mixctl->getNrDevices() || mixctl->getSupport(current)==false){
+                  fprintf(stderr,"%s : Sorry, this channel (%i) is not supported.\n", NAME, current);
+                  current=-1;
+               }
+               else{
+                  channel[channels]=current;
+                  channels++;
 	       }
             }
-            if(strncmp(buf,"setmono ",strlen("setmono "))==0){
-               if(Channels>0){
+            if(strncmp(buf, "setchannel ", strlen("setchannel "))==0){
+               sscanf(buf, "setchannel %i", &current);
+               if(current>=mixctl->getNrDevices() || mixctl->getSupport(current)==false){
+                  fprintf(stderr,"%s : Sorry, this channel (%i) is not supported.\n", NAME, current);
+                  current=-1;
+               }
+            }
+            if(strncmp(buf, "setmono ", strlen("setmono "))==0){
+               if(current==-1)
+                  fprintf(stderr,"%s : Sorry, no current channel.\n", NAME);
+	       else{
                   int value;
-                  sscanf(buf,"setmono %i",&value);
-                  mixctl->setLeft(Channel[Channels-1],value);
-                  mixctl->setRight(Channel[Channels-1],value);
-                  mixctl->writeVol(Channel[Channels-1]);
+                  sscanf(buf, "setmono %i", &value);
+                  mixctl->setLeft(current, value);
+                  mixctl->setRight(current, value);
+                  mixctl->writeVol(current);
                }
             }
-            if(strncmp(buf,"setleft ",strlen("setleft "))==0){
-	       if(Channels>0){
+            if(strncmp(buf, "setleft ", strlen("setleft "))==0){
+               if(current==-1)
+                  fprintf(stderr, "%s : Sorry, no current channel.\n", NAME);
+	       else{
                   int value;
-                  sscanf(buf,"setleft %i",&value);
-                  mixctl->setLeft(Channel[Channels-1],value);
-                  mixctl->writeVol(Channel[Channels-1]);
+                  sscanf(buf, "setleft %i", &value);
+                  mixctl->setLeft(current, value);
+                  mixctl->writeVol(current);
 	       }
             }
-            if(strncmp(buf,"setright ",strlen("setright "))==0){
-	       if(Channels>0){
+            if(strncmp(buf, "setright ", strlen("setright "))==0){
+               if(current==-1)
+                  fprintf(stderr, "%s : Sorry, no current channel.\n", NAME);
+	       else{
                   int value;
-                  sscanf(buf,"setleft %i",&value);
-                  mixctl->setRight(Channel[Channels-1],value);
-                  mixctl->writeVol(Channel[Channels-1]);
+                  sscanf(buf, "setleft %i", &value);
+                  mixctl->setRight(current, value);
+                  mixctl->writeVol(current);
 	       }
             }
-            if(strncmp(buf,"setrecsrc ",strlen("setrecsrc "))==0){
-	       if(Channels>0)
-                  mixctl->setRec(Channel[Channels-1],(strncmp(buf+strlen("setrecsrc "),"TRUE",strlen("TRUE"))==0));
+            if(strncmp(buf, "setrecsrc ", strlen("setrecsrc "))==0){
+               if(current==-1)
+                  fprintf(stderr, "%s : Sorry, no current channel.\n", NAME);
+	       else
+                  mixctl->setRec(current, (strncmp(buf+strlen("setrecsrc "), "true", strlen("true"))==0));
             }
          }
       }  while(done==0);
       fclose(rcfile);
-      mixctl->writeRec();       // delayed write, to avoid interference from low-level drivers.
+      mixctl->writeRec();
    }
 }
 
-void checkVol(bool forced){
-   mixctl->readVol(Channel[curDev],TRUE);
-   int nl=mixctl->readLeft(Channel[curDev]);
-   int nr=mixctl->readRight(Channel[curDev]);
-   bool nrec=mixctl->readRec(Channel[curDev],TRUE);
+void checkVol(bool forced=true){
+   mixctl->readVol(channel[curchannel], true);
+   int nl=mixctl->readLeft(channel[curchannel]);
+   int nr=mixctl->readRight(channel[curchannel]);
+   bool nrec=mixctl->readRec(channel[curchannel], true);
    if(forced){
-      curLeft=nl;
-      curRight=nr;
-      curRec=nrec;
+      curleft=nl;
+      curright=nr;
+      currec=nrec;
       if(nrec)
-         btnstate|=btnRec;
+         btnstate |= BTNREC;
       else
-         btnstate&=~btnRec;      
-      curShowRec=mixctl->getRecords(Channel[curDev]);
-      update();   // Update everything
+         btnstate &= ~BTNREC;
+      curshowrec=mixctl->getRecords(channel[curchannel]);
+      update();
       repaint();
    }
    else{
-      if(nl!=curLeft || nr!=curRight || nrec!=curRec){
-         if(nl!=curLeft){
-            curLeft=nl;
+      if(nl!=curleft || nr!=curright || nrec!=currec){
+         if(nl!=curleft){
+            curleft=nl;
             drawLeft();
          }
-         if(nr!=curRight){
-            curRight=nr;
+         if(nr!=curright){
+            curright=nr;
             drawRight();
          }
-         if(nrec!=curRec){
-            curRec=nrec;
+         if(nrec!=currec){
+            currec=nrec;
             if(nrec)
-               btnstate|=btnRec;
+               btnstate |= BTNREC;
             else
-               btnstate&=~btnRec;
-            drawBtns(btnRec);
+               btnstate &= ~BTNREC;
+            drawBtns(BTNREC);
          }
          repaint();
       }
@@ -451,123 +544,121 @@ void checkVol(bool forced){
 }
 
 void pressEvent(XButtonEvent *xev){
-   int x=xev->x;
-   int y=xev->y;
+   int x=xev->x-(winsize/2-32);
+   int y=xev->y-(winsize/2-32);
    if(x>=5 && y>=33 && x<=16 && y<=43){
-      curDev--;
-      if(curDev<0)
-         curDev=Channels-1;
-      btnstate|=btnPrev;
-      btntimer=0;
-      drawBtns(btnPrev);
-      checkVol(TRUE);
+      curchannel--;
+      if(curchannel<0)
+         curchannel=channels-1;
+      btnstate |= BTNPREV;
+      rpttimer=0;
+      drawBtns(BTNPREV);
+      checkVol(true);
       return;
    }
    if(x>=17 && y>=33 && x<=28 && y<=43){
-      curDev++;
-      if(curDev>=Channels)
-         curDev=0;
-      btnstate|=btnNext;
-      btntimer=0;
-      drawBtns(btnNext);
-      checkVol(TRUE);
+      curchannel++;
+      if(curchannel>=channels)
+         curchannel=0;
+      btnstate|=BTNNEXT;
+      rpttimer=0;
+      drawBtns(BTNNEXT);
+      checkVol(true);
       return;
    }
    if(x>=37 && x<=56 && y>=8 && y<=56){
-      int v=((60-y)*100)/(3*17);
-      dragging=TRUE;
+      int v=((60-y)*100)/(2*25);
+      dragging=true;
       if(x<=50)
-         mixctl->setLeft(Channel[curDev], v);
+         mixctl->setLeft(channel[curchannel], v);
       if(x>=45)
-         mixctl->setRight(Channel[curDev], v);
-      mixctl->writeVol(Channel[curDev]);
-      checkVol(FALSE);
+         mixctl->setRight(channel[curchannel], v);
+      mixctl->writeVol(channel[curchannel]);
+      checkVol(false);
       return;
    }
    if(x>=5 && y>=47 && x<=28 && y<=57){
-      mixctl->setRec(Channel[curDev], !mixctl->readRec(Channel[curDev],FALSE));
+      mixctl->setRec(channel[curchannel], !mixctl->readRec(channel[curchannel], false));
       mixctl->writeRec();
-      checkVol(FALSE);
+      checkVol(false);
    }
 }
 
 void releaseEvent(XButtonEvent *xev){
-   dragging=FALSE;
-   btnstate&=~(btnPrev | btnNext);
-   drawBtns(btnPrev | btnNext);
+   dragging=false;
+   btnstate &= ~(BTNPREV | BTNNEXT);
+   drawBtns(BTNPREV | BTNNEXT);
    repaint();
 }
 
 void motionEvent(XMotionEvent *xev){
-   int x=xev->x;
-   int y=xev->y;
+   int x=xev->x-(winsize/2-32);
+   int y=xev->y-(winsize/2-32);
    if(x>=37 && x<=56 && y>=8 && dragging){
-      int v=((60-y)*100)/(3*17);
+      int v=((60-y)*100)/(2*25);
       if(v<0)
          v=0;
       if(x<=50)
-         mixctl->setLeft(Channel[curDev], v);
+         mixctl->setLeft(channel[curchannel], v);
       if(x>=45)
-         mixctl->setRight(Channel[curDev], v);
-      mixctl->writeVol(Channel[curDev]);
-      checkVol(FALSE);
+         mixctl->setRight(channel[curchannel], v);
+      mixctl->writeVol(channel[curchannel]);
+      checkVol(false);
    }
 }
 
 void repaint(){
-   XCopyArea(dpy, disp, Win[activeWin], WinGC, 0, 0, 64, 64, 0, 0);
+   XCopyArea(d_display, pm_disp, w_activewin, gc_gc, 0, 0, 64, 64, winsize/2-32, winsize/2-32);
    XEvent xev;
-   while(XCheckTypedEvent(dpy, Expose, &xev));
+   while(XCheckTypedEvent(d_display, Expose, &xev));
 }
 
 void update(){
-   // Only needs to be called when the current device is changed
-
-   XCopyArea(dpy, symb, disp, WinGC, sympic[Channel[curDev]]*22,0,22,22, 6,5);
+   XCopyArea(d_display, pm_icon, pm_disp, gc_gc, icon[channel[curchannel]]*22, 0, 22, 22, 6, 5);
    drawLeft();
    drawRight();
-   drawBtns(btnRec);
+   drawBtns(BTNREC);
 }
 
 void drawLeft(){
-   XSetForeground(dpy, WinGC, fcolor);
-   for(int i=0;i<17;i++){
-      if(i==(curLeft*17)/100)
-         XSetForeground(dpy, WinGC, bcolor);
-      XFillRectangle(dpy, disp, WinGC, 37, 54-3*i, 9, 2);
+   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(dpy, WinGC, fcolor);
-   for(int i=0;i<17;i++){
-      if(i==(curRight*17)/100)
-         XSetForeground(dpy, WinGC, bcolor);
-      XFillRectangle(dpy, disp, WinGC, 48, 54-3*i, 9, 2);
+   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(dpy, nrec, disp, WinGC, 0,0,6,7,14,49);
+   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(dpy, back, disp, WinGC, 14,49,6,7,14,49);
+         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(dpy, back, disp, WinGC, x,y,w,h,x,y);
+      XCopyArea(d_display, pm_main, pm_disp, gc_gc, x, y, w, h, x, y);
    else{
-      XCopyArea(dpy, back, disp, WinGC, x,y,1,h-1,x+w-1,y+1);
-      XCopyArea(dpy, back, disp, WinGC, x+w-1,y+1,1,h-1,x,y);
-      XCopyArea(dpy, back, disp, WinGC, x,y,w-1,1,x+1,y+h-1);
-      XCopyArea(dpy, back, disp, WinGC, x+1,y+h-1,w-1,1,x,y);
+      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);
    }
 }

-- 
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