A melange of fixen (#2179)

* split up ncdirect_dump_{sprixel, cellplane}()
* build ncdirect_dump_cellplane() out of fbuf #2167
* [macos] don't run pandoc in workflow
* [gpm] account for margins in mouse reports
* [in] drop mouse clicks from top/left margins
* [ffmpeg] compile against avformat 59+ w/out warnings
pull/2180/head
nick black 3 years ago committed by GitHub
parent 875b3a56de
commit 811f9334d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -26,9 +26,9 @@ gpmwatcher(void* vti){
logwarn("negative input %hd %hd", gev.x, gev.y);
continue;
}
++gev.x;
++gev.y;
if(snprintf(cmdbuf + 3, space, "%hd;%hd;%hdM", 0, gev.x, gev.y) >= space){
// gpm is 0-indexed, but we assume mice reports to be 1-indexed, as they
// are in the XTerm protocols. no need to account for margins here.
if(snprintf(cmdbuf + 3, space, "%hd;%hd;%hdM", 0, gev.x + 1, gev.y + 1) >= space){
logwarn("input overflowed %hd %hd\n", gev.x, gev.y);
continue;
}
@ -38,7 +38,6 @@ gpmwatcher(void* vti){
}
int gpm_connect(tinfo* ti){
(void)ti;
gpm_zerobased = 1;
// get all of _MOVE, _DRAG, _DOWN, and _UP
gpmconn.eventMask = GPM_DRAG | GPM_DOWN | GPM_UP;

@ -806,10 +806,17 @@ set_sda_version(inputctx* ictx){
// ictx->numeric, ictx->p3, and ictx->p2 have the two parameters
static void
mouse_click(inputctx* ictx){
// convert from 1- to 0-indexing, and account for margins
const int x = ictx->p3 - 1 - ictx->lmargin;
const int y = ictx->numeric - 1 - ictx->tmargin;
if(x < 0 || y < 0){ // click was in margins, drop it
logwarn("dropping click in margins\n");
return;
}
pthread_mutex_lock(&ictx->ilock);
if(ictx->ivalid == ictx->isize){
pthread_mutex_unlock(&ictx->ilock);
logerror("dropping mouse click 0x%02x %d %d\n", ictx->p2, ictx->p3, ictx->numeric);
logerror("dropping mouse click 0x%02x %d %d\n", ictx->p2, y, x);
return;
}
ncinput* ni = ictx->inputs + ictx->iwrite;
@ -827,9 +834,8 @@ mouse_click(inputctx* ictx){
ni->ctrl = ictx->p2 & 0x10;
ni->alt = ictx->p2 & 0x08;
ni->shift = ictx->p2 & 0x04;
// convert from 1- to 0-indexing and account for margins
ni->x = ictx->p3 - 1 - ictx->lmargin;
ni->y = ictx->numeric - 1 - ictx->tmargin;
ni->x = x;
ni->y = y;
if(++ictx->iwrite == ictx->isize){
ictx->iwrite = 0;
}

@ -395,7 +395,12 @@ ncvisual* ffmpeg_from_file(const char* filename){
goto err;
}
//av_dump_format(ncv->details->fmtctx, 0, filename, false);
if((averr = av_find_best_stream(ncv->details->fmtctx, AVMEDIA_TYPE_SUBTITLE, -1, -1, &ncv->details->subtcodec, 0)) >= 0){
if((averr = av_find_best_stream(ncv->details->fmtctx, AVMEDIA_TYPE_SUBTITLE, -1, -1,
#if LIBAVFORMAT_VERSION_MAJOR >= 59
(const AVCodec**)&ncv->details->subtcodec, 0)) >= 0){
#else
&ncv->details->subtcodec, 0)) >= 0){
#endif
ncv->details->sub_stream_index = averr;
if((ncv->details->subtcodecctx = avcodec_alloc_context3(ncv->details->subtcodec)) == NULL){
//fprintf(stderr, "Couldn't allocate decoder for %s\n", filename);
@ -414,7 +419,12 @@ ncvisual* ffmpeg_from_file(const char* filename){
// fprintf(stderr, "Couldn't allocate packet for %s\n", filename);
goto err;
}
if((averr = av_find_best_stream(ncv->details->fmtctx, AVMEDIA_TYPE_VIDEO, -1, -1, &ncv->details->codec, 0)) < 0){
if((averr = av_find_best_stream(ncv->details->fmtctx, AVMEDIA_TYPE_VIDEO, -1, -1,
#if LIBAVFORMAT_VERSION_MAJOR >= 59
(const AVCodec**)&ncv->details->codec, 0)) < 0){
#else
&ncv->details->codec, 0)) < 0){
#endif
// fprintf(stderr, "Couldn't find visuals in %s (%s)\n", filename, av_err2str(*averr));
goto err;
}

Loading…
Cancel
Save