From: Christophe CURIS <[email protected]>

There may be some case where user would like to fall back to the original
behaviour, for example if grabbing these keys could get in conflict with
other applications.

Signed-off-by: Christophe CURIS <[email protected]>
---
 wmix/config.c         |  8 +++++++-
 wmix/include/config.h |  1 +
 wmix/wmix.1x          | 11 +++++++++++
 wmix/wmix.c           |  4 +++-
 4 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/wmix/config.c b/wmix/config.c
index 6a3c822..0414ea4 100644
--- a/wmix/config.c
+++ b/wmix/config.c
@@ -41,6 +41,7 @@
        "  -e <name> exclude channel, can be used many times\n" \
        "  -f <file> parse this config [~/.wmixrc]\n" \
        "  -h        print this help\n" \
+       "  -k        disable grabing volume control keys\n" \
        "  -m <dev>  mixer device [/dev/mixer]\n" \
        "  -v        verbose -> id, long name, name\n" \
 
@@ -64,6 +65,7 @@ void config_init(void)
        config.mixer_device = (char *) default_mixer_device;
        config.mousewheel = 1;
        config.scrolltext = 1;
+       config.mmkeys = 1;
        config.wheel_button_up = 4;
        config.wheel_button_down = 5;
        config.scrollstep = 0.03;
@@ -117,7 +119,7 @@ void parse_cli_options(int argc, char **argv)
        config.verbose = false;
        error_found = false;
        for (;;) {
-               opt = getopt(argc, argv, ":d:e:f:hm:v");
+               opt = getopt(argc, argv, ":d:e:f:hkm:v");
                if (opt == -1)
                        break;
 
@@ -158,6 +160,10 @@ void parse_cli_options(int argc, char **argv)
                        exit(0);
                        break;
 
+               case 'k':
+                       config.mmkeys = false;
+                       break;
+
                case 'm':
                        if (config.mixer_device != default_mixer_device)
                                free(config.mixer_device);
diff --git a/wmix/include/config.h b/wmix/include/config.h
index 702a382..ee632f4 100644
--- a/wmix/include/config.h
+++ b/wmix/include/config.h
@@ -34,6 +34,7 @@ extern struct _Config {
        unsigned int osd        : 1;    /* show OSD? */
        unsigned int mousewheel : 1;    /* mousewheel enabled? */
        unsigned int scrolltext : 1;    /* scroll channel names? */
+       unsigned int mmkeys     : 1;    /* grab multimedia keys for volume 
control */
 
        unsigned int wheel_button_up;   /* up button */
        unsigned int wheel_button_down; /* down button */
diff --git a/wmix/wmix.1x b/wmix/wmix.1x
index 8e4cf68..9b6f650 100644
--- a/wmix/wmix.1x
+++ b/wmix/wmix.1x
@@ -40,6 +40,12 @@ Use config file instead of
 \fB\-h\fR
 Display list of command\-line options
 .TP
+\fB\-k\fR
+Disable grabbing the audio volume control keys on keyboard (see
+.SM
+.B BUGS
+below)
+.TP
 \fB\-m\fR <\fIdevice\fP>
 Use specified mixer device instead of
 .I /dev/mixer
@@ -137,6 +143,11 @@ that a channel has been muted.
 The X server allows only one application at a time to place a grab on a key,
 so if another application already claimed the volume control keys then 
\fBwmix\fP
 will warn you about it and continue without the functionality.
+If on the other hand you encounter problem with applications that do
+not work because they could not grab these keys (a typical symptom is
+an X Error of type \fIBadAccess\fP with major opcode 33 \fIX_GrabKey\fP),
+you can ask \fBwmix\fP to not grab them using the command line option
+\fB-k\fP.
 .LP
 If you modify the configuration file, do not expect \fBwmix\fP to reload
 it automatically, this is considered a too costly feature for such a
diff --git a/wmix/wmix.c b/wmix/wmix.c
index ae8bce5..a992987 100644
--- a/wmix/wmix.c
+++ b/wmix/wmix.c
@@ -93,7 +93,9 @@ int main(int argc, char **argv)
     dockapp_init(display);
     new_window("wmix", 64, 64);
     new_osd(DisplayWidth(display, DefaultScreen(display)) - 200, 60);
-    mmkey_install(display);
+
+    if (config.mmkeys)
+           mmkey_install(display);
 
     config_release();
 
-- 
1.9.2


-- 
To unsubscribe, send mail to [email protected].

Reply via email to