From ca5e14cdad978341fb3865d7b083d5f0fe65a11a Mon Sep 17 00:00:00 2001 From: nick black Date: Tue, 24 Dec 2019 01:17:49 -0500 Subject: [PATCH] xraydemo: isolate avi/text --- src/demo/xray.c | 13 ++++++++++--- src/lib/notcurses.c | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/demo/xray.c b/src/demo/xray.c index 95d011676..87e7f87e5 100644 --- a/src/demo/xray.c +++ b/src/demo/xray.c @@ -22,8 +22,7 @@ perframecb(struct notcurses* nc, struct ncvisual* ncv __attribute__ ((unused))){ int dimx, dimy; struct ncplane* n = notcurses_stdplane(nc); ncplane_dim_yx(n, &dimy, &dimx); - ncplane_putsimple_yx(n, 0, 0, 'a'); - int y = dimy - sizeof(leg) / sizeof(*leg) - 3; + int y = dimy - sizeof(leg) / sizeof(*leg); int x = dimx - frameno; for(size_t l = 0 ; l < sizeof(leg) / sizeof(*leg) ; ++l, ++y){ int r = startr; @@ -71,7 +70,14 @@ perframecb(struct notcurses* nc, struct ncvisual* ncv __attribute__ ((unused))){ } int xray_demo(struct notcurses* nc){ - struct ncplane* n = notcurses_stdplane(nc); + int dimx, dimy; + struct ncplane* nstd = notcurses_stdplane(nc); + ncplane_dim_yx(nstd, &dimy, &dimx); + dimy -= sizeof(leg) / sizeof(*leg); + struct ncplane* n = notcurses_newplane(nc, dimy, dimx, 0, 0, NULL); + if(n == NULL){ + return -1; + } char* path = find_data("notcursesI.avi"); int averr; struct ncvisual* ncv = ncplane_visual_open(n, path, &averr); @@ -83,5 +89,6 @@ int xray_demo(struct notcurses* nc){ } ncvisual_stream(nc, ncv, &averr, perframecb); ncvisual_destroy(ncv); + ncplane_destroy(n); return 0; } diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index 2e62e5bbc..0de3b68ea 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -1586,7 +1586,7 @@ ncplane* ncplane_below(ncplane* n){ #define SET_SGR_MODE_MOUSE "1006" int notcurses_mouse_enable(notcurses* n){ return term_emit("mouse", ESC "[?" SET_BTN_EVENT_MOUSE ";" - SET_FOCUS_EVENT_MOUSE ";" SET_SGR_MODE_MOUSE "h", + /*SET_FOCUS_EVENT_MOUSE ";" */SET_SGR_MODE_MOUSE "h", n->ttyfp, true); } @@ -1594,6 +1594,6 @@ int notcurses_mouse_enable(notcurses* n){ // the sequences 1000 etc? int notcurses_mouse_disable(notcurses* n){ return term_emit("mouse", ESC "[?" SET_BTN_EVENT_MOUSE ";" - SET_FOCUS_EVENT_MOUSE ";" SET_SGR_MODE_MOUSE "l", + /*SET_FOCUS_EVENT_MOUSE ";" */SET_SGR_MODE_MOUSE "l", n->ttyfp, true); }