Changeset 4cc49bc
- Timestamp:
- May 23, 2011, 8:57:46 PM (13 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- 6b4033f
- Parents:
- 2c79eae
- git-author:
- David Benjamin <davidben@mit.edu> (02/25/11 21:52:40)
- git-committer:
- David Benjamin <davidben@mit.edu> (05/23/11 20:57:46)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
owl.c
rc809f5e r4cc49bc 442 442 #endif /* OWL_STDERR_REDIR */ 443 443 444 static int owl_refresh_pre_select_action(owl_ps_action *a, void *data)445 {446 owl_colorpair_mgr *cpmgr;447 448 /* if a resize has been scheduled, deal with it */449 owl_global_check_resize(&g);450 /* update the terminal if we need to */451 owl_window_redraw_scheduled();452 /* On colorpair shortage, reset and redraw /everything/. NOTE: if453 * the current screen uses too many colorpairs, this draws454 * everything twice. But this is unlikely; COLOR_PAIRS is 64 with455 * 8+1 colors, and 256^2 with 256+1 colors. (+1 for default.) */456 cpmgr = owl_global_get_colorpair_mgr(&g);457 if (cpmgr->overflow) {458 owl_function_debugmsg("colorpairs: color shortage; reset pairs and redraw. COLOR_PAIRS = %d", COLOR_PAIRS);459 owl_fmtext_reset_colorpairs(cpmgr);460 owl_function_full_redisplay();461 owl_window_redraw_scheduled();462 }463 return 0;464 }465 466 467 444 int main(int argc, char **argv, char **env) 468 445 { … … 473 450 const char *dir; 474 451 owl_options opts; 452 GSource *source; 475 453 476 454 if (!GLIB_CHECK_VERSION (2, 12, 0)) … … 591 569 owl_global_push_context(&g, OWL_CTX_INTERACTIVE|OWL_CTX_RECV, NULL, "recv", NULL); 592 570 593 owl_select_add_pre_select_action(owl_refresh_pre_select_action, NULL, NULL); 571 source = owl_window_redraw_source_new(); 572 g_source_attach(source, NULL); 573 g_source_unref(source); 574 594 575 owl_select_add_pre_select_action(owl_process_messages, NULL, NULL); 595 576 owl_select_add_pre_select_action(owl_errsignal_pre_select_action, NULL, NULL); -
window.c
rb31f1c9 r4cc49bc 524 524 owl_window_set_position(w, nlines, ncols, w->begin_y, w->begin_x); 525 525 } 526 527 /** Redrawing main loop hooks **/ 528 529 static bool _owl_window_should_redraw(void) { 530 return g.resizepending || owl_window_get_screen()->dirty_subtree; 531 } 532 533 static gboolean _owl_window_redraw_prepare(GSource *source, int *timeout) { 534 *timeout = -1; 535 return _owl_window_should_redraw(); 536 } 537 538 static gboolean _owl_window_redraw_check(GSource *source) { 539 return _owl_window_should_redraw(); 540 } 541 542 static gboolean _owl_window_redraw_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) { 543 owl_colorpair_mgr *cpmgr; 544 545 /* if a resize has been scheduled, deal with it */ 546 owl_global_check_resize(&g); 547 /* update the terminal if we need to */ 548 owl_window_redraw_scheduled(); 549 /* On colorpair shortage, reset and redraw /everything/. NOTE: if 550 * the current screen uses too many colorpairs, this draws 551 * everything twice. But this is unlikely; COLOR_PAIRS is 64 with 552 * 8+1 colors, and 256^2 with 256+1 colors. (+1 for default.) */ 553 cpmgr = owl_global_get_colorpair_mgr(&g); 554 if (cpmgr->overflow) { 555 owl_function_debugmsg("colorpairs: color shortage; reset pairs and redraw. COLOR_PAIRS = %d", COLOR_PAIRS); 556 owl_fmtext_reset_colorpairs(cpmgr); 557 owl_function_full_redisplay(); 558 owl_window_redraw_scheduled(); 559 } 560 return TRUE; 561 } 562 563 static GSourceFuncs redraw_funcs = { 564 _owl_window_redraw_prepare, 565 _owl_window_redraw_check, 566 _owl_window_redraw_dispatch, 567 NULL 568 }; 569 570 GSource *owl_window_redraw_source_new(void) { 571 GSource *source; 572 source = g_source_new(&redraw_funcs, sizeof(GSource)); 573 /* TODO: priority?? */ 574 return source; 575 } -
window.h
r38e2250 r4cc49bc 72 72 void owl_window_resize(owl_window *w, int nlines, int ncols); 73 73 74 GSource *owl_window_redraw_source_new(void); 75 74 76 /* Standard callback functions in windowcb.c */ 75 77
Note: See TracChangeset
for help on using the changeset viewer.