Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • mainwin.c

    rf449096 r5cc7e5e  
    11#include "owl.h"
    22
    3 void owl_mainwin_init(owl_mainwin *mw)
     3static void owl_mainwin_redraw(owl_window *w, WINDOW *recwin, void *user_data);
     4static void owl_mainwin_resized(owl_window *w, void *user_data);
     5
     6void owl_mainwin_init(owl_mainwin *mw, owl_window *window)
    47{
    58  mw->curtruncated=0;
    69  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
     20static 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);
    733}
    834
    935void owl_mainwin_redisplay(owl_mainwin *mw)
     36{
     37  owl_window_dirty(mw->window);
     38}
     39
     40static void owl_mainwin_redraw(owl_window *w, WINDOW *recwin, void *user_data)
    1041{
    1142  owl_message *m;
     
    1344  int x, y, savey, recwinlines, start;
    1445  int topmsg, curmsg, markedmsgid, fgcolor, bgcolor;
    15   WINDOW *recwin;
    1646  const owl_view *v;
    1747  GList *fl;
    1848  const owl_filter *f;
     49  owl_mainwin *mw = user_data;
    1950
    20   recwin = owl_global_get_curs_recwin(&g);
    2151  topmsg = owl_global_get_topmsg(&g);
    2252  curmsg = owl_global_get_curmsg(&g);
     
    4373    mw->curtruncated=0;
    4474    mw->lastdisplayed=-1;
    45     owl_global_set_needrefresh(&g);
    4675    return;
    4776  }
     
    88117    if (y+lines > recwinlines-1) {
    89118      isfull=1;
    90       owl_message_curs_waddstr(m, owl_global_get_curs_recwin(&g),
     119      owl_message_curs_waddstr(m, recwin,
    91120                               start,
    92121                               start+recwinlines-y,
     
    96125    } else {
    97126      /* otherwise print the whole thing */
    98       owl_message_curs_waddstr(m, owl_global_get_curs_recwin(&g),
     127      owl_message_curs_waddstr(m, recwin,
    99128                               start,
    100129                               start+lines,
     
    139168  }
    140169  mw->lastdisplayed=i-1;
    141 
    142   owl_global_set_needrefresh(&g);
    143170}
    144171
Note: See TracChangeset for help on using the changeset viewer.