1 /* ncmpc
2 * (c) 2004 by Kalle Wallin <kaw@linux.se>
3 * Copyright (C) 2008 Max Kellermann <max@duempel.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
19 #include "ncu.h"
21 #ifdef ENABLE_COLORS
22 #include "colors.h"
23 #endif
25 #ifdef HAVE_GETMOUSE
26 #include "options.h"
27 #endif
29 #ifdef HAVE_NCURSESW_NCURSES_H
30 #include <ncursesw/ncurses.h>
31 #else
32 #include <ncurses.h>
33 #endif
35 void
36 ncu_init(void)
37 {
38 /* initialize the curses library */
39 initscr();
41 /* initialize color support */
42 #ifdef ENABLE_COLORS
43 colors_start();
44 #endif
46 /* tell curses not to do NL->CR/NL on output */
47 nonl();
49 /* don't echo input */
50 noecho();
52 /* set cursor invisible */
53 curs_set(0);
55 /* enable extra keys */
56 keypad(stdscr, TRUE);
58 /* initialize mouse support */
59 #ifdef HAVE_GETMOUSE
60 if (options.enable_mouse)
61 mousemask(ALL_MOUSE_EVENTS, NULL);
62 #endif
63 }
65 void
66 ncu_deinit(void)
67 {
68 endwin();
69 }