summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-10-08 12:54:26 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-10-08 12:54:26 +0000
commit11f2accbb136de107a7525ed0cf0d6f77f0507d1 (patch)
tree33eb80b5bc5fef0e301458651876382728f68a21 /src
parent62473e354fbe4ae766667c3245fb4d1b8af87411 (diff)
downloadirssi-11f2accbb136de107a7525ed0cf0d6f77f0507d1.zip
--disable-curses-windows option to configure
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@723 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/fe-text/gui-printtext.c28
-rw-r--r--src/fe-text/gui-readline.c2
-rw-r--r--src/fe-text/gui-windows.c27
-rw-r--r--src/fe-text/mainwindows.c10
-rw-r--r--src/fe-text/mainwindows.h4
-rw-r--r--src/fe-text/screen.c40
-rw-r--r--src/fe-text/screen.h4
7 files changed, 89 insertions, 26 deletions
diff --git a/src/fe-text/gui-printtext.c b/src/fe-text/gui-printtext.c
index 9558f7bf..2c74b5bf 100644
--- a/src/fe-text/gui-printtext.c
+++ b/src/fe-text/gui-printtext.c
@@ -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)
diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c
index f9aafef4..98651844 100644
--- a/src/fe-text/gui-readline.c
+++ b/src/fe-text/gui-readline.c
@@ -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";
diff --git a/src/fe-text/gui-windows.c b/src/fe-text/gui-windows.c
index 8e915454..7ccb5fbb 100644
--- a/src/fe-text/gui-windows.c
+++ b/src/fe-text/gui-windows.c
@@ -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);
}
diff --git a/src/fe-text/mainwindows.c b/src/fe-text/mainwindows.c
index 691db0bb..2ba547dc 100644
--- a/src/fe-text/mainwindows.c
+++ b/src/fe-text/mainwindows.c
@@ -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,6 +72,7 @@ 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);
@@ -77,6 +80,7 @@ static void mainwindow_resize(MAIN_WINDOW_REC *window, int ychange, int xchange)
delwin(window->curses_win);
create_curses_window(window);
#endif
+#endif
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
WINDOW_REC *rec = tmp->data;
@@ -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);
diff --git a/src/fe-text/mainwindows.h b/src/fe-text/mainwindows.h
index bad52393..f23aa8b7 100644
--- a/src/fe-text/mainwindows.h
+++ b/src/fe-text/mainwindows.h
@@ -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);
diff --git a/src/fe-text/screen.c b/src/fe-text/screen.c
index 59d1383a..b2e41c44 100644
--- a/src/fe-text/screen.c
+++ b/src/fe-text/screen.c
@@ -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
+ 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;
- clear();
+
+ if (!init_curses())
+ return FALSE;
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
return 1;
diff --git a/src/fe-text/screen.h b/src/fe-text/screen.h
index b51fb62e..bcbb824e 100644
--- a/src/fe-text/screen.h
+++ b/src/fe-text/screen.h
@@ -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