Removed a number of direct accesses to the WND structure, replacing

them by API calls.
This commit is contained in:
Alexandre Julliard 2001-08-10 22:51:42 +00:00
parent e5b5af9d66
commit de42428f23
19 changed files with 1907 additions and 2175 deletions

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,6 @@
#include "winuser.h"
#include "wine/winuser16.h"
#include "wine/unicode.h"
#include "win.h"
#include "spy.h"
#include "user.h"
#include "controls.h"
@ -30,12 +29,14 @@ DEFAULT_DEBUG_CHANNEL(combo);
* Additional combo box definitions
*/
#define CB_GETPTR( wnd ) (*(LPHEADCOMBO*)((wnd)->wExtra))
#define CB_NOTIFY( lphc, code ) \
(SendMessageW((lphc)->owner, WM_COMMAND, \
MAKEWPARAM((lphc)->self->wIDmenu, (code)), (lphc)->self->hwndSelf))
#define CB_GETEDITTEXTLENGTH( lphc ) \
(SendMessageW((lphc)->hWndEdit, WM_GETTEXTLENGTH, 0, 0 ))
MAKEWPARAM(GetWindowLongA((lphc)->self,GWL_ID), (code)), (lphc)->self))
#define CB_DISABLED( lphc ) (!IsWindowEnabled((lphc)->self))
#define CB_OWNERDRAWN( lphc ) ((lphc)->dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE))
#define CB_HASSTRINGS( lphc ) ((lphc)->dwStyle & CBS_HASSTRINGS)
#define CB_HWND( lphc ) ((lphc)->self)
#define ISWIN31 (LOWORD(GetVersion()) == 0x0a03)
@ -113,38 +114,36 @@ static BOOL COMBO_Init()
/***********************************************************************
* COMBO_NCCreate
*/
static LRESULT COMBO_NCCreate(WND* wnd, LONG style)
static LRESULT COMBO_NCCreate(HWND hwnd, LONG style)
{
LPHEADCOMBO lphc;
LPHEADCOMBO lphc;
if ( wnd && COMBO_Init() &&
(lphc = HeapAlloc(GetProcessHeap(), 0, sizeof(HEADCOMBO))) )
{
memset( lphc, 0, sizeof(HEADCOMBO) );
*(LPHEADCOMBO*)wnd->wExtra = lphc;
if (COMBO_Init() && (lphc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HEADCOMBO))) )
{
lphc->self = hwnd;
SetWindowLongA( hwnd, 0, (LONG)lphc );
/* some braindead apps do try to use scrollbar/border flags */
lphc->dwStyle = style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL);
wnd->dwStyle &= ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL);
SetWindowLongA( hwnd, GWL_STYLE, style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL) );
/*
* We also have to remove the client edge style to make sure
* we don't end-up with a non client area.
*/
wnd->dwExStyle &= ~(WS_EX_CLIENTEDGE);
SetWindowLongA( hwnd, GWL_EXSTYLE,
GetWindowLongA( hwnd, GWL_EXSTYLE ) & ~WS_EX_CLIENTEDGE );
if( !(style & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) )
lphc->dwStyle |= CBS_HASSTRINGS;
if( !(wnd->dwExStyle & WS_EX_NOPARENTNOTIFY) )
if( !(GetWindowLongA( hwnd, GWL_EXSTYLE ) & WS_EX_NOPARENTNOTIFY) )
lphc->wState |= CBF_NOTIFY;
TRACE("[0x%08x], style = %08x\n",
(UINT)lphc, lphc->dwStyle );
return (LRESULT)(UINT)wnd->hwndSelf;
TRACE("[0x%p], style = %08x\n", lphc, lphc->dwStyle );
return TRUE;
}
return (LRESULT)FALSE;
return FALSE;
}
/***********************************************************************
@ -155,15 +154,13 @@ static LRESULT COMBO_NCDestroy( LPHEADCOMBO lphc )
if( lphc )
{
WND* wnd = lphc->self;
TRACE("[%04x]: freeing storage\n", CB_HWND(lphc));
TRACE("[%04x]: freeing storage\n", lphc->self);
if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox )
DestroyWindow( lphc->hWndLBox );
SetWindowLongA( lphc->self, 0, 0 );
HeapFree( GetProcessHeap(), 0, lphc );
wnd->wExtra[0] = 0;
}
return 0;
}
@ -228,7 +225,8 @@ static INT CBGetTextAreaHeight(
MEASUREITEMSTRUCT measureItem;
RECT clientRect;
INT originalItemHeight = iTextItemHeight;
UINT id = GetWindowLongA( lphc->self, GWL_ID );
/*
* We use the client rect for the width of the item.
*/
@ -240,13 +238,12 @@ static INT CBGetTextAreaHeight(
* Send a first one to measure the size of the text area
*/
measureItem.CtlType = ODT_COMBOBOX;
measureItem.CtlID = lphc->self->wIDmenu;
measureItem.CtlID = id;
measureItem.itemID = -1;
measureItem.itemWidth = clientRect.right;
measureItem.itemHeight = iTextItemHeight - 6; /* ownerdrawn cb is taller */
measureItem.itemData = 0;
SendMessageW(lphc->owner, WM_MEASUREITEM,
(WPARAM)measureItem.CtlID, (LPARAM)&measureItem);
SendMessageW(lphc->owner, WM_MEASUREITEM, id, (LPARAM)&measureItem);
iTextItemHeight = 6 + measureItem.itemHeight;
/*
@ -256,13 +253,12 @@ static INT CBGetTextAreaHeight(
if (lphc->dwStyle & CBS_OWNERDRAWFIXED)
{
measureItem.CtlType = ODT_COMBOBOX;
measureItem.CtlID = lphc->self->wIDmenu;
measureItem.CtlID = id;
measureItem.itemID = 0;
measureItem.itemWidth = clientRect.right;
measureItem.itemHeight = originalItemHeight;
measureItem.itemData = 0;
SendMessageW(lphc->owner, WM_MEASUREITEM,
(WPARAM)measureItem.CtlID, (LPARAM)&measureItem);
SendMessageW(lphc->owner, WM_MEASUREITEM, id, (LPARAM)&measureItem);
lphc->fixedOwnerDrawHeight = measureItem.itemHeight;
}
@ -288,9 +284,9 @@ static void CBForceDummyResize(
RECT windowRect;
int newComboHeight;
newComboHeight = CBGetTextAreaHeight(CB_HWND(lphc),lphc) + 2*COMBO_YBORDERSIZE();
newComboHeight = CBGetTextAreaHeight(lphc->self,lphc) + 2*COMBO_YBORDERSIZE();
GetWindowRect(CB_HWND(lphc), &windowRect);
GetWindowRect(lphc->self, &windowRect);
/*
* We have to be careful, resizing a combobox also has the meaning that the
@ -300,7 +296,7 @@ static void CBForceDummyResize(
* this will cancel-out in the processing of the WM_WINDOWPOSCHANGING
* message.
*/
SetWindowPos( CB_HWND(lphc),
SetWindowPos( lphc->self,
(HWND)NULL,
0, 0,
windowRect.right - windowRect.left,
@ -427,7 +423,7 @@ static void CBGetDroppedControlRect( LPHEADCOMBO lphc, LPRECT lpRect)
/* In windows, CB_GETDROPPEDCONTROLRECT returns the upper left corner
of the combo box and the lower right corner of the listbox */
GetWindowRect(lphc->self->hwndSelf, lpRect);
GetWindowRect(lphc->self, lpRect);
lpRect->right = lpRect->left + lphc->droppedRect.right - lphc->droppedRect.left;
lpRect->bottom = lpRect->top + lphc->droppedRect.bottom - lphc->droppedRect.top;
@ -481,15 +477,14 @@ static LRESULT COMBO_WindowPosChanging(
/***********************************************************************
* COMBO_Create
*/
static LRESULT COMBO_Create( LPHEADCOMBO lphc, WND* wnd, HWND hwndParent, LONG style )
static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG style )
{
static const WCHAR clbName[] = {'C','o','m','b','o','L','B','o','x',0};
static const WCHAR editName[] = {'E','d','i','t',0};
if( !CB_GETTYPE(lphc) ) lphc->dwStyle |= CBS_SIMPLE;
if( CB_GETTYPE(lphc) != CBS_DROPDOWNLIST ) lphc->wState |= CBF_EDIT;
lphc->self = wnd;
lphc->owner = hwndParent;
/*
@ -515,13 +510,8 @@ static LRESULT COMBO_Create( LPHEADCOMBO lphc, WND* wnd, HWND hwndParent, LONG s
* control and then, force all the areas of the combobox to be
* recalculated.
*/
GetClientRect( wnd->hwndSelf, &lphc->droppedRect );
CBCalcPlacement(wnd->hwndSelf,
lphc,
&lphc->textRect,
&lphc->buttonRect,
&lphc->droppedRect );
GetClientRect( hwnd, &lphc->droppedRect );
CBCalcPlacement(hwnd, lphc, &lphc->textRect, &lphc->buttonRect, &lphc->droppedRect );
/*
* Adjust the position of the popup listbox if it's necessary
@ -536,8 +526,8 @@ static LRESULT COMBO_Create( LPHEADCOMBO lphc, WND* wnd, HWND hwndParent, LONG s
if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
lphc->droppedRect.left += COMBO_EDITBUTTONSPACE();
ClientToScreen(wnd->hwndSelf, (LPPOINT)&lphc->droppedRect);
ClientToScreen(wnd->hwndSelf, (LPPOINT)&lphc->droppedRect.right);
ClientToScreen(hwnd, (LPPOINT)&lphc->droppedRect);
ClientToScreen(hwnd, (LPPOINT)&lphc->droppedRect.right);
}
/* create listbox popup */
@ -577,10 +567,8 @@ static LRESULT COMBO_Create( LPHEADCOMBO lphc, WND* wnd, HWND hwndParent, LONG s
lphc->droppedRect.top,
lphc->droppedRect.right - lphc->droppedRect.left,
lphc->droppedRect.bottom - lphc->droppedRect.top,
lphc->self->hwndSelf,
(HMENU)ID_CB_LISTBOX,
lphc->self->hInstance,
(LPVOID)lphc );
hwnd, (HMENU)ID_CB_LISTBOX,
GetWindowLongA( hwnd, GWL_HINSTANCE ), lphc );
if( lphc->hWndLBox )
{
@ -605,7 +593,7 @@ static LRESULT COMBO_Create( LPHEADCOMBO lphc, WND* wnd, HWND hwndParent, LONG s
else if( lphc->dwStyle & CBS_UPPERCASE )
lbeStyle |= ES_UPPERCASE;
if (wnd->dwStyle & WS_DISABLED) lbeStyle |= WS_DISABLED;
if (!IsWindowEnabled(hwnd)) lbeStyle |= WS_DISABLED;
lphc->hWndEdit = CreateWindowExW(0,
editName,
@ -614,10 +602,8 @@ static LRESULT COMBO_Create( LPHEADCOMBO lphc, WND* wnd, HWND hwndParent, LONG s
lphc->textRect.left, lphc->textRect.top,
lphc->textRect.right - lphc->textRect.left,
lphc->textRect.bottom - lphc->textRect.top,
lphc->self->hwndSelf,
(HMENU)ID_CB_EDIT,
lphc->self->hInstance,
NULL );
hwnd, (HMENU)ID_CB_EDIT,
GetWindowLongA( hwnd, GWL_HINSTANCE ), NULL );
if( !lphc->hWndEdit )
bEdit = FALSE;
@ -639,7 +625,7 @@ static LRESULT COMBO_Create( LPHEADCOMBO lphc, WND* wnd, HWND hwndParent, LONG s
}
TRACE("init done\n");
return wnd->hwndSelf;
return hwnd;
}
ERR("edit control failure.\n");
} else ERR("listbox failure.\n");
@ -789,7 +775,8 @@ static void CBPaintText(
{
DRAWITEMSTRUCT dis;
HRGN clipRegion;
UINT ctlid = GetWindowLongA( lphc->self, GWL_ID );
/* setup state for DRAWITEM message. Owner will highlight */
if ( (lphc->wState & CBF_FOCUSED) &&
!(lphc->wState & CBF_DROPPED) )
@ -807,13 +794,12 @@ static void CBPaintText(
DeleteObject(clipRegion);
clipRegion=(HRGN)NULL;
}
if ( lphc->self->dwStyle & WS_DISABLED )
itemState |= ODS_DISABLED;
if (!IsWindowEnabled(lphc->self) & WS_DISABLED) itemState |= ODS_DISABLED;
dis.CtlType = ODT_COMBOBOX;
dis.CtlID = lphc->self->wIDmenu;
dis.hwndItem = lphc->self->hwndSelf;
dis.CtlID = ctlid;
dis.hwndItem = lphc->self;
dis.itemAction = ODA_DRAWENTIRE;
dis.itemID = id;
dis.itemState = itemState;
@ -828,10 +814,9 @@ static void CBPaintText(
IntersectClipRect(hdc,
rectEdit.left, rectEdit.top,
rectEdit.right, rectEdit.bottom);
SendMessageW(lphc->owner, WM_DRAWITEM,
lphc->self->wIDmenu, (LPARAM)&dis );
SendMessageW(lphc->owner, WM_DRAWITEM, ctlid, (LPARAM)&dis );
/*
* Reset the clipping region.
*/
@ -912,9 +897,8 @@ static HBRUSH COMBO_PrepareColors(
*/
if (CB_DISABLED(lphc))
{
hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLORSTATIC,
hDC, lphc->self->hwndSelf );
hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLORSTATIC, hDC, lphc->self );
/*
* We have to change the text color since WM_CTLCOLORSTATIC will
* set it to the "enabled" color. This is the same behavior as the
@ -926,13 +910,11 @@ static HBRUSH COMBO_PrepareColors(
{
if (lphc->wState & CBF_EDIT)
{
hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLOREDIT,
hDC, lphc->self->hwndSelf );
hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLOREDIT, hDC, lphc->self );
}
else
{
hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLORLISTBOX,
hDC, lphc->self->hwndSelf );
hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLORLISTBOX, hDC, lphc->self );
}
}
@ -983,7 +965,7 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
HDC hDC;
hDC = (hParamDC) ? hParamDC
: BeginPaint( lphc->self->hwndSelf, &ps);
: BeginPaint( lphc->self, &ps);
TRACE("hdc=%04x\n", hDC);
@ -1004,7 +986,7 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
*/
if (TWEAK_WineLook != WIN31_LOOK)
{
CBPaintBorder(CB_HWND(lphc), lphc, hDC);
CBPaintBorder(lphc->self, lphc, hDC);
}
if( !IsRectEmpty(&lphc->buttonRect) )
@ -1046,7 +1028,7 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
}
if( !hParamDC )
EndPaint(lphc->self->hwndSelf, &ps);
EndPaint(lphc->self, &ps);
return 0;
}
@ -1062,8 +1044,8 @@ static INT CBUpdateLBox( LPHEADCOMBO lphc, BOOL bSelect )
LPWSTR pText = NULL;
idx = LB_ERR;
length = CB_GETEDITTEXTLENGTH( lphc );
length = SendMessageW( lphc->hWndEdit, WM_GETTEXTLENGTH, 0, 0 );
if( length > 0 )
pText = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR));
@ -1135,7 +1117,7 @@ static void CBDropDown( LPHEADCOMBO lphc )
int nItems = 0;
int nDroppedHeight;
TRACE("[%04x]: drop down\n", CB_HWND(lphc));
TRACE("[%04x]: drop down\n", lphc->self);
CB_NOTIFY( lphc, CBN_DROPDOWN );
@ -1160,7 +1142,7 @@ static void CBDropDown( LPHEADCOMBO lphc )
}
/* now set popup position */
GetWindowRect( lphc->self->hwndSelf, &rect );
GetWindowRect( lphc->self, &rect );
/*
* If it's a dropdown, the listbox is offset
@ -1202,11 +1184,11 @@ static void CBDropDown( LPHEADCOMBO lphc )
if( !(lphc->wState & CBF_NOREDRAW) )
RedrawWindow( lphc->self->hwndSelf, NULL, 0, RDW_INVALIDATE |
RedrawWindow( lphc->self, NULL, 0, RDW_INVALIDATE |
RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN );
EnableWindow( lphc->hWndLBox, TRUE );
if (GetCapture() != lphc->self->hwndSelf)
if (GetCapture() != lphc->self)
SetCapture(lphc->hWndLBox);
}
@ -1217,10 +1199,10 @@ static void CBDropDown( LPHEADCOMBO lphc )
*/
static void CBRollUp( LPHEADCOMBO lphc, BOOL ok, BOOL bButton )
{
HWND hWnd = lphc->self->hwndSelf;
HWND hWnd = lphc->self;
TRACE("[%04x]: sel ok? [%i] dropped? [%i]\n",
CB_HWND(lphc), (INT)ok, (INT)(lphc->wState & CBF_DROPPED));
lphc->self, (INT)ok, (INT)(lphc->wState & CBF_DROPPED));
CB_NOTIFY( lphc, (ok) ? CBN_SELENDOK : CBN_SELENDCANCEL );
@ -1287,8 +1269,8 @@ BOOL COMBO_FlipListbox( LPHEADCOMBO lphc, BOOL ok, BOOL bRedrawButton )
*/
static void CBRepaintButton( LPHEADCOMBO lphc )
{
InvalidateRect(CB_HWND(lphc), &lphc->buttonRect, TRUE);
UpdateWindow(CB_HWND(lphc));
InvalidateRect(lphc->self, &lphc->buttonRect, TRUE);
UpdateWindow(lphc->self);
}
/***********************************************************************
@ -1306,7 +1288,7 @@ static void COMBO_SetFocus( LPHEADCOMBO lphc )
/* lphc->wState |= CBF_FOCUSED; */
if( !(lphc->wState & CBF_EDIT) )
InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
InvalidateRect(lphc->self, &lphc->textRect, TRUE);
CB_NOTIFY( lphc, CBN_SETFOCUS );
lphc->wState |= CBF_FOCUSED;
@ -1318,7 +1300,7 @@ static void COMBO_SetFocus( LPHEADCOMBO lphc )
*/
static void COMBO_KillFocus( LPHEADCOMBO lphc )
{
HWND hWnd = lphc->self->hwndSelf;
HWND hWnd = lphc->self;
if( lphc->wState & CBF_FOCUSED )
{
@ -1332,7 +1314,7 @@ static void COMBO_KillFocus( LPHEADCOMBO lphc )
/* redraw text */
if( !(lphc->wState & CBF_EDIT) )
InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
InvalidateRect(lphc->self, &lphc->textRect, TRUE);
CB_NOTIFY( lphc, CBN_KILLFOCUS );
}
@ -1353,7 +1335,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
case (EN_SETFOCUS >> 8):
TRACE("[%04x]: edit [%04x] got focus\n",
CB_HWND(lphc), lphc->hWndEdit );
lphc->self, lphc->hWndEdit );
COMBO_SetFocus( lphc );
break;
@ -1361,7 +1343,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
case (EN_KILLFOCUS >> 8):
TRACE("[%04x]: edit [%04x] lost focus\n",
CB_HWND(lphc), lphc->hWndEdit );
lphc->self, lphc->hWndEdit );
/* NOTE: it seems that Windows' edit control sends an
* undocumented message WM_USER + 0x1B instead of this
@ -1419,7 +1401,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
case LBN_SELCANCEL:
TRACE("[%04x]: lbox selection change [%04x]\n",
CB_HWND(lphc), lphc->wState );
lphc->self, lphc->wState );
if( HIWORD(wParam) == LBN_SELCHANGE)
{
@ -1432,7 +1414,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
}
else
InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
InvalidateRect(lphc->self, &lphc->textRect, TRUE);
}
/* do not roll up if selection is being tracked
@ -1464,35 +1446,46 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
*/
static LRESULT COMBO_ItemOp( LPHEADCOMBO lphc, UINT msg, LPARAM lParam )
{
HWND hWnd = lphc->self->hwndSelf;
HWND hWnd = lphc->self;
UINT id = GetWindowLongA( hWnd, GWL_ID );
TRACE("[%04x]: ownerdraw op %04x\n", CB_HWND(lphc), msg );
TRACE("[%04x]: ownerdraw op %04x\n", lphc->self, msg );
#define lpIS ((LPDELETEITEMSTRUCT)lParam)
/* two first items are the same in all 4 structs */
lpIS->CtlType = ODT_COMBOBOX;
lpIS->CtlID = lphc->self->wIDmenu;
switch( msg ) /* patch window handle */
switch( msg )
{
case WM_DELETEITEM:
lpIS->hwndItem = hWnd;
#undef lpIS
break;
case WM_DRAWITEM:
#define lpIS ((LPDRAWITEMSTRUCT)lParam)
lpIS->hwndItem = hWnd;
#undef lpIS
break;
case WM_COMPAREITEM:
#define lpIS ((LPCOMPAREITEMSTRUCT)lParam)
lpIS->hwndItem = hWnd;
#undef lpIS
break;
case WM_DELETEITEM:
{
DELETEITEMSTRUCT *lpIS = (DELETEITEMSTRUCT *)lParam;
lpIS->CtlType = ODT_COMBOBOX;
lpIS->CtlID = id;
lpIS->hwndItem = hWnd;
break;
}
case WM_DRAWITEM:
{
DRAWITEMSTRUCT *lpIS = (DRAWITEMSTRUCT *)lParam;
lpIS->CtlType = ODT_COMBOBOX;
lpIS->CtlID = id;
lpIS->hwndItem = hWnd;
break;
}
case WM_COMPAREITEM:
{
COMPAREITEMSTRUCT *lpIS = (COMPAREITEMSTRUCT *)lParam;
lpIS->CtlType = ODT_COMBOBOX;
lpIS->CtlID = id;
lpIS->hwndItem = hWnd;
break;
}
case WM_MEASUREITEM:
{
MEASUREITEMSTRUCT *lpIS = (MEASUREITEMSTRUCT *)lParam;
lpIS->CtlType = ODT_COMBOBOX;
lpIS->CtlID = id;
break;
}
}
return SendMessageW(lphc->owner, msg, lphc->self->wIDmenu, lParam);
return SendMessageW(lphc->owner, msg, id, lParam);
}
/***********************************************************************
@ -1622,7 +1615,7 @@ static void CBResetPos(
}
if( bRedraw && !(lphc->wState & CBF_NOREDRAW) )
RedrawWindow( lphc->self->hwndSelf, NULL, 0,
RedrawWindow( lphc->self, NULL, 0,
RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW );
}
}
@ -1633,7 +1626,7 @@ static void CBResetPos(
*/
static void COMBO_Size( LPHEADCOMBO lphc )
{
CBCalcPlacement(lphc->self->hwndSelf,
CBCalcPlacement(lphc->self,
lphc,
&lphc->textRect,
&lphc->buttonRect,
@ -1665,7 +1658,7 @@ static void COMBO_Font( LPHEADCOMBO lphc, HFONT hFont, BOOL bRedraw )
*/
if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
{
CBCalcPlacement(lphc->self->hwndSelf,
CBCalcPlacement(lphc->self,
lphc,
&lphc->textRect,
&lphc->buttonRect,
@ -1698,7 +1691,7 @@ static LRESULT COMBO_SetItemHeight( LPHEADCOMBO lphc, INT index, INT height )
*/
if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
{
CBCalcPlacement(lphc->self->hwndSelf,
CBCalcPlacement(lphc->self,
lphc,
&lphc->textRect,
&lphc->buttonRect,
@ -1733,7 +1726,7 @@ static LRESULT COMBO_SelectString( LPHEADCOMBO lphc, INT start, LPARAM pText, BO
CBUpdateEdit( lphc, index );
else
{
InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
InvalidateRect(lphc->self, &lphc->textRect, TRUE);
}
}
return (LRESULT)index;
@ -1746,7 +1739,7 @@ static void COMBO_LButtonDown( LPHEADCOMBO lphc, LPARAM lParam )
{
POINT pt;
BOOL bButton;
HWND hWnd = lphc->self->hwndSelf;
HWND hWnd = lphc->self;
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
@ -1842,7 +1835,7 @@ static void COMBO_MouseMove( LPHEADCOMBO lphc, WPARAM wParam, LPARAM lParam )
}
GetClientRect( lphc->hWndLBox, &lbRect );
MapWindowPoints( lphc->self->hwndSelf, lphc->hWndLBox, &pt, 1 );
MapWindowPoints( lphc->self, lphc->hWndLBox, &pt, 1 );
if( PtInRect(&lbRect, pt) )
{
lphc->wState &= ~CBF_CAPTURE;
@ -1856,18 +1849,17 @@ static void COMBO_MouseMove( LPHEADCOMBO lphc, WPARAM wParam, LPARAM lParam )
/***********************************************************************
* ComboWndProc_locked
* ComboWndProc_common
*
* http://www.microsoft.com/msdn/sdk/platforms/doc/sdk/win32/ctrl/src/combobox_15.htm
*/
static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam, BOOL unicode )
{
LPHEADCOMBO lphc = CB_GETPTR(pWnd);
HWND hwnd = pWnd->hwndSelf;
LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongA( hwnd, 0 );
TRACE("[%04x]: msg %s wp %08x lp %08lx\n",
pWnd->hwndSelf, SPY_GetMsgName(message), wParam, lParam );
hwnd, SPY_GetMsgName(message), wParam, lParam );
if( lphc || message == WM_NCCREATE )
switch(message)
@ -1879,7 +1871,7 @@ static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
{
LONG style = unicode ? ((LPCREATESTRUCTW)lParam)->style :
((LPCREATESTRUCTA)lParam)->style;
return COMBO_NCCreate(pWnd, style);
return COMBO_NCCreate(hwnd, style);
}
case WM_NCDESTROY:
COMBO_NCDestroy(lphc);
@ -1899,7 +1891,7 @@ static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
hwndParent = ((LPCREATESTRUCTA)lParam)->hwndParent;
style = ((LPCREATESTRUCTA)lParam)->style;
}
return COMBO_Create(lphc, pWnd, hwndParent, style);
return COMBO_Create(hwnd, lphc, hwndParent, style);
}
case WM_PRINTCLIENT:
@ -1999,7 +1991,7 @@ static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
EnableWindow( lphc->hWndLBox, (BOOL)wParam );
/* Force the control to repaint when the enabled state changes. */
InvalidateRect(CB_HWND(lphc), NULL, TRUE);
InvalidateRect(lphc->self, NULL, TRUE);
return TRUE;
case WM_SETREDRAW:
if( wParam )
@ -2038,7 +2030,7 @@ static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
SendMessageA(hwndTarget, message, wParam, lParam);
}
case WM_LBUTTONDOWN:
if( !(lphc->wState & CBF_FOCUSED) ) SetFocus( lphc->self->hwndSelf );
if( !(lphc->wState & CBF_FOCUSED) ) SetFocus( lphc->self );
if( lphc->wState & CBF_FOCUSED ) COMBO_LButtonDown( lphc, lParam );
return TRUE;
case WM_LBUTTONUP:
@ -2117,7 +2109,7 @@ static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)empty_stringW);
}
else
InvalidateRect(CB_HWND(lphc), NULL, TRUE);
InvalidateRect(lphc->self, NULL, TRUE);
return TRUE;
case CB_INITSTORAGE:
return SendMessageW(lphc->hWndLBox, LB_INITSTORAGE, wParam, lParam);
@ -2195,7 +2187,7 @@ static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
if( lphc->wState & CBF_EDIT )
CBUpdateEdit( lphc, (INT)wParam );
else
InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
InvalidateRect(lphc->self, &lphc->textRect, TRUE);
lphc->wState &= ~CBF_SELCHANGE;
return lParam;
case CB_GETLBTEXT16:
@ -2264,15 +2256,8 @@ static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
*/
static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
{
LRESULT retvalue = 0;
WND* pWnd = WIN_FindWndPtr(hwnd);
if (pWnd)
{
retvalue = ComboWndProc_locked(pWnd, message, wParam, lParam, FALSE);
WIN_ReleaseWndPtr(pWnd);
}
return retvalue;
if (!IsWindow(hwnd)) return 0;
return ComboWndProc_common( hwnd, message, wParam, lParam, FALSE );
}
/***********************************************************************
@ -2280,13 +2265,6 @@ static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPA
*/
static LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
{
LRESULT retvalue = 0;
WND* pWnd = WIN_FindWndPtr(hwnd);
if (pWnd)
{
retvalue = ComboWndProc_locked(pWnd, message, wParam, lParam, TRUE);
WIN_ReleaseWndPtr(pWnd);
}
return retvalue;
if (!IsWindow(hwnd)) return 0;
return ComboWndProc_common( hwnd, message, wParam, lParam, TRUE );
}

View File

@ -11,17 +11,13 @@
#include "windef.h"
#include "wingdi.h"
#include "user.h"
#include "win.h"
#include "controls.h"
#include "wine/winuser16.h"
typedef struct
{
HBRUSH hbrushPattern;
HBITMAP hbitmapWallPaper;
SIZE bitmapSize;
BOOL fTileWallPaper;
} DESKTOP;
static HBRUSH hbrushPattern;
static HBITMAP hbitmapWallPaper;
static SIZE bitmapSize;
static BOOL fTileWallPaper;
static LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
@ -35,7 +31,7 @@ const struct builtin_class_descr DESKTOP_builtin_class =
CS_GLOBALCLASS, /* style */
NULL, /* procA (winproc is Unicode only) */
DesktopWndProc, /* procW */
sizeof(DESKTOP), /* extra */
0, /* extra */
IDC_ARROWA, /* cursor */
COLOR_BACKGROUND+1 /* brush */
};
@ -103,20 +99,16 @@ static HBITMAP DESKTOP_LoadBitmap( HDC hdc, const char *filename )
static LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
{
LRESULT retvalue = 0;
WND *wndPtr = WIN_FindWndPtr( hwnd );
DESKTOP *desktopPtr = (DESKTOP *)wndPtr->wExtra;
if (message == WM_NCCREATE)
{
desktopPtr->hbrushPattern = 0;
desktopPtr->hbitmapWallPaper = 0;
hbrushPattern = 0;
hbitmapWallPaper = 0;
SetDeskPattern();
SetDeskWallPaper( (LPSTR)-1 );
retvalue = 1;
}
/* all other messages are ignored */
WIN_ReleaseWndPtr(wndPtr);
return retvalue;
}
@ -127,11 +119,9 @@ static LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LP
BOOL WINAPI PaintDesktop(HDC hdc)
{
HWND hwnd = GetDesktopWindow();
WND *wndPtr = WIN_FindWndPtr( hwnd );
DESKTOP *desktopPtr = (DESKTOP *)wndPtr->wExtra;
/* check for a queue; otherwise don't paint anything (non-desktop mode) */
if (wndPtr->hmemTaskQ)
/* check for an owning thread; otherwise don't paint anything (non-desktop mode) */
if (GetWindowThreadProcessId( hwnd, NULL ))
{
RECT rect;
@ -139,11 +129,10 @@ BOOL WINAPI PaintDesktop(HDC hdc)
/* Paint desktop pattern (only if wall paper does not cover everything) */
if (!desktopPtr->hbitmapWallPaper ||
(!desktopPtr->fTileWallPaper && ((desktopPtr->bitmapSize.cx < rect.right) ||
(desktopPtr->bitmapSize.cy < rect.bottom))))
if (!hbitmapWallPaper ||
(!fTileWallPaper && ((bitmapSize.cx < rect.right) || (bitmapSize.cy < rect.bottom))))
{
HBRUSH brush = desktopPtr->hbrushPattern;
HBRUSH brush = hbrushPattern;
if (!brush) brush = GetClassLongA( hwnd, GCL_HBRBACKGROUND );
/* Set colors in case pattern is a monochrome bitmap */
SetBkColor( hdc, RGB(0,0,0) );
@ -153,33 +142,30 @@ BOOL WINAPI PaintDesktop(HDC hdc)
/* Paint wall paper */
if (desktopPtr->hbitmapWallPaper)
if (hbitmapWallPaper)
{
INT x, y;
HDC hMemDC = CreateCompatibleDC( hdc );
SelectObject( hMemDC, desktopPtr->hbitmapWallPaper );
SelectObject( hMemDC, hbitmapWallPaper );
if (desktopPtr->fTileWallPaper)
if (fTileWallPaper)
{
for (y = 0; y < rect.bottom; y += desktopPtr->bitmapSize.cy)
for (x = 0; x < rect.right; x += desktopPtr->bitmapSize.cx)
BitBlt( hdc, x, y, desktopPtr->bitmapSize.cx,
desktopPtr->bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
for (y = 0; y < rect.bottom; y += bitmapSize.cy)
for (x = 0; x < rect.right; x += bitmapSize.cx)
BitBlt( hdc, x, y, bitmapSize.cx, bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
}
else
{
x = (rect.left + rect.right - desktopPtr->bitmapSize.cx) / 2;
y = (rect.top + rect.bottom - desktopPtr->bitmapSize.cy) / 2;
x = (rect.left + rect.right - bitmapSize.cx) / 2;
y = (rect.top + rect.bottom - bitmapSize.cy) / 2;
if (x < 0) x = 0;
if (y < 0) y = 0;
BitBlt( hdc, x, y, desktopPtr->bitmapSize.cx,
desktopPtr->bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
BitBlt( hdc, x, y, bitmapSize.cx, bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
}
DeleteDC( hMemDC );
}
}
WIN_ReleaseWndPtr(wndPtr);
return TRUE;
}
@ -213,8 +199,6 @@ BOOL WINAPI SetDeskWallPaper( LPCSTR filename )
HBITMAP hbitmap;
HDC hdc;
char buffer[256];
WND *wndPtr = WIN_GetDesktop();
DESKTOP *desktopPtr = (DESKTOP *)wndPtr->wExtra;
if (filename == (LPSTR)-1)
{
@ -224,17 +208,16 @@ BOOL WINAPI SetDeskWallPaper( LPCSTR filename )
hdc = GetDC( 0 );
hbitmap = DESKTOP_LoadBitmap( hdc, filename );
ReleaseDC( 0, hdc );
if (desktopPtr->hbitmapWallPaper) DeleteObject( desktopPtr->hbitmapWallPaper );
desktopPtr->hbitmapWallPaper = hbitmap;
desktopPtr->fTileWallPaper = GetProfileIntA( "desktop", "TileWallPaper", 0 );
if (hbitmapWallPaper) DeleteObject( hbitmapWallPaper );
hbitmapWallPaper = hbitmap;
fTileWallPaper = GetProfileIntA( "desktop", "TileWallPaper", 0 );
if (hbitmap)
{
BITMAP bmp;
GetObjectA( hbitmap, sizeof(bmp), &bmp );
desktopPtr->bitmapSize.cx = (bmp.bmWidth != 0) ? bmp.bmWidth : 1;
desktopPtr->bitmapSize.cy = (bmp.bmHeight != 0) ? bmp.bmHeight : 1;
bitmapSize.cx = (bmp.bmWidth != 0) ? bmp.bmWidth : 1;
bitmapSize.cy = (bmp.bmHeight != 0) ? bmp.bmHeight : 1;
}
WIN_ReleaseDesktop();
return TRUE;
}
@ -246,11 +229,9 @@ BOOL WINAPI SetDeskWallPaper( LPCSTR filename )
*/
BOOL DESKTOP_SetPattern( LPCSTR pattern )
{
WND *wndPtr = WIN_GetDesktop();
DESKTOP *desktopPtr = (DESKTOP *)wndPtr->wExtra;
int pat[8];
if (desktopPtr->hbrushPattern) DeleteObject( desktopPtr->hbrushPattern );
if (hbrushPattern) DeleteObject( hbrushPattern );
memset( pat, 0, sizeof(pat) );
if (pattern && sscanf( pattern, " %d %d %d %d %d %d %d %d",
&pat[0], &pat[1], &pat[2], &pat[3],
@ -262,11 +243,10 @@ BOOL DESKTOP_SetPattern( LPCSTR pattern )
for (i = 0; i < 8; i++) pattern[i] = pat[i] & 0xffff;
hbitmap = CreateBitmap( 8, 8, 1, 1, (LPSTR)pattern );
desktopPtr->hbrushPattern = CreatePatternBrush( hbitmap );
hbrushPattern = CreatePatternBrush( hbitmap );
DeleteObject( hbitmap );
}
else desktopPtr->hbrushPattern = 0;
WIN_ReleaseDesktop();
else hbrushPattern = 0;
return TRUE;
}

File diff suppressed because it is too large Load Diff

View File

@ -41,94 +41,89 @@ const struct builtin_class_descr ICONTITLE_builtin_class =
/***********************************************************************
* ICONTITLE_Create
*/
HWND ICONTITLE_Create( WND* wnd )
HWND ICONTITLE_Create( HWND owner )
{
WND* wndPtr;
HWND hWnd;
HINSTANCE instance = GetWindowLongA( owner, GWL_HINSTANCE );
if( wnd->dwStyle & WS_CHILD )
if( GetWindowLongA( owner, GWL_STYLE ) & WS_CHILD )
hWnd = CreateWindowExA( 0, ICONTITLE_CLASS_ATOM, NULL,
WS_CHILD | WS_CLIPSIBLINGS, 0, 0, 1, 1,
wnd->parent->hwndSelf, 0, wnd->hInstance, NULL );
GetParent(owner), 0, instance, NULL );
else
hWnd = CreateWindowExA( 0, ICONTITLE_CLASS_ATOM, NULL,
WS_CLIPSIBLINGS, 0, 0, 1, 1,
wnd->hwndSelf, 0, wnd->hInstance, NULL );
owner, 0, instance, NULL );
wndPtr = WIN_FindWndPtr( hWnd );
if( wndPtr )
{
WND *wnd = WIN_FindWndPtr(owner);
wndPtr->owner = wnd; /* MDI depends on this */
wndPtr->dwStyle &= ~(WS_CAPTION | WS_BORDER);
if( wnd->dwStyle & WS_DISABLED ) wndPtr->dwStyle |= WS_DISABLED;
if (!IsWindowEnabled(owner)) wndPtr->dwStyle |= WS_DISABLED;
WIN_ReleaseWndPtr(wndPtr);
WIN_ReleaseWndPtr(wnd);
return hWnd;
}
return 0;
}
/***********************************************************************
* ICONTITLE_GetTitlePos
* ICONTITLE_SetTitlePos
*/
static BOOL ICONTITLE_GetTitlePos( WND* wnd, LPRECT lpRect )
static BOOL ICONTITLE_SetTitlePos( HWND hwnd, HWND owner )
{
static WCHAR emptyTitleText[] = {'<','.','.','.','>',0};
LPWSTR str = NULL;
int length = lstrlenW( wnd->owner->text );
WCHAR str[80];
HDC hDC;
HFONT hPrevFont;
RECT rect;
INT cx, cy;
POINT pt;
if( length )
int length = GetWindowTextW( owner, str, sizeof(str)/sizeof(WCHAR) );
while (length && str[length - 1] == ' ') /* remove trailing spaces */
str[--length] = 0;
if( !length )
{
str = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR) );
strcpyW( str, wnd->owner->text );
while( str[length - 1] == ' ' ) /* remove trailing spaces */
{
str[--length] = '\0';
if( !length )
{
HeapFree( GetProcessHeap(), 0, str );
break;
}
}
}
if( !length )
{
str = emptyTitleText;
length = lstrlenW( str );
strcpyW( str, emptyTitleText );
length = strlenW( str );
}
if( str )
{
HDC hDC = GetDC( wnd->hwndSelf );
if( hDC )
{
HFONT hPrevFont = SelectObject( hDC, hIconTitleFont );
if (!(hDC = GetDC( hwnd ))) return FALSE;
SetRect( lpRect, 0, 0, GetSystemMetrics(SM_CXICONSPACING) -
GetSystemMetrics(SM_CXBORDER) * 2,
GetSystemMetrics(SM_CYBORDER) * 2 );
hPrevFont = SelectObject( hDC, hIconTitleFont );
DrawTextW( hDC, str, length, lpRect, DT_CALCRECT |
DT_CENTER | DT_NOPREFIX | DT_WORDBREAK |
(( bMultiLineTitle ) ? 0 : DT_SINGLELINE) );
SetRect( &rect, 0, 0, GetSystemMetrics(SM_CXICONSPACING) -
GetSystemMetrics(SM_CXBORDER) * 2,
GetSystemMetrics(SM_CYBORDER) * 2 );
SelectObject( hDC, hPrevFont );
ReleaseDC( wnd->hwndSelf, hDC );
DrawTextW( hDC, str, length, &rect, DT_CALCRECT | DT_CENTER | DT_NOPREFIX | DT_WORDBREAK |
(( bMultiLineTitle ) ? 0 : DT_SINGLELINE) );
lpRect->right += 4 * GetSystemMetrics(SM_CXBORDER) - lpRect->left;
lpRect->left = wnd->owner->rectWindow.left + GetSystemMetrics(SM_CXICON) / 2 -
(lpRect->right - lpRect->left) / 2;
lpRect->bottom -= lpRect->top;
lpRect->top = wnd->owner->rectWindow.top + GetSystemMetrics(SM_CYICON);
}
if( str != emptyTitleText ) HeapFree( GetProcessHeap(), 0, str );
return ( hDC ) ? TRUE : FALSE;
}
return FALSE;
SelectObject( hDC, hPrevFont );
ReleaseDC( hwnd, hDC );
cx = rect.right - rect.left + 4 * GetSystemMetrics(SM_CXBORDER);
cy = rect.bottom - rect.top;
pt.x = (GetSystemMetrics(SM_CXICON) - cx) / 2;
pt.y = GetSystemMetrics(SM_CYICON);
/* point is relative to owner, make it relative to parent */
MapWindowPoints( owner, GetParent(hwnd), &pt, 1 );
SetWindowPos( hwnd, owner, pt.x, pt.y, cx, cy, SWP_NOACTIVATE );
return TRUE;
}
/***********************************************************************
* ICONTITLE_Paint
*/
static BOOL ICONTITLE_Paint( WND* wnd, HDC hDC, BOOL bActive )
static BOOL ICONTITLE_Paint( HWND hwnd, HWND owner, HDC hDC, BOOL bActive )
{
HFONT hPrevFont;
HBRUSH hBrush = 0;
@ -141,9 +136,9 @@ static BOOL ICONTITLE_Paint( WND* wnd, HDC hDC, BOOL bActive )
}
else
{
if( wnd->dwStyle & WS_CHILD )
if( GetWindowLongA( hwnd, GWL_STYLE ) & WS_CHILD )
{
hBrush = (HBRUSH) GetClassLongA(wnd->hwndSelf, GCL_HBRBACKGROUND);
hBrush = (HBRUSH) GetClassLongA(hwnd, GCL_HBRBACKGROUND);
if( hBrush )
{
INT level;
@ -165,25 +160,23 @@ static BOOL ICONTITLE_Paint( WND* wnd, HDC hDC, BOOL bActive )
}
}
FillWindow16( wnd->parent->hwndSelf, wnd->hwndSelf, hDC, hBrush );
FillWindow16( GetParent(hwnd), hwnd, hDC, hBrush );
hPrevFont = SelectObject( hDC, hIconTitleFont );
if( hPrevFont )
{
RECT rect;
INT length;
char buffer[80];
WCHAR buffer[80];
rect.left = rect.top = 0;
rect.right = wnd->rectWindow.right - wnd->rectWindow.left;
rect.bottom = wnd->rectWindow.bottom - wnd->rectWindow.top;
GetClientRect( hwnd, &rect );
length = GetWindowTextA( wnd->owner->hwndSelf, buffer, 80 );
length = GetWindowTextW( owner, buffer, 80 );
SetTextColor( hDC, textColor );
SetBkMode( hDC, TRANSPARENT );
DrawTextA( hDC, buffer, length, &rect, DT_CENTER | DT_NOPREFIX |
DT_WORDBREAK | ((bMultiLineTitle) ? 0 : DT_SINGLELINE) );
DrawTextW( hDC, buffer, length, &rect, DT_CENTER | DT_NOPREFIX |
DT_WORDBREAK | ((bMultiLineTitle) ? 0 : DT_SINGLELINE) );
SelectObject( hDC, hPrevFont );
}
@ -197,6 +190,7 @@ LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg,
WPARAM wParam, LPARAM lParam )
{
LRESULT retvalue;
HWND owner = GetWindow( hWnd, GW_OWNER );
WND *wnd = WIN_FindWndPtr( hWnd );
if( !wnd )
@ -219,44 +213,27 @@ LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg,
goto END;
case WM_NCMOUSEMOVE:
case WM_NCLBUTTONDBLCLK:
retvalue = SendMessageA( wnd->owner->hwndSelf, msg, wParam, lParam );
retvalue = SendMessageW( owner, msg, wParam, lParam );
goto END;
case WM_ACTIVATE:
if( wParam ) SetActiveWindow( wnd->owner->hwndSelf );
if( wParam ) SetActiveWindow( owner );
/* fall through */
case WM_CLOSE:
retvalue = 0;
goto END;
case WM_SHOWWINDOW:
if( wnd && wParam )
{
RECT titleRect;
ICONTITLE_GetTitlePos( wnd, &titleRect );
if( wnd->owner->next != wnd ) /* keep icon title behind the owner */
SetWindowPos( hWnd, wnd->owner->hwndSelf,
titleRect.left, titleRect.top,
titleRect.right, titleRect.bottom, SWP_NOACTIVATE );
else
SetWindowPos( hWnd, 0, titleRect.left, titleRect.top,
titleRect.right, titleRect.bottom,
SWP_NOACTIVATE | SWP_NOZORDER );
}
if( wnd && wParam ) ICONTITLE_SetTitlePos( hWnd, owner );
retvalue = 0;
goto END;
case WM_ERASEBKGND:
if( wnd )
{
WND* iconWnd = WIN_LockWndPtr(wnd->owner);
if( iconWnd->dwStyle & WS_CHILD )
lParam = SendMessageA( iconWnd->hwndSelf, WM_ISACTIVEICON, 0, 0 );
if( GetWindowLongA( owner, GWL_STYLE ) & WS_CHILD )
lParam = SendMessageA( owner, WM_ISACTIVEICON, 0, 0 );
else
lParam = (iconWnd->hwndSelf == GetActiveWindow16());
WIN_ReleaseWndPtr(iconWnd);
if( ICONTITLE_Paint( wnd, (HDC)wParam, (BOOL)lParam ) )
lParam = (owner == GetActiveWindow());
if( ICONTITLE_Paint( hWnd, owner, (HDC)wParam, (BOOL)lParam ) )
ValidateRect( hWnd, NULL );
retvalue = 1;
goto END;

File diff suppressed because it is too large Load Diff

View File

@ -285,7 +285,7 @@ static void do_debug_print_menuitem(const char *prefix, MENUITEM * mp,
*
* Validate the given menu handle and returns the menu structure pointer.
*/
POPUPMENU *MENU_GetMenu(HMENU hMenu)
static POPUPMENU *MENU_GetMenu(HMENU hMenu)
{
POPUPMENU *menu = USER_HEAP_LIN_ADDR(hMenu);
if (!menu || menu->wMagic != MENU_MAGIC)
@ -296,6 +296,23 @@ POPUPMENU *MENU_GetMenu(HMENU hMenu)
return menu;
}
/***********************************************************************
* get_win_sys_menu
*
* Get the system menu of a window
*/
static HMENU get_win_sys_menu( HWND hwnd )
{
HMENU ret = 0;
WND *win = WIN_FindWndPtr( hwnd );
if (win)
{
ret = win->hSysMenu;
WIN_ReleaseWndPtr( win );
}
return ret;
}
/***********************************************************************
* MENU_CopySysPopup
*
@ -643,12 +660,7 @@ static UINT MENU_FindItemByKey( HWND hwndOwner, HMENU hmenu,
{
TRACE("\tlooking for '%c' in [%04x]\n", (char)key, (UINT16)hmenu );
if (!IsMenu( hmenu ))
{
WND* w = WIN_FindWndPtr(hwndOwner);
hmenu = GetSubMenu(w->hSysMenu, 0);
WIN_ReleaseWndPtr(w);
}
if (!IsMenu( hmenu )) hmenu = GetSubMenu( get_win_sys_menu(hwndOwner), 0);
if (hmenu)
{
@ -1457,10 +1469,9 @@ UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect, HWND hwnd,
LPPOPUPMENU lppop;
UINT i,retvalue;
HFONT hfontOld = 0;
HMENU hMenu = GetMenu(hwnd);
WND *wndPtr = WIN_FindWndPtr( hwnd );
lppop = MENU_GetMenu ((HMENU)wndPtr->wIDmenu );
lppop = MENU_GetMenu( hMenu );
if (lppop == NULL || lprect == NULL)
{
retvalue = GetSystemMetrics(SM_CYMENU);
@ -1505,16 +1516,13 @@ UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect, HWND hwnd,
for (i = 0; i < lppop->nItems; i++)
{
MENU_DrawMenuItem( hwnd, (HMENU)wndPtr->wIDmenu, hwnd,
hDC, &lppop->items[i], lppop->Height, TRUE, ODA_DRAWENTIRE );
MENU_DrawMenuItem( hwnd, hMenu, hwnd,
hDC, &lppop->items[i], lppop->Height, TRUE, ODA_DRAWENTIRE );
}
retvalue = lppop->Height;
END:
if (hfontOld)
SelectObject (hDC, hfontOld);
WIN_ReleaseWndPtr(wndPtr);
if (hfontOld) SelectObject (hDC, hfontOld);
return retvalue;
}
@ -1527,8 +1535,8 @@ END:
static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id,
INT x, INT y, INT xanchor, INT yanchor )
{
POPUPMENU *menu;
WND *wndOwner = NULL;
POPUPMENU *menu;
UINT width, height;
TRACE("owner=0x%04x hmenu=0x%04x id=0x%04x x=0x%04x y=0x%04x xa=0x%04x ya=0x%04x\n",
hwndOwner, hmenu, id, x, y, xanchor, yanchor);
@ -1543,62 +1551,52 @@ static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id,
/* store the owner for DrawItem */
menu->hwndOwner = hwndOwner;
if( (wndOwner = WIN_FindWndPtr( hwndOwner )) )
MENU_PopupMenuCalcSize( menu, hwndOwner );
/* adjust popup menu pos so that it fits within the desktop */
width = menu->Width + GetSystemMetrics(SM_CXBORDER);
height = menu->Height + GetSystemMetrics(SM_CYBORDER);
if( x + width > GetSystemMetrics(SM_CXSCREEN ))
{
UINT width, height;
MENU_PopupMenuCalcSize( menu, hwndOwner );
/* adjust popup menu pos so that it fits within the desktop */
width = menu->Width + GetSystemMetrics(SM_CXBORDER);
height = menu->Height + GetSystemMetrics(SM_CYBORDER);
if( x + width > GetSystemMetrics(SM_CXSCREEN ))
{
if( xanchor )
x -= width - xanchor;
if( x + width > GetSystemMetrics(SM_CXSCREEN))
x = GetSystemMetrics(SM_CXSCREEN) - width;
}
if( x < 0 ) x = 0;
if( y + height > GetSystemMetrics(SM_CYSCREEN ))
{
if( yanchor )
y -= height + yanchor;
if( y + height > GetSystemMetrics(SM_CYSCREEN ))
y = GetSystemMetrics(SM_CYSCREEN) - height;
}
if( y < 0 ) y = 0;
if( TWEAK_WineLook == WIN31_LOOK )
{
width += POPUP_XSHADE * GetSystemMetrics(SM_CXBORDER); /* add space for shading */
height += POPUP_YSHADE * GetSystemMetrics(SM_CYBORDER);
}
/* NOTE: In Windows, top menu popup is not owned. */
menu->hWnd = CreateWindowA( POPUPMENU_CLASS_ATOM, NULL,
WS_POPUP, x, y, width, height,
hwndOwner, 0, wndOwner->hInstance,
(LPVOID)hmenu );
if( !menu->hWnd )
{
WIN_ReleaseWndPtr(wndOwner);
return FALSE;
}
if (!top_popup) top_popup = menu->hWnd;
/* Display the window */
SetWindowPos( menu->hWnd, HWND_TOP, 0, 0, 0, 0,
SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
UpdateWindow( menu->hWnd );
WIN_ReleaseWndPtr(wndOwner);
return TRUE;
if( xanchor )
x -= width - xanchor;
if( x + width > GetSystemMetrics(SM_CXSCREEN))
x = GetSystemMetrics(SM_CXSCREEN) - width;
}
return FALSE;
if( x < 0 ) x = 0;
if( y + height > GetSystemMetrics(SM_CYSCREEN ))
{
if( yanchor )
y -= height + yanchor;
if( y + height > GetSystemMetrics(SM_CYSCREEN ))
y = GetSystemMetrics(SM_CYSCREEN) - height;
}
if( y < 0 ) y = 0;
if( TWEAK_WineLook == WIN31_LOOK )
{
width += POPUP_XSHADE * GetSystemMetrics(SM_CXBORDER); /* add space for shading */
height += POPUP_YSHADE * GetSystemMetrics(SM_CYBORDER);
}
/* NOTE: In Windows, top menu popup is not owned. */
menu->hWnd = CreateWindowA( POPUPMENU_CLASS_ATOM, NULL,
WS_POPUP, x, y, width, height,
hwndOwner, 0, GetWindowLongA(hwndOwner,GWL_HINSTANCE),
(LPVOID)hmenu );
if( !menu->hWnd ) return FALSE;
if (!top_popup) top_popup = menu->hWnd;
/* Display the window */
SetWindowPos( menu->hWnd, HWND_TOP, 0, 0, 0, 0,
SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
UpdateWindow( menu->hWnd );
return TRUE;
}
@ -2005,27 +2003,17 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu,
RECT rect;
POPUPMENU *menu;
MENUITEM *item;
WND *wndPtr;
HDC hdc;
TRACE("owner=0x%04x hmenu=0x%04x 0x%04x\n", hwndOwner, hmenu, selectFirst);
if (!(menu = MENU_GetMenu( hmenu ))) return hmenu;
if (!(wndPtr = WIN_FindWndPtr( menu->hWnd )) ||
(menu->FocusedItem == NO_SELECTED_ITEM))
{
WIN_ReleaseWndPtr(wndPtr);
return hmenu;
}
if (menu->FocusedItem == NO_SELECTED_ITEM) return hmenu;
item = &menu->items[menu->FocusedItem];
if (!(item->fType & MF_POPUP) ||
(item->fState & (MF_GRAYED | MF_DISABLED)))
{
WIN_ReleaseWndPtr(wndPtr);
if (!(item->fType & MF_POPUP) || (item->fState & (MF_GRAYED | MF_DISABLED)))
return hmenu;
}
/* message must be sent before using item,
because nearly everything may be changed by the application ! */
@ -2057,26 +2045,29 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu,
if (IS_SYSTEM_MENU(menu))
{
MENU_InitSysMenuPopup(item->hSubMenu, wndPtr->dwStyle, GetClassLongA(wndPtr->hwndSelf, GCL_STYLE));
MENU_InitSysMenuPopup(item->hSubMenu,
GetWindowLongA( menu->hWnd, GWL_STYLE ),
GetClassLongA( menu->hWnd, GCL_STYLE));
NC_GetSysPopupPos( wndPtr, &rect );
NC_GetSysPopupPos( menu->hWnd, &rect );
rect.top = rect.bottom;
rect.right = GetSystemMetrics(SM_CXSIZE);
rect.bottom = GetSystemMetrics(SM_CYSIZE);
}
else
{
GetWindowRect( menu->hWnd, &rect );
if (menu->wFlags & MF_POPUP)
{
rect.left = wndPtr->rectWindow.left + item->rect.right - GetSystemMetrics(SM_CXBORDER);
rect.top = wndPtr->rectWindow.top + item->rect.top;
rect.left += item->rect.right - GetSystemMetrics(SM_CXBORDER);
rect.top += item->rect.top;
rect.right = item->rect.left - item->rect.right + GetSystemMetrics(SM_CXBORDER);
rect.bottom = item->rect.top - item->rect.bottom;
}
else
{
rect.left = wndPtr->rectWindow.left + item->rect.left;
rect.top = wndPtr->rectWindow.top + item->rect.bottom;
rect.left += item->rect.left;
rect.top += item->rect.bottom;
rect.right = item->rect.right - item->rect.left;
rect.bottom = item->rect.bottom - item->rect.top;
}
@ -2086,7 +2077,6 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu,
rect.left, rect.top, rect.right, rect.bottom );
if (selectFirst)
MENU_MoveSelection( hwndOwner, item->hSubMenu, ITEM_NEXT );
WIN_ReleaseWndPtr(wndPtr);
return item->hSubMenu;
}
@ -2108,30 +2098,28 @@ BOOL MENU_IsMenuActive(void)
static HMENU MENU_PtMenu( HMENU hMenu, POINT pt )
{
POPUPMENU *menu = MENU_GetMenu( hMenu );
register UINT ht = menu->FocusedItem;
UINT item = menu->FocusedItem;
HMENU ret;
/* try subpopup first (if any) */
ht = (ht != NO_SELECTED_ITEM &&
(menu->items[ht].fType & MF_POPUP) &&
(menu->items[ht].fState & MF_MOUSESELECT))
? (UINT) MENU_PtMenu(menu->items[ht].hSubMenu, pt) : 0;
ret = (item != NO_SELECTED_ITEM &&
(menu->items[item].fType & MF_POPUP) &&
(menu->items[item].fState & MF_MOUSESELECT))
? MENU_PtMenu(menu->items[item].hSubMenu, pt) : 0;
if( !ht ) /* check the current window (avoiding WM_HITTEST) */
if (!ret) /* check the current window (avoiding WM_HITTEST) */
{
ht = (UINT)NC_HandleNCHitTest( menu->hWnd, pt );
if( menu->wFlags & MF_POPUP )
ht = (ht != (UINT)HTNOWHERE &&
ht != (UINT)HTERROR) ? (UINT)hMenu : 0;
else
{
WND* wndPtr = WIN_FindWndPtr(menu->hWnd);
ht = ( ht == HTSYSMENU ) ? (UINT)(wndPtr->hSysMenu)
: ( ht == HTMENU ) ? (UINT)(wndPtr->wIDmenu) : 0;
WIN_ReleaseWndPtr(wndPtr);
}
INT ht = NC_HandleNCHitTest( menu->hWnd, pt );
if( menu->wFlags & MF_POPUP )
{
if (ht != HTNOWHERE && ht != HTERROR) ret = hMenu;
}
else if (ht == HTSYSMENU)
ret = get_win_sys_menu( menu->hWnd );
else if (ht == HTMENU)
ret = GetMenu( menu->hWnd );
}
return (HMENU)ht;
return ret;
}
/***********************************************************************
@ -2335,7 +2323,6 @@ static LRESULT MENU_DoNextMenu( MTRACKER* pmt, UINT vk )
if( (vk == VK_LEFT && menu->FocusedItem == 0 ) ||
(vk == VK_RIGHT && menu->FocusedItem == menu->nItems - 1))
{
WND* wndPtr;
HMENU hNewMenu;
HWND hNewWnd;
UINT id = 0;
@ -2347,62 +2334,50 @@ static LRESULT MENU_DoNextMenu( MTRACKER* pmt, UINT vk )
if( l == 0 )
{
wndPtr = WIN_FindWndPtr(pmt->hOwnerWnd);
DWORD style = GetWindowLongA( pmt->hOwnerWnd, GWL_STYLE );
hNewWnd = pmt->hOwnerWnd;
if( IS_SYSTEM_MENU(menu) )
{
/* switch to the menu bar */
if( wndPtr->dwStyle & WS_CHILD || !wndPtr->wIDmenu )
{
WIN_ReleaseWndPtr(wndPtr);
return FALSE;
}
if(style & WS_CHILD || !(hNewMenu = GetMenu(hNewWnd))) return FALSE;
hNewMenu = wndPtr->wIDmenu;
if( vk == VK_LEFT )
{
menu = MENU_GetMenu( hNewMenu );
id = menu->nItems - 1;
}
}
else if( wndPtr->dwStyle & WS_SYSMENU )
else if (style & WS_SYSMENU )
{
/* switch to the system menu */
hNewMenu = wndPtr->hSysMenu;
hNewMenu = get_win_sys_menu( hNewWnd );
}
else
{
WIN_ReleaseWndPtr(wndPtr);
return FALSE;
}
WIN_ReleaseWndPtr(wndPtr);
else return FALSE;
}
else /* application returned a new menu to switch to */
{
hNewMenu = LOWORD(l); hNewWnd = HIWORD(l);
hNewMenu = LOWORD(l);
hNewWnd = HIWORD(l);
if( IsMenu(hNewMenu) && IsWindow(hNewWnd) )
{
wndPtr = WIN_FindWndPtr(hNewWnd);
DWORD style = GetWindowLongA( hNewWnd, GWL_STYLE );
if( wndPtr->dwStyle & WS_SYSMENU &&
GetSubMenu(wndPtr->hSysMenu, 0) == hNewMenu )
if (style & WS_SYSMENU &&
GetSubMenu(get_win_sys_menu(hNewWnd), 0) == hNewMenu )
{
/* get the real system menu */
hNewMenu = wndPtr->hSysMenu;
hNewMenu = get_win_sys_menu(hNewWnd);
}
else if( wndPtr->dwStyle & WS_CHILD || wndPtr->wIDmenu != hNewMenu )
else if (style & WS_CHILD || GetMenu(hNewWnd) != hNewMenu )
{
/* FIXME: Not sure what to do here;
* perhaps try to track hNewMenu as a popup? */
TRACE(" -- got confused.\n");
WIN_ReleaseWndPtr(wndPtr);
return FALSE;
}
WIN_ReleaseWndPtr(wndPtr);
}
else return FALSE;
}
@ -2955,13 +2930,12 @@ static BOOL MENU_ExitTracking(HWND hWnd)
*
* Menu-bar tracking upon a mouse event. Called from NC_HandleSysCommand().
*/
void MENU_TrackMouseMenuBar( WND* wndPtr, INT ht, POINT pt )
void MENU_TrackMouseMenuBar( HWND hWnd, INT ht, POINT pt )
{
HWND hWnd = wndPtr->hwndSelf;
HMENU hMenu = (ht == HTSYSMENU) ? wndPtr->hSysMenu : wndPtr->wIDmenu;
HMENU hMenu = (ht == HTSYSMENU) ? get_win_sys_menu( hWnd ) : GetMenu( hWnd );
UINT wFlags = TPM_ENTERIDLEEX | TPM_BUTTONDOWN | TPM_LEFTALIGN | TPM_LEFTBUTTON;
TRACE("pwnd=%p ht=0x%04x (%ld,%ld)\n", wndPtr, ht, pt.x, pt.y);
TRACE("wnd=%x ht=0x%04x (%ld,%ld)\n", hWnd, ht, pt.x, pt.y);
if (IsMenu(hMenu))
{
@ -2977,59 +2951,54 @@ void MENU_TrackMouseMenuBar( WND* wndPtr, INT ht, POINT pt )
*
* Menu-bar tracking upon a keyboard event. Called from NC_HandleSysCommand().
*/
void MENU_TrackKbdMenuBar( WND* wndPtr, UINT wParam, INT vkey)
void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, INT vkey)
{
UINT uItem = NO_SELECTED_ITEM;
HMENU hTrackMenu;
UINT wFlags = TPM_ENTERIDLEEX | TPM_LEFTALIGN | TPM_LEFTBUTTON;
UINT uItem = NO_SELECTED_ITEM;
HMENU hTrackMenu;
UINT wFlags = TPM_ENTERIDLEEX | TPM_LEFTALIGN | TPM_LEFTBUTTON;
/* find window that has a menu */
while( wndPtr->dwStyle & WS_CHILD)
if( !(wndPtr = wndPtr->parent) ) return;
while (GetWindowLongA( hwnd, GWL_STYLE ) & WS_CHILD)
if (!(hwnd = GetParent( hwnd ))) return;
/* check if we have to track a system menu */
if( (wndPtr->dwStyle & (WS_CHILD | WS_MINIMIZE)) ||
!wndPtr->wIDmenu || vkey == VK_SPACE )
hTrackMenu = GetMenu( hwnd );
if (!hTrackMenu || IsIconic(hwnd) || vkey == VK_SPACE )
{
if( !(wndPtr->dwStyle & WS_SYSMENU) ) return;
hTrackMenu = wndPtr->hSysMenu;
uItem = 0;
wParam |= HTSYSMENU; /* prevent item lookup */
if (!(GetWindowLongA( hwnd, GWL_STYLE ) & WS_SYSMENU)) return;
hTrackMenu = get_win_sys_menu( hwnd );
uItem = 0;
wParam |= HTSYSMENU; /* prevent item lookup */
}
else
hTrackMenu = wndPtr->wIDmenu;
if (IsMenu( hTrackMenu ))
if (!IsMenu( hTrackMenu )) return;
MENU_InitTracking( hwnd, hTrackMenu, FALSE, wFlags );
if( vkey && vkey != VK_SPACE )
{
MENU_InitTracking( wndPtr->hwndSelf, hTrackMenu, FALSE, wFlags );
if( vkey && vkey != VK_SPACE )
uItem = MENU_FindItemByKey( hwnd, hTrackMenu, vkey, (wParam & HTSYSMENU) );
if( uItem >= (UINT)(-2) )
{
uItem = MENU_FindItemByKey( wndPtr->hwndSelf, hTrackMenu,
vkey, (wParam & HTSYSMENU) );
if( uItem >= (UINT)(-2) )
{
if( uItem == (UINT)(-1) ) MessageBeep(0);
hTrackMenu = 0;
}
if( uItem == (UINT)(-1) ) MessageBeep(0);
hTrackMenu = 0;
}
if( hTrackMenu )
{
MENU_SelectItem( wndPtr->hwndSelf, hTrackMenu, uItem, TRUE, 0 );
if( uItem == NO_SELECTED_ITEM )
MENU_MoveSelection( wndPtr->hwndSelf, hTrackMenu, ITEM_NEXT );
else if( vkey )
PostMessageA( wndPtr->hwndSelf, WM_KEYDOWN, VK_DOWN, 0L );
MENU_TrackMenu( hTrackMenu, wFlags, 0, 0, wndPtr->hwndSelf, NULL );
}
MENU_ExitTracking (wndPtr->hwndSelf);
}
if( hTrackMenu )
{
MENU_SelectItem( hwnd, hTrackMenu, uItem, TRUE, 0 );
if( uItem == NO_SELECTED_ITEM )
MENU_MoveSelection( hwnd, hTrackMenu, ITEM_NEXT );
else if( vkey )
PostMessageA( hwnd, WM_KEYDOWN, VK_DOWN, 0L );
MENU_TrackMenu( hTrackMenu, wFlags, 0, 0, hwnd, NULL );
}
MENU_ExitTracking( hwnd );
}
@ -3159,30 +3128,19 @@ UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
{
HDC hdc;
RECT rectBar;
WND *wndPtr;
LPPOPUPMENU lppop;
UINT retvalue;
TRACE("HWND 0x%x, width %d, at (%d, %d).\n",
hwnd, menubarWidth, orgX, orgY );
if (!(wndPtr = WIN_FindWndPtr( hwnd )))
return 0;
hwnd, menubarWidth, orgX, orgY );
if (!(lppop = MENU_GetMenu((HMENU16)wndPtr->wIDmenu)))
{
WIN_ReleaseWndPtr(wndPtr);
return 0;
}
if (!(lppop = MENU_GetMenu( GetMenu(hwnd) ))) return 0;
hdc = GetDCEx( hwnd, 0, DCX_CACHE | DCX_WINDOW );
SelectObject( hdc, hMenuFont);
SetRect(&rectBar, orgX, orgY, orgX+menubarWidth, orgY+GetSystemMetrics(SM_CYMENU));
MENU_MenuBarCalcSize( hdc, &rectBar, lppop, hwnd );
ReleaseDC( hwnd, hdc );
retvalue = lppop->Height;
WIN_ReleaseWndPtr(wndPtr);
return retvalue;
return lppop->Height;
}
@ -3977,15 +3935,8 @@ HMENU16 WINAPI GetMenu16( HWND16 hWnd )
*/
HMENU WINAPI GetMenu( HWND hWnd )
{
HMENU retvalue;
WND * wndPtr = WIN_FindWndPtr(hWnd);
if (!wndPtr) return 0;
retvalue = (HMENU)wndPtr->wIDmenu;
TRACE("for %swindow %04x returning %04x\n",
(wndPtr->dwStyle & WS_CHILD) ? "child " : "", hWnd, retvalue);
WIN_ReleaseWndPtr(wndPtr);
HMENU retvalue = (HMENU)GetWindowLongA( hWnd, GWL_ID );
TRACE("for %04x returning %04x\n", hWnd, retvalue);
return retvalue;
}
@ -4004,40 +3955,32 @@ BOOL16 WINAPI SetMenu16( HWND16 hWnd, HMENU16 hMenu )
*/
BOOL WINAPI SetMenu( HWND hWnd, HMENU hMenu )
{
WND * wndPtr = WIN_FindWndPtr(hWnd);
BOOL res = FALSE;
TRACE("(%04x, %04x);\n", hWnd, hMenu);
if (hMenu && !IsMenu(hMenu))
{
WARN("hMenu is not a menu handle\n");
goto exit;
WARN("hMenu %x is not a menu handle\n", hMenu);
return FALSE;
}
if (GetWindowLongA( hWnd, GWL_STYLE ) & WS_CHILD) return FALSE;
if (wndPtr && !(wndPtr->dwStyle & WS_CHILD))
if (GetCapture() == hWnd) ReleaseCapture();
if (hMenu != 0)
{
if (GetCapture() == hWnd) ReleaseCapture();
LPPOPUPMENU lpmenu;
wndPtr->wIDmenu = (UINT)hMenu;
if (hMenu != 0)
{
LPPOPUPMENU lpmenu;
if (!(lpmenu = MENU_GetMenu(hMenu))) return FALSE;
if (!(lpmenu = MENU_GetMenu(hMenu)))
goto exit;
lpmenu->hWnd = hWnd;
lpmenu->Height = 0; /* Make sure we recalculate the size */
}
if (IsWindowVisible(hWnd))
SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
res = TRUE;
lpmenu->hWnd = hWnd;
lpmenu->Height = 0; /* Make sure we recalculate the size */
}
exit:
WIN_ReleaseWndPtr(wndPtr);
return res;
SetWindowLongA( hWnd, GWL_ID, hMenu );
if (IsWindowVisible(hWnd))
SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
return TRUE;
}
@ -4079,25 +4022,16 @@ void WINAPI DrawMenuBar16( HWND16 hWnd )
BOOL WINAPI DrawMenuBar( HWND hWnd )
{
LPPOPUPMENU lppop;
WND *wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr && !(wndPtr->dwStyle & WS_CHILD) && wndPtr->wIDmenu)
{
lppop = MENU_GetMenu((HMENU16)wndPtr->wIDmenu);
if (lppop == NULL)
{
WIN_ReleaseWndPtr(wndPtr);
return FALSE;
}
HMENU hMenu = GetMenu(hWnd);
lppop->Height = 0; /* Make sure we call MENU_MenuBarCalcSize */
lppop->hwndOwner = hWnd;
SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
WIN_ReleaseWndPtr(wndPtr);
return TRUE;
}
WIN_ReleaseWndPtr(wndPtr);
return FALSE;
if (GetWindowLongA( hWnd, GWL_STYLE ) & WS_CHILD) return FALSE;
if (!hMenu || !(lppop = MENU_GetMenu( hMenu ))) return FALSE;
lppop->Height = 0; /* Make sure we call MENU_MenuBarCalcSize */
lppop->hwndOwner = hWnd;
SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
return TRUE;
}
/***********************************************************************
@ -4967,11 +4901,9 @@ static BOOL translate_accelerator( HWND hWnd, UINT message, WPARAM wParam, LPARA
{
HMENU hMenu, hSubMenu, hSysMenu;
UINT uSysStat = (UINT)-1, uStat = (UINT)-1, nPos;
WND* wndPtr = WIN_FindWndPtr(hWnd);
hMenu = (wndPtr->dwStyle & WS_CHILD) ? 0 : (HMENU)wndPtr->wIDmenu;
hSysMenu = wndPtr->hSysMenu;
WIN_ReleaseWndPtr(wndPtr);
hMenu = (GetWindowLongA( hWnd, GWL_STYLE ) & WS_CHILD) ? 0 : GetMenu(hWnd);
hSysMenu = get_win_sys_menu( hWnd );
/* find menu item and ask application to initialize it */
/* 1. in the system menu */

View File

@ -144,11 +144,12 @@ static void SCROLL_LoadBitmaps(void)
/***********************************************************************
* SCROLL_GetPtrScrollInfo
* SCROLL_GetScrollInfo
*/
static SCROLLBAR_INFO *SCROLL_GetPtrScrollInfo( WND* wndPtr, INT nBar )
static SCROLLBAR_INFO *SCROLL_GetScrollInfo( HWND hwnd, INT nBar )
{
SCROLLBAR_INFO *infoPtr;
WND *wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return NULL;
switch(nBar)
@ -156,7 +157,9 @@ static SCROLLBAR_INFO *SCROLL_GetPtrScrollInfo( WND* wndPtr, INT nBar )
case SB_HORZ: infoPtr = (SCROLLBAR_INFO *)wndPtr->pHScroll; break;
case SB_VERT: infoPtr = (SCROLLBAR_INFO *)wndPtr->pVScroll; break;
case SB_CTL: infoPtr = (SCROLLBAR_INFO *)wndPtr->wExtra; break;
default: return NULL;
default:
WIN_ReleaseWndPtr( wndPtr );
return NULL;
}
if (!infoPtr) /* Create the info structure if needed */
@ -171,23 +174,11 @@ static SCROLLBAR_INFO *SCROLL_GetPtrScrollInfo( WND* wndPtr, INT nBar )
}
if (!hUpArrow) SCROLL_LoadBitmaps();
}
WIN_ReleaseWndPtr( wndPtr );
return infoPtr;
}
/***********************************************************************
* SCROLL_GetScrollInfo
*/
static SCROLLBAR_INFO *SCROLL_GetScrollInfo( HWND hwnd, INT nBar )
{
SCROLLBAR_INFO *retvalue;
WND *wndPtr = WIN_FindWndPtr( hwnd );
retvalue = SCROLL_GetPtrScrollInfo( wndPtr, nBar );
WIN_ReleaseWndPtr(wndPtr);
return retvalue;
}
/***********************************************************************
* SCROLL_GetScrollBarRect
*
@ -258,7 +249,7 @@ static BOOL SCROLL_GetScrollBarRect( HWND hwnd, INT nBar, RECT *lprect,
}
else
{
SCROLLBAR_INFO *info = SCROLL_GetPtrScrollInfo( wndPtr, nBar );
SCROLLBAR_INFO *info = SCROLL_GetScrollInfo( hwnd, nBar );
*arrowSize = GetSystemMetrics(SM_CXVSCROLL);
pixels -= (2 * (GetSystemMetrics(SM_CXVSCROLL) - SCROLL_ARROW_THUMB_OVERLAP));
@ -793,7 +784,7 @@ void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar,
RECT rect;
BOOL vertical;
WND *wndPtr = WIN_FindWndPtr( hwnd );
SCROLLBAR_INFO *infoPtr = SCROLL_GetPtrScrollInfo( wndPtr, nBar );
SCROLLBAR_INFO *infoPtr = SCROLL_GetScrollInfo( hwnd, nBar );
BOOL Save_SCROLL_MovingThumb = SCROLL_MovingThumb;
if (!wndPtr || !infoPtr ||
@ -877,9 +868,8 @@ static void SCROLL_RefreshScrollBar( HWND hwnd, INT nBar,
*/
static void SCROLL_HandleKbdEvent( HWND hwnd, WPARAM wParam )
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
WPARAM msg;
switch(wParam)
{
case VK_PRIOR: msg = SB_PAGEUP; break;
@ -888,14 +878,11 @@ static void SCROLL_HandleKbdEvent( HWND hwnd, WPARAM wParam )
case VK_END: msg = SB_BOTTOM; break;
case VK_UP: msg = SB_LINEUP; break;
case VK_DOWN: msg = SB_LINEDOWN; break;
default:
WIN_ReleaseWndPtr(wndPtr);
return;
default: return;
}
SendMessageW( GetParent(hwnd),
(wndPtr->dwStyle & SBS_VERT) ? WM_VSCROLL : WM_HSCROLL,
msg, hwnd );
WIN_ReleaseWndPtr(wndPtr);
(GetWindowLongA( hwnd, GWL_STYLE ) & SBS_VERT) ? WM_VSCROLL : WM_HSCROLL,
msg, hwnd );
}
@ -1651,30 +1638,33 @@ BOOL bRedraw /* [in] Should scrollbar be redrawn afterwards ? */)
*
* Updates both scrollbars at the same time. Used by MDI CalcChildScroll().
*/
INT SCROLL_SetNCSbState(WND* wndPtr, int vMin, int vMax, int vPos,
int hMin, int hMax, int hPos)
INT SCROLL_SetNCSbState(HWND hwnd, int vMin, int vMax, int vPos,
int hMin, int hMax, int hPos)
{
INT vA, hA;
SCROLLINFO vInfo, hInfo;
vInfo.cbSize = hInfo.cbSize = sizeof(SCROLLINFO);
vInfo.nMin = vMin; hInfo.nMin = hMin;
vInfo.nMax = vMax; hInfo.nMax = hMax;
vInfo.nPos = vPos; hInfo.nPos = hPos;
vInfo.nMin = vMin;
vInfo.nMax = vMax;
vInfo.nPos = vPos;
hInfo.nMin = hMin;
hInfo.nMax = hMax;
hInfo.nPos = hPos;
vInfo.fMask = hInfo.fMask = SIF_RANGE | SIF_POS;
SCROLL_SetScrollInfo( wndPtr->hwndSelf, SB_VERT, &vInfo, &vA );
SCROLL_SetScrollInfo( wndPtr->hwndSelf, SB_HORZ, &hInfo, &hA );
SCROLL_SetScrollInfo( hwnd, SB_VERT, &vInfo, &vA );
SCROLL_SetScrollInfo( hwnd, SB_HORZ, &hInfo, &hA );
if( !SCROLL_ShowScrollBar( wndPtr->hwndSelf, SB_BOTH,
if( !SCROLL_ShowScrollBar( hwnd, SB_BOTH,
(hA & SA_SSI_SHOW),(vA & SA_SSI_SHOW) ) )
{
/* SetWindowPos() wasn't called, just redraw the scrollbars if needed */
if( vA & SA_SSI_REFRESH )
SCROLL_RefreshScrollBar( wndPtr->hwndSelf, SB_VERT, FALSE, TRUE );
SCROLL_RefreshScrollBar( hwnd, SB_VERT, FALSE, TRUE );
if( hA & SA_SSI_REFRESH )
SCROLL_RefreshScrollBar( wndPtr->hwndSelf, SB_HORZ, FALSE, TRUE );
SCROLL_RefreshScrollBar( hwnd, SB_HORZ, FALSE, TRUE );
}
return 0;
}

View File

@ -8,7 +8,6 @@
#include "windef.h"
#include "wingdi.h"
#include "wine/winuser16.h"
#include "win.h"
#include "cursoricon.h"
#include "controls.h"
#include "user.h"
@ -16,25 +15,23 @@
DEFAULT_DEBUG_CHANNEL(static);
static void STATIC_PaintOwnerDrawfn( WND *wndPtr, HDC hdc );
static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc );
static void STATIC_PaintRectfn( WND *wndPtr, HDC hdc );
static void STATIC_PaintIconfn( WND *wndPtr, HDC hdc );
static void STATIC_PaintBitmapfn( WND *wndPtr, HDC hdc );
static void STATIC_PaintEtchedfn( WND *wndPtr, HDC hdc );
static void STATIC_PaintOwnerDrawfn( HWND hwnd, HDC hdc, DWORD style );
static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style );
static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD style );
static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style );
static void STATIC_PaintBitmapfn( HWND hwnd, HDC hdc, DWORD style );
static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style );
static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
static LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
static COLORREF color_windowframe, color_background, color_window;
typedef struct
{
HFONT16 hFont; /* Control font (or 0 for system font) */
WORD dummy; /* Don't know what MS-Windows puts in there */
HICON16 hIcon; /* Icon handle for SS_ICON controls */
} STATICINFO;
/* offsets for GetWindowLong for static private information */
#define HFONT_GWL_OFFSET 0
#define HICON_GWL_OFFSET (sizeof(HFONT))
#define STATIC_EXTRA_BYTES (HICON_GWL_OFFSET + sizeof(HICON))
typedef void (*pfPaint)( WND *, HDC );
typedef void (*pfPaint)( HWND hwnd, HDC hdc, DWORD style );
static pfPaint staticPaintFunc[SS_TYPEMASK+1] =
{
@ -69,7 +66,7 @@ const struct builtin_class_descr STATIC_builtin_class =
CS_GLOBALCLASS | CS_DBLCLKS | CS_PARENTDC, /* style */
StaticWndProcA, /* procA */
StaticWndProcW, /* procW */
sizeof(STATICINFO), /* extra */
STATIC_EXTRA_BYTES, /* extra */
IDC_ARROWA, /* cursor */
0 /* brush */
};
@ -80,22 +77,20 @@ const struct builtin_class_descr STATIC_builtin_class =
*
* Set the icon for an SS_ICON control.
*/
static HICON16 STATIC_SetIcon( WND *wndPtr, HICON16 hicon )
static HICON STATIC_SetIcon( HWND hwnd, HICON hicon, DWORD style )
{
HICON16 prevIcon;
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
HICON prevIcon;
CURSORICONINFO *info = hicon?(CURSORICONINFO *) GlobalLock16( hicon ):NULL;
if ((wndPtr->dwStyle & SS_TYPEMASK) != SS_ICON) return 0;
if ((style & SS_TYPEMASK) != SS_ICON) return 0;
if (hicon && !info) {
ERR("huh? hicon!=0, but info=0???\n");
return 0;
}
prevIcon = infoPtr->hIcon;
infoPtr->hIcon = hicon;
prevIcon = SetWindowLongA( hwnd, HICON_GWL_OFFSET, hicon );
if (hicon)
{
SetWindowPos( wndPtr->hwndSelf, 0, 0, 0, info->nWidth, info->nHeight,
SetWindowPos( hwnd, 0, 0, 0, info->nWidth, info->nHeight,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
GlobalUnlock16( hicon );
}
@ -107,23 +102,21 @@ static HICON16 STATIC_SetIcon( WND *wndPtr, HICON16 hicon )
*
* Set the bitmap for an SS_BITMAP control.
*/
static HBITMAP16 STATIC_SetBitmap( WND *wndPtr, HBITMAP16 hBitmap )
static HBITMAP STATIC_SetBitmap( HWND hwnd, HBITMAP hBitmap, DWORD style )
{
HBITMAP16 hOldBitmap;
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
HBITMAP hOldBitmap;
if ((wndPtr->dwStyle & SS_TYPEMASK) != SS_BITMAP) return 0;
if ((style & SS_TYPEMASK) != SS_BITMAP) return 0;
if (hBitmap && GetObjectType(hBitmap) != OBJ_BITMAP) {
ERR("huh? hBitmap!=0, but not bitmap\n");
return 0;
}
hOldBitmap = infoPtr->hIcon;
infoPtr->hIcon = hBitmap;
hOldBitmap = SetWindowLongA( hwnd, HICON_GWL_OFFSET, hBitmap );
if (hBitmap)
{
BITMAP bm;
GetObjectW(hBitmap, sizeof(bm), &bm);
SetWindowPos( wndPtr->hwndSelf, 0, 0, 0, bm.bmWidth, bm.bmHeight,
SetWindowPos( hwnd, 0, 0, 0, bm.bmWidth, bm.bmHeight,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
}
return hOldBitmap;
@ -134,9 +127,10 @@ static HBITMAP16 STATIC_SetBitmap( WND *wndPtr, HBITMAP16 hBitmap )
*
* Load the icon for an SS_ICON control.
*/
static HICON STATIC_LoadIconA( WND *wndPtr, LPCSTR name )
static HICON STATIC_LoadIconA( HWND hwnd, LPCSTR name )
{
HICON hicon = LoadIconA( wndPtr->hInstance, name );
HINSTANCE hInstance = GetWindowLongA( hwnd, GWL_HINSTANCE );
HICON hicon = LoadIconA( hInstance, name );
if (!hicon) hicon = LoadIconA( 0, name );
return hicon;
}
@ -146,9 +140,10 @@ static HICON STATIC_LoadIconA( WND *wndPtr, LPCSTR name )
*
* Load the icon for an SS_ICON control.
*/
static HICON STATIC_LoadIconW( WND *wndPtr, LPCWSTR name )
static HICON STATIC_LoadIconW( HWND hwnd, LPCWSTR name )
{
HICON hicon = LoadIconW( wndPtr->hInstance, name );
HINSTANCE hInstance = GetWindowLongA( hwnd, GWL_HINSTANCE );
HICON hicon = LoadIconW( hInstance, name );
if (!hicon) hicon = LoadIconW( 0, name );
return hicon;
}
@ -158,9 +153,10 @@ static HICON STATIC_LoadIconW( WND *wndPtr, LPCWSTR name )
*
* Load the bitmap for an SS_BITMAP control.
*/
static HBITMAP STATIC_LoadBitmapA( WND *wndPtr, LPCSTR name )
static HBITMAP STATIC_LoadBitmapA( HWND hwnd, LPCSTR name )
{
HBITMAP hbitmap = LoadBitmapA( wndPtr->hInstance, name );
HINSTANCE hInstance = GetWindowLongA( hwnd, GWL_HINSTANCE );
HBITMAP hbitmap = LoadBitmapA( hInstance, name );
if (!hbitmap) /* Try OEM icon (FIXME: is this right?) */
hbitmap = LoadBitmapA( 0, name );
return hbitmap;
@ -171,23 +167,24 @@ static HBITMAP STATIC_LoadBitmapA( WND *wndPtr, LPCSTR name )
*
* Load the bitmap for an SS_BITMAP control.
*/
static HBITMAP STATIC_LoadBitmapW( WND *wndPtr, LPCWSTR name )
static HBITMAP STATIC_LoadBitmapW( HWND hwnd, LPCWSTR name )
{
HBITMAP hbitmap = LoadBitmapW( wndPtr->hInstance, name );
HINSTANCE hInstance = GetWindowLongA( hwnd, GWL_HINSTANCE );
HBITMAP hbitmap = LoadBitmapW( hInstance, name );
if (!hbitmap) /* Try OEM icon (FIXME: is this right?) */
hbitmap = LoadBitmapW( 0, name );
return hbitmap;
}
/***********************************************************************
* StaticWndProc_locked
* StaticWndProc_common
*/
static LRESULT StaticWndProc_locked( WND *wndPtr, UINT uMsg, WPARAM wParam,
static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
LPARAM lParam, BOOL unicode )
{
LRESULT lResult = 0;
LONG style = wndPtr->dwStyle & SS_TYPEMASK;
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
LONG full_style = GetWindowLongA( hwnd, GWL_STYLE );
LONG style = full_style & SS_TYPEMASK;
switch (uMsg)
{
@ -195,8 +192,7 @@ static LRESULT StaticWndProc_locked( WND *wndPtr, UINT uMsg, WPARAM wParam,
if (style < 0L || style > SS_TYPEMASK)
{
ERR("Unknown style 0x%02lx\n", style );
lResult = -1L;
break;
return -1;
}
/* initialise colours */
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
@ -214,36 +210,36 @@ static LRESULT StaticWndProc_locked( WND *wndPtr, UINT uMsg, WPARAM wParam,
* had already been loaded by the application the last thing we want to do is
* GlobalFree16 the handle.
*/
} else {
lResult = unicode ? DefWindowProcW(wndPtr->hwndSelf, uMsg, wParam, lParam) :
DefWindowProcA(wndPtr->hwndSelf, uMsg, wParam, lParam);
}
break;
break;
}
else return unicode ? DefWindowProcW(hwnd, uMsg, wParam, lParam) :
DefWindowProcA(hwnd, uMsg, wParam, lParam);
case WM_PAINT:
{
PAINTSTRUCT ps;
BeginPaint(wndPtr->hwndSelf, &ps);
BeginPaint(hwnd, &ps);
if (staticPaintFunc[style])
(staticPaintFunc[style])( wndPtr, ps.hdc );
EndPaint(wndPtr->hwndSelf, &ps);
(staticPaintFunc[style])( hwnd, ps.hdc, full_style );
EndPaint(hwnd, &ps);
}
break;
case WM_ENABLE:
InvalidateRect(wndPtr->hwndSelf, NULL, FALSE);
InvalidateRect(hwnd, NULL, FALSE);
break;
case WM_SYSCOLORCHANGE:
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
color_background = GetSysColor(COLOR_BACKGROUND);
color_window = GetSysColor(COLOR_WINDOW);
InvalidateRect(wndPtr->hwndSelf, NULL, TRUE);
InvalidateRect(hwnd, NULL, TRUE);
break;
case WM_NCCREATE:
if ((TWEAK_WineLook > WIN31_LOOK) && (wndPtr->dwStyle & SS_SUNKEN))
wndPtr->dwExStyle |= WS_EX_STATICEDGE;
if ((TWEAK_WineLook > WIN31_LOOK) && (full_style & SS_SUNKEN))
SetWindowLongA( hwnd, GWL_EXSTYLE,
GetWindowLongA( hwnd, GWL_EXSTYLE ) | WS_EX_STATICEDGE );
if(unicode)
lParam = (LPARAM)(((LPCREATESTRUCTW)lParam)->lpszName);
@ -255,98 +251,81 @@ static LRESULT StaticWndProc_locked( WND *wndPtr, UINT uMsg, WPARAM wParam,
{
HICON hIcon;
if(unicode)
hIcon = STATIC_LoadIconW(wndPtr, (LPCWSTR)lParam);
hIcon = STATIC_LoadIconW(hwnd, (LPCWSTR)lParam);
else
hIcon = STATIC_LoadIconA(wndPtr, (LPCSTR)lParam);
hIcon = STATIC_LoadIconA(hwnd, (LPCSTR)lParam);
/* FIXME : should we also return the previous hIcon here ??? */
STATIC_SetIcon(wndPtr, hIcon);
STATIC_SetIcon(hwnd, hIcon, style);
}
else if (style == SS_BITMAP)
{
HBITMAP hBitmap;
if(unicode)
hBitmap = STATIC_LoadBitmapW(wndPtr, (LPCWSTR)lParam);
hBitmap = STATIC_LoadBitmapW(hwnd, (LPCWSTR)lParam);
else
hBitmap = STATIC_LoadBitmapA(wndPtr, (LPCSTR)lParam);
STATIC_SetBitmap(wndPtr, hBitmap);
hBitmap = STATIC_LoadBitmapA(hwnd, (LPCSTR)lParam);
STATIC_SetBitmap(hwnd, hBitmap, style);
}
else if(lParam && HIWORD(lParam))
else if (HIWORD(lParam))
{
if(unicode)
DEFWND_SetTextW(wndPtr, (LPCWSTR)lParam);
lResult = DefWindowProcW( hwnd, WM_SETTEXT, wParam, lParam );
else
DEFWND_SetTextA(wndPtr, (LPCSTR)lParam);
lResult = DefWindowProcA( hwnd, WM_SETTEXT, wParam, lParam );
}
if(uMsg == WM_SETTEXT)
InvalidateRect(wndPtr->hwndSelf, NULL, FALSE);
lResult = 1; /* success. FIXME: check text length */
break;
InvalidateRect(hwnd, NULL, FALSE);
return 1; /* success. FIXME: check text length */
case WM_SETFONT:
if (style == SS_ICON)
{
lResult = 0;
goto END;
}
if (style == SS_BITMAP)
{
lResult = 0;
goto END;
}
infoPtr->hFont = (HFONT16)wParam;
if ((style == SS_ICON) || (style == SS_BITMAP)) return 0;
SetWindowLongA( hwnd, HFONT_GWL_OFFSET, wParam );
if (LOWORD(lParam))
InvalidateRect( wndPtr->hwndSelf, NULL, FALSE );
InvalidateRect( hwnd, NULL, FALSE );
break;
case WM_GETFONT:
lResult = infoPtr->hFont;
goto END;
return GetWindowLongA( hwnd, HFONT_GWL_OFFSET );
case WM_NCHITTEST:
if (wndPtr->dwStyle & SS_NOTIFY)
lResult = HTCLIENT;
if (full_style & SS_NOTIFY)
return HTCLIENT;
else
lResult = HTTRANSPARENT;
goto END;
return HTTRANSPARENT;
case WM_GETDLGCODE:
lResult = DLGC_STATIC;
goto END;
return DLGC_STATIC;
case STM_GETIMAGE:
case STM_GETICON16:
case STM_GETICON:
lResult = infoPtr->hIcon;
goto END;
return GetWindowLongA( hwnd, HICON_GWL_OFFSET );
case STM_SETIMAGE:
switch(wParam) {
case IMAGE_BITMAP:
lResult = STATIC_SetBitmap( wndPtr, (HBITMAP)lParam );
lResult = STATIC_SetBitmap( hwnd, (HBITMAP)lParam, style );
break;
case IMAGE_ICON:
lResult = STATIC_SetIcon( wndPtr, (HICON16)lParam );
lResult = STATIC_SetIcon( hwnd, (HICON)lParam, style );
break;
default:
FIXME("STM_SETIMAGE: Unhandled type %x\n", wParam);
break;
}
InvalidateRect( wndPtr->hwndSelf, NULL, FALSE );
InvalidateRect( hwnd, NULL, FALSE );
break;
case STM_SETICON16:
case STM_SETICON:
lResult = STATIC_SetIcon( wndPtr, (HICON16)wParam );
InvalidateRect( wndPtr->hwndSelf, NULL, FALSE );
lResult = STATIC_SetIcon( hwnd, (HICON)wParam, style );
InvalidateRect( hwnd, NULL, FALSE );
break;
default:
lResult = unicode ? DefWindowProcW(wndPtr->hwndSelf, uMsg, wParam, lParam) :
DefWindowProcA(wndPtr->hwndSelf, uMsg, wParam, lParam);
break;
return unicode ? DefWindowProcW(hwnd, uMsg, wParam, lParam) :
DefWindowProcA(hwnd, uMsg, wParam, lParam);
}
END:
return lResult;
}
@ -355,15 +334,8 @@ END:
*/
static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
LRESULT lResult = 0;
WND *wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr)
{
lResult = StaticWndProc_locked(wndPtr, uMsg, wParam, lParam, FALSE);
WIN_ReleaseWndPtr(wndPtr);
}
return lResult;
if (!IsWindow( hWnd )) return 0;
return StaticWndProc_common(hWnd, uMsg, wParam, lParam, FALSE);
}
/***********************************************************************
@ -371,47 +343,39 @@ static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
*/
static LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
LRESULT lResult = 0;
WND *wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr)
{
lResult = StaticWndProc_locked(wndPtr, uMsg, wParam, lParam, TRUE);
WIN_ReleaseWndPtr(wndPtr);
}
return lResult;
if (!IsWindow( hWnd )) return 0;
return StaticWndProc_common(hWnd, uMsg, wParam, lParam, TRUE);
}
static void STATIC_PaintOwnerDrawfn( WND *wndPtr, HDC hdc )
static void STATIC_PaintOwnerDrawfn( HWND hwnd, HDC hdc, DWORD style )
{
DRAWITEMSTRUCT dis;
LONG id = GetWindowLongA( hwnd, GWL_ID );
dis.CtlType = ODT_STATIC;
dis.CtlID = wndPtr->wIDmenu;
dis.CtlID = id;
dis.itemID = 0;
dis.itemAction = ODA_DRAWENTIRE;
dis.itemState = 0;
dis.hwndItem = wndPtr->hwndSelf;
dis.hwndItem = hwnd;
dis.hDC = hdc;
dis.itemData = 0;
GetClientRect( wndPtr->hwndSelf, &dis.rcItem );
GetClientRect( hwnd, &dis.rcItem );
SendMessageW( GetParent(wndPtr->hwndSelf), WM_CTLCOLORSTATIC,
hdc, wndPtr->hwndSelf );
SendMessageW( GetParent(wndPtr->hwndSelf), WM_DRAWITEM,
wndPtr->wIDmenu, (LPARAM)&dis );
SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC, hdc, hwnd );
SendMessageW( GetParent(hwnd), WM_DRAWITEM, id, (LPARAM)&dis );
}
static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc )
static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style )
{
RECT rc;
HBRUSH hBrush;
HFONT hFont;
WORD wFormat;
INT len;
WCHAR *text;
LONG style = wndPtr->dwStyle;
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
GetClientRect( wndPtr->hwndSelf, &rc);
GetClientRect( hwnd, &rc);
switch (style & SS_TYPEMASK)
{
@ -442,31 +406,32 @@ static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc )
if (style & SS_NOPREFIX)
wFormat |= DT_NOPREFIX;
if (infoPtr->hFont) SelectObject( hdc, infoPtr->hFont );
if ((hFont = GetWindowLongA( hwnd, HFONT_GWL_OFFSET ))) SelectObject( hdc, hFont );
if ((style & SS_NOPREFIX) || ((style & SS_TYPEMASK) != SS_SIMPLE))
{
hBrush = SendMessageW( GetParent(wndPtr->hwndSelf), WM_CTLCOLORSTATIC,
hdc, wndPtr->hwndSelf );
hBrush = SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC, hdc, hwnd );
if (!hBrush) /* did the app forget to call defwindowproc ? */
hBrush = DefWindowProcW(GetParent(wndPtr->hwndSelf), WM_CTLCOLORSTATIC,
hdc, wndPtr->hwndSelf);
FillRect( hdc, &rc, hBrush );
hBrush = DefWindowProcW(GetParent(hwnd), WM_CTLCOLORSTATIC, hdc, hwnd);
FillRect( hdc, &rc, hBrush );
}
if (!IsWindowEnabled(wndPtr->hwndSelf))
SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
if (!IsWindowEnabled(hwnd)) SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
if (wndPtr->text) DrawTextW( hdc, wndPtr->text, -1, &rc, wFormat );
if (!(len = SendMessageW( hwnd, WM_GETTEXTLENGTH, 0, 0 ))) return;
if (!(text = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) ))) return;
SendMessageW( hwnd, WM_GETTEXT, len + 1, (LPARAM)text );
DrawTextW( hdc, text, -1, &rc, wFormat );
HeapFree( GetProcessHeap(), 0, text );
}
static void STATIC_PaintRectfn( WND *wndPtr, HDC hdc )
static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD style )
{
RECT rc;
HBRUSH hBrush;
GetClientRect( wndPtr->hwndSelf, &rc);
GetClientRect( hwnd, &rc);
switch (wndPtr->dwStyle & SS_TYPEMASK)
switch (style & SS_TYPEMASK)
{
case SS_BLACKRECT:
hBrush = CreateSolidBrush(color_windowframe);
@ -499,42 +464,41 @@ static void STATIC_PaintRectfn( WND *wndPtr, HDC hdc )
}
static void STATIC_PaintIconfn( WND *wndPtr, HDC hdc )
static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style )
{
RECT rc;
HBRUSH hbrush;
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
HICON hIcon;
GetClientRect( wndPtr->hwndSelf, &rc );
hbrush = SendMessageW( GetParent(wndPtr->hwndSelf), WM_CTLCOLORSTATIC,
hdc, wndPtr->hwndSelf );
GetClientRect( hwnd, &rc );
hbrush = SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC, hdc, hwnd );
FillRect( hdc, &rc, hbrush );
if (infoPtr->hIcon) DrawIcon( hdc, rc.left, rc.top, infoPtr->hIcon );
if ((hIcon = GetWindowLongA( hwnd, HICON_GWL_OFFSET )))
DrawIcon( hdc, rc.left, rc.top, hIcon );
}
static void STATIC_PaintBitmapfn(WND *wndPtr, HDC hdc )
static void STATIC_PaintBitmapfn(HWND hwnd, HDC hdc, DWORD style )
{
RECT rc;
HBRUSH hbrush;
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
HICON hIcon;
HDC hMemDC;
HBITMAP oldbitmap;
GetClientRect( wndPtr->hwndSelf, &rc );
hbrush = SendMessageW( GetParent(wndPtr->hwndSelf), WM_CTLCOLORSTATIC,
hdc, wndPtr->hwndSelf );
GetClientRect( hwnd, &rc );
hbrush = SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC, hdc, hwnd );
FillRect( hdc, &rc, hbrush );
if (infoPtr->hIcon) {
if ((hIcon = GetWindowLongA( hwnd, HICON_GWL_OFFSET )))
{
BITMAP bm;
SIZE sz;
if(GetObjectType(infoPtr->hIcon) != OBJ_BITMAP)
return;
if(GetObjectType(hIcon) != OBJ_BITMAP) return;
if (!(hMemDC = CreateCompatibleDC( hdc ))) return;
GetObjectW(infoPtr->hIcon, sizeof(bm), &bm);
GetBitmapDimensionEx(infoPtr->hIcon, &sz);
oldbitmap = SelectObject(hMemDC, infoPtr->hIcon);
GetObjectW(hIcon, sizeof(bm), &bm);
GetBitmapDimensionEx(hIcon, &sz);
oldbitmap = SelectObject(hMemDC, hIcon);
BitBlt(hdc, sz.cx, sz.cy, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0,
SRCCOPY);
SelectObject(hMemDC, oldbitmap);
@ -543,15 +507,15 @@ static void STATIC_PaintBitmapfn(WND *wndPtr, HDC hdc )
}
static void STATIC_PaintEtchedfn( WND *wndPtr, HDC hdc )
static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style )
{
RECT rc;
if (TWEAK_WineLook == WIN31_LOOK)
return;
GetClientRect( wndPtr->hwndSelf, &rc );
switch (wndPtr->dwStyle & SS_TYPEMASK)
GetClientRect( hwnd, &rc );
switch (style & SS_TYPEMASK)
{
case SS_ETCHEDHORZ:
DrawEdge(hdc,&rc,EDGE_ETCHED,BF_TOP|BF_BOTTOM);
@ -564,4 +528,3 @@ static void STATIC_PaintEtchedfn( WND *wndPtr, HDC hdc )
break;
}
}

