Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flag to disable mouse click #108

Merged
merged 1 commit into from
Mar 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
flag to disable mouse click
  • Loading branch information
Nisker committed Mar 23, 2022
commit 613594abae4d36ce7222c2795b0cb0e4b33f716e
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