Changes in mainwin.c [f449096:5cc7e5e]
Legend:
- Unmodified
- Added
- Removed
-
mainwin.c
rf449096 r5cc7e5e 1 1 #include "owl.h" 2 2 3 void owl_mainwin_init(owl_mainwin *mw) 3 static void owl_mainwin_redraw(owl_window *w, WINDOW *recwin, void *user_data); 4 static void owl_mainwin_resized(owl_window *w, void *user_data); 5 6 void owl_mainwin_init(owl_mainwin *mw, owl_window *window) 4 7 { 5 8 mw->curtruncated=0; 6 9 mw->lastdisplayed=-1; 10 mw->window = g_object_ref(window); 11 /* for now, just assume this object lasts forever */ 12 g_signal_connect(window, "redraw", G_CALLBACK(owl_mainwin_redraw), mw); 13 g_signal_connect(window, "resized", G_CALLBACK(owl_mainwin_resized), mw); 14 owl_window_dirty(window); 15 16 /* For now, we do not bother with connecting up dependencies; that'll be a 17 * future refactor of the mainwin */ 18 } 19 20 static void owl_mainwin_resized(owl_window *w, void *user_data) 21 { 22 owl_mainwin *mw = user_data; 23 24 /* in case any styles rely on the current width */ 25 owl_messagelist_invalidate_formats(owl_global_get_msglist(&g)); 26 27 /* recalculate the topmsg to make sure the current message is on 28 * screen */ 29 owl_function_calculate_topmsg(OWL_DIRECTION_NONE); 30 31 /* Schedule a redraw */ 32 owl_window_dirty(mw->window); 7 33 } 8 34 9 35 void owl_mainwin_redisplay(owl_mainwin *mw) 36 { 37 owl_window_dirty(mw->window); 38 } 39 40 static void owl_mainwin_redraw(owl_window *w, WINDOW *recwin, void *user_data) 10 41 { 11 42 owl_message *m; … … 13 44 int x, y, savey, recwinlines, start; 14 45 int topmsg, curmsg, markedmsgid, fgcolor, bgcolor; 15 WINDOW *recwin;16 46 const owl_view *v; 17 47 GList *fl; 18 48 const owl_filter *f; 49 owl_mainwin *mw = user_data; 19 50 20 recwin = owl_global_get_curs_recwin(&g);21 51 topmsg = owl_global_get_topmsg(&g); 22 52 curmsg = owl_global_get_curmsg(&g); … … 43 73 mw->curtruncated=0; 44 74 mw->lastdisplayed=-1; 45 owl_global_set_needrefresh(&g);46 75 return; 47 76 } … … 88 117 if (y+lines > recwinlines-1) { 89 118 isfull=1; 90 owl_message_curs_waddstr(m, owl_global_get_curs_recwin(&g),119 owl_message_curs_waddstr(m, recwin, 91 120 start, 92 121 start+recwinlines-y, … … 96 125 } else { 97 126 /* otherwise print the whole thing */ 98 owl_message_curs_waddstr(m, owl_global_get_curs_recwin(&g),127 owl_message_curs_waddstr(m, recwin, 99 128 start, 100 129 start+lines, … … 139 168 } 140 169 mw->lastdisplayed=i-1; 141 142 owl_global_set_needrefresh(&g);143 170 } 144 171
Note: See TracChangeset
for help on using the changeset viewer.