X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwlayout.c;h=0261736f8f980c8171da0d7a37d2d7663f0d8baa;hb=27765e84d7ffb84191fdd56ef38eac138920c048;hp=0fd28f0d60f0f806224f8dd7a4632e213cf933e0;hpb=91d8e5853ca580769cc130aa6ea004869118d171;p=xboard.git diff --git a/winboard/wlayout.c b/winboard/wlayout.c index 0fd28f0..0261736 100644 --- a/winboard/wlayout.c +++ b/winboard/wlayout.c @@ -44,7 +44,7 @@ VOID RestoreWindowPlacement( HWND hWnd, WindowPlacement * wp ) ZeroMemory( &stWP, sizeof(stWP) ); - EnsureOnScreen( &wp->x, &wp->y); + EnsureOnScreen( &wp->x, &wp->y, 0, 0); stWP.length = sizeof(stWP); stWP.flags = 0; @@ -156,3 +156,34 @@ VOID ReattachAfterMove( LPRECT lprcOldPos, int new_x, int new_y, HWND hWndChild, } } } + +extern FILE *debugFP; +VOID ReattachAfterSize( LPRECT lprcOldPos, int new_w, int new_h, HWND hWndChild, WindowPlacement * pwpChild ) +{ + if( ! IsDefaultPlacement( pwpChild ) ) { + GetActualPlacement( hWndChild, pwpChild ); + +if(appData.debugMode) fprintf(debugFP, "resize, old=(%d,%d,%d,%d), new=(%d,%d)\n", +lprcOldPos->left,lprcOldPos->top,lprcOldPos->right,lprcOldPos->bottom,new_w,new_h); + if( IsAttachedByWindowPlacement( lprcOldPos, pwpChild ) ) { + /* Get delta of lower right corner */ + int delta_x = new_w - (lprcOldPos->right - lprcOldPos->left); + int delta_y = new_h - (lprcOldPos->bottom - lprcOldPos->top); + + /* Adjust size & placement */ + if(pwpChild->x + pwpChild->width >= lprcOldPos->right ) + pwpChild->width += delta_x; + if(pwpChild->y + pwpChild->height >= lprcOldPos->bottom ) + pwpChild->height += delta_y; + if(pwpChild->x >= lprcOldPos->right) pwpChild->width -= delta_x, pwpChild->x += delta_x; + if(pwpChild->y >= lprcOldPos->bottom) pwpChild->height -= delta_y, pwpChild->y += delta_y; + /* Move window */ + if( hWndChild != NULL ) { + SetWindowPos( hWndChild, HWND_TOP, + pwpChild->x, pwpChild->y, + pwpChild->width, pwpChild->height, + SWP_NOZORDER ); + } + } + } +}