Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | '\" t |
| 2 | .\"*************************************************************************** |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 3 | .\" Copyright 2018-2023,2024 Thomas E. Dickey * |
| 4 | .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. * |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 5 | .\" * |
| 6 | .\" Permission is hereby granted, free of charge, to any person obtaining a * |
| 7 | .\" copy of this software and associated documentation files (the * |
| 8 | .\" "Software"), to deal in the Software without restriction, including * |
| 9 | .\" without limitation the rights to use, copy, modify, merge, publish, * |
| 10 | .\" distribute, distribute with modifications, sublicense, and/or sell * |
| 11 | .\" copies of the Software, and to permit persons to whom the Software is * |
| 12 | .\" furnished to do so, subject to the following conditions: * |
| 13 | .\" * |
| 14 | .\" The above copyright notice and this permission notice shall be included * |
| 15 | .\" in all copies or substantial portions of the Software. * |
| 16 | .\" * |
| 17 | .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
| 18 | .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
| 19 | .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
| 20 | .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
| 21 | .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
| 22 | .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
| 23 | .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
| 24 | .\" * |
| 25 | .\" Except as contained in this notice, the name(s) of the above copyright * |
| 26 | .\" holders shall not be used in advertising or otherwise to promote the * |
| 27 | .\" sale, use or other dealings in this Software without prior written * |
| 28 | .\" authorization. * |
| 29 | .\"*************************************************************************** |
| 30 | .\" |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 31 | .\" $Id: curs_inch.3x,v 1.51 2024/04/20 21:20:07 tom Exp $ |
| 32 | .TH curs_inch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" |
| 33 | .ie \n(.g \{\ |
| 34 | .ds `` \(lq |
| 35 | .ds '' \(rq |
| 36 | .\} |
| 37 | .el \{\ |
| 38 | .ie t .ds `` `` |
| 39 | .el .ds `` "" |
| 40 | .ie t .ds '' '' |
| 41 | .el .ds '' "" |
| 42 | .\} |
| 43 | . |
| 44 | .de bP |
| 45 | .ie n .IP \(bu 4 |
| 46 | .el .IP \(bu 2 |
| 47 | .. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 48 | .SH NAME |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 49 | \fB\%inch\fP, |
| 50 | \fB\%winch\fP, |
| 51 | \fB\%mvinch\fP, |
| 52 | \fB\%mvwinch\fP \- |
| 53 | get a \fIcurses\fR character from a window |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 54 | .SH SYNOPSIS |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 55 | .nf |
| 56 | \fB#include <curses.h> |
| 57 | .PP |
| 58 | \fBchtype inch(void); |
| 59 | \fBchtype winch(WINDOW *\fIwin\fP); |
| 60 | .PP |
| 61 | \fBchtype mvinch(int \fIy\fP, int \fIx\fP); |
| 62 | \fBchtype mvwinch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP); |
| 63 | .fi |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 64 | .SH DESCRIPTION |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 65 | These routines return the character, of type \fBchtype\fP, at the current |
| 66 | position in the named window. |
| 67 | If any attributes are set for that position, |
| 68 | their values are OR'ed into the value returned. |
| 69 | Constants defined in |
| 70 | \fB<curses.h>\fP can be used with the \fB&\fP (logical AND) operator to |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 71 | extract the character or attributes alone. |
| 72 | . |
| 73 | .SS Attributes |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 74 | The following bit masks may be AND-ed with characters returned by \fBwinch\fP. |
| 75 | .PP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 76 | .TS |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 77 | Lb Lb |
| 78 | Lb Lx. |
| 79 | Name Description |
| 80 | _ |
| 81 | A_CHARTEXT Extract character |
| 82 | A_ATTRIBUTES Extract attributes |
| 83 | A_COLOR Extract color pair information |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 84 | .TE |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 85 | .SH RETURN VALUE |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 86 | Functions prefixed with \*(``mv\*('' first perform cursor movement and |
| 87 | fail if the position |
| 88 | .RI ( y , |
| 89 | .IR x ) |
| 90 | is outside the window boundaries. |
| 91 | .PP |
| 92 | The \fBwinch\fP function does not return an error if the window contains |
| 93 | characters larger than 8-bits (255). |
| 94 | Only the low-order 8 bits of the character are used by \fBwinch\fP. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 95 | .SH NOTES |
| 96 | Note that all of these routines may be macros. |
| 97 | .SH PORTABILITY |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 98 | These functions are described in X/Open Curses, Issue 4. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 99 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 100 | Very old systems (before standardization) provide a different function |
| 101 | with the same name: |
| 102 | .bP |
| 103 | The \fBwinch\fP function was part of the original BSD curses library, |
| 104 | which stored a 7-bit character combined with the \fIstandout\fP attribute. |
| 105 | .IP |
| 106 | In BSD curses, \fBwinch\fP returned only the character (as an integer) |
| 107 | with the \fIstandout\fP attribute removed. |
| 108 | .bP |
| 109 | System V curses added support for several video attributes which |
| 110 | could be combined with characters in the window. |
| 111 | .IP |
| 112 | Reflecting this improvement, the function was altered to return the |
| 113 | character combined with all video attributes in a \fBchtype\fP value. |
| 114 | .PP |
| 115 | X/Open Curses does not specify |
| 116 | the size and layout of attributes, color and character values in |
| 117 | \fBchtype\fP; it is implementation-dependent. |
| 118 | This implementation uses 8 bits for character values. |
| 119 | An application using more bits, e.g., a Unicode value, |
| 120 | should use the wide-character equivalents to these functions. |
| 121 | .SH SEE ALSO |
| 122 | \fB\%curs_in_wch\fP(3X) describes comparable functions of the |
| 123 | .I \%ncurses |
| 124 | library in its wide-character configuration |
| 125 | .RI ( \%ncursesw ). |
| 126 | .PP |
| 127 | \fB\%curses\fP(3X), |
| 128 | \fB\%curs_instr\fP(3X) |