Code

colors: make color support optional at compile time
[ncmpc.git] / src / ncu.c
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 #include <ncurses.h>
31 void
32 ncu_init(void)
33 {
34         /* initialize the curses library */
35         initscr();
37         /* initialize color support */
38 #ifdef ENABLE_COLORS
39         colors_start();
40 #endif
42         /* tell curses not to do NL->CR/NL on output */
43         nonl();
45         /*  use raw mode (ignore interrupt,quit,suspend, and flow control ) */
46 #ifdef ENABLE_RAW_MODE
47         //  raw();
48 #endif
50         /* don't echo input */
51         noecho();
53         /* set cursor invisible */
54         curs_set(0);
56         /* enable extra keys */
57         keypad(stdscr, TRUE);
59         /* initialize mouse support */
60 #ifdef HAVE_GETMOUSE
61         if (options.enable_mouse)
62                 mousemask(ALL_MOUSE_EVENTS, NULL);
63 #endif
64 }
66 void
67 ncu_deinit(void)
68 {
69         endwin();
70 }