Changeset ab88b05


Ignore:
Timestamp:
Jan 23, 2012, 5:27:42 PM (9 years ago)
Author:
Jason Gross <jgross@mit.edu>
Branches:
master, release-1.9
Children:
219f52c
Parents:
8135737
git-author:
Jason Gross <jgross@mit.edu> (07/23/11 22:33:17)
git-committer:
Jason Gross <jgross@mit.edu> (01/23/12 17:27:42)
Message:
Allocate the mainwin on the heap

This lets us return NULL from owl_global_get_mainwin before the mainwin
has been initilized.

Since g has static duration, g.mw is automatically initialized to NULL.
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • global.c

    r9078f69 rab88b05  
    109109
    110110  /* Create the widgets */
    111   owl_mainwin_init(&(g->mw), g->mainpanel.recwin);
     111  g->mw = owl_mainwin_new(g->mainpanel.recwin);
    112112  owl_msgwin_init(&(g->msgwin), g->mainpanel.msgwin);
    113113  owl_sepbar_init(g->mainpanel.sepwin);
     
    241241/* windows */
    242242
    243 owl_mainwin *owl_global_get_mainwin(owl_global *g) {
    244   return(&(g->mw));
     243owl_mainwin *owl_global_get_mainwin(owl_global *g)
     244{
     245  return g->mw;
    245246}
    246247
  • mainwin.c

    r099597c rab88b05  
    44static void owl_mainwin_resized(owl_window *w, void *user_data);
    55
    6 void owl_mainwin_init(owl_mainwin *mw, owl_window *window)
     6CALLER_OWN owl_mainwin *owl_mainwin_new(owl_window *window)
    77{
     8  owl_mainwin *mw = g_new(owl_mainwin, 1);
    89  mw->curtruncated=0;
    910  mw->lastdisplayed=-1;
     
    1617  /* For now, we do not bother with connecting up dependencies; that'll be a
    1718   * future refactor of the mainwin */
     19
     20  return mw;
    1821}
    1922
  • owl.h

    rb9517cf rab88b05  
    533533
    534534typedef struct _owl_global {
    535   owl_mainwin mw;
     535  owl_mainwin *mw;
    536536  owl_popwin *pw;
    537537  owl_msgwin msgwin;
Note: See TracChangeset for help on using the changeset viewer.