Skip to content

Commit

Permalink
Merge pull request zevv#108 from Nisker/master
Browse files Browse the repository at this point in the history
flag to disable mouse click
  • Loading branch information
zevv authored Mar 24, 2022
2 parents dd4b471 + 613594a commit 6758522
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ static double midloc[] = {
};

static int opt_verbose = 0;
static int opt_no_click = 0;
static int opt_stereo_width = 50;
static int opt_gain = 100;
static int opt_fallback_sound = 0;
Expand All @@ -76,7 +77,7 @@ static const char *opt_path_audio = PATH_AUDIO;
static int muted = 0;


static const char short_opts[] = "d:fg:hlm:Mp:s:v";
static const char short_opts[] = "d:fg:hlm:Mp:s:cv";

static const struct option long_opts[] = {
{ "device", required_argument, NULL, 'd' },
Expand All @@ -88,6 +89,7 @@ static const struct option long_opts[] = {
{ "mute", no_argument, NULL, 'M' },
{ "audio-path", required_argument, NULL, 'p' },
{ "stereo-width", required_argument, NULL, 'w' },
{ "no-click", no_argument, NULL, 'c' },
{ "verbose", no_argument, NULL, 'v' },
{ 0, 0, 0, 0 }
};
Expand Down Expand Up @@ -130,6 +132,9 @@ int main(int argc, char **argv)
case 's':
opt_stereo_width = atoi(optarg);
break;
case 'c':
opt_no_click++;
break;
case 'v':
opt_verbose++;
break;
Expand Down Expand Up @@ -210,6 +215,7 @@ static void usage(char *exe)
" -g, --gain=GAIN set playback gain [0..100]\n"
" -m, --mute-keycode=CODE use CODE as mute key (default 0x46 for scroll lock)\n"
" -M, --mute start the program muted\n"
" -c, --no-click don't play a sound on mouse click\n"
" -h, --help show help\n"
" -l, --list-devices list available OpenAL audio devices\n"
" -p, --audio-path=PATH load .wav files from directory PATH\n"
Expand Down Expand Up @@ -315,6 +321,8 @@ int play(int code, int press)

printd("scancode %d/0x%x", code, code);

if (code == 0xff && opt_no_click) return 0;

/* Check for mute sequence: ScrollLock down+up+down */

if (press) {
Expand Down

0 comments on commit 6758522

Please sign in to comment.