wmmixer patches

This commit is contained in:
Rodolfo kix Garcia 2011-07-13 11:22:32 +02:00 committed by Carlos R. Mafra
parent 17283d07a2
commit 02b63cb41c
9 changed files with 51 additions and 17 deletions

View file

@ -82,3 +82,11 @@ Release 1.5 25 Jun 2002 Several fixes (really open mixer device given
set volume below 0) set volume below 0)
Shaded LED-Bar Shaded LED-Bar
Initial Exception Handling Initial Exception Handling
Release 1.6 13 Jul 2011 Support of multiple config files to run multiple
instances of wmmixer. Hurd support. Support of
XClasses. These patches was created first in Debian
01_restore_pristine_code.patch
02_multiple_config_files.patch
03_hurd_support.patch
04_xclass_support.patch

View file

@ -82,10 +82,10 @@ The effect this has is to enable shape support (it implies "-s"), and
to reduce the size of the window to 56x56 pixels. to reduce the size of the window to 56x56 pixels.
The "-position position" option has also been added, so you can push The "-position position" option has also been added, so you can push
wmcdplay off the edge of the screen while it gets swallowed. wmcdplay off the edge of the screen while it gets swallowed.
To put wmmount in your Wharf, add the following line in the appropriate To put wmmixer in your Wharf, add the following line in the appropriate
part of your .steprc part of your .steprc
*Wharf wmmixer nil MaxSwallow "wmmount" wmmixer -a -g -0-0 & *Wharf wmmixer nil MaxSwallow "wmmixer" wmmixer -a -g -0-0 &
It is also possible (by editing and recompiling the afterstep sources), It is also possible (by editing and recompiling the afterstep sources),
to make Wharf handle the new 56x56 pixel window properly - yes, I add to make Wharf handle the new 56x56 pixel window properly - yes, I add

View file

@ -37,4 +37,4 @@ class MixerDeviceException : public Exception
// virtual ~MixerDeviceException(); // virtual ~MixerDeviceException();
}; };
#endif _exception_h__ #endif //_exception_h__

View file

