disable mouse support while suspended

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3655 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
David Lawrence Ramsey 2006-06-09 18:24:37 +00:00
parent 9134781eaf
commit 503bad02fe
3 changed files with 38 additions and 9 deletions

View File

@ -149,8 +149,10 @@ CVS code -
parse_rcfile(), nano.1, nano.texi, and nanorc.sample.in. parse_rcfile(), nano.1, nano.texi, and nanorc.sample.in.
(Benno Schulenberg, minor tweaks by DLR and Nick Warne) (Benno Schulenberg, minor tweaks by DLR and Nick Warne)
- Make suspension clear the screen and put the cursor on the - Make suspension clear the screen and put the cursor on the
last line before displaying anything, as Pico does. Changes last line before displaying anything, as Pico does. New
to do_suspend(), do_continue(), and terminal_init(). (DLR) functions disable_mouse_support() and enable_mouse_support();
changes to do_mouse(), do_suspend(), do_continue(), and
terminal_init(). (DLR)
- browser.c: - browser.c:
do_browser() do_browser()
- Reference NANO_GOTODIR_(ALT|F)?KEY instead of - Reference NANO_GOTODIR_(ALT|F)?KEY instead of

View File

@ -665,16 +665,29 @@ void window_init(void)
} }
#ifndef DISABLE_MOUSE #ifndef DISABLE_MOUSE
/* Initialize mouse support. */ /* Disable mouse support. */
void disable_mouse_support(void)
{
mousemask(0, NULL);
}
/* Enable mouse support. */
void enable_mouse_support(void)
{
mousemask(BUTTON1_RELEASED, NULL);
mouseinterval(50);
}
/* Initialize mouse support. Enable it if the USE_MOUSE flag is set,
* and disable it otherwise. */
void mouse_init(void) void mouse_init(void)
{ {
if (ISSET(USE_MOUSE)) { if (ISSET(USE_MOUSE))
mousemask(BUTTON1_RELEASED, NULL); enable_mouse_support();
mouseinterval(50); else
} else disable_mouse_support();
mousemask(0, NULL);
} }
#endif #endif /* !DISABLE_MOUSE */
#ifdef HAVE_GETOPT_LONG #ifdef HAVE_GETOPT_LONG
#define print_opt(shortflag, longflag, desc) print_opt_full(shortflag, longflag, desc) #define print_opt(shortflag, longflag, desc) print_opt_full(shortflag, longflag, desc)
@ -993,6 +1006,11 @@ RETSIGTYPE handle_hupterm(int signal)
/* Handler for SIGTSTP (suspend). */ /* Handler for SIGTSTP (suspend). */
RETSIGTYPE do_suspend(int signal) RETSIGTYPE do_suspend(int signal)
{ {
#ifndef DISABLE_MOUSE
/* Turn mouse support off. */
disable_mouse_support();
#endif
/* Blank the screen, and move the cursor to the last line of it. */ /* Blank the screen, and move the cursor to the last line of it. */
erase(); erase();
move(LINES - 1, 0); move(LINES - 1, 0);
@ -1018,6 +1036,12 @@ RETSIGTYPE do_suspend(int signal)
/* Handler for SIGCONT (continue after suspend). */ /* Handler for SIGCONT (continue after suspend). */
RETSIGTYPE do_continue(int signal) RETSIGTYPE do_continue(int signal)
{ {
#ifndef DISABLE_MOUSE
/* Turn mouse support back on if it was on before. */
if (ISSET(USE_MOUSE))
enable_mouse_support();
#endif
#ifndef NANO_TINY #ifndef NANO_TINY
/* Perhaps the user resized the window while we slept. Handle it, /* Perhaps the user resized the window while we slept. Handle it,
* and restore the terminal to its previous state and update the * and restore the terminal to its previous state and update the
@ -2107,6 +2131,7 @@ int main(int argc, char **argv)
shortcut_init(FALSE); shortcut_init(FALSE);
#ifndef DISABLE_MOUSE #ifndef DISABLE_MOUSE
/* Initialize mouse support. */
mouse_init(); mouse_init();
#endif #endif

View File

@ -429,6 +429,8 @@ void die(const char *msg, ...);
void die_save_file(const char *die_filename); void die_save_file(const char *die_filename);
void window_init(void); void window_init(void);
#ifndef DISABLE_MOUSE #ifndef DISABLE_MOUSE
void disable_mouse_support(void);
void enable_mouse_support(void);
void mouse_init(void); void mouse_init(void);
#endif #endif
void print_opt_full(const char *shortflag void print_opt_full(const char *shortflag