X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwlayout.c;h=c308fb333ee9cba7743a5f695c5c98faa8da06cf;hb=439b2edcbe1c2108c6d4c4ec3db5be04dbf92a0a;hp=8cc175f09918dc91a761a3cfabb8a6a8e2671bad;hpb=fc709af77ad30d0f2c58e60404256f373abbf630;p=xboard.git diff --git a/winboard/wlayout.c b/winboard/wlayout.c index 8cc175f..c308fb3 100644 --- a/winboard/wlayout.c +++ b/winboard/wlayout.c @@ -3,6 +3,11 @@ * * Author: Alessandro Scotti (Dec 2005) * + * Copyright 2005 Alessandro Scotti + * + * Enhancements Copyright 2009, 2012, 2013, 2014, 2015, 2016 Free + * Software Foundation, Inc. + * * ------------------------------------------------------------------------ * * GNU XBoard is free software: you can redistribute it and/or modify @@ -31,6 +36,7 @@ #include #include "common.h" +#include "frontend.h" #include "winboard.h" VOID RestoreWindowPlacement( HWND hWnd, WindowPlacement * wp ) @@ -91,7 +97,7 @@ static BOOL IsDefaultPlacement( WindowPlacement * wp ) return result; } -static BOOL GetActualPlacement( HWND hWnd, WindowPlacement * wp ) +BOOL GetActualPlacement( HWND hWnd, WindowPlacement * wp ) { BOOL result = FALSE; @@ -169,12 +175,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 < screenGeometry.right - 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 >= screenGeometry.right ) // don't move right edge off screen + pwpChild->width = screenGeometry.right - pwpChild->x; + if(pwpChild->y + pwpChild->height >= lprcOldPos->bottom && + (pwpChild->y + pwpChild->height < screenGeometry.bottom - 35 || delta_y > 0) ) // keep bottom edge glued to display edge if touching pwpChild->height += delta_y; + if(pwpChild->y + pwpChild->height >= screenGeometry.bottom - 30 ) // don't move bottom edge off screen + pwpChild->height = screenGeometry.bottom - 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,