View File

@ -10,8 +10,6 @@
#include "winuser.h"
#include "winproc.h"
struct tagWND;
/* Built-in class names (see _Undocumented_Windows_ p.418) */
#define POPUPMENU_CLASS_ATOM MAKEINTATOM(32768) /* PopupMenu */
#define DESKTOP_CLASS_ATOM MAKEINTATOM(32769) /* Desktop */
@ -36,7 +34,7 @@ struct builtin_class_descr
extern BOOL DESKTOP_SetPattern( LPCSTR pattern );
/* icon title */
extern HWND ICONTITLE_Create( struct tagWND * );
extern HWND ICONTITLE_Create( HWND hwnd );
/* menu controls */
extern BOOL MENU_Init(void);
@ -44,8 +42,8 @@ extern BOOL MENU_IsMenuActive(void);
extern HMENU MENU_GetSysMenu(HWND hWndOwner, HMENU hSysPopup);
extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
INT orgX, INT orgY );
extern void MENU_TrackMouseMenuBar( struct tagWND *wnd, INT ht, POINT pt );
extern void MENU_TrackKbdMenuBar( struct tagWND *wnd, UINT wParam, INT vkey );
extern void MENU_TrackMouseMenuBar( HWND hwnd, INT ht, POINT pt );
extern void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, INT vkey );
extern UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect,
HWND hwnd, BOOL suppress_draw );
extern UINT MENU_FindSubMenu( HMENU *hmenu, HMENU hSubTarget );
@ -53,7 +51,7 @@ extern UINT MENU_FindSubMenu( HMENU *hmenu, HMENU hSubTarget );
/* scrollbar */
extern void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, BOOL arrows, BOOL interior );
extern void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt );
extern INT SCROLL_SetNCSbState( struct tagWND *wndPtr, int vMin, int vMax, int vPos,
extern INT SCROLL_SetNCSbState( HWND hwnd, int vMin, int vMax, int vPos,
int hMin, int hMax, int hPos );
/* combo box */
@ -80,7 +78,7 @@ extern INT SCROLL_SetNCSbState( struct tagWND *wndPtr, int vMin, int vMax, int v
/* combo state struct */
typedef struct
{
struct tagWND *self;
HWND self;
HWND owner;
UINT dwStyle;
HWND hWndEdit;
@ -98,10 +96,6 @@ typedef struct
/* Note, that CBS_DROPDOWNLIST style is actually (CBS_SIMPLE | CBS_DROPDOWN) */
#define CB_GETTYPE( lphc ) ((lphc)->dwStyle & (CBS_DROPDOWNLIST))
#define CB_DISABLED( lphc ) ((lphc)->self->dwStyle & WS_DISABLED)
#define CB_OWNERDRAWN( lphc ) ((lphc)->dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE))
#define CB_HASSTRINGS( lphc ) ((lphc)->dwStyle & CBS_HASSTRINGS)
#define CB_HWND( lphc ) ((lphc)->self->hwndSelf)
extern BOOL COMBO_FlipListbox( LPHEADCOMBO, BOOL, BOOL );

View File

@ -953,12 +953,12 @@ UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
break;
case SW_MAXIMIZE:
WINPOS_GetMinMaxInfo( wndPtr, &size, &wpl.ptMaxPosition, NULL, NULL );
WINPOS_GetMinMaxInfo( hwnd, &size, &wpl.ptMaxPosition, NULL, NULL );
if( wndPtr->dwStyle & WS_MINIMIZE )
{
wndPtr->dwStyle &= ~WS_MINIMIZE;
WINPOS_ShowIconTitle( wndPtr, FALSE );
WINPOS_ShowIconTitle( hwnd, FALSE );
X11DRV_set_iconic_state( wndPtr );
}
wndPtr->dwStyle |= WS_MAXIMIZE;
@ -970,13 +970,13 @@ UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
if( wndPtr->dwStyle & WS_MINIMIZE )
{
wndPtr->dwStyle &= ~WS_MINIMIZE;
WINPOS_ShowIconTitle( wndPtr, FALSE );
WINPOS_ShowIconTitle( hwnd, FALSE );
X11DRV_set_iconic_state( wndPtr );
if( wndPtr->flags & WIN_RESTORE_MAX)
{
/* Restore to maximized position */
WINPOS_GetMinMaxInfo( wndPtr, &size, &wpl.ptMaxPosition, NULL, NULL);
WINPOS_GetMinMaxInfo( hwnd, &size, &wpl.ptMaxPosition, NULL, NULL);
wndPtr->dwStyle |= WS_MAXIMIZE;
SetRect( rect, wpl.ptMaxPosition.x, wpl.ptMaxPosition.y, size.x, size.y );
break;
@ -1103,14 +1103,14 @@ BOOL X11DRV_ShowWindow( HWND hwnd, INT cmd )
*/
if (hwnd == GetActiveWindow())
WINPOS_ActivateOtherWindow(wndPtr);
WINPOS_ActivateOtherWindow(hwnd);
/* Revert focus to parent */
if (hwnd == GetFocus() || IsChild(hwnd, GetFocus()))
SetFocus( GetParent(hwnd) );
}
if (!IsWindow( hwnd )) goto END;
else if( wndPtr->dwStyle & WS_MINIMIZE ) WINPOS_ShowIconTitle( wndPtr, TRUE );
else if( wndPtr->dwStyle & WS_MINIMIZE ) WINPOS_ShowIconTitle( hwnd, TRUE );
if (wndPtr->flags & WIN_NEED_SIZE)
{
@ -1704,7 +1704,7 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
/* Get min/max info */
WINPOS_GetMinMaxInfo( wndPtr, NULL, NULL, &minTrack, &maxTrack );
WINPOS_GetMinMaxInfo( hwnd, NULL, NULL, &minTrack, &maxTrack );
sizingRect = wndPtr->rectWindow;
origRect = sizingRect;
if (wndPtr->dwStyle & WS_CHILD)
@ -1816,7 +1816,7 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
{
hOldCursor = SetCursor(hDragCursor);
ShowCursor( TRUE );
WINPOS_ShowIconTitle( wndPtr, FALSE );
WINPOS_ShowIconTitle( hwnd, FALSE );
}
else if(!DragFullWindows)
draw_moving_frame( hdc, &sizingRect, thickframe );
@ -1934,7 +1934,7 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
SendMessageA( hwnd, WM_SYSCOMMAND,
SC_MOUSEMENU + HTSYSMENU, MAKELONG(pt.x,pt.y));
}
else WINPOS_ShowIconTitle( wndPtr, TRUE );
else WINPOS_ShowIconTitle( hwnd, TRUE );
}
END:

View File

@ -9,19 +9,17 @@
#include "windef.h"
struct tagWND;
extern LONG NC_HandleNCPaint( HWND hwnd , HRGN clip);
extern LONG NC_HandleNCActivate( struct tagWND *pwnd, WPARAM wParam );
extern LONG NC_HandleNCCalcSize( struct tagWND *pWnd, RECT *winRect );
extern LONG NC_HandleNCHitTest( HWND hwnd, POINT pt );
extern LONG NC_HandleNCLButtonDown( struct tagWND* pWnd, WPARAM wParam, LPARAM lParam );
extern LONG NC_HandleNCLButtonDblClk( struct tagWND *pWnd, WPARAM wParam, LPARAM lParam);
extern LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT pt );
extern LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam );
extern void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down );
extern LONG NC_HandleNCPaint( HWND hwnd , HRGN clip);
extern LONG NC_HandleNCActivate( HWND hwnd, WPARAM wParam );
extern LONG NC_HandleNCCalcSize( HWND hwnd, RECT *winRect );
extern LONG NC_HandleNCHitTest( HWND hwnd, POINT pt );
extern LONG NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam );
extern LONG NC_HandleNCLButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam);
extern LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT pt );
extern LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam );
extern void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down );
extern BOOL NC_DrawSysButton95( HWND hwnd, HDC hdc, BOOL down );
extern BOOL NC_GetSysPopupPos( struct tagWND* wndPtr, RECT* rect );
extern void NC_GetSysPopupPos( HWND hwnd, RECT* rect );
extern void NC_GetInsideRect( HWND hwnd, RECT *rect );
#endif /* __WINE_NONCLIENT_H */

