amatrix

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
git clone git://git.kocotian.pl/amatrix.git
Log | Files | Refs | README | LICENSE

commit 0f820eb79f990cdfb1d00c1b640e6622f44289a8
parent 7d1af24722bb1a4fb5a7af16c08b2a4ad2070158
Author: Abishek V Ashok <abishekvashok@gmail.com>
Date:   Tue, 26 Mar 2019 21:06:27 +0530

Merge pull request #67 from FrozenAndrey/resolve#25

Resolve issue #25
Diffstat:
MCMakeLists.txt | 1+
Mcmatrix.c | 12++++++++++++
Mconfigure.ac | 3+++
3 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -14,6 +14,7 @@ set(MKFONTDIR "/usr/bin/mkfontdir") add_definitions(-DEXCLUDE_CONFIG_H) add_definitions(-DVERSION="${VERSION}") +add_definitions(-DUSE_TIOCSTI) include(CheckIncludeFiles) check_include_files("sys/ioctl.h" HAVE_SYS_IOCTL_H) diff --git a/cmatrix.c b/cmatrix.c @@ -467,6 +467,18 @@ if (console) { if ((keypress = wgetch(stdscr)) != ERR) { if (screensaver == 1) { +#ifdef USE_TIOCSTI + char *str = malloc(0); + size_t str_len = 0; + do { + str = realloc(str, str_len + 1); + str[str_len++] = keypress; + } while ((keypress = wgetch(stdscr)) != ERR); + size_t i; + for (i = 0; i < str_len; i++) + ioctl(STDIN_FILENO, TIOCSTI, (char*)(str + i)); + free(str); +#endif finish(); } else { switch (keypress) { diff --git a/configure.ac b/configure.ac @@ -136,10 +136,13 @@ AM_CONDITIONAL([MATRIX_FONTS], [test x$enable_fonts = xtrue]) AC_SUBST(CURSES_LIB) +AC_DEFINE(USE_TIOCSTI) + AH_TEMPLATE([HAVE_USE_DEFAULT_COLORS], [Define this if your curses library has use_default_colors, for cool transparency =-)]) AH_TEMPLATE([HAVE_CONSOLECHARS], [Define this if you have the linux consolechars program]) AH_TEMPLATE([HAVE_SETFONT], [Define this if you have the linux setfont program]) AH_TEMPLATE([HAVE_WRESIZE], [Define this if you have the wresize function in your ncurses-type library]) AH_TEMPLATE([HAVE_RESIZETERM], [Define this if you have the resizeterm function in your ncurses-type library]) +AH_TEMPLATE([USE_TIOCSTI], [Define this if you want a character you pressed in the screensaver mode to retain in the terminal]) AC_OUTPUT(Makefile cmatrix.spec)