Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve issue #25 #67

Merged
merged 2 commits into from
Mar 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions cmatrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,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) {
Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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)