1 /****************************************************************************
2 * Copyright (c) 2011 Free Software Foundation, Inc. *
4 * Permission is hereby granted, free of charge, to any person obtaining a *
5 * copy of this software and associated documentation files (the *
6 * "Software"), to deal in the Software without restriction, including *
7 * without limitation the rights to use, copy, modify, merge, publish, *
8 * distribute, distribute with modifications, sublicense, and/or sell *
9 * copies of the Software, and to permit persons to whom the Software is *
10 * furnished to do so, subject to the following conditions: *
12 * The above copyright notice and this permission notice shall be included *
13 * in all copies or substantial portions of the Software. *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 * Except as contained in this notice, the name(s) of the above copyright *
24 * holders shall not be used in advertising or otherwise to promote the *
25 * sale, use or other dealings in this Software without prior written *
27 ****************************************************************************/
29 /****************************************************************************
30 * Author: Thomas E. Dickey, 2011 *
31 ****************************************************************************/
35 $Id: ncurses_compat.c,v 1.2 2011/03/28 00:29:04 tom Exp $
36 --------------------------------------------------------------------------*/
39 * Provide compatibility with older versions of ncurses.
43 #if defined(NCURSES_VERSION_PATCH)
45 #if NCURSES_VERSION_PATCH < 20081122
46 extern bool has_mouse(void);
47 extern int _nc_has_mouse(void);
52 return (bool) _nc_has_mouse();
57 * These are provided by lib_gen.c:
59 #if NCURSES_VERSION_PATCH < 20070331
60 extern bool (is_keypad
) (const WINDOW
*);
61 extern bool (is_scrollok
) (const WINDOW
*);
64 is_keypad(const WINDOW
*win
)
66 return ((win
)->_use_keypad
);
70 (is_scrollok
) (const WINDOW
*win
)
72 return ((win
)->_scroll
);
76 #if NCURSES_VERSION_PATCH < 20060107
77 extern int (getbegx
) (WINDOW
*);
78 extern int (getbegy
) (WINDOW
*);
79 extern int (getcurx
) (WINDOW
*);
80 extern int (getcury
) (WINDOW
*);
81 extern int (getmaxx
) (WINDOW
*);
82 extern int (getmaxy
) (WINDOW
*);
83 extern int (getparx
) (WINDOW
*);
84 extern int (getpary
) (WINDOW
*);
87 (getbegy
) (WINDOW
*win
)
89 return ((win
) ? (win
)->_begy
: ERR
);
93 (getbegx
) (WINDOW
*win
)
95 return ((win
) ? (win
)->_begx
: ERR
);
99 (getcury
) (WINDOW
*win
)
101 return ((win
) ? (win
)->_cury
: ERR
);
105 (getcurx
) (WINDOW
*win
)
107 return ((win
) ? (win
)->_curx
: ERR
);
111 (getmaxy
) (WINDOW
*win
)
113 return ((win
) ? ((win
)->_maxy
+ 1) : ERR
);
117 (getmaxx
) (WINDOW
*win
)
119 return ((win
) ? ((win
)->_maxx
+ 1) : ERR
);
123 (getpary
) (WINDOW
*win
)
125 return ((win
) ? (win
)->_pary
: ERR
);
129 (getparx
) (WINDOW
*win
)
131 return ((win
) ? (win
)->_parx
: ERR
);