Code

Rename variable sun as it is predefined (to 1) on solaris
[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"
20 #include "config.h"
22 #ifdef ENABLE_COLORS
23 #include "colors.h"
24 #endif
26 #ifdef HAVE_GETMOUSE
27 #include "options.h"
28 #endif
30 #ifdef HAVE_NCURSESW_NCURSES_H
31 #include <ncursesw/ncurses.h>
32 #else
33 #include <ncurses.h>
34 #endif
36 void
37 ncu_init(void)
38 {
39         /* initialize the curses library */
40         initscr();
42         /* initialize color support */
43 #ifdef ENABLE_COLORS
44         colors_start();
45 #endif
47         /* tell curses not to do NL->CR/NL on output */
48         nonl();
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 }