1 /****************************************************************************
2 * Copyright (c) 2011,2015 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.3 2015/08/06 23:09:10 tom Exp $
36 --------------------------------------------------------------------------*/
39 * Provide compatibility with older versions of ncurses.
41 #include <ncurses_cfg.h>
44 # include <inttypes.h>
53 #if defined(NCURSES_VERSION_PATCH)
55 #if NCURSES_VERSION_PATCH < 20081122
56 extern bool has_mouse(void);
57 extern int _nc_has_mouse(void);
62 return (bool)_nc_has_mouse();
67 * These are provided by lib_gen.c:
69 #if NCURSES_VERSION_PATCH < 20070331
70 extern bool (is_keypad
) (const WINDOW
*);
71 extern bool (is_scrollok
) (const WINDOW
*);
74 is_keypad(const WINDOW
*win
)
76 return ((win
)->_use_keypad
);
80 (is_scrollok
) (const WINDOW
*win
)
82 return ((win
)->_scroll
);
86 #if NCURSES_VERSION_PATCH < 20060107
87 extern int (getbegx
) (WINDOW
*);
88 extern int (getbegy
) (WINDOW
*);
89 extern int (getcurx
) (WINDOW
*);
90 extern int (getcury
) (WINDOW
*);
91 extern int (getmaxx
) (WINDOW
*);
92 extern int (getmaxy
) (WINDOW
*);
93 extern int (getparx
) (WINDOW
*);
94 extern int (getpary
) (WINDOW
*);
97 (getbegy
) (WINDOW
*win
)
99 return ((win
) ? (win
)->_begy
: ERR
);
103 (getbegx
) (WINDOW
*win
)
105 return ((win
) ? (win
)->_begx
: ERR
);
109 (getcury
) (WINDOW
*win
)
111 return ((win
) ? (win
)->_cury
: ERR
);
115 (getcurx
) (WINDOW
*win
)
117 return ((win
) ? (win
)->_curx
: ERR
);
121 (getmaxy
) (WINDOW
*win
)
123 return ((win
) ? ((win
)->_maxy
+ 1) : ERR
);
127 (getmaxx
) (WINDOW
*win
)
129 return ((win
) ? ((win
)->_maxx
+ 1) : ERR
);
133 (getpary
) (WINDOW
*win
)
135 return ((win
) ? (win
)->_pary
: ERR
);
139 (getparx
) (WINDOW
*win
)
141 return ((win
) ? (win
)->_parx
: ERR
);