[Pkg-wmaker-commits] [wmmixer] 01/16: Rename wmmixer folder
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Tue Aug 29 09:59:07 UTC 2017
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch upstream
in repository wmmixer.
commit d97766b3f96c3e2f1c9778d08ee099ee5ac8a240
Author: Carlos R. Mafra <crmafra at gmail.com>
Date: Wed Jul 13 11:33:50 2011 +0200
Rename wmmixer folder
---
CHANGES | 84 +++++++
COPYING | 339 +++++++++++++++++++++++++
INSTALL | 9 +
Makefile | 54 ++++
README | 105 ++++++++
XPM/.xvpics/norec.xpm | 5 +
XPM/.xvpics/wmmixer.xpm | Bin 0 -> 3666 bytes
XPM/.xvpics/wmmixer_new.xpm | Bin 0 -> 3666 bytes
XPM/.xvpics/wmmixer_new2.xpm | Bin 0 -> 3666 bytes
XPM/icons.xpm | 29 +++
XPM/norec.xpm | 15 ++
XPM/tile.xpm | 121 +++++++++
XPM/wmmixer.xpm | 77 ++++++
common.h | 30 +++
exception.cc | 53 ++++
exception.h | 40 +++
home.wmmixer | 69 +++++
mixctl.cc | 258 +++++++++++++++++++
mixctl.h | 103 ++++++++
wmmixer.1 | 92 +++++++
wmmixer.cc | 581 +++++++++++++++++++++++++++++++++++++++++++
wmmixer.h | 87 +++++++
xhandler.cc | 549 ++++++++++++++++++++++++++++++++++++++++
xhandler.h | 153 ++++++++++++
24 files changed, 2853 insertions(+)
diff --git a/CHANGES b/CHANGES
new file mode 100644
index 0000000..0a821ef
--- /dev/null
+++ b/CHANGES
@@ -0,0 +1,84 @@
+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
+
+Release 1.2 25 May 2002 Merge Debian patches
+ Cleanup/Splitup MixCtl
+ Preparing for major rewrite...
+ Makefile updated again
+
+
+Release 1.3 26 May 2002 Change the whole thing to actual C++ code.
+ It is not yet pretty code, but it is a lot
+ better. Still, much work to do.
+
+Release 1.4 08 Jun 2002 Display only one bar for mono channels
+ (Taken from Damian Kramer's wmsmixer)
+ Split X code up into smaller pieces
+ Fix channel rotating (repeat timer)
+ Add mute button
+
+Release 1.5 25 Jun 2002 Several fixes (really open mixer device given
+ with -m, don't segfault when /dev/mixer is not
+ there, don't go to max if using scrollwheel to
+ set volume below 0)
+ Shaded LED-Bar
+ Initial Exception Handling
\ No newline at end of file
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..a43ea21
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
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/Makefile b/Makefile
new file mode 100644
index 0000000..47cef3d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,54 @@
+# $Id: Makefile,v 1.5 2002/06/25 22:13:09 gordon Exp $
+
+prefix = /usr/local
+exec_prefix = ${prefix}
+bindir = ${exec_prefix}/bin
+mandir = ${prefix}/share/man
+
+DESTDIR =
+
+CXX = g++
+CXXFLAGS = -O -Wall
+EXTRA_LIBS = -L/usr/X11R6/lib -lX11 -lXpm -lXext
+
+
+LD = g++
+LDFLAGS = -o $(EXECUTABLE) $(EXTRA_LIBDIRS) $(EXTRA_LIBS) $(CXXFLAGS)
+
+EXECUTABLE = wmmixer
+OBJS = xhandler.o mixctl.o wmmixer.o exception.o
+
+INSTALL = install
+INSTALL_FILE = $(INSTALL) -D -p -o root -g root -m 644
+INSTALL_PROGRAM = $(INSTALL) -D -p -o root -g root -m 755
+
+.cc.o:
+ $(CXX) $(CXXFLAGS) -c -o $@ $<
+
+$(EXECUTABLE): $(OBJS)
+ $(LD) $(LDFLAGS) $(OBJS)
+
+all: $(EXECUTABLE)
+
+clean:
+ rm -f $(OBJS) $(EXECUTABLE)
+
+install: install-bin install-doc
+
+install-bin: wmmixer
+ $(INSTALL_PROGRAM) $< $(DESTDIR)$(bindir)/wmmixer
+
+install-doc: wmmixer.1
+ $(INSTALL_FILE) $< $(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
+
+.PHONY: all clean dist-clean install install-bin install-doc \
+ uninstall uninstall-bin uninstall-doc
+
diff --git a/README b/README
new file mode 100644
index 0000000..5109cbb
--- /dev/null
+++ b/README
@@ -0,0 +1,105 @@
+wmmixer - A mixer designed for WindowMaker
+25 June 2002 Release 1.5
+
+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
+See the COPYING file for details.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+
+AUTHORS:
+========
+
+Original Author: Sam Hawker <shawkie at geocities.com>
+Current Author: Gordon Fraser <gordon at debian.org>
+
+
+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:
+======
+
+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.
+
+See the program's manpage ('man wmmixer') for detailed listings of the
+available options.
+
+SHADED VOLUME BARS:
+===================
+As of version 1.5 wmmixer allows shading the volume bar in two colours.
+If you do not want this and prefer the traditional single-coloured
+look, you'll have to tell wmmixer to use the same colour for high and
+low colours:
+
+$ wmmixer -l green -L green
+...this will give you the traditional look.
+
+$ wmmixer -l lightgreen -L blue
+...this is an example for the new look. By default, green is used for low volume
+settings and fade to red for high volumes.
+
+
+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 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
+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."
diff --git a/XPM/.xvpics/norec.xpm b/XPM/.xvpics/norec.xpm
new file mode 100644
index 0000000..a24c8f2
--- /dev/null
+++ b/XPM/.xvpics/norec.xpm
@@ -0,0 +1,5 @@
+P7 332
+#IMGINFO:10x9 RGB (221 bytes)
+#END_OF_COMMENTS
+10 9 255
+�����������������������E(E(�����(%I$E)����(%I$E)����(%I$E)�����E(E(�����������������������
\ No newline at end of file
diff --git a/XPM/.xvpics/wmmixer.xpm b/XPM/.xvpics/wmmixer.xpm
new file mode 100644
index 0000000..7f099c5
Binary files /dev/null and b/XPM/.xvpics/wmmixer.xpm differ
diff --git a/XPM/.xvpics/wmmixer_new.xpm b/XPM/.xvpics/wmmixer_new.xpm
new file mode 100644
index 0000000..90e97ac
Binary files /dev/null and b/XPM/.xvpics/wmmixer_new.xpm differ
diff --git a/XPM/.xvpics/wmmixer_new2.xpm b/XPM/.xvpics/wmmixer_new2.xpm
new file mode 100644
index 0000000..4b98c9c
Binary files /dev/null and b/XPM/.xvpics/wmmixer_new2.xpm differ
diff --git a/XPM/icons.xpm b/XPM/icons.xpm
new file mode 100644
index 0000000..d34aac7
--- /dev/null
+++ b/XPM/icons.xpm
@@ -0,0 +1,29 @@
+/* XPM */
+static char * icons_xpm[] = {
+"220 22 4 1",
+" c #282828 s back_color",
+". c #00ffff s led_color_high",
+"X c #007b7b s led_color_low",
+"o c #ffffff",
+" ",
+" ",
+" .. ",
+" .... X.. XXXXXX . . .. ",
+" . . ...... X......X X..X. .. ........X X. .X . . ",
+" . . ..XXX..... X............X. ..X.X. .. . ..X X.... X. .X . ",
+" X. . . ..XXXX...... X....... . . . .X.X.. . . . . ... ..... .. . . . X. ",
+" X... . . ............... ...XXX....o. .X............X. .X.. . .X. XX . X..X X...X .. .. . X... ",
+" X..... . . .X.X.X.X X.X.X.X .XX.XXX...o... . X......X ..XX . . X. . . . X...X ...X X.X X..... ",
+" X....... . . .X.X.X.X X.X.X.X .XXXXX...o.... . .XX . ..X . . . .... ...X ....X . X....... ",
+" X......... .................... .X.X.X.X X.X.X.X .XXXX. .XXXX. X. .XX . .X. X . . . . X..X ...X .. X.X .. X......... ",
+" X........... . . .X X X X X X X.X .XXXX. .XXXX. X. .XX . .X. . . . X...X .. ..X .... X........... ",
+" X............. . . .X X X X X X X.X ....o...XXXXX. . .XX . .. . . . .... X.X . . . X............. ",
+" X............... . . ...............X ...o...XX..XX. . .XX. . X. . . . .... X. . . . X............... ",
+" ................. . . XXXXXXXXXXXXXXX .o....XXX... . ... .X. XX . X.... X. . . ................. ",
+" . . ......XXXX.. .. . . . . . X....X X. X.X. ",
+" . . .....XXX.. .. X... .X .. . .... X...... ",
+" .... ...... .. . ...X .. .. .X ",
+" . ...X ",
+" ",
+" ",
+" "};
diff --git a/XPM/norec.xpm b/XPM/norec.xpm
new file mode 100644
index 0000000..eaf0106
--- /dev/null
+++ b/XPM/norec.xpm
@@ -0,0 +1,15 @@
+/* XPM */
+static char * norec_xpm[] = {
+"10 9 3 1",
+" c None",
+". c #AEAAAE",
+"+ c #353535",
+"..........",
+"..........",
+"...++++...",
+"..++++++..",
+"..++++++..",
+"..++++++..",
+"...++++...",
+"..........",
+".........."};
diff --git a/XPM/tile.xpm b/XPM/tile.xpm
new file mode 100644
index 0000000..e65c234
--- /dev/null
+++ b/XPM/tile.xpm
@@ -0,0 +1,121 @@
+/* XPM */
+static char *tile_xpm[] = {
+"64 64 54 1",
+" c #F3CEF3CEF3CE",
+". c #000000000000",
+"X c #514461856185",
+"o c #A289A289B2CA",
+"O c #A289A289A289",
+"+ c #A2899248B2CA",
+"@ c #9248A289A289",
+"# c #A2899248A289",
+"$ c #92489248A289",
+"% c #924892489248",
+"& c #92488207A289",
+"* c #820792489248",
+"= c #924882079248",
+"- c #820782079248",
+"; c #820782078207",
+": c #820771C69248",
+"> c #618551446185",
+", c #9248A289B2CA",
+"< c #92489248B2CA",
+"1 c #82079248A289",
+"2 c #82078207A289",
+"3 c #71C682079248",
+"4 c #71C682078207",
+"5 c #514451446185",
+"6 c #514451445144",
+"7 c #820771C68207",
+"8 c #410351445144",
+"9 c #514441035144",
+"0 c #71C671C69248",
+"q c #71C671C68207",
+"w c #71C671C671C6",
+"e c #410341035144",
+"r c #71C661858207",
+"t c #618571C68207",
+"y c #410351444103",
+"u c #410341034103",
+"i c #618571C671C6",
+"p c #410330C24103",
+"a c #30C241034103",
+"s c #71C6618571C6",
+"d c #6185618571C6",
+"f c #618561858207",
+"g c #30C230C230C2",
+"h c #618561856185",
+"j c #30C230C24103",
+"k c #5144618571C6",
+"l c #30C2410330C2",
+"z c #6185514471C6",
+"x c #208130C230C2",
+"c c #30C2208130C2",
+"v c #5144514471C6",
+"b c #2081208130C2",
+"n c #208120812081",
+"m c #410330C25144",
+" .",
+" X.",
+" oOoO+O+O+O+@#$+@#$#$#$$$#$$%&%&%&%&*&*&*=-=*=-=-=--;---;:;:;>.",
+" oo at o,o at o@o at +@+@<@$@$@$@$@$1$$$*$*$*&*&*2*&*2*-*-*-----3-3-4-X.",
+" oO+OoO#O+@#@#@#$#@#$#%#$$%$%$%&%&*=%&*=*=*=-=-=--;-;-;:;:;:;5.",
+" ,ooo at +@+ at +@+@<@#@<@$$$$$$$$$*$1$*&*&*&*&*2*---*-----3---4:4:6.",
+" +O+O+O+@#$#@#$#$#$$%$$$%&%&%&%&*=*&*=-=*=---=--;---;:;:4:;:45.",
+" @o at o@o at +@+@<@$@$@$$$@$1$1$*$*$*&*&*2*=*2*-*-*-----4-3-4:4-4:6.",
+" +O#O+@#@#@#$#$#$#%#%$%&%$%&%&*=*&*=*=*=-=-=--;-;-;:;:;:;:4745.",
+" @+ at +@+ at +@<@#@$@$$$$$$$$$*$*$*&*&*&*&*2*---*-----3---4:4:4:4:8.",
+" #O+@#$#@#$#$#$$%$$$%&%&%&%&*=*&*=-=-=---=--;:;-;:;:4:4:474:49.",
+" @o@<@+@<@$@$@$$$$$1$1$*$*$*&*&*2*=*2*-*-*-----4-4-4:4:4:4:408.",
+" +@#@#@#$#$#$$%#%$%&%$%&%&*=*&*=*=*=-=-=--;-;-;:;:;:;:474747q9.",
+" @+ at +@<@$$$@$$$$$1$$$*&*$*&*&*&*&*2*---------3-3-4:4:4:4:404q8.",
+" #$#@#$#$#$$%$$$%&%&%&%&*=-&*=-=-=---=--;:;:;:;:4:4:474:47q7q9.",
+" @#@<@$@$@$$$$$*$1$*$*$*&*&*2*-*2*-*-*-3---4-4-4:4:4:4:404q4q8.",
+" #@#$#$#$$%$%$%&%$%&%&*=*=*=-=*=-=;=--;-;-;:;:47;:474747q7q7q9.",
+" @<@$$$@$$$$$1$$$*&*&*&*&*&*=*2*---------4-3-4:4:4:4:404qq04q8.",
+" #$#$#$$%$%$%&%&%&%&*=-&*=-=-=------;:;:;:;:4:4:47q747qqq7qqq9.",
+" @$@$@$$$$$*$1$*$*$*&*&*2*-*-*---*-3-3-4-4-4:4:4:4:404q4q4qqq8.",
+" #$#$$%$%$%&%&%&%&*=*=*=-=-=-=;=--;:;-;:;:474:474747q7q7qqwqw9.",
+" $$@$$$$$*$$$*&*&*&*&*2*=*2*---------4-3-4:4:4:4:404qqq4qqqqqe.",
+" #$$%$%$%&%&*&%&*=-&*=-=-=------;:;:;:;:4:4:47q7q7qqq7qqwrqqw9.",
+" @$$$$$*$1$*&*$*2*&*2*-*-*-----3-3-4-4-4:4:404:404q4q4qqqqqtqy.",
+" $%$%$%&%&%=%&*=*=*=-=-=--;=--;:;-;:;:474:474747q7q7qqwqwqwrwe.",
+" $$$$*$1$*&*&*&*&*2*--2*-----3---4:3-4:4:4:4:404qqqqqqqqqtqtqu.",
+" &%$%&%&*&*&*=-=*=-=-=--;---;:;:;:;:4:4:47q7q7qqq7qqwrqrwrwrip.",
+" $$*$*$*&*&*2*&*2*-*-*-----3-3-4-4-4:4:404q404q4q4qtqqqiqtqiru.",
+" $%&%&*=%&*=*=*=-=-=--;-;-;:;-;:;:474:47q747q7q7qqwqwqwrwrirwu.",
+" *$1$*&*&*&*&*2*---*-----3---4:4:4:4:4:4:404qqqqqqqqqtqtqirira.",
+" &%&*=*&*=-=*=-=-=--;---;:;:;:;:4:4:47q7q7qqqqqqwrqrwrwriririp.",
+" *$*&*&*2*&*2*-*-*-----3-3-4-4-4:4:404q4q4qqq4qtqtqiqiqiriqira.",
+" &*=*&*=*=*=-=-=--;-;-;:;:;:;:474:47q7q7q7q7qqwrwqwrwrirwrisip.",
+" *&*&*&*&*2*---*-----3---4:4:4:4:404:404qqqqqqqqqtqtqiriririra.",
+" =*&*=-=*=---=--;---;:;:4:;:474:47q7q7qqqqqqwrwrwrwriririsdrdp.",
+" *&*2*=*2*-*-*-----4-3-4:4-4:4:404q4q4qqqqqtqtqiqiqiriqifirifa.",
+" &*=*=*=-=-=--;-;-;:;:;:;:474747q7q7qqq7qqwrwqwrwrirwrisisisdp.",
+" *&*&*2*---*-----3-3-4:4:4:4:404qq04qqqqqtqqqirtqiririririfida.",
+" =-=-=---=--;:;-;:;:4:4:474:47q7q7qqqqqqwrwrwrwriririsdrdsdddp.",
+" *=*2*-*-*-----4-4-4:4:4:4:404q4q4qqqqqtqtqiqiqiriqifififidida.",
+" =*=-=-=--;-;-;:;:4:;:474747q7q7qqwqwqwrwqwrwrirwrisdsisdsdsdp.",
+" *2*---------4-3-4:4:4:4:404qq04qqqqqtqqqiririririririfidddddg.",
+" =---=--;:;:;:;:4:4:474:47q7q7qqqqqqwrwrwrwriririsdsdsddddddhj.",
+" *---*-3---4-4-4:4:4:4:404q4q4qqqqqtqtqiqiqiririfififidddidkdl.",
+" =;=--;:;-;:;:474:474747q7q7qqwqwqwrwrwrwrirwrisdsdsdsdsddhzhj.",
+" --------4-3-4:4:4:4:404qq04qqqqqtqqqiririririfirifidddddddddx.",
+" ---;:;:;:;:4:4:47q747qqq7qqwqqqwrwrirwriririsdsdsddddddhzhzhc.",
+" --3-3-4-4-4:4:4:4:404q4q4qqqqqtqtqiriqiririfififidddddkdkdXdx.",
+" -;:;-;:;:474:474747q7q7qqwqwqwrwrwrwrisisisdsdsdddsddhzhdhzhg.",
+" ----4-3-4:4:4:4:404qqq4qqqqqtqtqiriririrififdfidddddkdddkzkdx.",
+" :;:;:;:4:4:47q7q7qqq7qqwrqqwrwriririririsdsdsddddddhzhzhzhzXc.",
+" 3-4-4-4:4:404:404q4q4qqqqqtqtqiriqiririfidididddddkdkdXdXdXzx.",
+" -;:;:474:47q747q7q7qqwqwqwrwrirwrisisisdsdsddddddhzhdhzhzXzhc.",
+" 4:4-4:4:4:4:404qqqqqqqqqtqtqiriririrififdfidddddkdddkzkdXzXzx.",
+" :;:4:4:47q7q7qqq7qqwrqrwrwriririsirisdsdsddddddhzhzhzhzXzXzXc.",
+" 4-4:4:404q404qqq4qtqqqiqtqiriqiririfidididddddkdkdXdXdXzXzXvx.",
+" :474:47q7q7q7q7qqwrwqwrwrirwrisisisdsdsddddddhzhzhzhzXzhzX>5c.",
+" 4:4:4:4:404qqqqqqqqqtqtqiririririfiddfidddddkdddXzkdXzXzXvXzx.",
+" :4:47q7q7qqqqqqwrwrwrwriririsdrisdddsddddddhzhzXzhzXzXzX>5>5c.",
+" 4:404q4q4qqqqqtqtqiqiqiriqiririfidididddddkdkdXzXdXzXzXvXvXvx.",
+" :47q7q7q7q7qqwrwqwrwrirwrisisisdsdsddhdddhzhzhzhzXzXzX>5>5>5b.",
+" 404:404qqqqqqqqqiqtqiririririfidddidddddkdkdXzkzXzXzXvXv5vX5n.",
+" >65656569698989y9e9u9ueumueupupapaplpgjgjgjgcgcgcgcxcbcncnbnb.",
+" ..............................................................."};
diff --git a/XPM/wmmixer.xpm b/XPM/wmmixer.xpm
new file mode 100644
index 0000000..d3ec49c
--- /dev/null
+++ b/XPM/wmmixer.xpm
@@ -0,0 +1,77 @@
+/* XPM */
+static char * wmmixer_xpm[] = {
+"64 64 10 1",
+" c None",
+". c #000000",
+"+ c #AEAAAE",
+"@ c #282828",
+"# c #202020",
+"$ c #F7F3FF",
+"% c #86828E",
+"& c #FF0000",
+"* c #FA0808",
+"= c #FE0000",
+" ",
+" ",
+" ",
+" ",
+" .........................+ ........................+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .#@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@@+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" ++++++++++++++++++++++++++ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .......................... .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$$$$$$$$$$$%$$$$$$$$$$$%+ .#@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$++++++++++.$++++++++++.+ .#@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$++++++.+++.$+++.++++++.+ .#@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$+++++..+++.$+++..+++++.+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$++++...+++.$+++...++++.+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$+++....+++.$+++....+++.+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$++++...+++.$+++...++++.+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$+++++..+++.$+++..+++++.+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$++++++.+++.$+++.++++++.+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$++++++++++.$++++++++++.+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .%...........%...........+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" ++++++++++++++++++++++++++ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .......................... .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$$$$$$$$$$$%$$$$$$$$$$$%+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$++++++++++.$&++++++++&.+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$++++++++++.$+&++++..&+.+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$+++*&&=+++.$++&++.+.++.+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$++**=*&=++.$++...+&.++.+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$++*===*=++.$++.+&&+.++.+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$++*===&=++.$++...+&.++.+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$+++*=&=+++.$++&++.+.++.+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$++++++++++.$+&++++..&+.+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .$++++++++++.$&++++++++&.+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" .%...........%...........+ .@@@@@@@@@@@@@@@@@@@@@@@+ ",
+" ++++++++++++++++++++++++++ +++++++++++++++++++++++++ ",
+" ",
+" ",
+" ",
+" ",
+" "};
diff --git a/common.h b/common.h
new file mode 100644
index 0000000..dc3ade6
--- /dev/null
+++ b/common.h
@@ -0,0 +1,30 @@
+// common.h - Common defines and includes for wmmixer
+//
+// Release 1.5
+// 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
+// See the COPYING file for details.
+
+#ifndef __common_h__
+#define __common_h__
+
+// User defines - custom
+#define MIXERDEV "/dev/mixer"
+#define BACKCOLOR "#282828"
+#define LEDCOLOR "green"
+#define LEDCOLOR_HIGH "red"
+
+// User defines - standard
+#define WINDOWMAKER false
+#define USESHAPE false
+#define AFTERSTEP false
+#define NORMSIZE 64
+#define ASTEPSIZE 56
+#define NAME "wmmixer"
+#define CLASS "WMMixer"
+
+
+#endif //__common_h__
diff --git a/exception.cc b/exception.cc
new file mode 100644
index 0000000..a4fa261
--- /dev/null
+++ b/exception.cc
@@ -0,0 +1,53 @@
+// wmmixer - A mixer designed for WindowMaker
+//
+// Release 1.5
+// 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
+// See the COPYING file for details.
+
+#include "exception.h"
+
+
+//--------------------------------------------------------------------
+Exception::Exception()
+{
+ error_message_ = NULL;
+}
+
+//--------------------------------------------------------------------
+Exception::Exception(const Exception& exc)
+{
+ char* other_message = exc.getErrorMessage();
+
+ if(other_message != NULL)
+ {
+ error_message_ = new char[strlen(other_message)+1];
+ strcpy(error_message_, other_message);
+ }
+ else
+ error_message_ = NULL;
+}
+
+//--------------------------------------------------------------------
+Exception::~Exception()
+{
+ if(error_message_ != NULL)
+ delete[] error_message_;
+}
+
+//--------------------------------------------------------------------
+char* Exception::getErrorMessage() const
+{
+ return error_message_;
+}
+
+//--------------------------------------------------------------------
+MixerDeviceException::MixerDeviceException(char* device)
+{
+ error_message_ = new char[256];
+ strcpy(error_message_, "Unable to open mixer device ");
+ strcat(error_message_, device);
+}
diff --git a/exception.h b/exception.h
new file mode 100644
index 0000000..3923006
--- /dev/null
+++ b/exception.h
@@ -0,0 +1,40 @@
+// wmmixer - A mixer designed for WindowMaker
+//
+// Release 1.5
+// 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
+// See the COPYING file for details.
+
+
+#ifndef __exception_h__
+#define __exception_h__
+
+#include <stdlib.h>
+#include <string.h>
+
+//--------------------------------------------------------------------
+class Exception
+{
+ protected:
+ char* error_message_;
+
+ public:
+ Exception();
+ Exception(const Exception&);
+ virtual ~Exception();
+ char* getErrorMessage() const;
+};
+
+
+//--------------------------------------------------------------------
+class MixerDeviceException : public Exception
+{
+ public:
+ MixerDeviceException(char *);
+ // virtual ~MixerDeviceException();
+};
+
+#endif _exception_h__
diff --git a/home.wmmixer b/home.wmmixer
new file mode 100644
index 0000000..6e05f81
--- /dev/null
+++ b/home.wmmixer
@@ -0,0 +1,69 @@
+# wmmixer - A mixer designed for WindowMaker
+# 8 Jun 2002 Release 1.4
+# 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.cc b/mixctl.cc
new file mode 100644
index 0000000..7cf3261
--- /dev/null
+++ b/mixctl.cc
@@ -0,0 +1,258 @@
+// mixctl.h - MixCtl class provides control of audio mixer functions
+//
+// Release 1.5
+// 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
+// See the COPYING file for details.
+
+
+
+#include "mixctl.h"
+
+//----------------------------------------------------------------------
+MixCtl::MixCtl(char *device_name) throw(MixerDeviceException)
+{
+ device_ = new char[strlen(device_name)+1];
+ strcpy(device_, device_name);
+
+ modify_counter = -1;
+
+ if((mixfd = open(device_,O_RDONLY | O_NONBLOCK)) != -1)
+ {
+ num_devices_ = SOUND_MIXER_NRDEVICES;
+ char *devnames[] = SOUND_DEVICE_NAMES;
+ char *devlabels[] = SOUND_DEVICE_LABELS;
+ ioctl(mixfd, SOUND_MIXER_READ_DEVMASK, &devmask);
+ ioctl(mixfd, SOUND_MIXER_READ_STEREODEVS, &stmask);
+ ioctl(mixfd, SOUND_MIXER_READ_RECMASK, &recmask);
+ ioctl(mixfd, SOUND_MIXER_READ_CAPS, &caps);
+
+ mixer_devices_ = new MixerDevice[num_devices_];
+ int mixmask = 1;
+
+ for(unsigned count=0; count<num_devices_; count++)
+ {
+ mixer_devices_[count].support = devmask & mixmask;
+ mixer_devices_[count].stereo = stmask & mixmask;
+ mixer_devices_[count].records = recmask & mixmask;
+ mixer_devices_[count].mask = mixmask;
+ mixer_devices_[count].name = devnames[count];
+ mixer_devices_[count].label = devlabels[count];
+ mixer_devices_[count].muted = 0;
+ mixmask*=2;
+ }
+ doStatus();
+ }
+ else
+ {
+ throw MixerDeviceException(device_name);
+ }
+}
+
+//----------------------------------------------------------------------
+MixCtl::~MixCtl()
+{
+ if(mixer_devices_ != NULL)
+ delete[](mixer_devices_);
+ close(mixfd);
+
+ delete[] device_;
+}
+
+//----------------------------------------------------------------------
+bool MixCtl::isMuted(int channel)
+{
+ return mixer_devices_[channel].muted;
+}
+
+//----------------------------------------------------------------------
+void MixCtl::mute(int channel)
+{
+ mixer_devices_[channel].muted = mixer_devices_[channel].value;
+ mixer_devices_[channel].value = 0;
+ writeVol(channel);
+}
+
+//----------------------------------------------------------------------
+void MixCtl::unmute(int channel)
+{
+ mixer_devices_[channel].value = mixer_devices_[channel].muted;
+ mixer_devices_[channel].muted = 0;
+ writeVol(channel);
+}
+
+//----------------------------------------------------------------------
+void MixCtl::doStatus()
+{
+ ioctl(mixfd, SOUND_MIXER_READ_RECSRC, &recsrc);
+ for(unsigned i=0;i<num_devices_;i++)
+ {
+ if(mixer_devices_[i].support)
+ {
+ ioctl(mixfd, MIXER_READ(i), &mixer_devices_[i].value);
+ }
+ mixer_devices_[i].recsrc=(recsrc & mixer_devices_[i].mask);
+ }
+}
+
+
+//----------------------------------------------------------------------
+// Return volume for a device, optionally reading it from device first.
+// Can be used as a way to avoid calling doStatus().
+int MixCtl::readVol(int dev, bool read)
+{
+ if(read)
+ {
+ ioctl(mixfd, MIXER_READ(dev), &mixer_devices_[dev].value);
+ }
+ return mixer_devices_[dev].value;
+}
+
+//----------------------------------------------------------------------
+// Return left and right componenets of volume for a device.
+// If you are lazy, you can call readVol to read from the device, then these
+// to get left and right values.
+int MixCtl::readLeft(int dev)
+{
+ return mixer_devices_[dev].value%256;
+}
+
+//----------------------------------------------------------------------
+int MixCtl::readRight(int dev)
+{
+ return mixer_devices_[dev].value/256;
+}
+
+//----------------------------------------------------------------------
+// Write volume to device. Use setVolume, setLeft and setRight first.
+void MixCtl::writeVol(int dev)
+{
+ ioctl(mixfd, MIXER_WRITE(dev), &mixer_devices_[dev].value);
+}
+
+//----------------------------------------------------------------------
+// Set volume (or left or right component) for a device. You must call writeVol to write it.
+void MixCtl::setVol(int dev, int value)
+{
+ mixer_devices_[dev].value=value;
+}
+//----------------------------------------------------------------------
+void MixCtl::setBoth(int dev, int l, int r)
+{
+ mixer_devices_[dev].value=256*r+l;
+}
+//----------------------------------------------------------------------
+void MixCtl::setLeft(int dev, int l)
+{
+ int r;
+ if(mixer_devices_[dev].stereo)
+ r=mixer_devices_[dev].value/256;
+ else
+ r=l;
+ mixer_devices_[dev].value=256*r+l;
+}
+//----------------------------------------------------------------------
+void MixCtl::setRight(int dev, int r)
+{
+ int l;
+ if(mixer_devices_[dev].stereo)
+ l=mixer_devices_[dev].value%256;
+ else
+ l=r;
+ mixer_devices_[dev].value=256*r+l;
+}
+
+//----------------------------------------------------------------------
+// Return record source value for a device, optionally reading it from device first.
+bool MixCtl::readRec(int dev, bool read)
+{
+ if(read)
+ {
+ ioctl(mixfd, SOUND_MIXER_READ_RECSRC, &recsrc);
+ mixer_devices_[dev].recsrc=(recsrc & mixer_devices_[dev].mask);
+ }
+ return mixer_devices_[dev].recsrc;
+}
+
+//----------------------------------------------------------------------
+// Write record source values to device. Use setRec first.
+void MixCtl::writeRec(){
+ ioctl(mixfd, SOUND_MIXER_WRITE_RECSRC, &recsrc);
+}
+
+//----------------------------------------------------------------------
+// Make a device (not) a record source.
+void MixCtl::setRec(int dev, bool rec)
+{
+ if(rec)
+ {
+ if(caps & SOUND_CAP_EXCL_INPUT)
+ recsrc=mixer_devices_[dev].mask;
+ else
+ recsrc|=mixer_devices_[dev].mask;
+ }
+ else
+ recsrc&=~mixer_devices_[dev].mask;
+}
+
+//----------------------------------------------------------------------
+// Return various other info
+char* MixCtl::getDevName()
+{
+ return device_;
+}
+//----------------------------------------------------------------------
+unsigned MixCtl::getNrDevices()
+{
+ return num_devices_;
+}
+//----------------------------------------------------------------------
+int MixCtl::getCapabilities()
+{
+ return caps;
+}
+//----------------------------------------------------------------------
+bool MixCtl::getSupport(int dev)
+{
+ return mixer_devices_[dev].support;
+}
+//----------------------------------------------------------------------
+bool MixCtl::getStereo(int dev)
+{
+ return mixer_devices_[dev].stereo;
+}
+//----------------------------------------------------------------------
+bool MixCtl::getRecords(int dev)
+{
+ return mixer_devices_[dev].records;
+}
+//----------------------------------------------------------------------
+char* MixCtl::getName(int dev)
+{
+ return mixer_devices_[dev].name;
+}
+//----------------------------------------------------------------------
+char* MixCtl::getLabel(int dev)
+{
+ return mixer_devices_[dev].label;
+}
+
+//----------------------------------------------------------------------
+bool MixCtl::hasChanged()
+{
+ struct mixer_info mixer_info;
+ ioctl(mixfd, SOUND_MIXER_INFO, &mixer_info);
+
+ if (mixer_info.modify_counter == modify_counter)
+ {
+ return false;
+ }
+ else
+ {
+ modify_counter = mixer_info.modify_counter;
+ return true;
+ }
+}
diff --git a/mixctl.h b/mixctl.h
new file mode 100644
index 0000000..2750693
--- /dev/null
+++ b/mixctl.h
@@ -0,0 +1,103 @@
+// mixctl.h - MixCtl class provides control of audio mixer functions
+//
+// Release 1.5
+// 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
+// See the COPYING file for details.
+
+#ifndef __mixctl_h__
+#define __mixctl_h__
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#ifdef __NetBSD__
+#include <soundcard.h>
+#endif
+#ifdef __FreeBSD__
+#include <machine/soundcard.h>
+#endif
+#ifdef __linux__
+#include <linux/soundcard.h>
+#endif
+
+#include "exception.h"
+
+//----------------------------------------------------------------------
+struct _MixerDevice_{
+ bool support;
+ bool stereo;
+ bool recsrc;
+ bool records;
+ char *name;
+ char *label;
+ int value;
+ int mask;
+ int muted;
+};
+
+typedef struct _MixerDevice_ MixerDevice;
+
+//----------------------------------------------------------------------
+class MixCtl
+{
+ protected:
+ int mixfd;
+ int mixfdopen;
+ char* device_;
+ int muted_;
+
+ unsigned num_devices_; // maximum number of devices
+ int devmask; // supported devices
+ int stmask; // stereo devices
+ int recmask; // devices which can be recorded from
+ int caps; // capabilities
+ int recsrc; // devices which are being recorded from
+ int modify_counter;
+ MixerDevice* mixer_devices_;
+
+ void doStatus();
+
+ public:
+ MixCtl(char *dname) throw(MixerDeviceException);
+ virtual ~MixCtl();
+ int readVol(int, bool);
+ int readLeft(int);
+ int readRight(int);
+ void writeVol(int);
+
+ void setVol(int, int);
+ void setBoth(int, int, int);
+ void setLeft(int, int);
+ void setRight(int, int);
+
+ bool readRec(int, bool);
+ void writeRec();
+ void setRec(int, bool);
+
+ char *getDevName();
+ unsigned getNrDevices();
+ int getCapabilities();
+ bool getSupport(int);
+ bool getStereo(int);
+ bool getRecords(int);
+ char *getName(int);
+ char *getLabel(int);
+ bool hasChanged();
+
+ bool isMuted(int);
+ void mute(int);
+ void unmute(int);
+};
+
+#endif // __mixctl_h__
+
diff --git a/wmmixer.1 b/wmmixer.1
new file mode 100644
index 0000000..4d26c51
--- /dev/null
+++ b/wmmixer.1
@@ -0,0 +1,92 @@
+.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 (default: green)
+.TP
+.B \-L, \-\-led\-highcolor <\fIstring\fP>
+use the specified color for led-shading, e.g. red, green, blue (default: red)
+.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
new file mode 100644
index 0000000..3cbe4a0
--- /dev/null
+++ b/wmmixer.cc
@@ -0,0 +1,581 @@
+// wmmixer.cc - A mixer designed for WindowMaker
+//
+// Release 1.5
+// 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
+// See the COPYING file for details.
+
+
+#include "wmmixer.h"
+
+//--------------------------------------------------------------------
+WMMixer::WMMixer()
+{
+ // Initialize member variables
+ current_channel_ = 0;
+ num_channels_ = 0;
+ current_channel_left_ = 0;
+ current_channel_right_ = 0;
+ repeat_timer_ = 0;
+ wheel_scroll_ = 2;
+ current_recording_ = false;
+ current_show_recording_ = false;
+ dragging_ = false;
+
+ strcpy(mixer_device_, MIXERDEV);
+
+ xhandler_ = new XHandler();
+}
+
+
+//--------------------------------------------------------------------
+WMMixer::~WMMixer()
+{
+ delete[] channel_list_;
+ delete mixctl_;
+ delete xhandler_;
+}
+
+
+//--------------------------------------------------------------------
+void WMMixer::loop()
+{
+ XEvent xev;
+
+ bool done=false;
+ while(!done)
+ {
+ while(XPending(xhandler_->getDisplay()))
+ {
+ XNextEvent(xhandler_->getDisplay(), &xev);
+ switch(xev.type)
+ {
+ case Expose:
+ xhandler_->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] == (int)xhandler_->getDeleteWin())
+ done=true;
+ break;
+ }
+ }
+
+ // keep a button pressed causes scrolling throught the channels
+ if(xhandler_->getButtonState() & (BTNPREV | BTNNEXT))
+ {
+ repeat_timer_++;
+ if(repeat_timer_ >= RPTINTERVAL)
+ {
+ if(xhandler_->getButtonState() & BTNNEXT)
+ {
+ current_channel_++;
+ if(current_channel_ >= num_channels_)
+ current_channel_ = 0;
+ }
+ else
+ {
+ if(current_channel_ < 1)
+ current_channel_ = num_channels_-1;
+ else
+ current_channel_--;
+ }
+
+ checkVol(true);
+ repeat_timer_ = 0;
+ }
+ }
+ else
+ {
+ checkVol(false);
+ }
+
+ XFlush(xhandler_->getDisplay());
+ usleep(100000);
+ }
+}
+
+
+//--------------------------------------------------------------------
+void WMMixer::init(int argc, char **argv)
+{
+ parseArgs(argc, argv);
+
+ initMixer();
+
+ readConfigurationFile();
+
+ xhandler_->init(argc, argv, mixctl_->getNrDevices());
+
+ if(num_channels_ == 0)
+ {
+ std::cerr << NAME << " : Sorry, no supported channels found." << std::endl;
+ }
+ else
+ {
+ checkVol(true);
+ }
+}
+
+//--------------------------------------------------------------------
+void WMMixer::initMixer()
+{
+ // Initialize Mixer
+ try
+ {
+ mixctl_ = new MixCtl(mixer_device_);
+ }
+ catch(MixerDeviceException &exc)
+ {
+ std::cerr << NAME << " : " << exc.getErrorMessage() << "'." << std::endl;
+ exit(1);
+ }
+
+ channel_list_ = new unsigned[mixctl_->getNrDevices()];
+
+ for(unsigned count=0; count<mixctl_->getNrDevices(); count++)
+ {
+ if(mixctl_->getSupport(count)){
+ channel_list_[num_channels_]=count;
+ num_channels_++;
+ }
+ }
+}
+
+
+//--------------------------------------------------------------------
+void WMMixer::checkVol(bool forced = true)
+{
+ if(!forced && !mixctl_->hasChanged())
+ return;
+
+ if(mixctl_->isMuted(channel_list_[current_channel_]))
+ xhandler_->setButtonState(xhandler_->getButtonState() | BTNMUTE);
+ else
+ xhandler_->setButtonState(xhandler_->getButtonState() & ~BTNMUTE);
+
+
+ mixctl_->readVol(channel_list_[current_channel_], true);
+ unsigned nl = mixctl_->readLeft(channel_list_[current_channel_]);
+ unsigned nr = mixctl_->readRight(channel_list_[current_channel_]);
+ bool nrec = mixctl_->readRec(channel_list_[current_channel_], true);
+
+ if(forced)
+ {
+ current_channel_left_ = nl;
+ current_channel_right_ = nr;
+ current_recording_ = nrec;
+ if(nrec)
+ xhandler_->setButtonState(xhandler_->getButtonState() | BTNREC);
+ else
+ xhandler_->setButtonState(xhandler_->getButtonState() & ~BTNREC);
+ current_show_recording_=mixctl_->getRecords(channel_list_[current_channel_]);
+ updateDisplay();
+ }
+ else
+ {
+ if(nl != current_channel_left_ || nr != current_channel_right_ || nrec != current_recording_)
+ {
+ if(nl!=current_channel_left_)
+ {
+ current_channel_left_=nl;
+ if(mixctl_->getStereo(channel_list_[current_channel_]))
+ xhandler_->drawLeft(current_channel_left_);
+ else
+ xhandler_->drawMono(current_channel_left_);
+ }
+ if(nr!=current_channel_right_)
+ {
+ current_channel_right_=nr;
+ if(mixctl_->getStereo(channel_list_[current_channel_]))
+ xhandler_->drawRight(current_channel_right_);
+ else
+ xhandler_->drawMono(current_channel_left_);
+ }
+ if(nrec!=current_recording_)
+ {
+ current_recording_=nrec;
+ if(nrec)
+ xhandler_->setButtonState(xhandler_->getButtonState() | BTNREC);
+ else
+ xhandler_->setButtonState(xhandler_->getButtonState() & ~BTNREC);
+ xhandler_->drawBtns(BTNREC, current_show_recording_);
+ }
+ updateDisplay();
+ }
+ }
+}
+
+
+
+//--------------------------------------------------------------------
+void WMMixer::parseArgs(int argc, char **argv)
+{
+ 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'},
+ {"led-highcolor", 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:L:b:m:r:", long_opts, &opt_index)) != -1)
+ {
+ switch (i)
+ {
+ case 'h':
+ case ':':
+ case '?':
+ displayUsage(argv[0]);
+ break;
+ case 'v':
+ displayVersion();
+ break;
+ case 'd':
+ xhandler_->setDisplay(optarg);
+ break;
+ case 'g':
+ xhandler_->setPosition(optarg);
+ break;
+ case 'w':
+ xhandler_->setWindowMaker();
+ break;
+ case 'a':
+ xhandler_->setAfterStep();
+ break;
+ case 's':
+ xhandler_->setUnshaped();
+ break;
+ case 'l':
+ xhandler_->setLedColor(optarg);
+ break;
+ case 'L':
+ xhandler_->setLedHighColor(optarg);
+ break;
+ case 'b':
+ xhandler_->setBackColor(optarg);
+ break;
+ case 'm':
+ sprintf(mixer_device_, "%s", optarg);
+ break;
+ case 'r':
+ if(atoi(optarg)>0)
+ wheel_scroll_ = atoi(optarg);
+ break;
+ }
+ }
+}
+
+//--------------------------------------------------------------------
+void WMMixer::readConfigurationFile()
+{
+ FILE *rcfile;
+ char rcfilen[256];
+ char buf[256];
+ int done;
+ // int current=-1;
+ unsigned current = mixctl_->getNrDevices() + 1;
+
+ sprintf(rcfilen, "%s/.wmmixer", getenv("HOME"));
+ if((rcfile=fopen(rcfilen, "r"))!=NULL)
+ {
+ num_channels_=0;
+ do
+ {
+ 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", ¤t);
+ if(current >= mixctl_->getNrDevices() || mixctl_->getSupport(current) == false)
+ {
+ fprintf(stderr,"%s : Sorry, this channel (%i) is not supported.\n", NAME, current);
+ current = mixctl_->getNrDevices() + 1;
+ }
+ else
+ {
+ channel_list_[num_channels_] = current;
+ num_channels_++;
+ }
+ }
+ if(strncmp(buf, "setchannel ", strlen("setchannel "))==0)
+ {
+ sscanf(buf, "setchannel %i", ¤t);
+ if(current >= mixctl_->getNrDevices() || mixctl_->getSupport(current)==false)
+ {
+ fprintf(stderr,"%s : Sorry, this channel (%i) is not supported.\n", NAME, current);
+ current = mixctl_->getNrDevices() + 1;
+ }
+ }
+ if(strncmp(buf, "setmono ", strlen("setmono "))==0)
+ {
+ if(current== mixctl_->getNrDevices() + 1)
+ fprintf(stderr,"%s : Sorry, no current channel.\n", NAME);
+ else{
+ int value;
+ sscanf(buf, "setmono %i", &value);
+ mixctl_->setLeft(current, value);
+ mixctl_->setRight(current, value);
+ mixctl_->writeVol(current);
+ }
+ }
+ if(strncmp(buf, "setleft ", strlen("setleft "))==0)
+ {
+ if(current== mixctl_->getNrDevices() + 1)
+ fprintf(stderr, "%s : Sorry, no current channel.\n", NAME);
+ else{
+ int value;
+ sscanf(buf, "setleft %i", &value);
+ mixctl_->setLeft(current, value);
+ mixctl_->writeVol(current);
+ }
+ }
+ if(strncmp(buf, "setright ", strlen("setright "))==0)
+ {
+ if(current== mixctl_->getNrDevices() + 1)
+ fprintf(stderr, "%s : Sorry, no current channel.\n", NAME);
+ else
+ {
+ int value;
+ sscanf(buf, "setleft %i", &value);
+ mixctl_->setRight(current, value);
+ mixctl_->writeVol(current);
+ }
+ }
+ if(strncmp(buf, "setrecsrc ", strlen("setrecsrc "))==0)
+ {
+ if(current== mixctl_->getNrDevices() + 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();
+ }
+}
+
+//--------------------------------------------------------------------
+void WMMixer::displayUsage(const char* name)
+{
+ std::cout << "Usage: " << name << "[options]" << std::endl;
+ std::cout << " -h, --help display this help screen" << std::endl;
+ std::cout << " -v, --version display program version" << std::endl;
+ std::cout << " -d, --display <string> display to use (see X manual pages)" << std::endl;
+ std::cout << " -g, --geometry +XPOS+YPOS geometry to use (see X manual pages)" << std::endl;
+ std::cout << " -w, --withdrawn run the application in withdrawn mode" << std::endl;
+ std::cout << " (for WindowMaker, etc)" << std::endl;
+ std::cout << " -a, --afterstep use smaller window (for AfterStep Wharf)" << std::endl;
+ std::cout << " -s, --shaped shaped window" << std::endl;
+ std::cout << " -l, --led-color <string> use the specified color for led display" << std::endl;
+ std::cout << " -L, --led-highcolor <string> use the specified color for led shading" << std::endl;
+ std::cout << " -b, --back-color <string> use the specified color for backgrounds" << std::endl;
+ std::cout << " -m, --mix-device use specified device (rather than /dev/mixer)" << std::endl;
+ std::cout << " -r, --scrollwheel <number> volume increase/decrease with mouse wheel (default: 2)" << std::endl;
+ std::cout << "\nFor backward compatibility the following obsolete options are still supported:" << std::endl;
+ std::cout << " -help display this help screen" << std::endl;
+ std::cout << " -position geometry to use (see X manual pages)" << std::endl;
+ std::cout << " -display display to use (see X manual pages)" << std::endl;
+ exit(0);
+
+}
+
+//--------------------------------------------------------------------
+void WMMixer::displayVersion()
+{
+ std::cout << "wmmixer version 1.5" << std::endl;
+ exit(0);
+}
+
+
+//--------------------------------------------------------------------
+void WMMixer::pressEvent(XButtonEvent *xev)
+{
+ bool forced_update = true;
+ int x = xev->x-(xhandler_->getWindowSize()/2-32);
+ int y = xev->y-(xhandler_->getWindowSize()/2-32);
+
+ if(xhandler_->isLeftButton(x, y))
+ {
+ if(current_channel_ < 1)
+ current_channel_=num_channels_-1;
+ else
+ current_channel_--;
+
+ xhandler_->setButtonState(xhandler_->getButtonState() | BTNPREV);
+ repeat_timer_ = 0;
+ xhandler_->drawBtns(BTNPREV, current_show_recording_);
+ }
+
+ if(xhandler_->isRightButton(x, y))
+ {
+ current_channel_++;
+ if(current_channel_ >= num_channels_)
+ current_channel_=0;
+
+ xhandler_->setButtonState(xhandler_->getButtonState() | BTNNEXT);
+ repeat_timer_ = 0;
+ xhandler_->drawBtns(BTNNEXT, current_show_recording_);
+ }
+
+ // Volume settings
+ if(xhandler_->isVolumeBar(x, y))
+ {
+ int vl = 0, vr = 0;
+
+ if(xev->button < 4)
+ {
+ vl = ((60-y)*100)/(2*25);
+ vr = vl;
+ dragging_ = true;
+ }
+ else if(xev->button == 4)
+ {
+ vr = mixctl_->readRight(channel_list_[current_channel_]) + wheel_scroll_;
+ vl = mixctl_->readLeft(channel_list_[current_channel_]) + wheel_scroll_;
+
+ }
+ else if(xev->button == 5)
+ {
+ vr = mixctl_->readRight(channel_list_[current_channel_]) - wheel_scroll_;
+ vl = mixctl_->readLeft(channel_list_[current_channel_]) - wheel_scroll_;
+ }
+
+ if(vl <= 0)
+ vl = 0;
+ if(vr <= 0)
+ vr = 0;
+
+ if(x <= 50)
+ mixctl_->setLeft(channel_list_[current_channel_], vl);
+ if(x >= 45)
+ mixctl_->setRight(channel_list_[current_channel_], vr);
+ mixctl_->writeVol(channel_list_[current_channel_]);
+
+ forced_update = false;
+ }
+
+ // Toggle record
+ if(xhandler_->isRecButton(x, y))
+ {
+ mixctl_->setRec(channel_list_[current_channel_], !mixctl_->readRec(channel_list_[current_channel_], false));
+ mixctl_->writeRec();
+ forced_update = false;
+ }
+
+ // Toggle mute
+ if(xhandler_->isMuteButton(x, y))
+ {
+ if(mixctl_->isMuted(channel_list_[current_channel_]))
+ {
+ xhandler_->setButtonState(xhandler_->getButtonState() & ~BTNMUTE);
+ mixctl_->unmute(channel_list_[current_channel_]);
+ }
+ else
+ {
+ mixctl_->mute(channel_list_[current_channel_]);
+ xhandler_->setButtonState(xhandler_->getButtonState() | BTNMUTE);
+ }
+
+ xhandler_->drawBtns(BTNMUTE, current_show_recording_);
+ }
+
+ // Update volume display
+ checkVol(forced_update);
+}
+
+//--------------------------------------------------------------------
+void WMMixer::releaseEvent(XButtonEvent *xev)
+{
+ dragging_ = false;
+ xhandler_->setButtonState(xhandler_->getButtonState() & ~(BTNPREV | BTNNEXT));
+ xhandler_->drawBtns(BTNPREV | BTNNEXT, current_show_recording_);
+ xhandler_->repaint();
+}
+
+//--------------------------------------------------------------------
+void WMMixer::motionEvent(XMotionEvent *xev)
+{
+ int x=xev->x-(xhandler_->getWindowSize()/2-32);
+ int y=xev->y-(xhandler_->getWindowSize()/2-32);
+ // if(x>=37 && x<=56 && y>=8 && dragging_){
+ if(xhandler_->isVolumeBar(x, y) && dragging_){
+ int v=((60-y)*100)/(2*25);
+ if(v<0)
+ v=0;
+ if(x<=50)
+ mixctl_->setLeft(channel_list_[current_channel_], v);
+ if(x>=45)
+ mixctl_->setRight(channel_list_[current_channel_], v);
+ mixctl_->writeVol(channel_list_[current_channel_]);
+ checkVol(false);
+ }
+}
+
+//--------------------------------------------------------------------
+void WMMixer::updateDisplay()
+{
+ xhandler_->update(channel_list_[current_channel_]);
+ if(mixctl_->getStereo(channel_list_[current_channel_]))
+ {
+ xhandler_->drawLeft(current_channel_left_);
+ xhandler_->drawRight(current_channel_right_);
+ }
+ else
+ {
+ xhandler_->drawMono(current_channel_right_);
+ }
+ xhandler_->drawBtns(BTNREC | BTNNEXT | BTNPREV | BTNMUTE, current_show_recording_);
+ xhandler_->repaint();
+}
+
+
+
+//====================================================================
+int main(int argc, char** argv)
+{
+ WMMixer mixer = WMMixer();
+ mixer.init(argc, argv);
+ mixer.loop();
+}
diff --git a/wmmixer.h b/wmmixer.h
new file mode 100644
index 0000000..2e0968e
--- /dev/null
+++ b/wmmixer.h
@@ -0,0 +1,87 @@
+// wmmixer.h - A mixer designed for WindowMaker
+//
+// Release 1.5
+// 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
+// See the COPYING file for details.
+
+
+#ifndef __wmmixer_h__
+#define __wmmixer_h_
+
+// Input/Output
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <getopt.h>
+
+#include <iostream>
+
+#include <X11/X.h>
+
+// WMMixer
+#include "mixctl.h"
+#include "xhandler.h"
+#include "common.h"
+#include "exception.h"
+
+// For repeating next and prev buttons
+#define RPTINTERVAL 5
+
+
+class WMMixer
+{
+ protected:
+
+ // Mixer
+ MixCtl *mixctl_;
+
+ char mixer_device_[256];
+ unsigned num_channels_;
+ unsigned current_channel_;
+ unsigned current_channel_left_;
+ unsigned current_channel_right_;
+ bool current_recording_;
+ bool current_show_recording_;
+
+ XHandler *xhandler_;
+
+ unsigned *channel_list_;
+
+ int repeat_timer_;
+
+ // For draggable volume control
+ bool dragging_;
+// Default scroll amount
+ int wheel_scroll_;
+
+ // Input/Output
+ void readConfigurationFile();
+ void displayVersion(void);
+ void displayUsage(const char*);
+ void checkVol(bool);
+
+ void motionEvent(XMotionEvent *xev);
+ void releaseEvent(XButtonEvent *xev);
+ void pressEvent(XButtonEvent *xev);
+ void parseArgs(int , char **);
+
+ void initMixer();
+ void initXHandler();
+
+ void updateDisplay();
+
+ public:
+ WMMixer();
+ ~WMMixer();
+
+ void init(int, char **);
+ void loop();
+};
+
+
+#endif //__wmmixer_h__
diff --git a/xhandler.cc b/xhandler.cc
new file mode 100644
index 0000000..652335d
--- /dev/null
+++ b/xhandler.cc
@@ -0,0 +1,549 @@
+// wmmixer - A mixer designed for WindowMaker
+//
+// Release 1.5
+// 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
+// See the COPYING file for details.
+
+#include "xhandler.h"
+
+//--------------------------------------------------------------------
+XHandler::XHandler()
+{
+ is_wmaker_ = WINDOWMAKER;
+ is_ushape_ = USESHAPE;
+ is_astep_ = AFTERSTEP;
+
+ strcpy(display_name_, "");
+ strcpy(position_name_, "");
+ strcpy(ledcolor_name_, LEDCOLOR);
+ strcpy(ledcolor_high_name_, LEDCOLOR_HIGH);
+ strcpy(backcolor_name_, BACKCOLOR);
+
+ button_state_ = 0;
+}
+
+//--------------------------------------------------------------------
+XHandler::~XHandler()
+{
+ XFreeGC(display_default_, graphics_context_);
+ XFreePixmap(display_default_, pixmap_main);
+ XFreePixmap(display_default_, pixmap_tile);
+ XFreePixmap(display_default_, pixmap_disp);
+ XFreePixmap(display_default_, pixmap_mask);
+ XFreePixmap(display_default_, pixmap_icon);
+ XFreePixmap(display_default_, pixmap_nrec);
+
+ XDestroyWindow(display_default_, window_main_);
+
+ if(is_wmaker_)
+ XDestroyWindow(display_default_, window_icon_);
+
+ XCloseDisplay(display_default_);
+
+ delete[] icon_list_;
+}
+
+
+//--------------------------------------------------------------------
+void XHandler::init(int argc, char** argv, int num_channels)
+{
+ int display_depth;
+
+ window_size_=is_astep_ ? ASTEPSIZE : NORMSIZE;
+
+ if((display_default_ = XOpenDisplay(display_name_))==NULL)
+ {
+ std::cerr << NAME << " : Unable to open X display '" << XDisplayName(display_name_) << "'." << std::endl;
+ exit(1);
+ }
+
+ initWindow(argc, argv);
+
+ initColors();
+
+ display_depth = DefaultDepth(display_default_, DefaultScreen(display_default_));
+ initPixmaps(display_depth);
+
+ initGraphicsContext();
+
+ initMask();
+
+ initIcons(num_channels);
+}
+
+
+//--------------------------------------------------------------------
+bool XHandler::isLeftButton(int x, int y)
+{
+ return(x>=BTN_LEFT_X && y>=BTN_LEFT_Y && x<=BTN_LEFT_X + BTN_WIDTH && y<=BTN_LEFT_Y + BTN_HEIGHT);
+}
+
+//--------------------------------------------------------------------
+bool XHandler::isRightButton(int x, int y)
+{
+ return(x>=BTN_RIGHT_X && y>=BTN_RIGHT_Y && x<=BTN_RIGHT_X + BTN_WIDTH && y<=BTN_RIGHT_Y + BTN_HEIGHT);
+}
+
+//--------------------------------------------------------------------
+bool XHandler::isMuteButton(int x, int y)
+{
+ return(x>=BTN_MUTE_X && y>=BTN_MUTE_Y && x<=BTN_MUTE_X + BTN_WIDTH && y<=BTN_MUTE_Y + BTN_HEIGHT);
+}
+
+//--------------------------------------------------------------------
+bool XHandler::isRecButton(int x, int y)
+{
+ return(x>=BTN_REC_X && y>=BTN_REC_Y && x<=BTN_REC_X + BTN_WIDTH && y<=BTN_REC_Y + BTN_HEIGHT);
+}
+
+//--------------------------------------------------------------------
+bool XHandler::isVolumeBar(int x, int y)
+{
+ return(x>=37 && x<=56 && y>=8 && y<=56);
+}
+
+//--------------------------------------------------------------------
+unsigned long XHandler::getColor(char *colorname)
+{
+ XColor color;
+ XWindowAttributes winattr;
+
+ XGetWindowAttributes(display_default_, window_root_, &winattr);
+ color.pixel=0;
+ XParseColor(display_default_, winattr.colormap, colorname, &color);
+ color.flags=DoRed | DoGreen | DoBlue;
+ XAllocColor(display_default_, winattr.colormap, &color);
+
+ return color.pixel;
+}
+
+//--------------------------------------------------------------------
+unsigned long XHandler::mixColor(char *colorname1, int prop1, char *colorname2, int prop2)
+{
+ XColor color, color1, color2;
+ XWindowAttributes winattr;
+
+ XGetWindowAttributes(display_default_, window_root_, &winattr);
+
+ XParseColor(display_default_, winattr.colormap, colorname1, &color1);
+ XParseColor(display_default_, 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(display_default_, winattr.colormap, &color);
+
+ return color.pixel;
+}
+
+//--------------------------------------------------------------------
+void XHandler::repaint()
+{
+ flush_expose(window_icon_);
+ XCopyArea(display_default_, pixmap_disp, window_icon_, graphics_context_, 0, 0, 64, 64, window_size_/2-32, window_size_/2-32);
+ flush_expose(window_main_);
+ XCopyArea(display_default_, pixmap_disp, window_main_, graphics_context_, 0, 0, 64, 64, window_size_/2-32, window_size_/2-32);
+
+ XEvent xev;
+ while(XCheckTypedEvent(display_default_, Expose, &xev));
+}
+
+//--------------------------------------------------------------------
+void XHandler::update(unsigned channel)
+{
+ if(is_wmaker_ || is_ushape_ || is_astep_)
+ {
+ XShapeCombineMask(display_default_, window_icon_, ShapeBounding, window_size_/2-32, window_size_/2-32, pixmap_mask, ShapeSet);
+ XShapeCombineMask(display_default_, window_main_, ShapeBounding, window_size_/2-32, window_size_/2-32, pixmap_mask, ShapeSet);
+ }
+ else
+ {
+ XCopyArea(display_default_, pixmap_tile, pixmap_disp, graphics_context_, 0, 0, 64, 64, 0, 0);
+ }
+
+ XSetClipMask(display_default_, graphics_context_, pixmap_mask);
+ XCopyArea(display_default_, pixmap_main, pixmap_disp, graphics_context_, 0, 0, 64, 64, 0, 0);
+ XSetClipMask(display_default_, graphics_context_, None);
+ XCopyArea(display_default_, pixmap_icon, pixmap_disp, graphics_context_, icon_list_[channel]*22, 0, 22, 22, 6, 5);
+}
+
+//--------------------------------------------------------------------
+void XHandler::drawLeft(unsigned curleft)
+{
+ XSetForeground(display_default_, graphics_context_, shade_colors_[(curleft*25)/100]);
+ for(unsigned i=0;i<25;i++)
+ {
+ if(i >= (curleft*25)/100)
+ {
+ XSetForeground(display_default_, graphics_context_, colors_[3]);
+ }
+ else
+ {
+ XSetForeground(display_default_, graphics_context_, shade_colors_[i]);
+ }
+ XFillRectangle(display_default_, pixmap_disp, graphics_context_, 37, 55-2*i, 9, 1);
+ }
+}
+
+//--------------------------------------------------------------------
+void XHandler::drawRight(unsigned curright)
+{
+ for(unsigned i=0;i<25;i++)
+ {
+ if(i >= (curright*25)/100)
+ {
+ XSetForeground(display_default_, graphics_context_, colors_[3]);
+ }
+ else
+ {
+ XSetForeground(display_default_, graphics_context_, shade_colors_[i]);
+ }
+ XFillRectangle(display_default_, pixmap_disp, graphics_context_, 48, 55-2*i, 9, 1);
+ }
+}
+
+//--------------------------------------------------------------------
+// Based on wmsmixer by Damian Kramer <psiren at hibernaculum.demon.co.uk>
+void XHandler::drawMono(unsigned curright)
+{
+ XSetForeground(display_default_, graphics_context_, colors_[1]);
+ for(unsigned i=0;i<25;i++)
+ {
+ if(i >= (curright*25)/100)
+ {
+ XSetForeground(display_default_, graphics_context_, colors_[3]);
+ }
+ else
+ {
+ XSetForeground(display_default_, graphics_context_, shade_colors_[i]);
+ }
+ XFillRectangle(display_default_, pixmap_disp, graphics_context_, 37, 55-2*i, 20, 1);
+ }
+}
+
+
+//--------------------------------------------------------------------
+void XHandler::drawBtns(int buttons, bool curshowrec)
+{
+ if(buttons & BTNPREV)
+ drawButton(BTN_LEFT_X, BTN_LEFT_Y, BTN_WIDTH, BTN_HEIGHT, (button_state_ & BTNPREV));
+
+ if(buttons & BTNNEXT)
+ drawButton(BTN_RIGHT_X, BTN_RIGHT_Y, BTN_WIDTH, BTN_HEIGHT, (button_state_ & BTNNEXT));
+
+ if(buttons & BTNMUTE)
+ drawButton(BTN_MUTE_X, BTN_MUTE_Y, BTN_WIDTH, BTN_HEIGHT, (button_state_ & BTNMUTE));
+
+ if(buttons & BTNREC){
+ drawButton(BTN_REC_X, BTN_REC_Y, BTN_WIDTH, BTN_HEIGHT, (button_state_ & BTNREC));
+
+ if(!curshowrec)
+ XCopyArea(display_default_, pixmap_nrec, pixmap_disp, graphics_context_, 0, 0, 9, 8, 6, 47);
+ else
+ XCopyArea(display_default_, pixmap_main, pixmap_disp, graphics_context_, 6, 48, 9, 8, 6, 47);
+ }
+}
+
+//--------------------------------------------------------------------
+void XHandler::drawButton(int x, int y, int w, int h, bool down)
+{
+ if(!down)
+ XCopyArea(display_default_, pixmap_main, pixmap_disp, graphics_context_, x, y, w, h, x, y);
+ else {
+ XCopyArea(display_default_, pixmap_main, pixmap_disp, graphics_context_, x, y, 1, h-1, x+w-1, y+1);
+ XCopyArea(display_default_, pixmap_main, pixmap_disp, graphics_context_, x+w-1, y+1, 1, h-1, x, y);
+ XCopyArea(display_default_, pixmap_main, pixmap_disp, graphics_context_, x, y, w-1, 1, x+1, y+h-1);
+ XCopyArea(display_default_, pixmap_main, pixmap_disp, graphics_context_, x+1, y+h-1, w-1, 1, x, y);
+ }
+}
+
+//--------------------------------------------------------------------
+int XHandler::flush_expose(Window w)
+{
+ XEvent dummy;
+ int i=0;
+
+ while (XCheckTypedWindowEvent(display_default_, w, Expose, &dummy))
+ i++;
+
+ return i;
+}
+
+
+//--------------------------------------------------------------------
+int XHandler::getWindowSize()
+{
+ return window_size_;
+}
+
+//--------------------------------------------------------------------
+// --> inline
+//Display* XHandler::getDisplay()
+//{
+// return display_default_;
+//}
+
+
+//--------------------------------------------------------------------
+int XHandler::getButtonState()
+{
+ return button_state_;
+}
+
+//--------------------------------------------------------------------
+void XHandler::setButtonState(int button_state)
+{
+ button_state_ = button_state;
+}
+
+//--------------------------------------------------------------------
+void XHandler::setDisplay(char* arg)
+{
+ sprintf(display_name_, "%s", arg);
+}
+
+//--------------------------------------------------------------------
+void XHandler::setPosition(char* arg)
+{
+ sprintf(position_name_, "%s", arg);
+}
+
+//--------------------------------------------------------------------
+void XHandler::setLedColor(char* arg)
+{
+ sprintf(ledcolor_name_, "%s", arg);
+}
+
+//--------------------------------------------------------------------
+void XHandler::setLedHighColor(char* arg)
+{
+ sprintf(ledcolor_high_name_, "%s", arg);
+}
+
+//--------------------------------------------------------------------
+void XHandler::setBackColor(char* arg)
+{
+ sprintf(backcolor_name_, "%s", arg);
+}
+
+//--------------------------------------------------------------------
+void XHandler::setUnshaped()
+{
+ is_ushape_ = 1;
+}
+
+//--------------------------------------------------------------------
+void XHandler::setWindowMaker()
+{
+ is_wmaker_ = 1;
+}
+
+//--------------------------------------------------------------------
+void XHandler::setAfterStep()
+{
+ is_astep_ = 1;
+}
+
+//--------------------------------------------------------------------
+Atom XHandler::getDeleteWin()
+{
+ return deleteWin;
+}
+
+
+//--------------------------------------------------------------------
+void XHandler::initIcons(int num)
+{
+ if(icon_list_)
+ delete[] icon_list_;
+
+ icon_list_ = new unsigned[num];
+
+ icon_list_[0] = 0;
+ icon_list_[1] = 7;
+ icon_list_[2] = 8;
+ icon_list_[3] = 2;
+ icon_list_[4] = 1;
+ icon_list_[5] = 6;
+ icon_list_[6] = 4;
+ icon_list_[7] = 5;
+ icon_list_[8] = 3;
+ for(int counter=9; counter<num; counter++)
+ icon_list_[counter] = 9;
+}
+
+//--------------------------------------------------------------------
+void XHandler::initGraphicsContext()
+{
+ XGCValues gcv;
+ unsigned long gcm;
+
+ gcm = GCForeground | GCBackground | GCGraphicsExposures;
+ gcv.graphics_exposures = 0;
+ gcv.foreground = fore_pix;
+ gcv.background = back_pix;
+ graphics_context_ = XCreateGC(display_default_, window_root_, gcm, &gcv);
+}
+
+//--------------------------------------------------------------------
+void XHandler::initPixmaps(int display_depth)
+{
+ XpmColorSymbol xpmcsym[4]={{"back_color", NULL, colors_[0]},
+ {"led_color_high", NULL, colors_[1]},
+ {"led_color_med", NULL, colors_[2]},
+ {"led_color_low", NULL, colors_[3]}};
+ XpmAttributes xpmattr;
+
+ xpmattr.numsymbols = 4;
+ xpmattr.colorsymbols = xpmcsym;
+ xpmattr.exactColors = false;
+ xpmattr.closeness = 40000;
+ xpmattr.valuemask = XpmColorSymbols | XpmExactColors | XpmCloseness;
+
+ XpmCreatePixmapFromData(display_default_, window_root_, wmmixer_xpm, &pixmap_main, &pixmap_mask, &xpmattr);
+ XpmCreatePixmapFromData(display_default_, window_root_, tile_xpm, &pixmap_tile, NULL, &xpmattr);
+ XpmCreatePixmapFromData(display_default_, window_root_, icons_xpm, &pixmap_icon, NULL, &xpmattr);
+ XpmCreatePixmapFromData(display_default_, window_root_, norec_xpm, &pixmap_nrec, NULL, &xpmattr);
+
+ pixmap_disp = XCreatePixmap(display_default_, window_root_, 64, 64, display_depth);
+}
+
+
+//--------------------------------------------------------------------
+void XHandler::initWindow(int argc, char** argv)
+{
+ char *wname = argv[0];
+ int screen, dummy = 0;
+ XWMHints wmhints;
+ XSizeHints shints;
+ XClassHint classHint;
+ XTextProperty name;
+
+ screen = DefaultScreen(display_default_);
+ _XA_GNUSTEP_WM_FUNC = XInternAtom(display_default_, "_GNUSTEP_WM_FUNCTION", false);
+ deleteWin = XInternAtom(display_default_, "WM_DELETE_WINDOW", false);
+
+
+ shints.x = 0;
+ shints.y = 0;
+ // shints.flags = USSize;
+ shints.flags = 0; // Gordon
+
+ bool pos = (XWMGeometry(display_default_, DefaultScreen(display_default_),
+ position_name_, NULL, 0, &shints, &shints.x, &shints.y,
+ &shints.width, &shints.height, &dummy)
+ & (XValue | YValue));
+ shints.min_width = window_size_;
+ shints.min_height = window_size_;
+ shints.max_width = window_size_;
+ shints.max_height = window_size_;
+ shints.base_width = window_size_;
+ shints.base_height = window_size_;
+ shints.width = window_size_;
+ shints.height = window_size_;
+ shints.flags=PMinSize | PMaxSize | PBaseSize; // Gordon
+
+
+ window_root_ = RootWindow(display_default_, screen);
+
+ back_pix = getColor("white");
+ fore_pix = getColor("black");
+
+ window_main_ = XCreateSimpleWindow(display_default_, window_root_, shints.x, shints.y,
+ shints.width, shints.height, 0, fore_pix, back_pix);
+
+ window_icon_ = XCreateSimpleWindow(display_default_, window_root_, shints.x, shints.y,
+ shints.width, shints.height, 0, fore_pix, back_pix);
+
+ XSetWMNormalHints(display_default_, window_main_, &shints);
+
+
+ wmhints.icon_x = shints.x;
+ wmhints.icon_y = shints.y;
+
+ if(is_wmaker_ || is_astep_ || pos)
+ shints.flags |= USPosition;
+
+ if(is_wmaker_)
+ {
+ wmhints.initial_state = WithdrawnState;
+ wmhints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint;
+ wmhints.icon_window = window_icon_;
+
+ wmhints.icon_x = shints.x;
+ wmhints.icon_y = shints.y;
+ wmhints.window_group = window_main_;
+ }
+ else
+ {
+ wmhints.initial_state = NormalState;
+ wmhints.flags = WindowGroupHint | StateHint;
+ }
+
+ classHint.res_name=NAME;
+ classHint.res_class=CLASS;
+
+ XSetClassHint(display_default_, window_main_, &classHint);
+ XSetClassHint(display_default_, window_icon_, &classHint);
+
+
+ if (XStringListToTextProperty(&wname, 1, &name) == 0)
+ {
+ std::cerr << wname << ": can't allocate window name" << std::endl;
+ exit(1);
+ }
+
+ XSetWMName(display_default_, window_main_, &name);
+ XSetWMHints(display_default_, window_main_, &wmhints);
+ XSetCommand(display_default_, window_main_, argv, argc);
+ XSetWMProtocols(display_default_, window_main_, &deleteWin, 1); // Close
+}
+
+
+//--------------------------------------------------------------------
+// Initialize main colors and shaded color-array for bars
+void XHandler::initColors()
+{
+ colors_[0] = mixColor(ledcolor_name_, 0, backcolor_name_, 100);
+ colors_[1] = mixColor(ledcolor_name_, 100, backcolor_name_, 0);
+ colors_[2] = mixColor(ledcolor_name_, 60, backcolor_name_, 40);
+ colors_[3] = mixColor(ledcolor_name_, 25, backcolor_name_, 75);
+
+ for(int count=0; count<25; count++)
+ {
+ shade_colors_[count] = mixColor(ledcolor_high_name_, count*2, ledcolor_name_, 100-count*4);
+ }
+}
+
+
+//--------------------------------------------------------------------
+void XHandler::initMask()
+{
+ XSetClipMask(display_default_, graphics_context_, pixmap_mask);
+ XCopyArea( display_default_, pixmap_main, pixmap_disp, graphics_context_, 0, 0, 64, 64, 0, 0);
+ XSetClipMask(display_default_, graphics_context_, None);
+ XStoreName( display_default_, window_main_, NAME);
+ XSetIconName(display_default_, window_main_, NAME);
+
+ if(is_wmaker_ || is_ushape_ || is_astep_)
+ {
+ XShapeCombineMask(display_default_, window_icon_, ShapeBounding, window_size_/2-32, window_size_/2-32, pixmap_mask, ShapeSet);
+ XShapeCombineMask(display_default_, window_main_, ShapeBounding, window_size_/2-32, window_size_/2-32, pixmap_mask, ShapeSet);
+ }
+ else
+ {
+ XCopyArea(display_default_, pixmap_tile, pixmap_disp, graphics_context_, 0, 0, 64, 64, 0, 0);
+ }
+
+ XSelectInput(display_default_, window_main_, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
+ XSelectInput(display_default_, window_icon_, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
+ XMapWindow(display_default_, window_main_);
+}
+
diff --git a/xhandler.h b/xhandler.h
new file mode 100644
index 0000000..68ecbf8
--- /dev/null
+++ b/xhandler.h
@@ -0,0 +1,153 @@
+// wmmixer - A mixer designed for WindowMaker
+//
+// Release 1.5
+// 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
+// See the COPYING file for details.
+
+
+#ifndef __xhandler_h__
+#define __xhandler_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>
+
+#include <iostream>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "common.h"
+
+// Xpm images - standard
+#include "XPM/wmmixer.xpm"
+#include "XPM/tile.xpm"
+
+// Xpm images - custom
+#include "XPM/icons.xpm"
+#include "XPM/norec.xpm"
+
+//--------------------------------------------------------------------
+#define BTN_LEFT_X 5
+#define BTN_LEFT_Y 34
+
+#define BTN_RIGHT_X 17
+#define BTN_RIGHT_Y 34
+
+#define BTN_MUTE_X 17
+#define BTN_MUTE_Y 47
+
+#define BTN_REC_X 5
+#define BTN_REC_Y 47
+
+#define BTN_WIDTH 12
+#define BTN_HEIGHT 11
+
+#define BTNNEXT 1
+#define BTNPREV 2
+#define BTNREC 4
+#define BTNMUTE 8
+
+
+//--------------------------------------------------------------------
+class XHandler
+{
+ protected:
+ int button_state_;
+ int window_size_;
+
+ bool is_wmaker_;
+ bool is_ushape_;
+ bool is_astep_;
+
+ unsigned *icon_list_;
+
+ Display *display_default_;
+ Window window_icon_;
+ Window window_main_;
+ Window window_root_;
+
+ GC graphics_context_;
+ unsigned long colors_[4];
+ unsigned long shade_colors_[25];
+
+ char display_name_[256];
+ char position_name_[256];
+ char ledcolor_name_[256];
+ char ledcolor_high_name_[256];
+ char backcolor_name_[256];
+
+ Pixel back_pix;
+ Pixel fore_pix;
+
+ // Pixmaps - standard
+ Pixmap pixmap_main;
+ Pixmap pixmap_tile;
+ Pixmap pixmap_disp;
+ Pixmap pixmap_mask;
+
+ // Pixmaps - custom
+ Pixmap pixmap_icon;
+ Pixmap pixmap_nrec;
+
+ // X-Windows basics - standard
+ Atom _XA_GNUSTEP_WM_FUNC;
+ Atom deleteWin;
+
+
+ unsigned long getColor(char*);
+ unsigned long mixColor(char*, int, char*, int);
+ void drawButton(int, int, int, int, bool);
+ void initPixmaps(int);
+ void initWindow(int, char**);
+ void initGraphicsContext();
+ void initMask();
+ void initColors();
+ void initIcons(int);
+
+ int flush_expose(Window);
+
+ public:
+ XHandler();
+ virtual ~XHandler();
+ void init(int, char**, int);
+
+ void repaint();
+ void update(unsigned);
+ void drawLeft(unsigned);
+ void drawRight(unsigned);
+ void drawBtns(int, bool);
+ void drawMono(unsigned);
+
+ bool isLeftButton(int, int);
+ bool isRightButton(int, int);
+ bool isMuteButton(int, int);
+ bool isRecButton(int, int);
+ bool isVolumeBar(int, int);
+
+ Display* getDisplay() {return display_default_;}
+ int getButtonState();
+ void setButtonState(int);
+ void setDisplay(char* arg);
+ void setPosition(char* arg);
+ void setLedColor(char* arg);
+ void setLedHighColor(char* arg);
+ void setBackColor(char* arg);
+ void setUnshaped();
+ void setWindowMaker();
+ void setAfterStep();
+ int getWindowSize();
+ Atom getDeleteWin();
+
+};
+
+#endif //__xhandler_h__
--
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