View File

@ -12,8 +12,6 @@
#include "wingdi.h"
#include "winuser.h"
struct tagWND;
/* undocumented SWP flags - from SDK 3.1 */
#define SWP_NOCLIENTSIZE 0x0800
#define SWP_NOCLIENTMOVE 0x1000
@ -24,10 +22,9 @@ struct tagWND;
struct tagWINDOWPOS16;
extern BOOL WINPOS_RedrawIconTitle( HWND hWnd );
extern BOOL WINPOS_ShowIconTitle( struct tagWND* pWnd, BOOL bShow );
extern void WINPOS_GetMinMaxInfo( struct tagWND* pWnd, POINT *maxSize,
POINT *maxPos, POINT *minTrack,
POINT *maxTrack );
extern BOOL WINPOS_ShowIconTitle( HWND hwnd, BOOL bShow );
extern void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, POINT *minTrack,
POINT *maxTrack );
extern BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse,
BOOL fChangeFocus );
extern BOOL WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg );
@ -35,11 +32,11 @@ extern LONG WINPOS_SendNCCalcSize(HWND hwnd, BOOL calcValidRect,
RECT *newWindowRect, RECT *oldWindowRect,
RECT *oldClientRect, WINDOWPOS *winpos,
RECT *newClientRect );
extern LONG WINPOS_HandleWindowPosChanging16(struct tagWND *wndPtr, struct tagWINDOWPOS16 *winpos);
extern LONG WINPOS_HandleWindowPosChanging(struct tagWND *wndPtr, WINDOWPOS *winpos);
extern LONG WINPOS_HandleWindowPosChanging16(HWND hwnd, struct tagWINDOWPOS16 *winpos);
extern LONG WINPOS_HandleWindowPosChanging(HWND hwnd, WINDOWPOS *winpos);
extern HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest );
extern void WINPOS_CheckInternalPos( struct tagWND* wndPtr );
extern BOOL WINPOS_ActivateOtherWindow(struct tagWND* pWnd);
extern void WINPOS_CheckInternalPos( HWND hwnd );
extern BOOL WINPOS_ActivateOtherWindow( HWND hwnd );
extern BOOL WINPOS_CreateInternalPosAtom(void);
#endif /* __WINE_WINPOS_H */

