static void dirty_check(void) { if (!dirty || dummy) return; term_resize_dirty(); if (full_redraw) { full_redraw = FALSE; /* first clear the screen so curses will be forced to redraw the screen */ term_clear(); term_refresh(NULL); mainwindows_redraw(); statusbar_redraw(NULL, TRUE); } mainwindows_redraw_dirty(); statusbar_redraw_dirty(); term_refresh(NULL); dirty = FALSE; }
/* redraw irssi's screen.. */ void irssi_redraw(void) { clear(); /* windows */ mainwindows_redraw(); /* statusbar */ statusbar_redraw(NULL); /* entry line */ gui_entry_redraw(); }
void mainwindow_destroy(MAIN_WINDOW_REC *window) { g_return_if_fail(window != NULL); mainwindows = g_slist_remove(mainwindows, window); signal_emit("mainwindow destroyed", 1, window); term_window_destroy(window->screen_win); if (mainwindows != NULL) { gui_windows_remove_parent(window); if (!quitting) { mainwindows_add_space(window->first_line, window->last_line); mainwindows_redraw(); } } g_free(window); if (active_mainwin == window) active_mainwin = NULL; }
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); if (!quitting && mainwindows != NULL) { gui_windows_remove_parent(window); mainwindows_add_space(window->first_line, window->last_line+window->statusbar_lines); mainwindows_redraw(); statusbar_redraw(NULL); } g_free(window); if (active_mainwin == window) active_mainwin = NULL; }
/* SYNTAX: WINDOW BALANCE */ static void cmd_window_balance(void) { GSList *sorted, *tmp; int avail_size, unit_size, bigger_units; int windows, last_line, old_size; windows = g_slist_length(mainwindows); if (windows == 1) return; avail_size = LINES-reserved_up-reserved_down; unit_size = avail_size/windows; bigger_units = avail_size%windows; sorted = mainwindows_get_sorted(FALSE); last_line = 0; for (tmp = sorted; tmp != NULL; tmp = tmp->next) { MAIN_WINDOW_REC *rec = tmp->data; old_size = rec->lines; rec->first_line = last_line+1; rec->last_line = rec->first_line-1 + unit_size - rec->statusbar_lines; rec->lines = rec->last_line-rec->first_line+1; if (bigger_units > 0) { rec->last_line++; bigger_units--; } last_line = rec->last_line + rec->statusbar_lines; mainwindow_resize(rec, rec->lines-old_size, FALSE); } g_slist_free(sorted); mainwindows_redraw(); statusbar_redraw(NULL); }
/* SYNTAX: WINDOW BALANCE */ static void cmd_window_balance(void) { GSList *sorted, *tmp; int avail_size, unit_size, bigger_units; int windows, last_line, old_size; windows = g_slist_length(mainwindows); if (windows == 1) return; avail_size = term_height - screen_reserved_top-screen_reserved_bottom; unit_size = avail_size/windows; bigger_units = avail_size%windows; sorted = mainwindows_get_sorted(FALSE); last_line = screen_reserved_top; for (tmp = sorted; tmp != NULL; tmp = tmp->next) { MAIN_WINDOW_REC *rec = tmp->data; old_size = rec->height; rec->first_line = last_line; rec->last_line = rec->first_line + unit_size-1; if (bigger_units > 0) { rec->last_line++; bigger_units--; } rec->height = rec->last_line-rec->first_line+1; last_line = rec->last_line+1; mainwindow_resize(rec, 0, rec->height-old_size); } g_slist_free(sorted); mainwindows_redraw(); }
void quassel_irssi_backlog(void* arg, int msg_id, int timestamp, int bufferid, int network, char* buffer_id, char* sender, int type, int flags, char* content) { (void) msg_id; (void) bufferid; (void) type; (void) flags; Quassel_SERVER_REC *server = (Quassel_SERVER_REC*)arg; char *chan = channame(network, buffer_id); char *nick = strdup(sender); char *address; if( (address=index(nick, '!')) != NULL) *address = 0; address++; GSList *win = windows; while(win) { WINDOW_REC* winrec = (WINDOW_REC*) win->data; if(winrec->active_server != SERVER(server) && winrec->connect_server != SERVER(server)) goto next; if(!winrec->active) goto next; if(strcmp(winrec->active->visible_name, chan)!=0) goto next; if(!WINDOW_GUI(winrec) || !WINDOW_GUI(winrec)->view || !WINDOW_GUI(winrec)->view->buffer) goto next; LINE_INFO_REC lineinforec; lineinforec.time=timestamp; lineinforec.level = 0; LINE_REC* pos = WINDOW_GUI(winrec)->view->buffer->first_line; LINE_REC* before = pos; for(; pos!=NULL; pos = pos->next) { if(pos->info.time >= timestamp) break; before = pos; } unsigned char *data = NULL; int len = asprintf((char**)&data, "%d:%s:%sxx", timestamp, nick, content); data[len-2]=0; data[len-1]=0x80; LINE_REC *linerec = textbuffer_insert(WINDOW_GUI(winrec)->view->buffer, before, data, len, &lineinforec); free(data); textbuffer_view_insert_line(WINDOW_GUI(winrec)->view, linerec); if(WINDOW_GUI(winrec)->insert_after) WINDOW_GUI(winrec)->insert_after = linerec; WINDOW_GUI(winrec)->view->dirty = 1; winrec->last_line = time(NULL); mainwindows_redraw(); next: win = g_slist_next(win); } free(nick); }