#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include "automaton.h"
#include "internal.h"
#include "unixsig.h"
#include "render.h"
#include "in.h"
Go to the source code of this file.
|
void | sigwinch_handler (int signo) |
|
int | ncinput_shovel (inputctx *ictx, const void *buf, int len) |
|
int | init_inputlayer (tinfo *ti, FILE *infp, int lmargin, int tmargin, int rmargin, int bmargin, ncsharedstats *stats, unsigned drain, int linesigs_enabled) |
|
int | stop_inputlayer (tinfo *ti) |
|
int | inputready_fd (const inputctx *ictx) |
|
uint32_t | notcurses_get (notcurses *nc, const struct timespec *absdl, ncinput *ni) |
|
int | notcurses_getvec (notcurses *n, const struct timespec *absdl, ncinput *ni, int vcount) |
|
uint32_t | ncdirect_get (ncdirect *n, const struct timespec *absdl, ncinput *ni) |
|
int | get_cursor_location (inputctx *ictx, const char *u7, unsigned *y, unsigned *x) |
|
int | notcurses_linesigs_disable (notcurses *nc) |
|
int | notcurses_linesigs_enable (notcurses *n) |
|
struct initial_responses * | inputlayer_get_responses (inputctx *ictx) |
|
◆ cursorloc
◆ inputctx
◆ ipipe
Definition at line 46 of file in.c.
◆ get_cursor_location()
int get_cursor_location |
( |
inputctx * |
ictx, |
|
|
const char * |
u7, |
|
|
unsigned * |
y, |
|
|
unsigned * |
x |
|
) |
| |
Definition at line 2810 of file in.c.
2810 {
2811 pthread_mutex_lock(&ictx->
clock);
2812 while(ictx->
cvalid == 0){
2814 if(tty_emit(u7, ictx->
ti->
ttyfd)){
2815 pthread_mutex_unlock(&ictx->
clock);
2816 return -1;
2817 }
2819 }
2820 pthread_cond_wait(&ictx->
ccond, &ictx->
clock);
2821 }
2825 }
2829 }
2832 }
2833 pthread_mutex_unlock(&ictx->
clock);
2834 return 0;
2835}
◆ init_inputlayer()
int init_inputlayer |
( |
tinfo * |
ti, |
|
|
FILE * |
infp, |
|
|
int |
lmargin, |
|
|
int |
tmargin, |
|
|
int |
rmargin, |
|
|
int |
bmargin, |
|
|
ncsharedstats * |
stats, |
|
|
unsigned |
drain, |
|
|
int |
linesigs_enabled |
|
) |
| |
Definition at line 2638 of file in.c.
2640 {
2641 inputctx* ictx = create_inputctx(ti, infp, lmargin, tmargin, rmargin,
2642 bmargin, stats, drain, linesigs_enabled);
2644 return -1;
2645 }
2646 if(pthread_create(&ictx->
tid,
NULL, input_thread, ictx)){
2647 free_inputctx(ictx);
2648 return -1;
2649 }
2651 loginfo(
"spun up input thread");
2652 return 0;
2653}
◆ inputlayer_get_responses()
Definition at line 2921 of file in.c.
2921 {
2923 pthread_mutex_lock(&ictx->
ilock);
2925 pthread_cond_wait(&ictx->
icond, &ictx->
ilock);
2926 }
2929 pthread_mutex_unlock(&ictx->
ilock);
2931 logpanic(
"aborting after automaton construction failure");
2932 free(iresp);
2934 }
2935 return iresp;
2936}
#define logpanic(fmt,...)
◆ inputready_fd()
int inputready_fd |
( |
const inputctx * |
ictx | ) |
|
Definition at line 2672 of file in.c.
2672 {
2673#ifndef __MINGW32__
2675#else
2676 (void)ictx;
2677 logerror(
"readiness descriptor unavailable on windows");
2678 return -1;
2679#endif
2680}
#define logerror(fmt,...)
◆ ncdirect_get()
uint32_t ncdirect_get |
( |
ncdirect * |
n, |
|
|
const struct timespec * |
absdl, |
|
|
ncinput * |
ni |
|
) |
| |
Definition at line 2798 of file in.c.
2798 {
2801 return -1;
2802 }
2803 uint32_t
r = internal_get(
n->tcache.ictx, absdl, ni);
2806 }
2808}
◆ ncinput_shovel()
int ncinput_shovel |
( |
inputctx * |
ictx, |
|
|
const void * |
buf, |
|
|
int |
len |
|
) |
| |
Definition at line 2476 of file in.c.
2476 {
2477 process_melange(ictx, buf, &
len);
2480 inc_input_errors(ictx);
2481 }
2482 return 0;
2483}
API int API int const nccell unsigned len
◆ notcurses_get()
uint32_t notcurses_get |
( |
notcurses * |
nc, |
|
|
const struct timespec * |
absdl, |
|
|
ncinput * |
ni |
|
) |
| |
Definition at line 2776 of file in.c.
2776 {
2777 uint32_t ret = internal_get(nc->
tcache.
ictx, absdl, ni);
2778 return ret;
2779}
◆ notcurses_getvec()
int notcurses_getvec |
( |
notcurses * |
n, |
|
|
const struct timespec * |
absdl, |
|
|
ncinput * |
ni, |
|
|
int |
vcount |
|
) |
| |
Definition at line 2782 of file in.c.
2783 {
2784 for(
int v = 0 ;
v < vcount ; ++
v){
2786 if(u == (uint32_t)-1){
2788 return -1;
2789 }
2791 }else if(u == 0){
2793 }
2794 }
2795 return vcount;
2796}
uint32_t notcurses_get(notcurses *nc, const struct timespec *absdl, ncinput *ni)
struct ncvisual_options v
◆ notcurses_linesigs_disable()
int notcurses_linesigs_disable |
( |
notcurses * |
nc | ) |
|
Definition at line 2875 of file in.c.
2875 {
2876 return linesigs_disable(&nc->
tcache);
2877}
◆ notcurses_linesigs_enable()
int notcurses_linesigs_enable |
( |
notcurses * |
n | ) |
|
Definition at line 2917 of file in.c.
2917 {
2918 return linesigs_enable(&
n->tcache);
2919}
◆ sigwinch_handler()
void sigwinch_handler |
( |
int |
signo | ) |
|
Definition at line 31 of file in.c.
31 {
32 if(signo == SIGWINCH){
33 resize_seen = signo;
35 }else if(signo == SIGCONT){
36 cont_seen = signo;
38 }
39}
sig_atomic_t sigcont_seen_for_render
◆ stop_inputlayer()
int stop_inputlayer |
( |
tinfo * |
ti | ) |
|
Definition at line 2655 of file in.c.
2655 {
2656 int ret = 0;
2657 if(ti){
2658
2659#ifndef __MINGW32__
2661 loginfo(
"tearing down input thread");
2662 ret |= cancel_and_join(
"input", ti->
ictx->
tid,
NULL);
2664 free_inputctx(ti->
ictx);
2666 }
2667#endif
2668 }
2669 return ret;
2670}
int set_fd_nonblocking(int fd, unsigned state, unsigned *oldstate)
unsigned stdio_blocking_save