Changeset b0cbde4


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:
6b93305
Parents:
2dfccc7
git-author:
David Benjamin <davidben@mit.edu> (05/27/10 13:04:19)
git-committer:
David Benjamin <davidben@mit.edu> (05/29/10 13:14:57)
Message:
Move some things around

In case we want to make them static.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • window.c

    r2dfccc7 rb0cbde4  
    386386  if (begin_y) *begin_y = w->begin_y;
    387387  if (begin_x) *begin_x = w->begin_x;
    388 }
    389 
    390 void owl_window_set_position(owl_window *w, int nlines, int ncols, int begin_y, int begin_x)
    391 {
    392   /* can't move the screen */
    393   if (w->is_screen) {
    394     begin_y = begin_x = 0;
    395   }
    396 
    397   if (w->nlines == nlines && w->ncols == ncols) {
    398     /* moving is easier */
    399     owl_window_move(w, begin_y, begin_x);
    400     return;
    401   }
    402 
    403   w->begin_y = begin_y;
    404   w->begin_x = begin_x;
    405   w->nlines = nlines;
    406   w->ncols = ncols;
    407   /* window is mapped, we must try to have a window at the end */
    408   if (w->mapped) {
    409     /* resizing in ncurses is hard: give up do a unmap/map */
    410     _owl_window_unmap_internal(w);
    411   }
    412   /* call the resize hooks BEFORE remapping, so that everything can resize */
    413   if (w->resize_cb)
    414     w->resize_cb(w, w->resize_cbdata);
    415   if (w->mapped) {
    416     _owl_window_map_internal(w);
    417   }
    418 }
    419 
    420 void owl_window_resize(owl_window *w, int nlines, int ncols)
    421 {
    422   owl_window_set_position(w, nlines, ncols, w->begin_y, w->begin_x);
    423388}
    424389
     
    452417}
    453418
     419void owl_window_set_position(owl_window *w, int nlines, int ncols, int begin_y, int begin_x)
     420{
     421  /* can't move the screen */
     422  if (w->is_screen) {
     423    begin_y = begin_x = 0;
     424  }
     425
     426  if (w->nlines == nlines && w->ncols == ncols) {
     427    /* moving is easier */
     428    owl_window_move(w, begin_y, begin_x);
     429    return;
     430  }
     431
     432  w->begin_y = begin_y;
     433  w->begin_x = begin_x;
     434  w->nlines = nlines;
     435  w->ncols = ncols;
     436  /* window is mapped, we must try to have a window at the end */
     437  if (w->mapped) {
     438    /* resizing in ncurses is hard: give up do a unmap/map */
     439    _owl_window_unmap_internal(w);
     440  }
     441  /* call the resize hooks BEFORE remapping, so that everything can resize */
     442  if (w->resize_cb)
     443    w->resize_cb(w, w->resize_cbdata);
     444  if (w->mapped) {
     445    _owl_window_map_internal(w);
     446  }
     447}
     448
     449void owl_window_resize(owl_window *w, int nlines, int ncols)
     450{
     451  owl_window_set_position(w, nlines, ncols, w->begin_y, w->begin_x);
     452}
     453
    454454/** Stacking order **/
    455455
Note: See TracChangeset for help on using the changeset viewer.