@ -243,16 +243,16 @@ char* MixCtl::getLabel(int dev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool MixCtl::hasChanged() bool MixCtl::hasChanged()
{ {
struct mixer_info mixer_info; struct mixer_info mixer_info1;
ioctl(mixfd, SOUND_MIXER_INFO, &mixer_info); ioctl(mixfd, SOUND_MIXER_INFO, &mixer_info1);
if (mixer_info.modify_counter == modify_counter) if (mixer_info1.modify_counter == modify_counter)
{ {
return false; return false;
} }
else else
{ {
modify_counter = mixer_info.modify_counter; modify_counter = mixer_info1.modify_counter;
return true; return true;
} }
} }

View file

@ -23,12 +23,15 @@
#ifdef __NetBSD__ #ifdef __NetBSD__
#include <soundcard.h> #include <soundcard.h>
#endif #endif
#ifdef __FreeBSD__ #if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
#include <machine/soundcard.h> #include <sys/soundcard.h>
#endif #endif
#ifdef __linux__ #ifdef __linux__
#include <linux/soundcard.h> #include <linux/soundcard.h>
#endif #endif
#ifdef __GNU__ // Hurd
#include <sys/soundcard.h>
#endif
#include "exception.h" #include "exception.h"

View file

@ -3,6 +3,7 @@
// Release 1.5 // Release 1.5
// Copyright (C) 1998 Sam Hawker <shawkie@geocities.com> // Copyright (C) 1998 Sam Hawker <shawkie@geocities.com>
// Copyright (C) 2002 Gordon Fraser <gordon@debian.org> // Copyright (C) 2002 Gordon Fraser <gordon@debian.org>
// Patch added by Rodolfo (kix) Garcia <kix@kix.es> to select the config file
// This software comes with ABSOLUTELY NO WARRANTY // This software comes with ABSOLUTELY NO WARRANTY
// This software is free software, and you are welcome to redistribute it // This software is free software, and you are welcome to redistribute it
// under certain conditions // under certain conditions
@ -234,10 +235,14 @@ void WMMixer::parseArgs(int argc, char **argv)
{"led-highcolor", 1, NULL, 'L'}, {"led-highcolor", 1, NULL, 'L'},
{"back-color", 1, NULL, 'b'}, {"back-color", 1, NULL, 'b'},
{"mix-device", 1, NULL, 'm'}, {"mix-device", 1, NULL, 'm'},
{"config-file", 1, NULL, 'c'},
{"x-class", 1, NULL, 'x'},
{"scrollwheel",1, NULL, 'r'}, {"scrollwheel",1, NULL, 'r'},
{NULL, 0, NULL, 0 }}; {NULL, 0, NULL, 0 }};
int i, opt_index = 0; int i, opt_index = 0;
// init the config file name
snprintf(config_file_, CONFIGFILELEN -1, "%s/.wmmixer", getenv("HOME"));
// For backward compatibility // For backward compatibility
for(i=1; i<argc; i++) for(i=1; i<argc; i++)
@ -256,7 +261,7 @@ void WMMixer::parseArgs(int argc, char **argv)
} }
} }
while ((i = getopt_long(argc, argv, "hvd:g:wasl:L:b:m:r:", long_opts, &opt_index)) != -1) while ((i = getopt_long(argc, argv, "hvd:g:wasl:L:b:m:c:x:r:", long_opts, &opt_index)) != -1)
{ {
switch (i) switch (i)
{ {
@ -295,6 +300,12 @@ void WMMixer::parseArgs(int argc, char **argv)
case 'm': case 'm':
sprintf(mixer_device_, "%s", optarg); sprintf(mixer_device_, "%s", optarg);
break; break;
case 'c':
snprintf(config_file_, CONFIGFILELEN -1, "%s", optarg);
break;
case 'x':
xhandler_->setWindowClass(optarg);
break;
case 'r': case 'r':
if(atoi(optarg)>0) if(atoi(optarg)>0)
wheel_scroll_ = atoi(optarg); wheel_scroll_ = atoi(optarg);
@ -307,14 +318,12 @@ void WMMixer::parseArgs(int argc, char **argv)
void WMMixer::readConfigurationFile() void WMMixer::readConfigurationFile()
{ {
FILE *rcfile; FILE *rcfile;
char rcfilen[256];
char buf[256]; char buf[256];
int done; int done;
// int current=-1; // int current=-1;
unsigned current = mixctl_->getNrDevices() + 1; unsigned current = mixctl_->getNrDevices() + 1;
sprintf(rcfilen, "%s/.wmmixer", getenv("HOME")); if((rcfile=fopen(config_file_, "r"))!=NULL)
if((rcfile=fopen(rcfilen, "r"))!=NULL)
{ {
num_channels_=0; num_channels_=0;
do do
@ -412,6 +421,8 @@ void WMMixer::displayUsage(const char* name)
std::cout << " -L, --led-highcolor <string> use the specified color for led shading" << 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 << " -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 << " -m, --mix-device use specified device (rather than /dev/mixer)" << std::endl;
std::cout << " -c, --config-file use specified config file (rather than $HOME/.wmmixer)" << std::endl;
std::cout << " -x, --x-class <string> use specified class (rather than WMMmixer)" << std::endl;
std::cout << " -r, --scrollwheel <number> volume increase/decrease with mouse wheel (default: 2)" << 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 << "\nFor backward compatibility the following obsolete options are still supported:" << std::endl;
std::cout << " -help display this help screen" << std::endl; std::cout << " -help display this help screen" << std::endl;

View file

@ -3,6 +3,7 @@
// Release 1.5 // Release 1.5
// Copyright (C) 1998 Sam Hawker <shawkie@geocities.com> // Copyright (C) 1998 Sam Hawker <shawkie@geocities.com>
// Copyright (C) 2002 Gordon Fraser <gordon@debian.org> // Copyright (C) 2002 Gordon Fraser <gordon@debian.org>
// Patch added by Rodolfo (kix) Garcia <kix@kix.es> to select the config file
// This software comes with ABSOLUTELY NO WARRANTY // This software comes with ABSOLUTELY NO WARRANTY
// This software is free software, and you are welcome to redistribute it // This software is free software, and you are welcome to redistribute it
// under certain conditions // under certain conditions
@ -31,7 +32,7 @@
// For repeating next and prev buttons // For repeating next and prev buttons
#define RPTINTERVAL 5 #define RPTINTERVAL 5
#define CONFIGFILELEN 256
class WMMixer class WMMixer
{ {
@ -41,6 +42,7 @@ class WMMixer
MixCtl *mixctl_; MixCtl *mixctl_;
char mixer_device_[256]; char mixer_device_[256];
char config_file_[CONFIGFILELEN];
unsigned num_channels_; unsigned num_channels_;
unsigned current_channel_; unsigned current_channel_;
unsigned current_channel_left_; unsigned current_channel_left_;

View file

@ -22,8 +22,10 @@ XHandler::XHandler()
strcpy(ledcolor_name_, LEDCOLOR); strcpy(ledcolor_name_, LEDCOLOR);
strcpy(ledcolor_high_name_, LEDCOLOR_HIGH); strcpy(ledcolor_high_name_, LEDCOLOR_HIGH);
strcpy(backcolor_name_, BACKCOLOR); strcpy(backcolor_name_, BACKCOLOR);
strcpy(window_class_, CLASS);
button_state_ = 0; button_state_ = 0;
icon_list_ = NULL;
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -333,6 +335,12 @@ void XHandler::setBackColor(char* arg)
sprintf(backcolor_name_, "%s", arg); sprintf(backcolor_name_, "%s", arg);
} }
//--------------------------------------------------------------------
void XHandler::setWindowClass(char* arg)
{
snprintf(window_class_, 254, "%s", arg);
}
//-------------------------------------------------------------------- //--------------------------------------------------------------------
void XHandler::setUnshaped() void XHandler::setUnshaped()
{ {
@ -488,7 +496,7 @@ void XHandler::initWindow(int argc, char** argv)
} }
classHint.res_name=NAME; classHint.res_name=NAME;
classHint.res_class=CLASS; classHint.res_class = window_class_;
XSetClassHint(display_default_, window_main_, &classHint); XSetClassHint(display_default_, window_main_, &classHint);
XSetClassHint(display_default_, window_icon_, &classHint); XSetClassHint(display_default_, window_icon_, &classHint);

View file

@ -85,6 +85,7 @@ class XHandler
char ledcolor_name_[256]; char ledcolor_name_[256];
char ledcolor_high_name_[256]; char ledcolor_high_name_[256];
char backcolor_name_[256]; char backcolor_name_[256];
char window_class_[256];
Pixel back_pix; Pixel back_pix;
Pixel fore_pix; Pixel fore_pix;
@ -142,6 +143,7 @@ class XHandler
void setLedColor(char* arg); void setLedColor(char* arg);
void setLedHighColor(char* arg); void setLedHighColor(char* arg);
void setBackColor(char* arg); void setBackColor(char* arg);
void setWindowClass(char* arg);
void setUnshaped(); void setUnshaped();
void setWindowMaker(); void setWindowMaker();
void setAfterStep(); void setAfterStep();