scope

signal visualizer for plan9
git clone git://nsmpr.xyz/scope.git
Log | Files | Refs

commit b592f642e06559956b28f3af8296b1b4268ca830
parent 902005ab22e18dddf6b58ff1ddda4b0e6c487cde
Author: Pavel Renev <an2qzavok@gmail.com>
Date:   Fri, 27 Nov 2020 17:33:50 +0000

fix menuhit

Diffstat:
Mscope.c | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/scope.c b/scope.c @@ -126,6 +126,7 @@ dright(void) dmono(1); } +void (*dfunc[])(void) = {dleft, dright, dboth, dXY}; void @@ -211,7 +212,7 @@ threadmain(int argc, char **argv) } ARGEND if (argc > 0) usage(); if (initdraw(nil, nil, "scope") < 0) sysfatal("initdraw failed: %r"); - if ((mctl = initmouse(0, 0)) == nil) sysfatal("initmouse failed: %r"); + if ((mctl = initmouse(0, screen)) == nil) sysfatal("initmouse failed: %r"); if ((kctl = initkeyboard(0)) == nil) sysfatal("initkeyboard failed: %r"); supc = chancreate(sizeof(int), 0); @@ -225,8 +226,11 @@ threadmain(int argc, char **argv) threadcreate(threadupdate, supc, 8 * 1024); proccreate(procread, rctl, 64*1024); - char *menustr[2] = { + char *menustr[5] = { "left", + "right", + "both", + "XY", nil, }; @@ -253,7 +257,9 @@ threadmain(int argc, char **argv) break; case 1: /* mouse */ if (mv.buttons == 1) { - menuhit(1, mctl, &menu, 0); + int m; + m = menuhit(1, mctl, &menu, 0); + if (m >=0) dlines = dfunc[m]; } break; case 2: /* resize */