]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - doc/html/man/curs_getch.3x.html
ncurses 6.0 - patch 20170401
[ncurses.git] / doc / html / man / curs_getch.3x.html
index 1a3b37648e83410da5e98e129759239fab7b9485..d19c4b87454eea094ac47dad7dec1e085756245e 100644 (file)
@@ -1,7 +1,7 @@
 <!-- 
   * t
   ****************************************************************************
-  * Copyright (c) 1998-2014,2015 Free Software Foundation, Inc.              *
+  * Copyright (c) 1998-2015,2016 Free Software Foundation, Inc.              *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * copy of this software and associated documentation files (the            *
@@ -27,7 +27,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_getch.3x,v 1.44 2015/12/20 01:43:03 tom Exp @
+  * @Id: curs_getch.3x,v 1.49 2016/10/15 16:44:01 tom Exp @
 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
 <HTML>
 </PRE><H3><a name="h3-Keypad-mode">Keypad mode</a></H3><PRE>
        If  <STRONG>keypad</STRONG> is <STRONG>TRUE</STRONG>, and a function key is pressed, the to-
        ken for that function key is returned instead of  the  raw
-       characters.   Possible function keys are defined in <STRONG>&lt;curs-</STRONG>
-       <STRONG>es.h&gt;</STRONG> as macros with values outside  the  range  of  8-bit
-       characters  whose names begin with <STRONG>KEY_</STRONG>.  Thus, a variable
-       intended to hold the return value of a function  key  must
-       be of short size or larger.
+       characters:
+
+       <STRONG>o</STRONG>   The  predefined function keys are listed in <STRONG>&lt;curses.h&gt;</STRONG>
+           as macros with values outside the range of 8-bit char-
+           acters.  Their names begin with <STRONG>KEY_</STRONG>.
+
+       <STRONG>o</STRONG>   Other  (user-defined)  function  keys which may be de-
+           fined using <STRONG><A HREF="define_key.3x.html">define_key(3x)</A></STRONG> have no names, but also are
+           expected  to  have  values  outside the range of 8-bit
+           characters.
+
+       Thus, a variable intended to hold the return  value  of  a
+       function key must be of short size or larger.
 
        When a character that could be the beginning of a function
        key is received (which, on modern terminals, means an  es-
        experience a delay between the time a user presses the es-
        cape key and the escape is returned to the program.
 
+       In <STRONG>ncurses</STRONG>, the timer normally expires after the value  in
+       <STRONG>ESCDELAY</STRONG>  (see <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>).  If <STRONG>notimeout</STRONG> is <STRONG>TRUE</STRONG>,
+       the timer does not expire; it  is  an  infinite  (or  very
+       large) value.  Because function keys usually begin with an
+       escape character, the terminal may appear to hang  in  no-
+       timeout  mode  after pressing the escape key until another
+       key is pressed.
+
 
 </PRE><H3><a name="h3-Ungetting-characters">Ungetting characters</a></H3><PRE>
        The <STRONG>ungetch</STRONG> routine places <EM>ch</EM> back onto the input queue to
             KEY_SR          Scroll 1 line backward (reverse)
             KEY_NPAGE       Next page
             KEY_PPAGE       Previous page
+
             KEY_STAB        Set tab
             KEY_CTAB        Clear tab
             KEY_CATAB       Clear all tabs
             KEY_BTAB        Back tab key
             KEY_BEG         Beg(inning) key
             KEY_CANCEL      Cancel key
-
             KEY_CLOSE       Close key
             KEY_COMMAND     Cmd (command) key
             KEY_COPY        Copy key
             KEY_SREDO       Shifted redo key
             KEY_SREPLACE    Shifted replace key
             KEY_SRIGHT      Shifted right arrow
+
             KEY_SRSUME      Shifted resume key
             KEY_SSAVE       Shifted save key
             KEY_SSUSPEND    Shifted suspend key
        real key:
 
        <STRONG>o</STRONG>   <STRONG>KEY_RESIZE</STRONG> is returned when the  <STRONG>SIGWINCH</STRONG>  signal  has
-           been  detected  (see  <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG> and <STRONG><A HREF="resizeterm.3x.html">resizeterm(3x)</A></STRONG>).
+           been  detected  (see  <STRONG><A HREF="curs_initscr.3x.html">initscr(3x)</A></STRONG> and <STRONG><A HREF="resizeterm.3x.html">resizeterm(3x)</A></STRONG>).
            This code is returned whether or not <STRONG>keypad</STRONG>  has  been
            enabled.
 
        <STRONG>o</STRONG>   <STRONG>KEY_MOUSE</STRONG>    is   returned   for   mouse-events   (see
            <STRONG><A HREF="curs_mouse.3x.html">curs_mouse(3x)</A></STRONG>).  This code relies upon whether or not
-           <STRONG><A HREF="keypad.3x.html">keypad(3x)</A></STRONG> has been enabled, because (e.g., with <EM>xterm</EM>
+           <STRONG><A HREF="curs_inopts.3x.html">keypad(3x)</A></STRONG> has been enabled, because (e.g., with <EM>xterm</EM>
            mouse prototocol) ncurses must read escape  sequences,
            just like a function key.
 
 
 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
        All  routines  return  the integer <STRONG>ERR</STRONG> upon failure and an
-       integer value other than <STRONG>ERR</STRONG> (<STRONG>OK</STRONG> in the case of ungetch())
+       integer value other than <STRONG>ERR</STRONG> (<STRONG>OK</STRONG> in the case  of  <STRONG>ungetch</STRONG>)
        upon successful completion.
 
           <STRONG>ungetch</STRONG>
 
           <STRONG>wgetch</STRONG>
                returns  ERR  if the window pointer is null, or if
-               its timeout expires without having any data.
+               its timeout expires without having any data, or if
+               the  execution  was interrupted by a signal (<STRONG>errno</STRONG>
+               will be set to <STRONG>EINTR</STRONG>).
 
        Functions with a "mv" prefix first perform a cursor  move-
        ment  using  <STRONG>wmove</STRONG>, and return an error if the position is
        Programmers concerned about portability should be prepared
        for  either  of two cases: (a) signal receipt does not in-
        terrupt <STRONG>getch</STRONG>; (b) signal  receipt  interrupts  <STRONG>getch</STRONG>  and
-       causes  it  to  return ERR with <STRONG>errno</STRONG> set to <STRONG>EINTR</STRONG>.  Under
-       the <STRONG>ncurses</STRONG> implementation, handled signals  never  inter-
-       rupt <STRONG>getch</STRONG>.
+       causes it to return ERR with <STRONG>errno</STRONG> set to <STRONG>EINTR</STRONG>.
 
        The  <STRONG>has_key</STRONG>  function is unique to <STRONG>ncurses</STRONG>.  We recommend
        that any code using it be conditionalized  on  the  <STRONG>NCURS-</STRONG>
 
 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>,       <STRONG><A HREF="curs_inopts.3x.html">curs_inopts(3x)</A></STRONG>,       <STRONG><A HREF="curs_outopts.3x.html">curs_outopts(3x)</A></STRONG>,
-       <STRONG><A HREF="curs_mouse.3x.html">curs_mouse(3x)</A></STRONG>,   <STRONG><A HREF="curs_move.3x.html">curs_move(3x)</A></STRONG>,   <STRONG><A HREF="curs_refresh.3x.html">curs_refresh(3x)</A></STRONG>,   <STRONG>re-</STRONG>
-       <STRONG><A HREF="resizeterm.3x.html">sizeterm(3x)</A></STRONG>.
+       <STRONG><A HREF="curs_mouse.3x.html">curs_mouse(3x)</A></STRONG>,      <STRONG><A HREF="curs_move.3x.html">curs_move(3x)</A></STRONG>,      <STRONG><A HREF="curs_refresh.3x.html">curs_refresh(3x)</A></STRONG>,
+       <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>, <STRONG><A HREF="resizeterm.3x.html">resizeterm(3x)</A></STRONG>.
 
        Comparable  functions in the wide-character (ncursesw) li-
        brary are described in <STRONG><A HREF="curs_get_wch.3x.html">curs_get_wch(3x)</A></STRONG>.