Changeset d106110 for popwin.c


Ignore:
Timestamp:
May 29, 2010, 1:14:57 PM (14 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.7, release-1.8, release-1.9
Children:
d39f68c
Parents:
6b93305
git-author:
David Benjamin <davidben@mit.edu> (05/27/10 13:19:26)
git-committer:
David Benjamin <davidben@mit.edu> (05/29/10 13:14:57)
Message:
Make the size callbacks listen for parent sizing

This probably matches better with how we'll usually use it. Keep the
imperative functions around for now. They may be useful.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • popwin.c

    rd3814ff rd106110  
    99int owl_popwin_up(owl_popwin *pw)
    1010{
    11   /* make them zero-size for now */
    12   pw->border = owl_window_new(0, 0, 0, 0, 0);
    13   pw->content = owl_window_new(pw->border, 0, 0, 0, 0);
    14 
     11  pw->border = owl_window_new(NULL);
     12  pw->content = owl_window_new(pw->border);
    1513  owl_window_set_redraw_cb(pw->border, owl_popwin_draw_border, pw, 0);
    16   owl_window_set_resize_cb(pw->border, owl_popwin_resize_content, pw, 0);
    17   /* HACK */
    18   owl_window_set_resize_cb(owl_window_get_screen(), owl_popwin_reposition, pw, 0);
    19 
    20   /* calculate position, THEN map the windows maybe setting a resize hook
    21    * should just cause it to get called? */
    22   owl_popwin_reposition(owl_window_get_screen(), pw);
     14  owl_window_set_size_cb(pw->border, owl_popwin_size_border, 0, 0);
     15  owl_window_set_size_cb(pw->content, owl_popwin_size_content, 0, 0);
    2316  owl_window_map(pw->border, 1);
    2417
     
    2720}
    2821
    29 void owl_popwin_reposition(owl_window *screen, void *user_data)
     22void owl_popwin_size_border(owl_window *border, void *user_data)
    3023{
    31   owl_popwin *pw = user_data;
    3224  int lines, cols, startline, startcol;
    3325  int glines, gcols;
     26  owl_window *parent = owl_window_get_parent(border);
    3427
    35   owl_window_get_position(screen, &glines, &gcols, 0, 0);
     28  owl_window_get_position(parent, &glines, &gcols, 0, 0);
    3629
    3730  lines = owl_util_min(glines,24)*3/4 + owl_util_max(glines-24,0)/2;
     
    4033  startcol = (gcols-cols)/2;
    4134
    42   owl_window_set_position(pw->border, lines, cols, startline, startcol);
     35  owl_window_set_position(border, lines, cols, startline, startcol);
    4336}
    4437
    45 void owl_popwin_resize_content(owl_window *w, void *user_data)
     38void owl_popwin_size_content(owl_window *content, void *user_data)
    4639{
    4740  int lines, cols;
    48   owl_popwin *pw = user_data;
    49   owl_window_get_position(w, &lines, &cols, 0, 0);
    50   owl_window_set_position(pw->content, lines-2, cols-2, 1, 1);
     41  owl_window *parent = owl_window_get_parent(content);
     42  owl_window_get_position(parent, &lines, &cols, 0, 0);
     43  owl_window_set_position(content, lines-2, cols-2, 1, 1);
    5144}
    5245
     
    7669  pw->content = 0;
    7770  pw->active=0;
    78   owl_window_set_resize_cb(owl_window_get_screen(), 0, 0, 0);
    7971  return(0);
    8072}
Note: See TracChangeset for help on using the changeset viewer.