aboutsummaryrefslogtreecommitdiff
path: root/scripts/kconfig/libcurses/move.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/libcurses/move.c')
-rw-r--r--scripts/kconfig/libcurses/move.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/scripts/kconfig/libcurses/move.c b/scripts/kconfig/libcurses/move.c
new file mode 100644
index 000000000..96496445e
--- /dev/null
+++ b/scripts/kconfig/libcurses/move.c
@@ -0,0 +1,77 @@
1/* PDCurses */
2
3#include "curspriv.h"
4
5/*man-start**************************************************************
6
7move
8----
9
10### Synopsis
11
12 int move(int y, int x);
13 int mvcur(int oldrow, int oldcol, int newrow, int newcol);
14 int wmove(WINDOW *win, int y, int x);
15
16### Description
17
18 move() and wmove() move the cursor associated with the window to the
19 given location. This does not move the physical cursor of the
20 terminal until refresh() is called. The position specified is
21 relative to the upper left corner of the window, which is (0,0).
22
23 mvcur() moves the physical cursor without updating any window cursor
24 positions.
25
26### Return Value
27
28 All functions return OK on success and ERR on error.
29
30### Portability
31 X/Open ncurses NetBSD
32 move Y Y Y
33 mvcur Y Y Y
34 wmove Y Y Y
35
36**man-end****************************************************************/
37
38int move(int y, int x)
39{
40 PDC_LOG(("move() - called: y=%d x=%d\n", y, x));
41
42 if (!stdscr || x < 0 || y < 0 || x >= stdscr->_maxx || y >= stdscr->_maxy)
43 return ERR;
44
45 stdscr->_curx = x;
46 stdscr->_cury = y;
47
48 return OK;
49}
50
51int mvcur(int oldrow, int oldcol, int newrow, int newcol)
52{
53 PDC_LOG(("mvcur() - called: oldrow %d oldcol %d newrow %d newcol %d\n",
54 oldrow, oldcol, newrow, newcol));
55
56 if (!SP || newrow < 0 || newrow >= LINES || newcol < 0 || newcol >= COLS)
57 return ERR;
58
59 PDC_gotoyx(newrow, newcol);
60 SP->cursrow = newrow;
61 SP->curscol = newcol;
62
63 return OK;
64}
65
66int wmove(WINDOW *win, int y, int x)
67{
68 PDC_LOG(("wmove() - called: y=%d x=%d\n", y, x));
69
70 if (!win || x < 0 || y < 0 || x >= win->_maxx || y >= win->_maxy)
71 return ERR;
72
73 win->_curx = x;
74 win->_cury = y;
75
76 return OK;
77}