View File

@ -29,7 +29,6 @@ struct tagCURSORICONINFO;
struct tagDC;
struct tagDeviceCaps;
struct tagPALETTEOBJ;
struct tagWND;
struct tagWINDOWPOS;
struct DIDEVICEOBJECTDATA;
@ -367,8 +366,6 @@ extern INT16 X11DRV_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize);
extern BOOL X11DRV_GetDIState(DWORD len, LPVOID ptr);
extern BOOL X11DRV_GetDIData(BYTE *keystate, DWORD dodsize, struct DIDEVICEOBJECTDATA *dod, LPDWORD entries, DWORD flags);
extern void X11DRV_HandleEvent(struct tagWND *pWnd, XKeyEvent *event);
/* X11 mouse driver */
extern void X11DRV_InitMouse(LPMOUSE_EVENT_PROC);

View File

@ -307,11 +307,11 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
}
case WM_NCLBUTTONDOWN:
return NC_HandleNCLButtonDown( wndPtr, wParam, lParam );
return NC_HandleNCLButtonDown( wndPtr->hwndSelf, wParam, lParam );
case WM_LBUTTONDBLCLK:
case WM_NCLBUTTONDBLCLK:
return NC_HandleNCLButtonDblClk( wndPtr, wParam, lParam );
return NC_HandleNCLButtonDblClk( wndPtr->hwndSelf, wParam, lParam );
case WM_NCRBUTTONDOWN:
/* in Windows, capture is taken when right-clicking on the caption bar */
@ -376,7 +376,7 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
break;
case WM_NCACTIVATE:
return NC_HandleNCActivate( wndPtr, wParam );
return NC_HandleNCActivate( wndPtr->hwndSelf, wParam );
case WM_NCDESTROY:
if (wndPtr->text) HeapFree( GetProcessHeap(), 0, wndPtr->text );
@ -674,13 +674,13 @@ LRESULT WINAPI DefWindowProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam,
{
RECT rect32;
CONV_RECT16TO32( MapSL(lParam), &rect32 );
result = NC_HandleNCCalcSize( wndPtr, &rect32 );
result = NC_HandleNCCalcSize( hwnd, &rect32 );
CONV_RECT32TO16( &rect32, MapSL(lParam) );
}
break;
case WM_WINDOWPOSCHANGING:
result = WINPOS_HandleWindowPosChanging16( wndPtr, MapSL(lParam) );
result = WINPOS_HandleWindowPosChanging16( hwnd, MapSL(lParam) );
break;
case WM_WINDOWPOSCHANGED:
@ -751,12 +751,11 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam,
break;
case WM_NCCALCSIZE:
result = NC_HandleNCCalcSize( wndPtr, (RECT *)lParam );
result = NC_HandleNCCalcSize( hwnd, (RECT *)lParam );
break;
case WM_WINDOWPOSCHANGING:
result = WINPOS_HandleWindowPosChanging( wndPtr,
(WINDOWPOS *)lParam );
result = WINPOS_HandleWindowPosChanging( hwnd, (WINDOWPOS *)lParam );
break;
case WM_WINDOWPOSCHANGED:
@ -875,12 +874,11 @@ LRESULT WINAPI DefWindowProcW(
break;
case WM_NCCALCSIZE:
result = NC_HandleNCCalcSize( wndPtr, (RECT *)lParam );
result = NC_HandleNCCalcSize( hwnd, (RECT *)lParam );
break;
case WM_WINDOWPOSCHANGING:
result = WINPOS_HandleWindowPosChanging( wndPtr,
(WINDOWPOS *)lParam );
result = WINPOS_HandleWindowPosChanging( hwnd, (WINDOWPOS *)lParam );
break;
case WM_WINDOWPOSCHANGED:

View File

@ -1309,7 +1309,7 @@ static LRESULT WINAPI MDIClientWndProc_locked( WND *wndPtr, UINT message,
AppendMenuW( ci->hWindowMenu, MF_SEPARATOR, 0, NULL );
GetClientRect(frameWnd->hwndSelf, &rect);
NC_HandleNCCalcSize( wndPtr, &rect );
NC_HandleNCCalcSize( wndPtr->hwndSelf, &rect );
wndPtr->rectClient = rect;
TRACE("Client created - hwnd = %04x, idFirst = %u\n",
@ -2270,8 +2270,8 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll )
SetScrollInfo(hwnd, scroll, &info, TRUE);
break;
case SB_BOTH:
SCROLL_SetNCSbState( Wnd, vmin, vmax, vpos,
hmin, hmax, hpos);
SCROLL_SetNCSbState( Wnd->hwndSelf, vmin, vmax, vpos,
hmin, hmax, hpos);
}
WIN_ReleaseWndPtr(Wnd);
}

