diff options
Diffstat (limited to '')
-rw-r--r-- | src/command.c | 10 | ||||
-rw-r--r-- | src/main.c | 14 | ||||
-rw-r--r-- | src/ncmpc.h | 6 | ||||
-rw-r--r-- | src/screen_utils.c | 5 | ||||
-rw-r--r-- | src/wreadln.c | 6 |
5 files changed, 38 insertions, 3 deletions
diff --git a/src/command.c b/src/command.c index 1d77d0d2d..6cf3bf172 100644 --- a/src/command.c +++ b/src/command.c @@ -24,6 +24,7 @@ #include <string.h> #include <ctype.h> #include <glib.h> +#include <signal.h> #include <ncurses.h> #include "config.h" @@ -391,12 +392,17 @@ get_keyboard_command_with_timeout(int ms) if( key==KEY_RESIZE ) screen_resize(); +#ifdef ENABLE_RAW_MODE + if( key==KEY_SIGSTOP ) + sigstop(); +#endif + if( key==ERR ) return CMD_NONE; #ifdef HAVE_GETMOUSE - if( key==KEY_MOUSE ) - return CMD_MOUSE_EVENT; + // if( key==KEY_MOUSE ) + // return CMD_MOUSE_EVENT; #endif return get_key_command(key); diff --git a/src/main.c b/src/main.c index 9497e3b61..19dad2987 100644 --- a/src/main.c +++ b/src/main.c @@ -137,7 +137,19 @@ void catch_sigcont( int sig ) { D("catch_sigcont()\n"); - screen_resize(); +#ifdef ENABLE_RAW_MODE + reset_prog_mode(); /* restore tty modes */ + refresh(); +#endif + screen_resize(); +} + +void +sigstop(void) +{ + def_prog_mode(); /* save the tty modes */ + endwin(); /* end curses mode temporarily */ + kill(0, SIGSTOP); /* issue SIGSTOP */ } #ifdef DEBUG diff --git a/src/ncmpc.h b/src/ncmpc.h index 4118456a1..dec530dc2 100644 --- a/src/ncmpc.h +++ b/src/ncmpc.h @@ -46,4 +46,10 @@ void D(char *format, ...); #define DEFAULT_STATUS_FORMAT "[%artist% - ]%title%|%shortfile%" #define STATUS_FORMAT (options.status_format ? options.status_format : DEFAULT_STATUS_FORMAT) +/* sigstop key (Ctrl-Z) */ +#define KEY_SIGSTOP 26 + +/* send SIGSTOP */ +void sigstop(void); + #endif /* NCMPC_H */ diff --git a/src/screen_utils.c b/src/screen_utils.c index 7e2ba146c..cd3fc1ed0 100644 --- a/src/screen_utils.c +++ b/src/screen_utils.c @@ -66,6 +66,11 @@ screen_getch(WINDOW *w, char *prompt) while( (key=wgetch(w)) == ERR ) ; +#ifdef ENABLE_RAW_MODE + if( key==KEY_SIGSTOP ) + sigstop(); +#endif + #ifdef HAVE_GETMOUSE /* ignore mouse events */ if( key==KEY_MOUSE ) diff --git a/src/wreadln.c b/src/wreadln.c index 3ebba7f2a..d0204329e 100644 --- a/src/wreadln.c +++ b/src/wreadln.c @@ -44,6 +44,7 @@ wrln_gcmp_pre_cb_t wrln_pre_completion_callback = NULL; wrln_gcmp_post_cb_t wrln_post_completion_callback = NULL; extern void screen_bell(void); +extern void sigstop(void); char * wreadln(WINDOW *w, @@ -169,6 +170,11 @@ wreadln(WINDOW *w, case ERR: /* ingnore errors */ break; +#ifdef ENABLE_RAW_MODE + case 26: + sigstop(); + break; +#endif case KEY_RESIZE: /* a resize event -> call an external callback function */ if( wrln_resize_callback ) |