user32: Use window height/width instead of client for combo resizing.

This commit is contained in:
Sergey Guralnik 2013-03-08 22:28:39 +02:00 committed by Alexandre Julliard
parent 0515b44f2f
commit ac0738471d
1 changed files with 12 additions and 8 deletions

View File

@ -1507,7 +1507,7 @@ static void CBResetPos(
/*********************************************************************** /***********************************************************************
* COMBO_Size * COMBO_Size
*/ */
static void COMBO_Size( LPHEADCOMBO lphc, LPARAM lParam ) static void COMBO_Size( LPHEADCOMBO lphc )
{ {
/* /*
* Those controls are always the same height. So we have to make sure * Those controls are always the same height. So we have to make sure
@ -1515,8 +1515,12 @@ static void COMBO_Size( LPHEADCOMBO lphc, LPARAM lParam )
*/ */
if( CB_GETTYPE(lphc) != CBS_SIMPLE ) if( CB_GETTYPE(lphc) != CBS_SIMPLE )
{ {
int newComboHeight; int newComboHeight, curComboHeight, curComboWidth;
RECT rc;
GetWindowRect(lphc->self, &rc);
curComboHeight = rc.bottom - rc.top;
curComboWidth = rc.right - rc.left;
newComboHeight = CBGetTextAreaHeight(lphc->self, lphc) + 2*COMBO_YBORDERSIZE(); newComboHeight = CBGetTextAreaHeight(lphc->self, lphc) + 2*COMBO_YBORDERSIZE();
/* /*
@ -1527,18 +1531,18 @@ static void COMBO_Size( LPHEADCOMBO lphc, LPARAM lParam )
* the actual control, for example, to do the layout of a dialog that is * the actual control, for example, to do the layout of a dialog that is
* resized, the height of the dropdown is not changed. * resized, the height of the dropdown is not changed.
*/ */
if( HIWORD(lParam) > newComboHeight ) if( curComboHeight > newComboHeight )
{ {
TRACE("oldComboHeight=%d, newComboHeight=%d, oldDropBottom=%d, oldDropTop=%d\n", TRACE("oldComboHeight=%d, newComboHeight=%d, oldDropBottom=%d, oldDropTop=%d\n",
HIWORD(lParam), newComboHeight, lphc->droppedRect.bottom, curComboHeight, newComboHeight, lphc->droppedRect.bottom,
lphc->droppedRect.top); lphc->droppedRect.top);
lphc->droppedRect.bottom = lphc->droppedRect.top + HIWORD(lParam) - newComboHeight; lphc->droppedRect.bottom = lphc->droppedRect.top + curComboHeight - newComboHeight;
} }
/* /*
* Restore original height * Restore original height
*/ */
if( HIWORD(lParam) != newComboHeight ) if( curComboHeight != newComboHeight )
SetWindowPos(lphc->self, 0, 0, 0, LOWORD(lParam), newComboHeight, SetWindowPos(lphc->self, 0, 0, 0, curComboWidth, newComboHeight,
SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOREDRAW); SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOREDRAW);
} }
@ -1862,7 +1866,7 @@ LRESULT ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar
} }
case WM_SIZE: case WM_SIZE:
if( lphc->hWndLBox && if( lphc->hWndLBox &&
!(lphc->wState & CBF_NORESIZE) ) COMBO_Size( lphc, lParam ); !(lphc->wState & CBF_NORESIZE) ) COMBO_Size( lphc );
return TRUE; return TRUE;
case WM_SETFONT: case WM_SETFONT:
COMBO_Font( lphc, (HFONT)wParam, (BOOL)lParam ); COMBO_Font( lphc, (HFONT)wParam, (BOOL)lParam );