diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2018-03-11 09:59:39 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2018-03-11 09:59:39 +0100 |
commit | 805717e9ec3f66c960928bca607eceb871438fae (patch) | |
tree | c1832f0815bd8ade4530ed3948f55f0672103184 /src/gui/curses/headless/ncurses-fake.h | |
parent | 0126b03f47db7f7842aff497cdbb0e41a0a5be0a (diff) | |
download | weechat-805717e9ec3f66c960928bca607eceb871438fae.zip |
core: add binary weechat-headless to run WeeChat without interface (closes #1120)
The optional command line option "--daemon" runs WeeChat like a daemon
(fork, new process group, file descriptors closed).
Diffstat (limited to 'src/gui/curses/headless/ncurses-fake.h')
-rw-r--r-- | src/gui/curses/headless/ncurses-fake.h | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/src/gui/curses/headless/ncurses-fake.h b/src/gui/curses/headless/ncurses-fake.h new file mode 100644 index 000000000..79ce6fc25 --- /dev/null +++ b/src/gui/curses/headless/ncurses-fake.h @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2014-2018 Sébastien Helleu <flashcode@flashtux.org> + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * WeeChat is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with WeeChat. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef WEECHAT_NCURSES_FAKE_H +#define WEECHAT_NCURSES_FAKE_H + +#define ERR (-1) +#define OK (0) + +#define TRUE 1 +#define FALSE 0 + +#define COLS 80 +#define LINES 25 +#define COLORS 256 +#define COLOR_PAIRS 256 + +#define COLOR_PAIR(x) x + +#define COLOR_BLACK 0 +#define COLOR_RED 1 +#define COLOR_GREEN 2 +#define COLOR_YELLOW 3 +#define COLOR_BLUE 4 +#define COLOR_MAGENTA 5 +#define COLOR_CYAN 6 +#define COLOR_WHITE 7 + +#define A_BOLD 0 +#define A_UNDERLINE 0 +#define A_REVERSE 0 +#define A_ITALIC 0 + +#define ACS_HLINE '-' +#define ACS_VLINE '|' + +#define getyx(win, x, y) \ + x = 0; \ + y = 0; + +#define getmaxyx(win, x, y) \ + x = 0; \ + y = 0; + +struct _window +{ + int _cury, _curx; + int _maxy, _maxx; + int _begy, _begx; +}; +typedef struct _window WINDOW; + +typedef unsigned char bool; +typedef int attr_t; +typedef unsigned chtype; + +extern WINDOW *stdscr; +extern chtype acs_map[]; + +extern WINDOW *initscr (); +extern int endwin (); +extern WINDOW *newwin (int nlines, int ncols, int begin_y, int begin_x); +extern int delwin (WINDOW *win); +extern int move (int y, int x); +extern int wmove (WINDOW *win, int y, int x); +extern int wattr_on (WINDOW *win, attr_t attrs, void *opts); +extern int wattr_off (WINDOW *win, attr_t attrs, void *opts); +extern int wattr_get (WINDOW *win, attr_t *attrs, short *pair, void *opts); +extern int wattr_set (WINDOW *win, attr_t attrs, short pair, void *opts); +extern int wattron (WINDOW *win, int attrs); +extern int wattroff (WINDOW *win, int attrs); +extern int waddstr (WINDOW *win, const char *str); +extern int waddnstr (WINDOW *win, const char *str, int n); +extern int mvaddstr (int y, int x, const char *str); +extern int mvwaddstr (WINDOW *win, int y, int x, const char *str); +extern int wclrtobot (WINDOW *win); +extern int refresh (); +extern int wrefresh (WINDOW *win); +extern int wnoutrefresh (WINDOW *win); +extern int wclrtoeol (WINDOW *win); +extern int mvwprintw (WINDOW *win, int y, int x, const char *fmt, ...); +extern int init_pair (short pair, short f, short b); +extern bool has_colors (); +extern int cbreak (); +extern int start_color (); +extern int noecho (); +extern int clear (); +extern int wclear (WINDOW *win); +extern bool can_change_color (); +extern int curs_set (int visibility); +extern int nodelay (WINDOW *win, bool bf); +extern int werase (WINDOW *win); +extern int wbkgdset (WINDOW *win, chtype ch); +extern void wchgat (WINDOW *win, int n, attr_t attr, short color, + const void *opts); +extern int mvwchgat (WINDOW *win, int y, int x, int n, attr_t attr, short pair, + const void *opts); +extern void whline (WINDOW *win, chtype ch, int n); +extern void wvline (WINDOW *win, chtype ch, int n); +extern int mvwhline (WINDOW *win, int y, int x, chtype ch, int n); +extern int mvwvline (WINDOW *win, int y, int x, chtype ch, int n); +extern int raw (); +extern int wcolor_set (WINDOW *win, short pair, void *opts); +extern void cur_term (); +extern int use_default_colors (); +extern int resizeterm (); +extern int getch (); +extern int wgetch (WINDOW *win); + +#endif /* WEECHAT_NCURSES_FAKE_H */ |