home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 328_02 / wreopen.c < prev    next >
C/C++ Source or Header  |  1991-03-17  |  1KB  |  70 lines

  1.  
  2. /*! wreopen ()
  3.  *
  4.  *    makes the desired window the active window
  5.  *    Does NOT check that no other window overlaps this one
  6.  *    you can get screen gibberrish if you switch between
  7.  *    overlapping windows
  8.  *
  9.  *      The previous window becomes the second window on the chain.
  10.  */
  11.  
  12.  
  13. #include "wscreen.h"
  14. #include "wsys.h"
  15.  
  16.  
  17.  
  18.  
  19.  
  20. void  wreopen(WINDOW *Wnew)
  21.     {
  22.     WINDOW *p;
  23.  
  24.     int oldpage, newpage;
  25.  
  26.     if ( w0 == Wnew )
  27.         {
  28.         return;
  29.         }
  30.  
  31.     /* find the window that 'points' to the desired new window
  32.      */
  33.     for (p = w0; p->winchain != Wnew && p !=NULL; p= p->winchain)
  34.         {}
  35.  
  36.  
  37.     if (p==NULL)
  38.         {
  39.         werror('W', "WREOPEN-window not found");
  40.         }
  41.  
  42.  
  43.     /* now p points to the window immediately more recent than 'new' one
  44.      */
  45.     p->winchain       = Wnew->winchain;    /* remove new from chain */
  46.     Wnew->winchain   = w0;
  47.     w0            = Wnew;
  48.  
  49.  
  50.     newpage = w0->        winpage;
  51.     oldpage = w0->winchain->winpage;
  52.  
  53.  
  54.  
  55.  
  56.     if (oldpage != newpage)
  57.         {
  58.         wpage_ram = wvideo_ram + wpage_size*newpage;
  59.         }
  60.  
  61.  
  62.     #ifndef TEXTONLY
  63.                 /* align BGI graphics driver
  64.                  */
  65.                 walign (oldpage);
  66.     #endif /* ! TEXTONLY */
  67.  
  68.     return;    /* wreopen */
  69.     }
  70.