From 8b75299729034bd130e06462ebac49158bf58160 Mon Sep 17 00:00:00 2001 From: nattfodd Date: Tue, 8 Aug 2006 21:11:20 +0000 Subject: [PATCH] Merge of cuix back in trunk git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4309 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- configure.in | 20 ++ src/fe-text/Makefile.am | 12 + src/fe-text/cuix-api.c | 386 ++++++++++++++++++++++++++++++ src/fe-text/cuix-api.h | 81 +++++++ src/fe-text/cuix-lib.c | 139 +++++++++++ src/fe-text/cuix-lib.h | 16 ++ src/fe-text/cuix.c | 39 +++ src/fe-text/cuix.h | 11 + src/fe-text/gui-printtext.c | 6 + src/fe-text/term-curses.c | 16 ++ src/fe-text/textbuffer-commands.c | 26 ++ src/fe-text/textbuffer-view.c | 6 + 12 files changed, 758 insertions(+) create mode 100644 src/fe-text/cuix-api.c create mode 100644 src/fe-text/cuix-api.h create mode 100644 src/fe-text/cuix-lib.c create mode 100644 src/fe-text/cuix-lib.h create mode 100644 src/fe-text/cuix.c create mode 100644 src/fe-text/cuix.h diff --git a/configure.in b/configure.in index 343fab37..921ccb37 100644 --- a/configure.in +++ b/configure.in @@ -96,6 +96,21 @@ AC_ARG_WITH(terminfo, fi, want_terminfo=yes) +AC_ARG_WITH(ncurses, +[ --with-ncurses Use curses], + if test x$withval = xyes; then + want_terminfo=no + fi, want_curses=yes) + +AC_ARG_WITH(cuix, +[ --with-cuix Use curses ui extended], + if test x$withval = xyes; then + want_terminfo=no + want_cuix=yes + want_curses=yes + fi, want_cuix=no) + + AC_ARG_WITH(modules, [ --with-modules Specify what modules to build in binary], if test x$withval != xyes -a x$withval != xno; then @@ -339,6 +354,10 @@ if test "x$want_socks" = "xyes"; then ]) fi +if test "x$want_cuix" = "xyes"; then + AC_DEFINE([HAVE_CUIX], [1] ,[Enable cuix support]) +fi + dnl ** dnl ** fe-text checks dnl ** @@ -808,6 +827,7 @@ AM_CONDITIONAL(HAVE_PERL, test "$want_perl" != "no") AM_CONDITIONAL(HAVE_STATIC_PERL, test "$want_perl" = "static") AM_CONDITIONAL(NEED_TPARM, test "$need_tparm" = "yes") AM_CONDITIONAL(USE_CURSES, test "$want_terminfo" != "yes" -a "$want_termcap" != "yes") +AM_CONDITIONAL(USE_CUIX, test "$want_cuix" = "yes") # move LIBS to PROG_LIBS so they're not tried to be used when linking eg. perl libraries PROG_LIBS=$LIBS diff --git a/src/fe-text/Makefile.am b/src/fe-text/Makefile.am index 39d7a3a3..7b4546d4 100644 --- a/src/fe-text/Makefile.am +++ b/src/fe-text/Makefile.am @@ -33,6 +33,11 @@ terminfo_sources = \ curses_sources = \ term-curses.c +cuix_sources = \ + cuix-api.c \ + cuix-lib.c \ + cuix.c + if NEED_TPARM use_tparm_sources = $(tparm_sources) endif @@ -43,6 +48,13 @@ else use_term_sources = $(terminfo_sources) endif +if USE_CUIX +use_term_sources += $(cuix_sources) +irssi_LDFLAGS += -lform -lpanel -lmenu +INCLUDES += -I$(top_srcdir)/src/irc/core +endif + + irssi_SOURCES = \ gui-entry.c \ gui-expandos.c \ diff --git a/src/fe-text/cuix-api.c b/src/fe-text/cuix-api.c new file mode 100644 index 00000000..f8e9f614 --- /dev/null +++ b/src/fe-text/cuix-api.c @@ -0,0 +1,386 @@ +#include "module.h" +#include "settings.h" +#include "term.h" +#include "gui-windows.h" +#include +#if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +# include +#else +# include +#endif +#include +#include +#include + + +#include "cuix-api.h" + +#define INIT_ENTRIES 8 +#define X0_OFFSET 4 +#define Y0_OFFSET 2 +#define Y_OFFSET 1 +#define CUIX_FIELD_WIDTH 16 + +object *create_object (char *title, int type, void **entries) +{ + object *obj; + void **new_entries; + int i; + + obj = g_malloc (sizeof(object)); + if (!obj) { + return NULL; + } + obj->type = type; + obj->title = title; + if (!entries) { + new_entries = g_new0 (void *, INIT_ENTRIES); + obj->entries = new_entries; + obj->alloced = INIT_ENTRIES; + obj->last = 0; + } else { + for (i = 0; ((entry **)entries)[i]; i++); + obj->alloced = i; + obj->last = i; + obj->entries = entries; + } + return obj; +} + + +object *create_menu (char *title) +{ + return create_object (title, CUIX_MENU, NULL); +} + + +object *create_form (char *title) +{ + return create_object (title, CUIX_FORM, NULL); +} + + +/* entries must be NULL terminated */ +object *create_list (char *title, entry **entries) +{ + return create_object (title, CUIX_LIST, (void **)entries); +} + +entry *create_entry (char *label, int type, action_fn_type action) +{ + entry *entry; + + entry = g_malloc (sizeof(object)); + if (!entry) { + return NULL; + } + entry->type = type; + entry->data = label; + entry->action = action; + return entry; +} + +entry *create_menuentry (char *label, action_fn_type action) +{ + return create_entry (label, CUIX_MENUENTRY, action); +} + +entry *create_label (char *label) +{ + return create_entry (label, CUIX_LABEL, NULL); +} + + +entry *create_field (char *label, action_fn_type action) +{ + return create_entry (label, CUIX_FIELD, action); +} + + + +/* Adds child at the last position of father->entries */ +void attach_entry (object *father, void *child) +{ + void **entries; + int i; + + /* Check that we have enough space in father->entries, otherwise alloc + * twice more than previously */ + if (father->last >= father->alloced) { + entries = g_new0 (void *,2 * father->alloced); + if (!entries) { + fprintf (stderr, "Problem with memory allocation, quitting now...\n"); + exit (1); + } + for (i = 0; i < father->alloced; i++) { + entries[i] = father->entries[i]; + } + g_free (father->entries); + father->entries = entries; + father->alloced *= 2; + } + father->entries[father->last++] = child; +} + + +/* Adds a submenu to father */ +void attach_submenu (object *father, object *child) +{ + + /* Check that both are really menus */ + if (father->type != CUIX_MENU || child->type != CUIX_MENU) { + fprintf (stderr, "Typing error, trying to add %p (%d) as child of" + "%p (%d)\n", father, father->type, child, child->type); + exit (1); + } + attach_entry (father, (void *)child); +} + + +/* Returns the maximum width occupied by labels */ +int get_labels_width (object *obj) +{ + int i; + unsigned int w = 0; + entry *e; + object *o; + + for (i = 0; i < obj->last; i++) { + e = (entry *)obj->entries[i]; + if (e->type == CUIX_LABEL || e->type == CUIX_MENUENTRY) { + w = (w > strlen (e->data)) ? w : strlen (e->data); + } + if (e->type == CUIX_MENU) { + o = (object *)obj->entries[i]; + w = (w > strlen (o->title)) ? w : strlen (o->title); + } + + } + w += 2 * X0_OFFSET; + return (int)w; +} + + +/* Puts in x and y the coordinates to center an object of size objw and objh + * in the window win */ +void get_center (WINDOW *win, int objh, int objw, int *y, int *x) +{ + int begx, begy, maxx, maxy, w, h; + getbegyx (win, begy, begx); + getmaxyx (win, maxy, maxx); + w = maxx - begx; + h = maxy - begy; + *x = (w - objw) / 2 + begx; + *y = (h - objh) / 2 + begy; + if (*x < 0) + *x = 0; + if (*y < 0) + *y = 0; +} + + + +void display_object (object *obj) +{ + WINDOW *subwin; + FORM *form; + MENU *menu; + FIELD **fields; + ITEM **items, *cur_item; + object *o; + entry *e; + char *result; + int i, x, y, w, h; + int ch; + p_main = new_panel(root_window->win); + + if (obj->type >= CUIX_LABEL) { + fprintf (stderr, "Trying to display an entry %p (%d), terminating...\n", + obj, obj->type); + exit (1); + } + + switch (obj->type) { + case CUIX_LIST: + w = get_labels_width (obj); + h = Y_OFFSET * obj->last + 2 * Y0_OFFSET; + get_center (root_window->win, h, w, &y, &x); + cuix_win = newwin (h, w, y, x); + box (cuix_win, 0, 0); + p_cuix = new_panel(cuix_win); + x = X0_OFFSET; + y = Y0_OFFSET; + + for (i = 0; i < obj->last; i++) { + e = (entry *)obj->entries[i]; + if (e->type != CUIX_LABEL) { + fprintf (stderr, "Non-label entry in a list.\n"); + exit (1); + } + wmove (cuix_win,y,x); + waddstr (cuix_win,e->data); + y += Y_OFFSET; + x = X0_OFFSET; + } + top_panel (p_cuix); + update_panels(); + doupdate(); + wgetch(cuix_win); + /* refresh (); */ + /* wrefresh (cuix_win); */ + break; + + case CUIX_FORM: + w = get_labels_width (obj); + w = (w > CUIX_FIELD_WIDTH + 2 * X0_OFFSET) ? + w : CUIX_FIELD_WIDTH + 2 * X0_OFFSET; + h = Y_OFFSET * obj->last + 2 * Y0_OFFSET; + fields = g_new0 (FIELD *, obj->last + 1); + for (i = 0; i < obj->last; i++) { + e = (entry *)obj->entries[i]; + fields[i] = new_field (1, w, + Y0_OFFSET + i * Y_OFFSET, X0_OFFSET, 0, 0); + if (e->type == CUIX_LABEL) { + field_opts_off (fields[i], O_ACTIVE); + field_opts_off (fields[i], O_EDIT); + set_field_back (fields[i], A_BOLD); + } + set_field_buffer (fields[i], 0, e->data); + } + fields[obj->last] = NULL; + form = new_form (fields); + scale_form (form, &h, &w); + h += Y0_OFFSET; + w += 2 * X0_OFFSET; + get_center (root_window->win, h, w, &y, &x); + cuix_win = newwin (h, w, y, x); + keypad (cuix_win, TRUE); + nonl (); + set_form_win (form, cuix_win); + set_form_sub (form, derwin(cuix_win, w, h, X0_OFFSET, Y0_OFFSET)); + post_form (form); + box (cuix_win, 0, 0); + p_cuix = new_panel (cuix_win); + top_panel (p_cuix); + while((ch = wgetch(cuix_win)) != '\n' && ch != '\r' && ch != 27 /* ESC */) { + switch(ch) { + case KEY_DOWN: + /* Go to next field */ + form_driver(form, REQ_NEXT_FIELD); + /* Go to the end of the present buffer */ + /* Leaves nicely at the last character */ + form_driver(form, REQ_END_LINE); + break; + case KEY_UP: + /* Go to previous field */ + form_driver(form, REQ_PREV_FIELD); + form_driver(form, REQ_END_LINE); + break; + case KEY_BACKSPACE: + form_driver(form, REQ_PREV_CHAR); + form_driver(form, REQ_DEL_CHAR); + break; + case KEY_LEFT: + form_driver(form, REQ_PREV_CHAR); + break; + case KEY_RIGHT: + form_driver(form, REQ_NEXT_CHAR); + break; + default: + /* If this is a normal character, it gets */ + /* Printed */ + form_driver(form, ch); + break; + } + } + form_driver (form, REQ_VALIDATION); + if (ch != 27) { + for (i = 0; i < obj->last; i++) { + e = (entry *)obj->entries[i]; + if (e->type == CUIX_FIELD) { + result = field_buffer(fields[i],0); + e->action (result); + } + } + } + for (i = 0; i < obj->last; i++) { + free_field (fields[i]); + } + g_free (fields); + unpost_form (form); + + break; + + case CUIX_MENU: + w = get_labels_width (obj); + w = (w > CUIX_FIELD_WIDTH + 2 * X0_OFFSET) ? + w : CUIX_FIELD_WIDTH + 2 * X0_OFFSET; + h = Y_OFFSET * obj->last + 2 * Y0_OFFSET; + items = g_new0 (ITEM *, obj->last + 1); + for (i = 0; i < obj->last; i++) { + e = (entry *)obj->entries[i]; + o = (object *)obj->entries[i]; + if (e->type == CUIX_MENUENTRY) { + items[i] = new_item (e->data, ""); + set_item_userptr (items[i], (void*)e); + } else { + if (e->type == CUIX_LABEL) { + items[i] = new_item (e->data, ""); + item_opts_off (items[i], O_SELECTABLE); + } else { + items[i] = new_item (o->title, " (SUB) "); + set_item_userptr (items[i], (void*)o); + } + } + } + items[obj->last] = NULL; + menu = new_menu (items); + set_menu_mark (menu, " * "); + scale_menu (menu, &h, &w); + h += 4 * Y0_OFFSET; + w += 4 * X0_OFFSET; + get_center (root_window->win, h, w, &y, &x); + cuix_win = newwin (h, w, y, x); + keypad (cuix_win, TRUE); + nonl (); + set_menu_win (menu, cuix_win); + subwin = derwin (cuix_win, + h - 2 * Y0_OFFSET, w - 2 * X0_OFFSET, Y0_OFFSET, X0_OFFSET); + set_menu_sub (menu, subwin); + box (cuix_win, 0, 0); + post_menu (menu); + p_cuix = new_panel (cuix_win); + top_panel (p_cuix); + while((ch = wgetch(cuix_win)) != 27 /* ESC */) { + switch(ch) { + case KEY_DOWN: + menu_driver(menu, REQ_DOWN_ITEM); + break; + case KEY_UP: + menu_driver(menu, REQ_UP_ITEM); + break; + case '\n': + case '\r': + cur_item = current_item(menu); + e = (entry *)item_userptr(cur_item); + o = (object *)item_userptr(cur_item); + if (e->type == CUIX_MENUENTRY) + { + e->action (""); + } else { + display_object (o); + } + goto end; + break; + default: + break; + } + } +end: + for (i = 0; i < obj->last; i++) { + free_item (items[i]); + } + g_free (items); + unpost_menu (menu); + } +} diff --git a/src/fe-text/cuix-api.h b/src/fe-text/cuix-api.h new file mode 100644 index 00000000..cc9ec2d3 --- /dev/null +++ b/src/fe-text/cuix-api.h @@ -0,0 +1,81 @@ +#ifndef __CUIX_API_H +#define __CUIX_API_H + +#if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +# include +#else +# include +#endif +#include +#include + +#define MAX_FIELD_SIZE 64 + +/* Should be updated if the one in term-curses.c changes */ +struct _TERM_WINDOW { + int x, y; + int width, height; + WINDOW *win; +}; + +WINDOW *cuix_win; +PANEL *p_main; +PANEL *p_cuix; + +enum objtype { + /* For objects */ + CUIX_MENU, + CUIX_FORM, + CUIX_LIST, + /* For entries */ + /* NB: LABEL must stay the first entry, as it is used to test if we have + * an object or an entry */ + CUIX_LABEL, + CUIX_FIELD, + CUIX_MENUENTRY +}; + + + +/* This is the type of the action to be executed when the entry has been + * successfully selected (in case of a menuentry) or filled (in case of a + * field). */ +typedef int(*action_fn_type)(char *); + + +typedef struct entry { + int type; + char *data; /* contains label or submenu title */ + action_fn_type action; +} entry; + + +typedef struct object { + int type; + char *title; + void **entries; + int alloced; /* defines the current size of entries */ + int last; /* index of the first non-alloced entry */ +} object; + + +/* Object definitions */ + +object *create_menu (char *title); +object *create_form (char *title); +/* entries must be NULL terminated */ +object *create_list (char *title, entry **entries); + + +entry *create_menuentry (char *label, action_fn_type action); +entry *create_label (char *label); +entry *create_field (char *label, action_fn_type action); + +void attach_submenu (object *father, object *child); +void attach_entry (object *father, void *child); + +void display_object (object *obj); + +void my_menu(void); + +#endif /* __CUIX_API_H */ diff --git a/src/fe-text/cuix-lib.c b/src/fe-text/cuix-lib.c new file mode 100644 index 00000000..25d6a2f1 --- /dev/null +++ b/src/fe-text/cuix-lib.c @@ -0,0 +1,139 @@ +#include "module.h" +#include "settings.h" +#include "cuix-lib.h" +#include "signals.h" +#include "irc.h" +#include "irc-channels.h" +#include "mode-lists.h" +#include "gui-windows.h" + + +int do_nothing (char *foo) +{ + (void)foo; + return 0; +} + + +void display_message (char *message) +{ + object *list; + entry *text, *entries[2]; + + text = create_label (message); + entries[0] = text; + entries[1] = NULL; + list = create_list ("Message", entries); + display_object (list); +} + + +int change_nick (char *nick) +{ + SERVER_REC *server; + WI_ITEM_REC *wiitem; + if (active_win == NULL) { + server = NULL; + wiitem = NULL; + } else { + server = active_win->active_server != NULL ? + active_win->active_server : active_win->connect_server; + wiitem = active_win->active; + } + signal_emit("command nick", 3, nick, server, wiitem); + return 0; +} + + + +int show_banlist (char *nothing) +{ + GSList *tmp; + IRC_CHANNEL_REC *chan = IRC_CHANNEL(active_win->active); + BAN_REC *ban; + object *list; + entry *entry, **entries; + unsigned int size, i; + GString **baninfo; + + if (!chan) { + display_message ("This is not a channel"); + return 1; + } + if (!chan->banlist) { + display_message ("No bans set"); + return 0; + } + + size = (unsigned int) g_slist_length (chan->banlist); + entries = g_new0 (struct entry *, size + 1); + baninfo = g_new0 (GString *, size); + + for (tmp = chan->banlist, i = 0; tmp; tmp = tmp->next, i++) { + ban = tmp->data; + baninfo[i] = g_string_new (NULL); + g_string_printf (baninfo[i], "%s set by %s %d seconds ago", ban->ban, ban->setby, (int)(time(NULL)-ban->time)); + entry = create_label (baninfo[i]->str); + entries[i] = entry; + } + + list = create_list ("Bans", entries); + display_object (list); + for (i = 0; i < size; i++) { + g_string_free (baninfo[i], FALSE); + } + g_free (entries); + g_free (baninfo); + + return 0; +} + + +int change_nick_form (char *nothing) { + object *form; + entry *question, *answer; + (void)nothing; + + form = create_form ("True!"); + question = create_label ("Enter your new nick"); + answer = create_field ("", change_nick); + attach_entry (form, question); + attach_entry (form, answer); + display_object (form); + return 0; +} + + +int about_list (char *nothing) +{ + (void)nothing; + + display_message ("(c) irssi; See http://www.irssi.org."); + return 0; +} + + + + +int home_menu (char *nothing) +{ + /* Objects declaration */ + object *root_menu; + entry *about, *banlist, *nick; + (void)nothing; + + /* Objects initialisation */ + root_menu = create_menu ("My root menu"); + banlist = create_menuentry ("Banlist", show_banlist); + nick = create_menuentry ("Change nick", change_nick_form); + about = create_menuentry ("About", about_list); + + /* Layout */ + attach_entry (root_menu, (void *)banlist); + attach_entry (root_menu, (void *)nick); + attach_entry (root_menu, (void *)about); + + /* Declare that the object is ready to be displayed and do it */ + display_object (root_menu); + return 0; +} diff --git a/src/fe-text/cuix-lib.h b/src/fe-text/cuix-lib.h new file mode 100644 index 00000000..e03795c9 --- /dev/null +++ b/src/fe-text/cuix-lib.h @@ -0,0 +1,16 @@ +#ifndef __CUIX_LIB_H +#define __CUIX_LIB_H + +#if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +# include +#else +# include +#endif +#include +#include +#include "cuix-api.h" + +int home_menu (char *); + + +#endif /* __CUIX_LIB_H */ diff --git a/src/fe-text/cuix.c b/src/fe-text/cuix.c new file mode 100644 index 00000000..ef954703 --- /dev/null +++ b/src/fe-text/cuix.c @@ -0,0 +1,39 @@ +#include "module.h" +#include "settings.h" +#include "cuix-api.h" +#include "cuix-lib.h" +#include "cuix.h" +#include "term.h" +#if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +# include +#else +# include +#endif + + +void cuix_destroy (void) +{ + if (cuix_win) { + del_panel (p_cuix); + delwin(cuix_win); + } + cuix_win = NULL; + cuix_active = 0; + update_panels (); + doupdate(); + term_refresh (root_window); + irssi_redraw (); +} + +void cuix_create(void) +{ + home_menu (NULL); + cuix_destroy (); +} + +void cuix_refresh (void) +{ + update_panels (); +} + + diff --git a/src/fe-text/cuix.h b/src/fe-text/cuix.h new file mode 100644 index 00000000..ca8ffce0 --- /dev/null +++ b/src/fe-text/cuix.h @@ -0,0 +1,11 @@ +#ifndef __CUIX_TRY_H +#define __CUIX_TRY_H + +int cuix_active; + +void cuix_create (void); +void cuix_destroy (void); +void cuix_refresh (void); + + +#endif /* __CUIX_TRY_H */ diff --git a/src/fe-text/gui-printtext.c b/src/fe-text/gui-printtext.c index 836eb228..089ac6b1 100644 --- a/src/fe-text/gui-printtext.c +++ b/src/fe-text/gui-printtext.c @@ -28,6 +28,9 @@ #include "term.h" #include "gui-printtext.h" #include "gui-windows.h" +#ifdef HAVE_CUIX +#include "cuix.h" +#endif int mirc_colors[] = { 15, 0, 1, 2, 12, 4, 5, 6, 14, 10, 3, 11, 9, 13, 8, 7 }; static int scrollback_lines, scrollback_time, scrollback_burst_remove; @@ -281,6 +284,9 @@ static void sig_gui_print_text(WINDOW_REC *window, void *fgcolor, } if (gui->use_insert_after) gui->insert_after = insert_after; +#ifdef HAVE_CUIX + cuix_refresh (); +#endif } static void sig_gui_printtext_finished(WINDOW_REC *window) diff --git a/src/fe-text/term-curses.c b/src/fe-text/term-curses.c index b147e7ab..ca7db091 100644 --- a/src/fe-text/term-curses.c +++ b/src/fe-text/term-curses.c @@ -23,6 +23,10 @@ #include "term.h" #include "mainwindows.h" +#ifdef HAVE_CUIX +#include "cuix.h" +#endif +#include "panel.h" #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) # include @@ -349,14 +353,26 @@ void term_refresh_thaw(void) void term_refresh(TERM_WINDOW *window) { +#ifdef HAVE_CUIX + if (!cuix_active) { +#endif if (window != NULL) wnoutrefresh(window->win); if (freeze_refresh == 0) { move(curs_y, curs_x); wnoutrefresh(stdscr); +#ifdef HAVE_CUIX + cuix_refresh (); +#endif doupdate(); } +#ifdef HAVE_CUIX + } else { + update_panels (); + doupdate (); + } +#endif } void term_stop(void) diff --git a/src/fe-text/textbuffer-commands.c b/src/fe-text/textbuffer-commands.c index 92eaaec7..120814f4 100644 --- a/src/fe-text/textbuffer-commands.c +++ b/src/fe-text/textbuffer-commands.c @@ -30,6 +30,9 @@ #include "printtext.h" #include "gui-windows.h" #include "textbuffer-reformat.h" +#ifdef HAVE_CUIX +#include "cuix.h" +#endif /* SYNTAX: CLEAR [-all] [] */ static void cmd_clear(const char *data) @@ -303,6 +306,23 @@ static void sig_away_changed(SERVER_REC *server) } } +#ifdef HAVE_CUIX +static void cmd_cuix(void) +{ + if (!cuix_active) + { + /* textbuffer_view_clear(WINDOW_GUI(active_win)->view); */ + cuix_active = 1; + cuix_create(); + } else { + /* should never been called */ + /* cuix_destroy (); */ + cuix_active = 0; + /* textbuffer_view_clear(WINDOW_GUI(active_win)->view); */ + } +} +#endif + void textbuffer_commands_init(void) { command_bind("clear", NULL, (SIGNAL_FUNC) cmd_clear); @@ -314,6 +334,9 @@ void textbuffer_commands_init(void) command_bind("scrollback end", NULL, (SIGNAL_FUNC) cmd_scrollback_end); command_bind("scrollback redraw", NULL, (SIGNAL_FUNC) cmd_scrollback_redraw); command_bind("scrollback status", NULL, (SIGNAL_FUNC) cmd_scrollback_status); +#ifdef HAVE_CUIX + command_bind("cuix", NULL, (SIGNAL_FUNC) cmd_cuix); +#endif command_set_options("clear", "all"); @@ -331,6 +354,9 @@ void textbuffer_commands_deinit(void) command_unbind("scrollback end", (SIGNAL_FUNC) cmd_scrollback_end); command_unbind("scrollback redraw", (SIGNAL_FUNC) cmd_scrollback_redraw); command_unbind("scrollback status", (SIGNAL_FUNC) cmd_scrollback_status); +#ifdef HAVE_CUIX + command_unbind("cuix", (SIGNAL_FUNC) cmd_cuix); +#endif signal_remove("away mode changed", (SIGNAL_FUNC) sig_away_changed); } diff --git a/src/fe-text/textbuffer-view.c b/src/fe-text/textbuffer-view.c index 906e5668..51a9561c 100644 --- a/src/fe-text/textbuffer-view.c +++ b/src/fe-text/textbuffer-view.c @@ -23,6 +23,9 @@ #include "module.h" #include "textbuffer-view.h" #include "utf8.h" +#ifdef HAVE_CUIX +#include "cuix.h" +#endif typedef struct { char *name; @@ -1319,6 +1322,9 @@ static int sig_check_linecache(void) void textbuffer_view_init(void) { linecache_tag = g_timeout_add(LINE_CACHE_CHECK_TIME, (GSourceFunc) sig_check_linecache, NULL); +#ifdef HAVE_CUIX + cuix_active = 0; +#endif } void textbuffer_view_deinit(void)