void gui_entry_move(GUI_ENTRY_REC *entry, int xpos, int ypos, int width) { int old_width; g_return_if_fail(entry != NULL); if (entry->xpos != xpos || entry->ypos != ypos) { /* position in screen changed - needs a full redraw */ entry->xpos = xpos; entry->ypos = ypos; entry->width = width; gui_entry_redraw(entry); return; } if (entry->width == width) return; /* no changes */ if (width > entry->width) { /* input line grew - need to draw text at the end */ old_width = width; entry->width = width; gui_entry_redraw_from(entry, old_width); } else { /* input line shrinked - make sure the cursor is inside the input line */ entry->width = width; if (entry->pos - entry->scrstart > entry->width-2 - entry->promptlen) { gui_entry_fix_cursor(entry); } } gui_entry_draw(entry); }
static void item_input(SBAR_ITEM_REC *item, int get_size_only) { GUI_ENTRY_REC *rec; rec = g_hash_table_lookup(input_entries, item->bar->config->name); if (rec == NULL) { rec = gui_entry_create(ITEM_WINDOW_REAL_XPOS(item), item->bar->real_ypos, item->size, term_type == TERM_TYPE_UTF8); gui_entry_set_active(rec); g_hash_table_insert(input_entries, g_strdup(item->bar->config->name), rec); } if (get_size_only) { int max_width; WINDOW_REC *window; window = item->bar->parent_window != NULL ? item->bar->parent_window->active : NULL; max_width = window != NULL ? window->width : term_width; item->min_size = 2+max_width/10; item->max_size = max_width; return; } gui_entry_move(rec, ITEM_WINDOW_REAL_XPOS(item), item->bar->real_ypos, item->size); gui_entry_redraw(rec); /* FIXME: this is only necessary with ^L.. */ }
/* redraw irssi's screen.. */ void irssi_redraw(void) { clear(); /* windows */ mainwindows_redraw(); /* statusbar */ statusbar_redraw(NULL); /* entry line */ gui_entry_redraw(); }
static void item_input(SBAR_ITEM_REC *item, int get_size_only) { GUI_ENTRY_REC *rec; rec = g_hash_table_lookup(input_entries, item->bar); if (rec == NULL) { rec = gui_entry_create(item->xpos, item->bar->real_ypos, item->size, term_type == TERM_TYPE_UTF8); gui_entry_set_active(rec); g_hash_table_insert(input_entries, item->bar, rec); } if (get_size_only) { item->min_size = 2+term_width/10; item->max_size = term_width; return; } gui_entry_move(rec, item->xpos, item->bar->real_ypos, item->size); gui_entry_redraw(rec); /* FIXME: this is only necessary with ^L.. */ }