View File

@ -495,41 +495,45 @@ BOOL WINAPI AdjustWindowRectEx( LPRECT rect, DWORD style, BOOL menu, DWORD exSty
*
* Handle a WM_NCCALCSIZE message. Called from DefWindowProc().
*/
LONG NC_HandleNCCalcSize( WND *pWnd, RECT *winRect )
LONG NC_HandleNCCalcSize( HWND hwnd, RECT *winRect )
{
RECT tmpRect = { 0, 0, 0, 0 };
LONG result = 0;
UINT style = (UINT) GetClassLongA(pWnd->hwndSelf, GCL_STYLE);
LONG cls_style = GetClassLongA(hwnd, GCL_STYLE);
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
LONG exStyle = GetWindowLongA( hwnd, GWL_EXSTYLE );
if (style & CS_VREDRAW) result |= WVR_VREDRAW;
if (style & CS_HREDRAW) result |= WVR_HREDRAW;
if (cls_style & CS_VREDRAW) result |= WVR_VREDRAW;
if (cls_style & CS_HREDRAW) result |= WVR_HREDRAW;
if( !( pWnd->dwStyle & WS_MINIMIZE ) ) {
if (!IsIconic(hwnd))
{
if (TWEAK_WineLook == WIN31_LOOK)
NC_AdjustRect( &tmpRect, pWnd->dwStyle, FALSE, pWnd->dwExStyle );
NC_AdjustRect( &tmpRect, style, FALSE, exStyle );
else
NC_AdjustRectOuter95( &tmpRect, pWnd->dwStyle, FALSE, pWnd->dwExStyle );
NC_AdjustRectOuter95( &tmpRect, style, FALSE, exStyle );
winRect->left -= tmpRect.left;
winRect->top -= tmpRect.top;
winRect->right -= tmpRect.right;
winRect->bottom -= tmpRect.bottom;
if (HAS_MENU(pWnd)) {
if (!(style & WS_CHILD) && GetMenu(hwnd))
{
TRACE("Calling GetMenuBarHeight with HWND 0x%x, width %d, "
"at (%d, %d).\n", pWnd->hwndSelf,
"at (%d, %d).\n", hwnd,
winRect->right - winRect->left,
-tmpRect.left, -tmpRect.top );
winRect->top +=
MENU_GetMenuBarHeight( pWnd->hwndSelf,
MENU_GetMenuBarHeight( hwnd,
winRect->right - winRect->left,
-tmpRect.left, -tmpRect.top ) + 1;
}
if (TWEAK_WineLook > WIN31_LOOK) {
SetRect(&tmpRect, 0, 0, 0, 0);
NC_AdjustRectInner95 (&tmpRect, pWnd->dwStyle, pWnd->dwExStyle);
NC_AdjustRectInner95 (&tmpRect, style, exStyle);
winRect->left -= tmpRect.left;
winRect->top -= tmpRect.top;
winRect->right -= tmpRect.right;
@ -1693,23 +1697,26 @@ LONG NC_HandleNCPaint( HWND hwnd , HRGN clip)
*
* Handle a WM_NCACTIVATE message. Called from DefWindowProc().
*/
LONG NC_HandleNCActivate( WND *wndPtr, WPARAM wParam )
LONG NC_HandleNCActivate( HWND hwnd, WPARAM wParam )
{
WND* wndPtr = WIN_FindWndPtr( hwnd );
/* Lotus Notes draws menu descriptions in the caption of its main
* window. When it wants to restore original "system" view, it just
* sends WM_NCACTIVATE message to itself. Any optimizations here in
* attempt to minimize redrawings lead to a not restored caption.
*/
if (wndPtr)
{
if (wParam) wndPtr->flags |= WIN_NCACTIVATED;
else wndPtr->flags &= ~WIN_NCACTIVATED;
if( wndPtr->dwStyle & WS_MINIMIZE )
WINPOS_RedrawIconTitle( wndPtr->hwndSelf );
if (IsIconic(hwnd)) WINPOS_RedrawIconTitle( hwnd );
else if (TWEAK_WineLook == WIN31_LOOK)
NC_DoNCPaint( wndPtr, (HRGN)1, FALSE );
else
NC_DoNCPaint95( wndPtr, (HRGN)1, FALSE );
WIN_ReleaseWndPtr(wndPtr);
}
return TRUE;
}
@ -1769,30 +1776,28 @@ LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam )
/***********************************************************************
* NC_GetSysPopupPos
*/
BOOL NC_GetSysPopupPos( WND* wndPtr, RECT* rect )
void NC_GetSysPopupPos( HWND hwnd, RECT* rect )
{
if( wndPtr->hSysMenu )
{
if( wndPtr->dwStyle & WS_MINIMIZE )
GetWindowRect( wndPtr->hwndSelf, rect );
else
{
NC_GetInsideRect( wndPtr->hwndSelf, rect );
OffsetRect( rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top);
if (wndPtr->dwStyle & WS_CHILD)
ClientToScreen( wndPtr->parent->hwndSelf, (POINT *)rect );
if (TWEAK_WineLook == WIN31_LOOK) {
if (IsIconic(hwnd)) GetWindowRect( hwnd, rect );
else
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return;
NC_GetInsideRect( hwnd, rect );
OffsetRect( rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top);
if (wndPtr->dwStyle & WS_CHILD)
ClientToScreen( wndPtr->parent->hwndSelf, (POINT *)rect );
if (TWEAK_WineLook == WIN31_LOOK) {
rect->right = rect->left + GetSystemMetrics(SM_CXSIZE);
rect->bottom = rect->top + GetSystemMetrics(SM_CYSIZE);
}
else {
}
else {
rect->right = rect->left + GetSystemMetrics(SM_CYCAPTION) - 1;
rect->bottom = rect->top + GetSystemMetrics(SM_CYCAPTION) - 1;
}
}
return TRUE;
}
return FALSE;
}
WIN_ReleaseWndPtr( wndPtr );
}
}
/***********************************************************************
@ -2052,23 +2057,25 @@ END:
*
* Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
*/
LONG NC_HandleNCLButtonDown( WND* pWnd, WPARAM wParam, LPARAM lParam )
LONG NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam )
{
HWND hwnd = pWnd->hwndSelf;
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
switch(wParam) /* Hit test */
{
case HTCAPTION:
hwnd = WIN_GetTopParent(hwnd);
{
HWND top = WIN_GetTopParent(hwnd);
if( WINPOS_SetActiveWindow(hwnd, TRUE, TRUE) || (GetActiveWindow() == hwnd) )
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, lParam );
break;
if( WINPOS_SetActiveWindow(top, TRUE, TRUE) || (GetActiveWindow() == top) )
SendMessageW( hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, lParam );
break;
}
case HTSYSMENU:
if( pWnd->dwStyle & WS_SYSMENU )
if( style & WS_SYSMENU )
{
if( !(pWnd->dwStyle & WS_MINIMIZE) )
if( !(style & WS_MINIMIZE) )
{
HDC hDC = GetWindowDC(hwnd);
if (TWEAK_WineLook == WIN31_LOOK)
@ -2130,15 +2137,15 @@ LONG NC_HandleNCLButtonDown( WND* pWnd, WPARAM wParam, LPARAM lParam )
*
* Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
*/
LONG NC_HandleNCLButtonDblClk( WND *pWnd, WPARAM wParam, LPARAM lParam )
LONG NC_HandleNCLButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam )
{
/*
* if this is an icon, send a restore since we are handling
* a double click
*/
if (pWnd->dwStyle & WS_MINIMIZE)
if (IsIconic(hwnd))
{
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND, SC_RESTORE, lParam );
SendMessageW( hwnd, WM_SYSCOMMAND, SC_RESTORE, lParam );
return 0;
}
@ -2146,22 +2153,22 @@ LONG NC_HandleNCLButtonDblClk( WND *pWnd, WPARAM wParam, LPARAM lParam )
{
case HTCAPTION:
/* stop processing if WS_MAXIMIZEBOX is missing */
if (pWnd->dwStyle & WS_MAXIMIZEBOX)
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND,
(pWnd->dwStyle & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE, lParam );
if (GetWindowLongA( hwnd, GWL_STYLE ) & WS_MAXIMIZEBOX)
SendMessageW( hwnd, WM_SYSCOMMAND,
IsZoomed(hwnd) ? SC_RESTORE : SC_MAXIMIZE, lParam );
break;
case HTSYSMENU:
if (!(GetClassWord(pWnd->hwndSelf, GCW_STYLE) & CS_NOCLOSE))
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND, SC_CLOSE, lParam );
if (!(GetClassWord(hwnd, GCW_STYLE) & CS_NOCLOSE))
SendMessageW( hwnd, WM_SYSCOMMAND, SC_CLOSE, lParam );
break;
case HTHSCROLL:
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND, SC_HSCROLL + HTHSCROLL, lParam );
SendMessageW( hwnd, WM_SYSCOMMAND, SC_HSCROLL + HTHSCROLL, lParam );
break;
case HTVSCROLL:
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND, SC_VSCROLL + HTVSCROLL, lParam );
SendMessageW( hwnd, WM_SYSCOMMAND, SC_VSCROLL + HTVSCROLL, lParam );
break;
}
return 0;
@ -2219,11 +2226,11 @@ LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT pt )
break;
case SC_MOUSEMENU:
MENU_TrackMouseMenuBar( wndPtr, wParam & 0x000F, pt );
MENU_TrackMouseMenuBar( hwnd, wParam & 0x000F, pt );
break;
case SC_KEYMENU:
MENU_TrackKbdMenuBar( wndPtr , wParam , pt.x );
MENU_TrackKbdMenuBar( hwnd, wParam , pt.x );
break;
case SC_TASKLIST:

View File

@ -438,7 +438,7 @@ static WND* WIN_DestroyWindow( WND* wndPtr )
/* FIXME: do we need to fake QS_MOUSEMOVE wakebit? */
WINPOS_CheckInternalPos( wndPtr );
WINPOS_CheckInternalPos( hwnd );
if( hwnd == GetCapture()) ReleaseCapture();
/* free resources associated with the window */
@ -844,7 +844,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
{
WINPOS_GetMinMaxInfo( wndPtr, &maxSize, &maxPos, &minTrack, &maxTrack);
WINPOS_GetMinMaxInfo( hwnd, &maxSize, &maxPos, &minTrack, &maxTrack);
if (maxSize.x < cs->cx) cs->cx = maxSize.x;
if (maxSize.y < cs->cy) cs->cy = maxSize.y;
if (cs->cx < minTrack.x ) cs->cx = minTrack.x;
@ -1321,7 +1321,7 @@ BOOL WINAPI DestroyWindow( HWND hwnd )
else break;
}
WINPOS_ActivateOtherWindow(wndPtr);
WINPOS_ActivateOtherWindow(wndPtr->hwndSelf);
if( wndPtr->owner &&
wndPtr->owner->hwndLastActive == wndPtr->hwndSelf )

View File

@ -79,11 +79,11 @@ BOOL WINPOS_CreateInternalPosAtom()
*
* Called when a window is destroyed.
*/
void WINPOS_CheckInternalPos( WND* wndPtr )
void WINPOS_CheckInternalPos( HWND hwnd )
{
LPINTERNALPOS lpPos;
MESSAGEQUEUE *pMsgQ = 0;
HWND hwnd = wndPtr->hwndSelf;
WND *wndPtr = WIN_FindWndPtr( hwnd );
lpPos = (LPINTERNALPOS) GetPropA( hwnd, atomInternalPos );
@ -92,6 +92,7 @@ void WINPOS_CheckInternalPos( WND* wndPtr )
if ( !pMsgQ )
{
WARN("\tMessage queue not found. Exiting!\n" );
WIN_ReleaseWndPtr( wndPtr );
return;
}
@ -111,6 +112,7 @@ void WINPOS_CheckInternalPos( WND* wndPtr )
}
QUEUE_Unlock( pMsgQ );
WIN_ReleaseWndPtr( wndPtr );
return;
}
@ -141,16 +143,13 @@ UINT WINAPI ArrangeIconicWindows( HWND parent )
{
if( IsIconic( hwndChild ) )
{
WND *wndPtr = WIN_FindWndPtr(hwndChild);
WINPOS_ShowIconTitle( wndPtr, FALSE );
WINPOS_ShowIconTitle( hwndChild, FALSE );
SetWindowPos( hwndChild, 0, x + (xspacing - GetSystemMetrics(SM_CXICON)) / 2,
y - yspacing - GetSystemMetrics(SM_CYICON)/2, 0, 0,
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
if( IsWindow(hwndChild) )
WINPOS_ShowIconTitle(wndPtr , TRUE );
WIN_ReleaseWndPtr(wndPtr);
WINPOS_ShowIconTitle(hwndChild , TRUE );
if (x <= rectParent.right - xspacing) x += xspacing;
else
@ -1050,32 +1049,28 @@ BOOL WINPOS_RedrawIconTitle( HWND hWnd )
/***********************************************************************
* WINPOS_ShowIconTitle
*/
BOOL WINPOS_ShowIconTitle( WND* pWnd, BOOL bShow )
BOOL WINPOS_ShowIconTitle( HWND hwnd, BOOL bShow )
{
LPINTERNALPOS lpPos = (LPINTERNALPOS)GetPropA( pWnd->hwndSelf, atomInternalPos );
LPINTERNALPOS lpPos = (LPINTERNALPOS)GetPropA( hwnd, atomInternalPos );
if( lpPos && !(pWnd->dwExStyle & WS_EX_MANAGED))
if( lpPos && !(GetWindowLongA( hwnd, GWL_EXSTYLE) & WS_EX_MANAGED))
{
HWND16 hWnd = lpPos->hwndIconTitle;
HWND title = lpPos->hwndIconTitle;
TRACE("0x%04x %i\n", pWnd->hwndSelf, (bShow != 0) );
TRACE("0x%04x %i\n", hwnd, (bShow != 0) );
if( !hWnd )
lpPos->hwndIconTitle = hWnd = ICONTITLE_Create( pWnd );
if( !title )
lpPos->hwndIconTitle = title = ICONTITLE_Create( hwnd );
if( bShow )
{
if( ( pWnd = WIN_FindWndPtr(hWnd) ) != NULL)
{
if( !(pWnd->dwStyle & WS_VISIBLE) )
{
SendMessageA( hWnd, WM_SHOWWINDOW, TRUE, 0 );
SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW );
}
WIN_ReleaseWndPtr(pWnd);
}
if (!IsWindowVisible(title))
{
SendMessageA( title, WM_SHOWWINDOW, TRUE, 0 );
SetWindowPos( title, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW );
}
}
else ShowWindow( hWnd, SW_HIDE );
else ShowWindow( title, SW_HIDE );
}
return FALSE;
}
@ -1085,12 +1080,14 @@ BOOL WINPOS_ShowIconTitle( WND* pWnd, BOOL bShow )
*
* Get the minimized and maximized information for a window.
*/
void WINPOS_GetMinMaxInfo( WND *wndPtr, POINT *maxSize, POINT *maxPos,
void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos,
POINT *minTrack, POINT *maxTrack )
{
LPINTERNALPOS lpPos;
MINMAXINFO MinMax;
INT xinc, yinc;
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
LONG exstyle = GetWindowLongA( hwnd, GWL_EXSTYLE );
/* Compute default values */
@ -1101,7 +1098,7 @@ void WINPOS_GetMinMaxInfo( WND *wndPtr, POINT *maxSize, POINT *maxPos,
MinMax.ptMaxTrackSize.x = GetSystemMetrics(SM_CXSCREEN);
MinMax.ptMaxTrackSize.y = GetSystemMetrics(SM_CYSCREEN);
if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
if (HAS_DLGFRAME( style, exstyle ))
{
xinc = GetSystemMetrics(SM_CXDLGFRAME);
yinc = GetSystemMetrics(SM_CYDLGFRAME);
@ -1109,12 +1106,12 @@ void WINPOS_GetMinMaxInfo( WND *wndPtr, POINT *maxSize, POINT *maxPos,
else
{
xinc = yinc = 0;
if (HAS_THICKFRAME(wndPtr->dwStyle))
if (HAS_THICKFRAME(style))
{
xinc += GetSystemMetrics(SM_CXFRAME);
yinc += GetSystemMetrics(SM_CYFRAME);
}
if (wndPtr->dwStyle & WS_BORDER)
if (style & WS_BORDER)
{
xinc += GetSystemMetrics(SM_CXBORDER);
yinc += GetSystemMetrics(SM_CYBORDER);
@ -1123,7 +1120,7 @@ void WINPOS_GetMinMaxInfo( WND *wndPtr, POINT *maxSize, POINT *maxPos,
MinMax.ptMaxSize.x += 2 * xinc;
MinMax.ptMaxSize.y += 2 * yinc;
lpPos = (LPINTERNALPOS)GetPropA( wndPtr->hwndSelf, atomInternalPos );
lpPos = (LPINTERNALPOS)GetPropA( hwnd, atomInternalPos );
if( lpPos && !EMPTYPOINT(lpPos->ptMaxPos) )
CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition );
else
@ -1132,7 +1129,7 @@ void WINPOS_GetMinMaxInfo( WND *wndPtr, POINT *maxSize, POINT *maxPos,
MinMax.ptMaxPosition.y = -yinc;
}
SendMessageA( wndPtr->hwndSelf, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax );
SendMessageA( hwnd, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax );
/* Some sanity checks */
@ -1292,7 +1289,7 @@ static BOOL WINPOS_SetPlacement( HWND hwnd, const WINDOWPLACEMENT16 *wndpl,
if( pWnd->dwStyle & WS_MINIMIZE )
{
WINPOS_ShowIconTitle( pWnd, FALSE );
WINPOS_ShowIconTitle( pWnd->hwndSelf, FALSE );
if( wndpl->flags & WPF_SETMINPOSITION && !EMPTYPOINT(lpPos->ptIconPos))
SetWindowPos( hwnd, 0, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
@ -1312,7 +1309,7 @@ static BOOL WINPOS_SetPlacement( HWND hwnd, const WINDOWPLACEMENT16 *wndpl,
ShowWindow( hwnd, wndpl->showCmd );
if( IsWindow(hwnd) && pWnd->dwStyle & WS_MINIMIZE )
{
if( pWnd->dwStyle & WS_VISIBLE ) WINPOS_ShowIconTitle( pWnd, TRUE );
if( pWnd->dwStyle & WS_VISIBLE ) WINPOS_ShowIconTitle( pWnd->hwndSelf, TRUE );
/* SDK: ...valid only the next time... */
if( wndpl->flags & WPF_RESTORETOMAXIMIZED ) pWnd->flags |= WIN_RESTORE_MAX;
@ -1680,11 +1677,11 @@ CLEANUP_END:
*
* Activates window other than pWnd.
*/
BOOL WINPOS_ActivateOtherWindow(WND* pWnd)
BOOL WINPOS_ActivateOtherWindow(HWND hwnd)
{
BOOL bRet = 0;
WND* pWndTo = NULL;
HWND hwndActive = 0;
BOOL bRet = 0;
WND *pWnd, *pWndTo = NULL;
HWND hwndActive = 0;
/* Get current active window from the active queue */
if ( hActiveQueue )
@ -1697,37 +1694,42 @@ BOOL WINPOS_ActivateOtherWindow(WND* pWnd)
}
}
if( pWnd->hwndSelf == hwndPrevActive )
hwndPrevActive = 0;
if( hwnd == hwndPrevActive )
hwndPrevActive = 0;
if( hwndActive != pWnd->hwndSelf &&
( hwndActive || QUEUE_IsExitingQueue(pWnd->hmemTaskQ)) )
return 0;
pWnd = WIN_FindWndPtr( hwnd );
if( hwndActive != hwnd &&
( hwndActive || QUEUE_IsExitingQueue(pWnd->hmemTaskQ)) )
{
WIN_ReleaseWndPtr( pWnd );
return 0;
}
if( !(pWnd->dwStyle & WS_POPUP) || !(pWnd->owner) ||
!WINPOS_CanActivate((pWndTo = WIN_GetTopParentPtr(pWnd->owner))) )
{
WND* pWndPtr = WIN_GetTopParentPtr(pWnd);
if( !(pWnd->dwStyle & WS_POPUP) || !(pWnd->owner) ||
!WINPOS_CanActivate((pWndTo = WIN_GetTopParentPtr(pWnd->owner))) )
{
WND* pWndPtr = WIN_GetTopParentPtr(pWnd);
WIN_ReleaseWndPtr(pWndTo);
pWndTo = WIN_FindWndPtr(hwndPrevActive);
WIN_ReleaseWndPtr(pWndTo);
pWndTo = WIN_FindWndPtr(hwndPrevActive);
while( !WINPOS_CanActivate(pWndTo) )
{
/* by now owned windows should've been taken care of */
WIN_UpdateWndPtr(&pWndTo,pWndPtr->next);
WIN_UpdateWndPtr(&pWndPtr,pWndTo);
if( !pWndTo ) break;
}
WIN_ReleaseWndPtr(pWndPtr);
}
while( !WINPOS_CanActivate(pWndTo) )
{
/* by now owned windows should've been taken care of */
WIN_UpdateWndPtr(&pWndTo,pWndPtr->next);
WIN_UpdateWndPtr(&pWndPtr,pWndTo);
if( !pWndTo ) break;
}
WIN_ReleaseWndPtr(pWndPtr);
}
WIN_ReleaseWndPtr( pWnd );
bRet = WINPOS_SetActiveWindow( pWndTo ? pWndTo->hwndSelf : 0, FALSE, TRUE );
bRet = WINPOS_SetActiveWindow( pWndTo ? pWndTo->hwndSelf : 0, FALSE, TRUE );
if( pWndTo ) WIN_ReleaseWndPtr(pWndTo);
if( pWndTo ) WIN_ReleaseWndPtr(pWndTo);
hwndPrevActive = 0;
return bRet;
hwndPrevActive = 0;
return bRet;
}
/*******************************************************************
@ -1827,17 +1829,18 @@ LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect,
*
* Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
*/
LONG WINPOS_HandleWindowPosChanging16( WND *wndPtr, WINDOWPOS16 *winpos )
LONG WINPOS_HandleWindowPosChanging16( HWND hwnd, WINDOWPOS16 *winpos )
{
POINT maxSize, minTrack;
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
if (winpos->flags & SWP_NOSIZE) return 0;
if ((wndPtr->dwStyle & WS_THICKFRAME) ||
((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) == 0))
if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0))
{
WINPOS_GetMinMaxInfo( wndPtr, &maxSize, NULL, &minTrack, NULL );
WINPOS_GetMinMaxInfo( hwnd, &maxSize, NULL, &minTrack, NULL );
if (maxSize.x < winpos->cx) winpos->cx = maxSize.x;
if (maxSize.y < winpos->cy) winpos->cy = maxSize.y;
if (!(wndPtr->dwStyle & WS_MINIMIZE))
if (!(style & WS_MINIMIZE))
{
if (winpos->cx < minTrack.x ) winpos->cx = minTrack.x;
if (winpos->cy < minTrack.y ) winpos->cy = minTrack.y;
@ -1852,17 +1855,18 @@ LONG WINPOS_HandleWindowPosChanging16( WND *wndPtr, WINDOWPOS16 *winpos )
*
* Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
*/
LONG WINPOS_HandleWindowPosChanging( WND *wndPtr, WINDOWPOS *winpos )
LONG WINPOS_HandleWindowPosChanging( HWND hwnd, WINDOWPOS *winpos )
{
POINT maxSize, minTrack;
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
if (winpos->flags & SWP_NOSIZE) return 0;
if ((wndPtr->dwStyle & WS_THICKFRAME) ||
((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) == 0))
if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0))
{
WINPOS_GetMinMaxInfo( wndPtr, &maxSize, NULL, &minTrack, NULL );
WINPOS_GetMinMaxInfo( hwnd, &maxSize, NULL, &minTrack, NULL );
winpos->cx = min( winpos->cx, maxSize.x );
winpos->cy = min( winpos->cy, maxSize.y );
if (!(wndPtr->dwStyle & WS_MINIMIZE))
if (!(style & WS_MINIMIZE))
{
if (winpos->cx < minTrack.x ) winpos->cx = minTrack.x;
if (winpos->cy < minTrack.y ) winpos->cy = minTrack.y;