shithub: orca

Download patch

ref: 733ee3ae99e43ecc89ad5c0b6005dc413e52c299
parent: 65908306ef48ae629ec789d14a47acad88c95b0c
author: Nicola Pisanti <nicola@npisanti.com>
date: Mon Jul 15 18:24:25 EDT 2019

adds --nomouse option when compiling

--- a/README.md
+++ b/README.md
@@ -41,6 +41,8 @@
 
 PortMIDI is an optional dependency. It can be enabled by adding the option `--portmidi` when running the `tool` build script.
 
+You can also disable the mouse by adding the `--nomouse` option, useful to avoid accidental touchpad clicks.
+
 ### Make
 
 ```sh
--- a/tool
+++ b/tool
@@ -30,6 +30,8 @@
     --portmidi    Enable hardware MIDI output support with PortMIDI.
                   Default: not enabled
                   Note: PortMIDI has memory leaks and bugs.
+    --nomouse     Disables mouse clicks.
+                  Default: not enabled (mouse enabled).
 EOF
 }
 
@@ -50,6 +52,7 @@
 pie_enabled=0
 static_enabled=0
 portmidi_enabled=0
+mouse_disabled=0
 
 while getopts c:dhsv-: opt_val; do
   case "$opt_val" in
@@ -59,6 +62,7 @@
         static) static_enabled=1;;
         pie) pie_enabled=1;;
         portmidi) portmidi_enabled=1;;
+        nomouse) mouse_disabled=1;;
         *)
           echo "Unknown long option --$OPTARG" >&2
           print_usage >&2
@@ -336,6 +340,9 @@
         if [[ $1 = debug ]]; then
           echo -e "Warning: The PortMIDI library contains bugs.\\nIt may trigger address sanitizer in debug builds.\\nThese are not bugs in orca." >&2
         fi
+      fi
+      if [[ $mouse_disabled = 1 ]]; then
+        add cc_flags -DFEAT_NOMOUSE
       fi
       ;;
   esac
--- a/tui_main.c
+++ b/tui_main.c
@@ -2234,6 +2234,7 @@
       }
       goto next_getch;
     }
+#ifndef FEAT_NOMOUSE
     case KEY_MOUSE: {
       MEVENT mevent;
       if (cont_window && getmouse(&mevent) == OK) {
@@ -2255,6 +2256,7 @@
       }
       goto next_getch;
     }
+#endif
     case CTRL_PLUS('q'):
       goto quit;
     }