mirror of
https://github.com/irssi/irssi.git
synced 2026-08-19 16:42:30 +02: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
8 changed files with 97 additions and 26 deletions
|
|
@ -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_CHECK_HEADERS(string.h stdlib.h unistd.h dirent.h sys/ioctl.h libintl.h)
|
||||||
|
|
||||||
|
|
||||||
AC_ARG_WITH(socks,
|
AC_ARG_WITH(socks,
|
||||||
[ --with-socks Build with socks support],
|
[ --with-socks Build with socks support],
|
||||||
if test x$withval = xyes; then
|
if test x$withval = xyes; then
|
||||||
|
|
@ -131,6 +132,13 @@ AC_ARG_WITH(servertest,
|
||||||
fi,
|
fi,
|
||||||
want_servertest=no)
|
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,
|
AC_ARG_ENABLE(memdebug,
|
||||||
[ --enable-memdebug Enable memory debugging],
|
[ --enable-memdebug Enable memory debugging],
|
||||||
if test x$enableval = xyes; then
|
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. */
|
/* draw the line to screen. */
|
||||||
ypos = gui->ypos-new_lines;
|
ypos = gui->ypos-new_lines;
|
||||||
if (new_lines > 0) {
|
if (new_lines > 0) {
|
||||||
|
#ifdef USE_CURSES_WINDOWS
|
||||||
set_color(gui->parent->curses_win, 0);
|
set_color(gui->parent->curses_win, 0);
|
||||||
wmove(gui->parent->curses_win, ypos, 0);
|
wmove(gui->parent->curses_win, ypos, 0);
|
||||||
wclrtoeol(gui->parent->curses_win);
|
wclrtoeol(gui->parent->curses_win);
|
||||||
|
#else
|
||||||
|
set_color(stdscr, 0);
|
||||||
|
move(ypos + gui->parent->first_line, 0);
|
||||||
|
wclrtoeol(stdscr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ypos >= 0)
|
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)
|
static void window_clear(GUI_WINDOW_REC *gui)
|
||||||
{
|
{
|
||||||
WINDOW *cwin;
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
cwin = gui->parent->curses_win;
|
#ifdef USE_CURSES_WINDOWS
|
||||||
for (n = 0; n < gui->parent->lines; n++) {
|
wclear(gui->parent->curses_win);
|
||||||
wmove(cwin, n, 0);
|
screen_refresh(gui->parent->curses_win);
|
||||||
wclrtoeol(cwin);
|
#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 */
|
/* SYNTAX: CLEAR */
|
||||||
|
|
@ -359,8 +368,13 @@ static void sig_printtext_finished(WINDOW_REC *window)
|
||||||
GUI_WINDOW_REC *gui;
|
GUI_WINDOW_REC *gui;
|
||||||
|
|
||||||
gui = WINDOW_GUI(window);
|
gui = WINDOW_GUI(window);
|
||||||
if (is_window_visible(window))
|
if (is_window_visible(window)) {
|
||||||
|
#ifdef USE_CURSES_WINDOWS
|
||||||
screen_refresh(gui->parent->curses_win);
|
screen_refresh(gui->parent->curses_win);
|
||||||
|
#else
|
||||||
|
screen_refresh(NULL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_settings(void)
|
static void read_settings(void)
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,9 @@ static const char *get_key_name(int key)
|
||||||
case KEY_HOME:
|
case KEY_HOME:
|
||||||
return "Home";
|
return "Home";
|
||||||
case KEY_END:
|
case KEY_END:
|
||||||
|
#ifdef KEY_LL
|
||||||
case KEY_LL:
|
case KEY_LL:
|
||||||
|
#endif
|
||||||
return "End";
|
return "End";
|
||||||
case KEY_PPAGE:
|
case KEY_PPAGE:
|
||||||
return "Prior";
|
return "Prior";
|
||||||
|
|
|
||||||
|
|
@ -241,9 +241,17 @@ void gui_window_newline(GUI_WINDOW_REC *gui, int visible)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
scrollok(gui->parent->curses_win, TRUE);
|
WINDOW *cwin;
|
||||||
wscrl(gui->parent->curses_win, 1);
|
|
||||||
scrollok(gui->parent->curses_win, FALSE);
|
#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;
|
color = rec->color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_CURSES_WINDOWS
|
||||||
cwin = gui->parent->curses_win;
|
cwin = gui->parent->curses_win;
|
||||||
|
#else
|
||||||
|
cwin = stdscr;
|
||||||
|
ypos += gui->parent->first_line;
|
||||||
|
#endif
|
||||||
wmove(cwin, ypos, xpos);
|
wmove(cwin, ypos, xpos);
|
||||||
set_color(cwin, color);
|
set_color(cwin, color);
|
||||||
|
|
||||||
|
|
@ -497,11 +510,19 @@ void gui_window_redraw(WINDOW_REC *window)
|
||||||
g_return_if_fail(window != NULL);
|
g_return_if_fail(window != NULL);
|
||||||
|
|
||||||
gui = WINDOW_GUI(window);
|
gui = WINDOW_GUI(window);
|
||||||
|
#ifdef USE_CURSES_WINDOWS
|
||||||
cwin = gui->parent->curses_win;
|
cwin = gui->parent->curses_win;
|
||||||
|
#else
|
||||||
|
cwin = stdscr;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* clear the lines first */
|
/* clear the lines first */
|
||||||
set_color(cwin, 0);
|
set_color(cwin, 0);
|
||||||
|
#ifdef USE_CURSES_WINDOWS
|
||||||
for (ypos = 0; ypos <= gui->parent->lines; ypos++) {
|
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);
|
wmove(cwin, ypos, 0);
|
||||||
wclrtoeol(cwin);
|
wclrtoeol(cwin);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,11 +57,13 @@ static MAIN_WINDOW_REC *find_window_with_room(void)
|
||||||
return biggest_rec;
|
return biggest_rec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_CURSES_WINDOWS
|
||||||
static void create_curses_window(MAIN_WINDOW_REC *window)
|
static void create_curses_window(MAIN_WINDOW_REC *window)
|
||||||
{
|
{
|
||||||
window->curses_win = newwin(window->lines, COLS, window->first_line, 0);
|
window->curses_win = newwin(window->lines, COLS, window->first_line, 0);
|
||||||
idlok(window->curses_win, 1);
|
idlok(window->curses_win, 1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void mainwindow_resize(MAIN_WINDOW_REC *window, int ychange, int xchange)
|
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;
|
if (ychange == 0 && !xchange) return;
|
||||||
|
|
||||||
window->lines = window->last_line-window->first_line+1;
|
window->lines = window->last_line-window->first_line+1;
|
||||||
|
#ifdef USE_CURSES_WINDOWS
|
||||||
#ifdef HAVE_CURSES_WRESIZE
|
#ifdef HAVE_CURSES_WRESIZE
|
||||||
wresize(window->curses_win, window->lines, COLS);
|
wresize(window->curses_win, window->lines, COLS);
|
||||||
mvwin(window->curses_win, window->first_line, 0);
|
mvwin(window->curses_win, window->first_line, 0);
|
||||||
#else
|
#else
|
||||||
delwin(window->curses_win);
|
delwin(window->curses_win);
|
||||||
create_curses_window(window);
|
create_curses_window(window);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
|
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);
|
signal_emit("mainwindow resized", 1, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_CURSES_WINDOWS
|
||||||
void mainwindows_recreate(void)
|
void mainwindows_recreate(void)
|
||||||
{
|
{
|
||||||
GSList *tmp;
|
GSList *tmp;
|
||||||
|
|
@ -101,6 +106,7 @@ void mainwindows_recreate(void)
|
||||||
gui_window_redraw(rec->active);
|
gui_window_redraw(rec->active);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
MAIN_WINDOW_REC *mainwindow_create(void)
|
MAIN_WINDOW_REC *mainwindow_create(void)
|
||||||
{
|
{
|
||||||
|
|
@ -133,8 +139,10 @@ MAIN_WINDOW_REC *mainwindow_create(void)
|
||||||
mainwindow_resize(parent, -space-1, FALSE);
|
mainwindow_resize(parent, -space-1, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_CURSES_WINDOWS
|
||||||
rec->curses_win = newwin(rec->lines, COLS, rec->first_line, 0);
|
rec->curses_win = newwin(rec->lines, COLS, rec->first_line, 0);
|
||||||
refresh();
|
refresh();
|
||||||
|
#endif
|
||||||
|
|
||||||
mainwindows = g_slist_append(mainwindows, rec);
|
mainwindows = g_slist_append(mainwindows, rec);
|
||||||
signal_emit("mainwindow created", 1, rec);
|
signal_emit("mainwindow created", 1, rec);
|
||||||
|
|
@ -217,7 +225,9 @@ void mainwindow_destroy(MAIN_WINDOW_REC *window)
|
||||||
{
|
{
|
||||||
g_return_if_fail(window != NULL);
|
g_return_if_fail(window != NULL);
|
||||||
|
|
||||||
|
#ifdef USE_CURSES_WINDOWS
|
||||||
delwin(window->curses_win);
|
delwin(window->curses_win);
|
||||||
|
#endif
|
||||||
|
|
||||||
mainwindows = g_slist_remove(mainwindows, window);
|
mainwindows = g_slist_remove(mainwindows, window);
|
||||||
signal_emit("mainwindow destroyed", 1, window);
|
signal_emit("mainwindow destroyed", 1, window);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@
|
||||||
typedef struct {
|
typedef struct {
|
||||||
WINDOW_REC *active;
|
WINDOW_REC *active;
|
||||||
|
|
||||||
|
#ifdef USE_CURSES_WINDOWS
|
||||||
WINDOW *curses_win;
|
WINDOW *curses_win;
|
||||||
|
#endif
|
||||||
int first_line, last_line, lines;
|
int first_line, last_line, lines;
|
||||||
int statusbar_lines;
|
int statusbar_lines;
|
||||||
void *statusbar;
|
void *statusbar;
|
||||||
|
|
@ -25,7 +27,9 @@ void mainwindow_destroy(MAIN_WINDOW_REC *window);
|
||||||
|
|
||||||
void mainwindows_redraw(void);
|
void mainwindows_redraw(void);
|
||||||
void mainwindows_resize(int ychange, int xchange);
|
void mainwindows_resize(int ychange, int xchange);
|
||||||
|
#ifdef USE_CURSES_WINDOWS
|
||||||
void mainwindows_recreate(void);
|
void mainwindows_recreate(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
int mainwindows_reserve_lines(int count, int up);
|
int mainwindows_reserve_lines(int count, int up);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -107,30 +107,31 @@ static void read_settings(void)
|
||||||
if (use_colors != old_colors) irssi_redraw();
|
if (use_colors != old_colors) irssi_redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize screen, detect screen length */
|
static int init_curses(void)
|
||||||
int init_screen(void)
|
|
||||||
{
|
{
|
||||||
char ansi_tab[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };
|
char ansi_tab[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };
|
||||||
int num;
|
int num;
|
||||||
|
|
||||||
if (!initscr()) return 0;
|
if (!initscr())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (COLS < MIN_SCREEN_WIDTH)
|
if (COLS < MIN_SCREEN_WIDTH)
|
||||||
COLS = MIN_SCREEN_WIDTH;
|
COLS = MIN_SCREEN_WIDTH;
|
||||||
|
|
||||||
signal(SIGINT, sigint_handler);
|
signal(SIGINT, sigint_handler);
|
||||||
|
#ifdef SIGWINCH
|
||||||
|
signal(SIGWINCH, sig_winch);
|
||||||
|
#endif
|
||||||
cbreak(); noecho(); idlok(stdscr, 1);
|
cbreak(); noecho(); idlok(stdscr, 1);
|
||||||
#ifdef HAVE_CURSES_IDCOK
|
#ifdef HAVE_CURSES_IDCOK
|
||||||
idcok(stdscr, 1);
|
idcok(stdscr, 1);
|
||||||
#endif
|
#endif
|
||||||
intrflush(stdscr, FALSE); halfdelay(1); keypad(stdscr, 1);
|
intrflush(stdscr, FALSE); halfdelay(1); keypad(stdscr, 1);
|
||||||
|
|
||||||
settings_add_bool("lookandfeel", "colors", TRUE);
|
if (has_colors())
|
||||||
settings_add_str("misc", "ignore_signals", "");
|
start_color();
|
||||||
read_signals();
|
else
|
||||||
|
use_colors = FALSE;
|
||||||
use_colors = settings_get_bool("colors") && has_colors();
|
|
||||||
if (has_colors()) start_color();
|
|
||||||
|
|
||||||
#ifdef HAVE_NCURSES_USE_DEFAULT_COLORS
|
#ifdef HAVE_NCURSES_USE_DEFAULT_COLORS
|
||||||
/* this lets us to use the "default" background color for colors <= 7 so
|
/* 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);
|
init_pair(63, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
scrx = scry = 0;
|
|
||||||
#ifdef SIGWINCH
|
|
||||||
signal(SIGWINCH, sig_winch);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
freeze_refresh = 0;
|
|
||||||
clear();
|
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);
|
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
#define __SCREEN_H
|
#define __SCREEN_H
|
||||||
|
|
||||||
#if defined(USE_NCURSES) && !defined(RENAMED_NCURSES)
|
#if defined(USE_NCURSES) && !defined(RENAMED_NCURSES)
|
||||||
#include <ncurses.h>
|
# include <ncurses.h>
|
||||||
#else
|
#else
|
||||||
#include <curses.h>
|
# include <curses.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ATTR_UNDERLINE 0x100
|
#define ATTR_UNDERLINE 0x100
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue