mirror of
https://github.com/irssi/irssi.git
synced 2024-10-27 05:20:20 -04:00
--disable-curses-windows option to configure
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@723 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
62473e354f
commit
11f2accbb1
@ -27,6 +27,7 @@ $libtool_flags --disable-static --output=libtool-static --no-verify $ac_aux_dir/
|
||||
|
||||
AC_CHECK_HEADERS(string.h stdlib.h unistd.h dirent.h sys/ioctl.h libintl.h)
|
||||
|
||||
|
||||
AC_ARG_WITH(socks,
|
||||
[ --with-socks Build with socks support],
|
||||
if test x$withval = xyes; then
|
||||
@ -131,6 +132,13 @@ AC_ARG_WITH(servertest,
|
||||
fi,
|
||||
want_servertest=no)
|
||||
|
||||
AC_ARG_ENABLE(curses-windows,
|
||||
[ --enable-curses-windows Use curses windows],
|
||||
if test x$enableval != xno; then
|
||||
AC_DEFINE(USE_CURSES_WINDOWS)
|
||||
fi,
|
||||
AC_DEFINE(USE_CURSES_WINDOWS))
|
||||
|
||||
AC_ARG_ENABLE(memdebug,
|
||||
[ --enable-memdebug Enable memory debugging],
|
||||
if test x$enableval = xyes; then
|
||||
|
@ -306,9 +306,15 @@ static void gui_printtext(WINDOW_REC *window, gpointer fgcolor, gpointer bgcolor
|
||||
/* draw the line to screen. */
|
||||
ypos = gui->ypos-new_lines;
|
||||
if (new_lines > 0) {
|
||||
#ifdef USE_CURSES_WINDOWS
|
||||
set_color(gui->parent->curses_win, 0);
|
||||
wmove(gui->parent->curses_win, ypos, 0);
|
||||
wclrtoeol(gui->parent->curses_win);
|
||||
#else
|
||||
set_color(stdscr, 0);
|
||||
move(ypos + gui->parent->first_line, 0);
|
||||
wclrtoeol(stdscr);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ypos >= 0)
|
||||
@ -326,15 +332,18 @@ static void gui_printtext(WINDOW_REC *window, gpointer fgcolor, gpointer bgcolor
|
||||
|
||||
static void window_clear(GUI_WINDOW_REC *gui)
|
||||
{
|
||||
WINDOW *cwin;
|
||||
int n;
|
||||
|
||||
cwin = gui->parent->curses_win;
|
||||
for (n = 0; n < gui->parent->lines; n++) {
|
||||
wmove(cwin, n, 0);
|
||||
wclrtoeol(cwin);
|
||||
#ifdef USE_CURSES_WINDOWS
|
||||
wclear(gui->parent->curses_win);
|
||||
screen_refresh(gui->parent->curses_win);
|
||||
#else
|
||||
for (n = gui->parent->first_line; n < gui->parent->last_line; n++) {
|
||||
move(n, 0);
|
||||
clrtoeol();
|
||||
}
|
||||
screen_refresh(cwin);
|
||||
screen_refresh(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* SYNTAX: CLEAR */
|
||||
@ -359,8 +368,13 @@ static void sig_printtext_finished(WINDOW_REC *window)
|
||||
GUI_WINDOW_REC *gui;
|
||||
|
||||
gui = WINDOW_GUI(window);
|
||||
if (is_window_visible(window))
|
||||
if (is_window_visible(window)) {
|
||||
#ifdef USE_CURSES_WINDOWS
|
||||
screen_refresh(gui->parent->curses_win);
|
||||
#else
|
||||
screen_refresh(NULL);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void read_settings(void)
|
||||
|
@ -110,7 +110,9 @@ static const char *get_key_name(int key)
|
||||
case KEY_HOME:
|
||||
return "Home";
|
||||
case KEY_END:
|
||||
#ifdef KEY_LL
|
||||
case KEY_LL:
|
||||
#endif
|
||||
return "End";
|
||||
case KEY_PPAGE:
|
||||
return "Prior";
|
||||
|
@ -241,9 +241,17 @@ void gui_window_newline(GUI_WINDOW_REC *gui, int visible)
|
||||
}
|
||||
|
||||
if (visible) {
|
||||
scrollok(gui->parent->curses_win, TRUE);
|
||||
wscrl(gui->parent->curses_win, 1);
|
||||
scrollok(gui->parent->curses_win, FALSE);
|
||||
WINDOW *cwin;
|
||||
|
||||
#ifdef USE_CURSES_WINDOWS
|
||||
cwin = gui->parent->curses_win;
|
||||
#else
|
||||
cwin = stdscr;
|
||||
setscrreg(gui->parent->first_line, gui->parent->last_line);
|
||||
#endif
|
||||
scrollok(cwin, TRUE);
|
||||
wscrl(cwin, 1);
|
||||
scrollok(cwin, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -398,7 +406,12 @@ static void single_line_draw(GUI_WINDOW_REC *gui, int ypos, LINE_CACHE_SUB_REC *
|
||||
color = rec->color;
|
||||
}
|
||||
|
||||
#ifdef USE_CURSES_WINDOWS
|
||||
cwin = gui->parent->curses_win;
|
||||
#else
|
||||
cwin = stdscr;
|
||||
ypos += gui->parent->first_line;
|
||||
#endif
|
||||
wmove(cwin, ypos, xpos);
|
||||
set_color(cwin, color);
|
||||
|
||||
@ -497,11 +510,19 @@ void gui_window_redraw(WINDOW_REC *window)
|
||||
g_return_if_fail(window != NULL);
|
||||
|
||||
gui = WINDOW_GUI(window);
|
||||
#ifdef USE_CURSES_WINDOWS
|
||||
cwin = gui->parent->curses_win;
|
||||
#else
|
||||
cwin = stdscr;
|
||||
#endif
|
||||
|
||||
/* clear the lines first */
|
||||
set_color(cwin, 0);
|
||||
#ifdef USE_CURSES_WINDOWS
|
||||
for (ypos = 0; ypos <= gui->parent->lines; ypos++) {
|
||||
#else
|
||||
for (ypos = gui->parent->first_line; ypos <= gui->parent->last_line; ypos++) {
|
||||
#endif
|
||||
wmove(cwin, ypos, 0);
|
||||
wclrtoeol(cwin);
|
||||
}
|
||||
|
@ -57,11 +57,13 @@ static MAIN_WINDOW_REC *find_window_with_room(void)
|
||||
return biggest_rec;
|
||||
}
|
||||
|
||||
#ifdef USE_CURSES_WINDOWS
|
||||
static void create_curses_window(MAIN_WINDOW_REC *window)
|
||||
{
|
||||
window->curses_win = newwin(window->lines, COLS, window->first_line, 0);
|
||||
idlok(window->curses_win, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void mainwindow_resize(MAIN_WINDOW_REC *window, int ychange, int xchange)
|
||||
{
|
||||
@ -70,12 +72,14 @@ static void mainwindow_resize(MAIN_WINDOW_REC *window, int ychange, int xchange)
|
||||
if (ychange == 0 && !xchange) return;
|
||||
|
||||
window->lines = window->last_line-window->first_line+1;
|
||||
#ifdef USE_CURSES_WINDOWS
|
||||
#ifdef HAVE_CURSES_WRESIZE
|
||||
wresize(window->curses_win, window->lines, COLS);
|
||||
mvwin(window->curses_win, window->first_line, 0);
|
||||
#else
|
||||
delwin(window->curses_win);
|
||||
create_curses_window(window);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
|
||||
@ -90,6 +94,7 @@ static void mainwindow_resize(MAIN_WINDOW_REC *window, int ychange, int xchange)
|
||||
signal_emit("mainwindow resized", 1, window);
|
||||
}
|
||||
|
||||
#ifdef USE_CURSES_WINDOWS
|
||||
void mainwindows_recreate(void)
|
||||
{
|
||||
GSList *tmp;
|
||||
@ -101,6 +106,7 @@ void mainwindows_recreate(void)
|
||||
gui_window_redraw(rec->active);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
MAIN_WINDOW_REC *mainwindow_create(void)
|
||||
{
|
||||
@ -133,8 +139,10 @@ MAIN_WINDOW_REC *mainwindow_create(void)
|
||||
mainwindow_resize(parent, -space-1, FALSE);
|
||||
}
|
||||
|
||||
#ifdef USE_CURSES_WINDOWS
|
||||
rec->curses_win = newwin(rec->lines, COLS, rec->first_line, 0);
|
||||
refresh();
|
||||
#endif
|
||||
|
||||
mainwindows = g_slist_append(mainwindows, rec);
|
||||
signal_emit("mainwindow created", 1, rec);
|
||||
@ -217,7 +225,9 @@ void mainwindow_destroy(MAIN_WINDOW_REC *window)
|
||||
{
|
||||
g_return_if_fail(window != NULL);
|
||||
|
||||
#ifdef USE_CURSES_WINDOWS
|
||||
delwin(window->curses_win);
|
||||
#endif
|
||||
|
||||
mainwindows = g_slist_remove(mainwindows, window);
|
||||
signal_emit("mainwindow destroyed", 1, window);
|
||||
|
@ -7,7 +7,9 @@
|
||||
typedef struct {
|
||||
WINDOW_REC *active;
|
||||
|
||||
#ifdef USE_CURSES_WINDOWS
|
||||
WINDOW *curses_win;
|
||||
#endif
|
||||
int first_line, last_line, lines;
|
||||
int statusbar_lines;
|
||||
void *statusbar;
|
||||
@ -25,7 +27,9 @@ void mainwindow_destroy(MAIN_WINDOW_REC *window);
|
||||
|
||||
void mainwindows_redraw(void);
|
||||
void mainwindows_resize(int ychange, int xchange);
|
||||
#ifdef USE_CURSES_WINDOWS
|
||||
void mainwindows_recreate(void);
|
||||
#endif
|
||||
|
||||
int mainwindows_reserve_lines(int count, int up);
|
||||
|
||||
|
@ -107,30 +107,31 @@ static void read_settings(void)
|
||||
if (use_colors != old_colors) irssi_redraw();
|
||||
}
|
||||
|
||||
/* Initialize screen, detect screen length */
|
||||
int init_screen(void)
|
||||
static int init_curses(void)
|
||||
{
|
||||
char ansi_tab[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };
|
||||
int num;
|
||||
|
||||
if (!initscr()) return 0;
|
||||
if (!initscr())
|
||||
return FALSE;
|
||||
|
||||
if (COLS < MIN_SCREEN_WIDTH)
|
||||
COLS = MIN_SCREEN_WIDTH;
|
||||
|
||||
signal(SIGINT, sigint_handler);
|
||||
#ifdef SIGWINCH
|
||||
signal(SIGWINCH, sig_winch);
|
||||
#endif
|
||||
cbreak(); noecho(); idlok(stdscr, 1);
|
||||
#ifdef HAVE_CURSES_IDCOK
|
||||
idcok(stdscr, 1);
|
||||
#endif
|
||||
intrflush(stdscr, FALSE); halfdelay(1); keypad(stdscr, 1);
|
||||
|
||||
settings_add_bool("lookandfeel", "colors", TRUE);
|
||||
settings_add_str("misc", "ignore_signals", "");
|
||||
read_signals();
|
||||
|
||||
use_colors = settings_get_bool("colors") && has_colors();
|
||||
if (has_colors()) start_color();
|
||||
if (has_colors())
|
||||
start_color();
|
||||
else
|
||||
use_colors = FALSE;
|
||||
|
||||
#ifdef HAVE_NCURSES_USE_DEFAULT_COLORS
|
||||
/* this lets us to use the "default" background color for colors <= 7 so
|
||||
@ -148,13 +149,24 @@ int init_screen(void)
|
||||
init_pair(63, 0, 0);
|
||||
#endif
|
||||
|
||||
scrx = scry = 0;
|
||||
#ifdef SIGWINCH
|
||||
signal(SIGWINCH, sig_winch);
|
||||
#endif
|
||||
|
||||
freeze_refresh = 0;
|
||||
clear();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Initialize screen, detect screen length */
|
||||
int init_screen(void)
|
||||
{
|
||||
settings_add_bool("lookandfeel", "colors", TRUE);
|
||||
settings_add_str("misc", "ignore_signals", "");
|
||||
|
||||
use_colors = settings_get_bool("colors");
|
||||
read_signals();
|
||||
|
||||
scrx = scry = 0;
|
||||
freeze_refresh = 0;
|
||||
|
||||
if (!init_curses())
|
||||
return FALSE;
|
||||
|
||||
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
|
||||
return 1;
|
||||
|
@ -2,9 +2,9 @@
|
||||
#define __SCREEN_H
|
||||
|
||||
#if defined(USE_NCURSES) && !defined(RENAMED_NCURSES)
|
||||
#include <ncurses.h>
|
||||
# include <ncurses.h>
|
||||
#else
|
||||
#include <curses.h>
|
||||
# include <curses.h>
|
||||
#endif
|
||||
|
||||
#define ATTR_UNDERLINE 0x100
|
||||
|
Loading…
Reference in New Issue
Block a user