-
Notifications
You must be signed in to change notification settings - Fork 9
/
goncurses.c
92 lines (81 loc) · 2.55 KB
/
goncurses.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Copyright 2011 Rob Thornton. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include <stdbool.h>
#include <stdlib.h>
#include <curses.h>
#ifdef PDCURSES
bool is_term_resized(int y, int x) { return is_termresized(); }
int resizeterm(int y, int x) { return resize_term(y, x); }
int ncurses_getmouse(MEVENT *me) { return nc_getmouse(me); }
int ncurses_has_key(int ch) { return has_key(ch) == true ? 1 : 0; }
int ncurses_ungetch(int ch) { return PDC_ungetch(ch); }
int ncurses_wattroff(WINDOW *win, int attr ) {
return wattroff(win, (chtype) attr);
}
int ncurses_wattron(WINDOW *win, int attr) {
return wattron(win, (chtype) attr);
}
#else
int ncurses_getmouse(MEVENT *me) { return getmouse(me); }
int ncurses_has_key(int ch) { return has_key(ch); }
int ncurses_ungetch(int ch) { return ungetch(ch); }
int ncurses_wattroff(WINDOW *win, int attr) { return wattroff(win, attr); }
int ncurses_wattron(WINDOW *win, int attr) { return wattron(win, attr); }
#endif
int ncurses_COLOR_PAIR(int p) { return COLOR_PAIR(p); }
chtype ncurses_getbkgd(WINDOW *win) { return getbkgd(win); }
void ncurses_getyx(WINDOW *win, int *y, int *x) { getyx(win, *y, *x); }
void ncurses_getbegyx(WINDOW *win, int *y, int *x) { getbegyx(win, *y, *x); }
void ncurses_getmaxyx(WINDOW *win, int *y, int *x) { getmaxyx(win, *y, *x); }
WINDOW *ncurses_wgetparent(const WINDOW *win) {
#ifdef PDCURSES
return win->_parent;
#else
return wgetparent(win);
#endif
}
bool ncurses_is_cleared(const WINDOW *win) {
#ifdef PDCURSES
return win->_clear;
#else
return is_cleared(win);
#endif
}
bool ncurses_is_keypad(const WINDOW *win) {
#ifdef PDCURSES
return win->_use_keypad;
#else
return is_keypad(win);
#endif
}
bool ncurses_is_pad(const WINDOW *win) {
#ifdef PDCURSES
return false; /* no known built-in way to test for this */
#elif defined(__OpenBSD__)
return win->_flags & _ISPAD;
#else
return is_pad(win);
#endif
}
bool ncurses_is_subwin(const WINDOW *win) {
#ifdef PDCURSES
return win->_parent != NULL;
#elif defined(__OpenBSD__)
return win->_flags & _SUBWIN;
#else
return is_subwin(win);
#endif
}
bool ncurses_has_mouse(void) {
#if NCURSES_VERSION_MINOR < 8
return false;
#else
return has_mouse();
#endif
}
int ncurses_touchwin(WINDOW *win) { return touchwin(win); }
int ncurses_untouchwin(WINDOW *win) { return untouchwin(win); }
int ncurses_wattrset(WINDOW *win, int attr) { return wattrset(win, attr); }
int ncurses_wstandend(WINDOW *win) { return wstandend(win); }
int ncurses_wstandout(WINDOW *win) { return wstandout(win); }