From: H.G. Muller Date: Thu, 20 Sep 2012 13:29:42 +0000 (+0200) Subject: Let windows stick to right display edge (WB) X-Git-Url: http://hgm.nubati.net/cgi-bin/gitweb.cgi?p=xboard.git;a=commitdiff_plain;h=f4b62dcdc66f6b278439684a79170480f0c66efe Let windows stick to right display edge (WB) Auxiliary windows docked to the board window from below or to the right, which are pushed out of view when the board window resizes, will be trimmed to just touch the diplay edge (if sufficient width or height remains). When the board window shrinks, auxiliary windows touching the edge will be resized so they remain touching it. --- diff --git a/winboard/winboard.h b/winboard/winboard.h index 6759f79b..fe035478 100644 --- a/winboard/winboard.h +++ b/winboard/winboard.h @@ -215,3 +215,4 @@ extern HWND gameListDialog; VOID EditTagsProc(void); extern HWND editTagsDialog; +extern int screenWidth, screenHeight; diff --git a/winboard/wlayout.c b/winboard/wlayout.c index 24424662..08f461fb 100644 --- a/winboard/wlayout.c +++ b/winboard/wlayout.c @@ -172,12 +172,20 @@ VOID ReattachAfterSize( LPRECT lprcOldPos, int new_w, int new_h, HWND hWndChild, int delta_y = new_h - (lprcOldPos->bottom - lprcOldPos->top); /* Adjust size & placement */ - if(pwpChild->x + pwpChild->width >= lprcOldPos->right ) + if(pwpChild->x + pwpChild->width >= lprcOldPos->right && + (pwpChild->x + pwpChild->width < screenWidth - 5 || delta_x > 0) ) // keep right edge glued to display edge if touching pwpChild->width += delta_x; - if(pwpChild->y + pwpChild->height >= lprcOldPos->bottom ) + if(pwpChild->x + pwpChild->width >= screenWidth ) // don't move right edge off screen + pwpChild->width = screenWidth - pwpChild->x; + if(pwpChild->y + pwpChild->height >= lprcOldPos->bottom && + (pwpChild->y + pwpChild->height < screenHeight - 35 || delta_y > 0) ) // keep bottom edge glued to display edge if touching pwpChild->height += delta_y; + if(pwpChild->y + pwpChild->height >= screenHeight - 30 ) // don't move bottom edge off screen + pwpChild->height = screenHeight - 30 - pwpChild->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; + if(pwpChild->width < 30) pwpChild->width = 30; // force minimum width + if(pwpChild->height < 50) pwpChild->height = 50; // force minimum height /* Move window */ if( hWndChild != NULL ) { SetWindowPos( hWndChild, HWND_TOP,