00001
00002 #include "cur.h"
00003 #include "video.h"
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 int mvwin(WINDOW * win,int y,int x )
00016 {
00017 int old_x, old_y, xsize, ysize, delta_x, delta_y, visible;
00018 SBUF *image;
00019
00020 if( win == stdscr )
00021 return ERR;
00022
00023
00024
00025
00026
00027 old_x = win->x_org - win->boxed ;
00028 old_y = win->y_org - win->boxed ;
00029 xsize = win->x_size + (win->boxed * 2);
00030 ysize = win->y_size + (win->boxed * 2);
00031
00032
00033
00034 x = max( 0, x );
00035 y = max( 0, y );
00036 if( x + xsize > NUMCOLS )
00037 {
00038 x = NUMCOLS - xsize;
00039 }
00040 if( y + ysize > NUMROWS )
00041 {
00042 y = NUMROWS - ysize;
00043 }
00044
00045 delta_x = x - old_x;
00046 delta_y = y - old_y;
00047
00048 if( delta_y == 0 && delta_x == 0 )
00049 return ERR;
00050
00051 if(( visible = !win->hidden ))
00052 hidewin( win );
00053
00054 win->y_org += delta_y;
00055 win->x_org += delta_x;
00056 image = (SBUF *) win->image;
00057 image->top += delta_y;
00058 image->bottom += delta_y;
00059 image->left += delta_x;
00060 image->right += delta_x;
00061
00062 if( visible )
00063 showwin( win );
00064 return( OK );
00065 }