1.\" $NetBSD: curses_cursor.3,v 1.9 2017/01/05 09:46:32 wiz Exp $ 2.\" 3.\" Copyright (c) 2002 4.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) 5.\" 6.\" This code is donated to the NetBSD Foundation by the Author. 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions 10.\" are met: 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" notice, this list of conditions and the following disclaimer in the 15.\" documentation and/or other materials provided with the distribution. 16.\" 3. The name of the Author may not be used to endorse or promote 17.\" products derived from this software without specific prior written 18.\" permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" 33.Dd December 31, 2016 34.Dt CURSES 3 35.Os 36.Sh NAME 37.Nm curses_cursor , 38.Nm getcury , 39.Nm getcurx , 40.Nm getsyx , 41.Nm getyx , 42.Nm getbegy , 43.Nm getbegx , 44.Nm getbegyx , 45.Nm getmaxy , 46.Nm getmaxx , 47.Nm getmaxyx , 48.Nm getpary , 49.Nm getparx , 50.Nm getparyx , 51.Nm move , 52.Nm setsyx , 53.Nm wmove , 54.Nm mvcur , 55.Nm wcursyncup 56.Nd curses cursor and window location and positioning routines 57.Sh LIBRARY 58.Lb libcurses 59.Sh SYNOPSIS 60.In curses.h 61.Ft int 62.Fn getcury "WINDOW *win" 63.Ft int 64.Fn getcurx "WINDOW *win" 65.Ft int 66.Fn getsyx "int y" "int x" 67.Ft void 68.Fn getyx "WINDOW *win" "int y" "int x" 69.Ft int 70.Fn getbegy "WINDOW *win" 71.Ft int 72.Fn getbegx "WINDOW *win" 73.Ft void 74.Fn getbegyx "WINDOW *win" "int y" "int x" 75.Ft int 76.Fn getmaxy "WINDOW *win" 77.Ft int 78.Fn getmaxx "WINDOW *win" 79.Ft void 80.Fn getmaxyx "WINDOW *win" "int y" "int x" 81.Ft int 82.Fn getpary "WINDOW *win" 83.Ft int 84.Fn getparx "WINDOW *win" 85.Ft void 86.Fn getparyx "WINDOW *win" "int y" "int x" 87.Ft int 88.Fn move "int y" "int x" 89.Ft int 90.Fn setsyx "int y" "int x" 91.Ft int 92.Fn wmove "WINDOW *win" "int y" "int x" 93.Ft int 94.Fn mvcur "int oldy" "int oldx" "int y" "int x" 95.Ft void 96.Fn wcursyncup "WINDOW *win" 97.Sh DESCRIPTION 98These functions and macros locate and position cursors and windows. 99.Pp 100The 101.Fn getcury 102and 103.Fn getcurx 104functions get the current row and column positions, respectively, of the cursor in 105the window 106.Fa win . 107The 108.Fn getyx 109macro sets the values of 110.Fa y 111and 112.Fa x 113to the current row and column positions of the cursor in the window 114.Fa win . 115.Pp 116The 117.Fn getsyx 118macro sets the values of 119.Fa y 120and 121.Fa x 122of the current window if 123.Fn is_leaveok 124is false, otherwise \-1, \-1. 125The 126.Fn setsyx 127macro sets the row and column positions, respectively, of the cursor in the 128current window to the values of 129.Fa y 130and 131.Fa x . 132If both 133.Fa y 134and 135.Fa x 136are both \-1 then 137.Fn leaveok 138is set. 139.Pp 140The origin row and columns of a window 141.Fa win 142can be 143determined by calling the 144.Fn getbegy 145and 146.Fn getbegx 147functions, respectively, and the maximum row and column for the window can be 148found by calling the functions 149.Fn getmaxy 150and 151.Fn getmaxx , 152respectively. 153The 154.Fn getbegyx 155and 156.Fn getmaxyx 157macros set the values of 158.Fa y 159and 160.Fa x 161to the origin and maximum row and column positions, respectively, for the window 162.Fa win . 163.Pp 164The 165.Fn getpary 166and 167.Fn getparx 168functions return the row and column position of the given subwindow relative to 169the window's parent. 170The macro 171.Fn getparyx 172sets the values of 173.Fa y 174and 175.Fa x 176to the origin of the subwindow relative to the window's parent. 177.Pp 178The 179.Fn move 180function positions the cursor on the current window at the position given by 181.Fa y , 182.Fa x . 183The cursor position is not changed on the screen until the next 184.Fn refresh . 185.Pp 186The 187.Fn wmove 188function is the same as the 189.Fn move 190function, excepting that the cursor is moved in the window specified by 191.Fa win . 192.Pp 193The function 194.Fn mvcur 195moves the cursor to 196.Fa y , 197.Fa x 198on the screen. 199The arguments 200.Fa oldy , 201.Fa oldx 202define the previous cursor position for terminals that do not support 203absolute cursor motions. 204The curses library may optimise the cursor motion based on these values. 205If the 206.Fn mvcur 207succeeds then the curses internal structures are updated with the new 208position of the cursor. 209If the destination arguments for 210.Fn mvcur 211exceed the terminal bounds an error will be returned and the cursor 212position will be unchanged. 213.Pp 214The 215.Fn wcursyncup 216function sets the cursor positions of all ancestors of 217.Fa win 218to that of 219.Fa win . 220.Sh RETURN VALUES 221Functions returning pointers will return 222.Dv NULL 223if an error is detected. 224The functions that return an int will return one of the following 225values: 226.Pp 227.Bl -tag -width ERR -compact 228.It Er OK 229The function completed successfully. 230.It Er ERR 231An error occurred in the function. 232.El 233.Sh SEE ALSO 234.Xr curses_refresh 3 235.Sh STANDARDS 236The 237.Nx 238Curses library complies with the X/Open Curses specification, part of 239the Single Unix Specification. 240The 241.Fn getbegx , 242.Fn getbegy , 243.Fn getcurx , 244.Fn getcury , 245.Fn getmaxx , 246.Fn getmaxy , 247.Fn getparx , 248and 249.Fn getpary 250functions are extensions. 251.Sh HISTORY 252The Curses package appeared in 253.Bx 4.0 . 254The 255.Fn getsyx 256and 257.Fn setsyx 258functions are 259.Em ncurses 260extensions to the Curses library and were added in 261.Nx 8.0 . 262