Commit 4ff32c8a authored by Alexandre Julliard's avatar Alexandre Julliard

Removed a number of direct accesses to the window structure.

parent a3d3d405
......@@ -73,4 +73,3 @@ debug_channels (ttydrv)
@ cdecl IsClipboardFormatAvailable(long) TTYDRV_IsClipboardFormatAvailable
@ cdecl RegisterClipboardFormat(str) TTYDRV_RegisterClipboardFormat
@ cdecl IsSelectionOwner() TTYDRV_IsSelectionOwner
@ cdecl ResetSelectionOwner(ptr long) TTYDRV_ResetSelectionOwner
......@@ -212,10 +212,3 @@ BOOL TTYDRV_IsSelectionOwner(void)
{
return FALSE;
}
/***********************************************************************
* ResetSelectionOwner (TTYDRV.@)
*/
void TTYDRV_ResetSelectionOwner(struct tagWND *pWnd, BOOL bFooBar)
{
}
......@@ -28,7 +28,6 @@ LRESULT WINAPI SendMessage16( HWND16 hwnd, UINT16 msg, WPARAM16 wparam, LPARAM l
GetWindowThreadProcessId( hwnd, NULL ) == GetCurrentThreadId())
{
/* call 16-bit window proc directly */
WND *wndPtr;
WNDPROC16 winproc;
/* first the WH_CALLWNDPROC hook */
......@@ -51,13 +50,7 @@ LRESULT WINAPI SendMessage16( HWND16 hwnd, UINT16 msg, WPARAM16 wparam, LPARAM l
}
}
if (!(wndPtr = WIN_FindWndPtr( hwnd )))
{
WARN("invalid hwnd %04x\n", hwnd );
return 0;
}
winproc = (WNDPROC16)wndPtr->winproc;
WIN_ReleaseWndPtr( wndPtr );
if (!(winproc = (WNDPROC16)GetWindowLong16( hwnd, GWL_WNDPROC ))) return 0;
SPY_EnterMessage( SPY_SENDMESSAGE16, hwnd, msg, wparam, lparam );
result = CallWindowProc16( (WNDPROC16)winproc, hwnd, msg, wparam, lparam );
......
......@@ -1567,25 +1567,25 @@ static void draw_moving_frame( HDC hdc, RECT *rect, BOOL thickframe )
* Initialisation of a move or resize, when initiatied from a menu choice.
* Return hit test code for caption or sizing border.
*/
static LONG start_size_move( WND* wndPtr, WPARAM wParam, POINT *capturePoint )
static LONG start_size_move( HWND hwnd, WPARAM wParam, POINT *capturePoint, LONG style )
{
LONG hittest = 0;
POINT pt;
MSG msg;
RECT rectWindow;
GetWindowRect(wndPtr->hwndSelf,&rectWindow);
GetWindowRect( hwnd, &rectWindow );
if ((wParam & 0xfff0) == SC_MOVE)
{
/* Move pointer at the center of the caption */
RECT rect;
NC_GetInsideRect( wndPtr->hwndSelf, &rect );
if (wndPtr->dwStyle & WS_SYSMENU)
NC_GetInsideRect( hwnd, &rect );
if (style & WS_SYSMENU)
rect.left += GetSystemMetrics(SM_CXSIZE) + 1;
if (wndPtr->dwStyle & WS_MINIMIZEBOX)
if (style & WS_MINIMIZEBOX)
rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
if (wndPtr->dwStyle & WS_MAXIMIZEBOX)
if (style & WS_MAXIMIZEBOX)
rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
pt.x = rectWindow.left + (rect.right - rect.left) / 2;
pt.y = rectWindow.top + rect.top + GetSystemMetrics(SM_CYSIZE)/2;
......@@ -1602,7 +1602,7 @@ static LONG start_size_move( WND* wndPtr, WPARAM wParam, POINT *capturePoint )
switch(msg.message)
{
case WM_MOUSEMOVE:
hittest = NC_HandleNCHitTest( wndPtr->hwndSelf, msg.pt );
hittest = NC_HandleNCHitTest( hwnd, msg.pt );
if ((hittest < HTLEFT) || (hittest > HTBOTTOMRIGHT))
hittest = 0;
break;
......@@ -1641,8 +1641,7 @@ static LONG start_size_move( WND* wndPtr, WPARAM wParam, POINT *capturePoint )
*capturePoint = pt;
}
SetCursorPos( pt.x, pt.y );
NC_HandleSetCursor( wndPtr->hwndSelf,
wndPtr->hwndSelf, MAKELONG( hittest, WM_MOUSEMOVE ));
NC_HandleSetCursor( hwnd, hwnd, MAKELONG( hittest, WM_MOUSEMOVE ));
return hittest;
}
......@@ -1657,13 +1656,15 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
MSG msg;
RECT sizingRect, mouseRect, origRect;
HDC hdc;
HWND parent;
LONG hittest = (LONG)(wParam & 0x0f);
HCURSOR16 hDragCursor = 0, hOldCursor = 0;
POINT minTrack, maxTrack;
POINT capturePoint, pt;
WND * wndPtr = WIN_FindWndPtr( hwnd );
BOOL thickframe = HAS_THICKFRAME( wndPtr->dwStyle, wndPtr->dwExStyle );
BOOL iconic = wndPtr->dwStyle & WS_MINIMIZE;
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
LONG exstyle = GetWindowLongA( hwnd, GWL_EXSTYLE );
BOOL thickframe = HAS_THICKFRAME( style, exstyle );
BOOL iconic = style & WS_MINIMIZE;
BOOL moved = FALSE;
DWORD dwPoint = GetMessagePos ();
BOOL DragFullWindows = FALSE;
......@@ -1678,26 +1679,25 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
pt.y = SHIWORD(dwPoint);
capturePoint = pt;
if (IsZoomed(hwnd) || !IsWindowVisible(hwnd) ||
(wndPtr->dwExStyle & WS_EX_MANAGED)) goto END;
if (IsZoomed(hwnd) || !IsWindowVisible(hwnd) || (exstyle & WS_EX_MANAGED)) return;
if ((wParam & 0xfff0) == SC_MOVE)
{
if (!hittest) hittest = start_size_move( wndPtr, wParam, &capturePoint );
if (!hittest) goto END;
if (!hittest) hittest = start_size_move( hwnd, wParam, &capturePoint, style );
if (!hittest) return;
}
else /* SC_SIZE */
{
if (!thickframe) goto END;
if (!thickframe) return;
if ( hittest && hittest != HTSYSMENU ) hittest += 2;
else
{
SetCapture(hwnd);
hittest = start_size_move( wndPtr, wParam, &capturePoint );
hittest = start_size_move( hwnd, wParam, &capturePoint, style );
if (!hittest)
{
ReleaseCapture();
goto END;
return;
}
}
}
......@@ -1705,12 +1705,21 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
/* Get min/max info */
WINPOS_GetMinMaxInfo( hwnd, NULL, NULL, &minTrack, &maxTrack );
sizingRect = wndPtr->rectWindow;
origRect = sizingRect;
if (wndPtr->dwStyle & WS_CHILD)
GetClientRect( wndPtr->parent->hwndSelf, &mouseRect );
GetWindowRect( hwnd, &sizingRect );
if (style & WS_CHILD)
{
parent = GetParent(hwnd);
/* make sizing rect relative to parent */
MapWindowPoints( 0, parent, (POINT*)&sizingRect, 2 );
GetClientRect( parent, &mouseRect );
}
else
{
parent = 0;
SetRect(&mouseRect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
}
origRect = sizingRect;
if (ON_LEFT_BORDER(hittest))
{
mouseRect.left = max( mouseRect.left, sizingRect.right-maxTrack.x );
......@@ -1731,13 +1740,10 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
mouseRect.top = max( mouseRect.top, sizingRect.top+minTrack.y );
mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y );
}
if (wndPtr->dwStyle & WS_CHILD)
{
MapWindowPoints( wndPtr->parent->hwndSelf, 0, (LPPOINT)&mouseRect, 2 );
}
if (parent) MapWindowPoints( parent, 0, (LPPOINT)&mouseRect, 2 );
/* Retrieve a default cache DC (without using the window style) */
hdc = GetDCEx( wndPtr->parent->hwndSelf, 0, DCX_CACHE );
hdc = GetDCEx( parent, 0, DCX_CACHE );
if( iconic ) /* create a cursor for dragging */
{
......@@ -1754,8 +1760,7 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
SetCapture( hwnd );
/* grab the server only when moving top-level windows without desktop */
grab = (!DragFullWindows && (root_window == DefaultRootWindow(gdi_display)) &&
(wndPtr->parent->hwndSelf == GetDesktopWindow()));
grab = (!DragFullWindows && !parent && (root_window == DefaultRootWindow(gdi_display)));
wine_tsx11_lock();
if (grab)
......@@ -1767,9 +1772,10 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
old_gdi_display = gdi_display;
gdi_display = display;
}
XGrabPointer( display, get_whole_window(wndPtr), False,
XGrabPointer( display, X11DRV_get_whole_window(hwnd), False,
PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, get_client_window(wndPtr->parent),
GrabModeAsync, GrabModeAsync,
parent ? X11DRV_get_client_window(parent) : root_window,
None, CurrentTime );
wine_tsx11_unlock();
......@@ -1874,7 +1880,7 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
else if (moved && !DragFullWindows)
draw_moving_frame( hdc, &sizingRect, thickframe );
ReleaseDC( wndPtr->parent->hwndSelf, hdc );
ReleaseDC( parent, hdc );
wine_tsx11_lock();
XUngrabPointer( display, CurrentTime );
......@@ -1887,8 +1893,7 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
}
wine_tsx11_unlock();
if (HOOK_CallHooksA( WH_CBT, HCBT_MOVESIZE, hwnd, (LPARAM)&sizingRect ))
sizingRect = wndPtr->rectWindow;
if (HOOK_CallHooksA( WH_CBT, HCBT_MOVESIZE, hwnd, (LPARAM)&sizingRect )) moved = FALSE;
SendMessageA( hwnd, WM_EXITSIZEMOVE, 0, 0 );
SendMessageA( hwnd, WM_SETVISIBLE, !IsIconic(hwnd), 0L);
......@@ -1930,15 +1935,12 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
if( !moved )
{
if( wndPtr->dwStyle & WS_SYSMENU )
if(style & WS_SYSMENU )
SendMessageA( hwnd, WM_SYSCOMMAND,
SC_MOUSEMENU + HTSYSMENU, MAKELONG(pt.x,pt.y));
}
else WINPOS_ShowIconTitle( hwnd, TRUE );
}
END:
WIN_ReleaseWndPtr(wndPtr);
}
......
......@@ -67,7 +67,7 @@ typedef struct tagUSER_DRIVER {
BOOL (*pIsClipboardFormatAvailable)(UINT); /* Check if specified format is available */
BOOL (*pRegisterClipboardFormat)(LPCSTR); /* Register a clipboard format */
BOOL (*pIsSelectionOwner)(void); /* Check if we own the selection */
void (*pResetSelectionOwner)(struct tagWND *, BOOL);
void (*pResetSelectionOwner)(HWND, BOOL);
/* windowing functions */
BOOL (*pCreateWindow)(HWND,CREATESTRUCTA*,BOOL);
......
......@@ -77,12 +77,6 @@ typedef struct
#define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0800 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */
#define WIN_NEEDS_INTERNALSOP 0x1000 /* Window was hidden by WIN_InternalShowOwnedPopups */
/* BuildWinArray() flags */
#define BWA_SKIPDISABLED 0x0001
#define BWA_SKIPHIDDEN 0x0002
#define BWA_SKIPOWNED 0x0004
#define BWA_SKIPICONIC 0x0008
/* Window functions */
extern int WIN_SuspendWndsLock( void );
extern void WIN_RestoreWndsLock(int ipreviousLock);
......@@ -102,16 +96,14 @@ extern BOOL WIN_CreateDesktopWindow(void);
extern HWND WIN_GetTopParent( HWND hwnd );
extern WND* WIN_GetTopParentPtr( WND* pWnd );
extern BOOL WIN_IsWindowDrawable(WND*, BOOL );
extern WND** WIN_BuildWinArray( WND *wndPtr, UINT bwa, UINT* pnum );
extern void WIN_ReleaseWinArray(WND **wndArray);
extern HWND *WIN_BuildWinArray( HWND hwnd );
extern void WIN_ReleaseWinArray( HWND *wndArray );
extern BOOL WIN_InternalShowOwnedPopups( HWND owner, BOOL fShow, BOOL unmanagedOnly );
extern HWND CARET_GetHwnd(void);
extern void CARET_GetRect(LPRECT lprc); /* windows/caret.c */
extern BOOL16 DRAG_QueryUpdate( HWND, SEGPTR, BOOL );
extern void DEFWND_SetTextA( WND *wndPtr, LPCSTR text );
extern void DEFWND_SetTextW( WND *wndPtr, LPCWSTR text );
extern HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType ); /* windows/defwnd.c */
extern void PROPERTY_RemoveWindowProps( WND *pWnd ); /* windows/property.c */
......
......@@ -38,32 +38,45 @@ static void DEFDLG_SetFocus( HWND hwndDlg, HWND hwndCtrl )
/***********************************************************************
* DEFDLG_SaveFocus
*/
static BOOL DEFDLG_SaveFocus( HWND hwnd, DIALOGINFO *infoPtr )
static void DEFDLG_SaveFocus( HWND hwnd )
{
DIALOGINFO *infoPtr;
WND *wndPtr;
HWND hwndFocus = GetFocus();
if (!hwndFocus || !IsChild( hwnd, hwndFocus )) return FALSE;
if (!hwndFocus || !IsChild( hwnd, hwndFocus )) return;
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return;
infoPtr = (DIALOGINFO *)&wndPtr->wExtra;
infoPtr->hwndFocus = hwndFocus;
/* Remove default button */
return TRUE;
WIN_ReleaseWndPtr( wndPtr );
/* Remove default button */
}
/***********************************************************************
* DEFDLG_RestoreFocus
*/
static BOOL DEFDLG_RestoreFocus( HWND hwnd, DIALOGINFO *infoPtr )
static void DEFDLG_RestoreFocus( HWND hwnd )
{
if (!infoPtr->hwndFocus || IsIconic(hwnd)) return FALSE;
if (!IsWindow( infoPtr->hwndFocus )) return FALSE;
/* Don't set the focus back to controls if EndDialog is already called.*/
if (!(infoPtr->flags & DF_END))
DEFDLG_SetFocus( hwnd, infoPtr->hwndFocus );
DIALOGINFO *infoPtr;
WND *wndPtr;
/* This used to set infoPtr->hwndFocus to NULL for no apparent reason,
sometimes losing focus when receiving WM_SETFOCUS messages. */
return TRUE;
if (IsIconic( hwnd )) return;
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return;
infoPtr = (DIALOGINFO *)&wndPtr->wExtra;
if (IsWindow( infoPtr->hwndFocus ))
{
/* Don't set the focus back to controls if EndDialog is already called.*/
if (!(infoPtr->flags & DF_END))
{
WIN_ReleaseWndPtr( wndPtr );
DEFDLG_SetFocus( hwnd, infoPtr->hwndFocus );
return;
}
/* This used to set infoPtr->hwndFocus to NULL for no apparent reason,
sometimes losing focus when receiving WM_SETFOCUS messages. */
}
WIN_ReleaseWndPtr( wndPtr );
}
......@@ -161,16 +174,16 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
return DefWindowProcA( hwnd, msg, wParam, lParam );
case WM_SHOWWINDOW:
if (!wParam) DEFDLG_SaveFocus( hwnd, dlgInfo );
if (!wParam) DEFDLG_SaveFocus( hwnd );
return DefWindowProcA( hwnd, msg, wParam, lParam );
case WM_ACTIVATE:
if (wParam) DEFDLG_RestoreFocus( hwnd, dlgInfo );
else DEFDLG_SaveFocus( hwnd, dlgInfo );
if (wParam) DEFDLG_RestoreFocus( hwnd );
else DEFDLG_SaveFocus( hwnd );
return 0;
case WM_SETFOCUS:
DEFDLG_RestoreFocus( hwnd, dlgInfo );
DEFDLG_RestoreFocus( hwnd );
return 0;
case DM_SETDEFID:
......@@ -231,7 +244,7 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
/***********************************************************************
* DEFDLG_Epilog
*/
static LRESULT DEFDLG_Epilog(DIALOGINFO* dlgInfo, UINT msg, BOOL fResult)
static LRESULT DEFDLG_Epilog(HWND hwnd, UINT msg, BOOL fResult)
{
/* see SDK 3.1 */
......@@ -241,7 +254,7 @@ static LRESULT DEFDLG_Epilog(DIALOGINFO* dlgInfo, UINT msg, BOOL fResult)
msg == WM_QUERYDRAGICON || msg == WM_INITDIALOG)
return fResult;
return dlgInfo->msgResult;
return GetWindowLongA( hwnd, DWL_MSGRESULT );
}
/***********************************************************************
......@@ -251,18 +264,22 @@ LRESULT WINAPI DefDlgProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam,
LPARAM lParam )
{
DIALOGINFO * dlgInfo;
WNDPROC16 dlgproc;
BOOL result = FALSE;
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return 0;
dlgInfo = (DIALOGINFO *)&wndPtr->wExtra;
dlgInfo->msgResult = 0;
dlgproc = (WNDPROC16)dlgInfo->dlgProc;
WIN_ReleaseWndPtr(wndPtr);
if (dlgInfo->dlgProc) { /* Call dialog procedure */
result = CallWindowProc16( (WNDPROC16)dlgInfo->dlgProc,
hwnd, msg, wParam, lParam );
if (dlgproc)
{
/* Call dialog procedure */
result = CallWindowProc16( dlgproc, hwnd, msg, wParam, lParam );
/* 16 bit dlg procs only return BOOL16 */
if( WINPROC_GetProcType( dlgInfo->dlgProc ) == WIN_PROC_16 )
if( WINPROC_GetProcType( dlgproc ) == WIN_PROC_16 )
result = LOWORD(result);
}
......@@ -285,7 +302,6 @@ LRESULT WINAPI DefDlgProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam,
case WM_ENTERMENULOOP:
case WM_LBUTTONDOWN:
case WM_NCLBUTTONDOWN:
WIN_ReleaseWndPtr(wndPtr);
return DEFDLG_Proc( (HWND)hwnd, msg,
(WPARAM)wParam, lParam, dlgInfo );
case WM_INITDIALOG:
......@@ -295,12 +311,10 @@ LRESULT WINAPI DefDlgProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam,
break;
default:
WIN_ReleaseWndPtr(wndPtr);
return DefWindowProc16( hwnd, msg, wParam, lParam );
}
}
WIN_ReleaseWndPtr(wndPtr);
return DEFDLG_Epilog(dlgInfo, msg, result);
}
return DEFDLG_Epilog(hwnd, msg, result);
}
......@@ -311,18 +325,22 @@ LRESULT WINAPI DefDlgProcA( HWND hwnd, UINT msg,
WPARAM wParam, LPARAM lParam )
{
DIALOGINFO * dlgInfo;
WNDPROC dlgproc;
BOOL result = FALSE;
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return 0;
dlgInfo = (DIALOGINFO *)&wndPtr->wExtra;
dlgInfo->msgResult = 0;
dlgproc = dlgInfo->dlgProc;
WIN_ReleaseWndPtr(wndPtr);
if (dlgInfo->dlgProc) { /* Call dialog procedure */
result = CallWindowProcA( (WNDPROC)dlgInfo->dlgProc,
hwnd, msg, wParam, lParam );
if (dlgproc)
{
/* Call dialog procedure */
result = CallWindowProcA( dlgproc, hwnd, msg, wParam, lParam );
/* 16 bit dlg procs only return BOOL16 */
if( WINPROC_GetProcType( dlgInfo->dlgProc ) == WIN_PROC_16 )
if( WINPROC_GetProcType( dlgproc ) == WIN_PROC_16 )
result = LOWORD(result);
}
......@@ -345,9 +363,7 @@ LRESULT WINAPI DefDlgProcA( HWND hwnd, UINT msg,
case WM_ENTERMENULOOP:
case WM_LBUTTONDOWN:
case WM_NCLBUTTONDOWN:
WIN_ReleaseWndPtr(wndPtr);
return DEFDLG_Proc( (HWND)hwnd, msg,
(WPARAM)wParam, lParam, dlgInfo );
return DEFDLG_Proc( hwnd, msg, wParam, lParam, dlgInfo );
case WM_INITDIALOG:
case WM_VKEYTOITEM:
case WM_COMPAREITEM:
......@@ -355,12 +371,10 @@ LRESULT WINAPI DefDlgProcA( HWND hwnd, UINT msg,
break;
default:
WIN_ReleaseWndPtr(wndPtr);
return DefWindowProcA( hwnd, msg, wParam, lParam );
}
}
WIN_ReleaseWndPtr(wndPtr);
return DEFDLG_Epilog(dlgInfo, msg, result);
return DEFDLG_Epilog(hwnd, msg, result);
}
......@@ -372,17 +386,21 @@ LRESULT WINAPI DefDlgProcW( HWND hwnd, UINT msg, WPARAM wParam,
{
DIALOGINFO * dlgInfo;
BOOL result = FALSE;
WNDPROC dlgproc;
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return 0;
dlgInfo = (DIALOGINFO *)&wndPtr->wExtra;
dlgInfo->msgResult = 0;
dlgproc = dlgInfo->dlgProc;
WIN_ReleaseWndPtr(wndPtr);
if (dlgInfo->dlgProc) { /* Call dialog procedure */
result = CallWindowProcW( (WNDPROC)dlgInfo->dlgProc,
hwnd, msg, wParam, lParam );
if (dlgproc)
{
/* Call dialog procedure */
result = CallWindowProcW( dlgproc, hwnd, msg, wParam, lParam );
/* 16 bit dlg procs only return BOOL16 */
if( WINPROC_GetProcType( dlgInfo->dlgProc ) == WIN_PROC_16 )
if( WINPROC_GetProcType( dlgproc ) == WIN_PROC_16 )
result = LOWORD(result);
}
......@@ -405,9 +423,7 @@ LRESULT WINAPI DefDlgProcW( HWND hwnd, UINT msg, WPARAM wParam,
case WM_ENTERMENULOOP:
case WM_LBUTTONDOWN:
case WM_NCLBUTTONDOWN:
WIN_ReleaseWndPtr(wndPtr);
return DEFDLG_Proc( (HWND)hwnd, msg,
(WPARAM)wParam, lParam, dlgInfo );
return DEFDLG_Proc( hwnd, msg, wParam, lParam, dlgInfo );
case WM_INITDIALOG:
case WM_VKEYTOITEM:
case WM_COMPAREITEM:
......@@ -415,10 +431,8 @@ LRESULT WINAPI DefDlgProcW( HWND hwnd, UINT msg, WPARAM wParam,
break;
default:
WIN_ReleaseWndPtr(wndPtr);
return DefWindowProcW( hwnd, msg, wParam, lParam );
}
}
WIN_ReleaseWndPtr(wndPtr);
return DEFDLG_Epilog(dlgInfo, msg, result);
return DEFDLG_Epilog(hwnd, msg, result);
}
......@@ -122,21 +122,18 @@ static void queue_hardware_message( MSG *msg, ULONG_PTR extra_info, enum message
*/
static void MSG_SendParentNotify( HWND hwnd, WORD event, WORD idChild, POINT pt )
{
WND *tmpWnd = WIN_FindWndPtr(hwnd);
/* pt has to be in the client coordinates of the parent window */
MapWindowPoints( 0, tmpWnd->hwndSelf, &pt, 1 );
while (tmpWnd)
MapWindowPoints( 0, hwnd, &pt, 1 );
for (;;)
{
if (!(tmpWnd->dwStyle & WS_CHILD) || (tmpWnd->dwExStyle & WS_EX_NOPARENTNOTIFY))
{
WIN_ReleaseWndPtr(tmpWnd);
break;
}
pt.x += tmpWnd->rectClient.left;
pt.y += tmpWnd->rectClient.top;
WIN_UpdateWndPtr(&tmpWnd,tmpWnd->parent);
SendMessageA( tmpWnd->hwndSelf, WM_PARENTNOTIFY,
HWND parent;
if (!(GetWindowLongA( hwnd, GWL_STYLE ) & WS_CHILD)) break;
if (GetWindowLongA( hwnd, GWL_EXSTYLE ) & WS_EX_NOPARENTNOTIFY) break;
if (!(parent = GetParent(hwnd))) break;
MapWindowPoints( hwnd, parent, &pt, 1 );
hwnd = parent;
SendMessageA( hwnd, WM_PARENTNOTIFY,
MAKEWPARAM( event, idChild ), MAKELPARAM( pt.x, pt.y ) );
}
}
......
......@@ -324,7 +324,7 @@ HDC WINAPI BeginPaint( HWND hwnd, PAINTSTRUCT *lps )
WND *wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return 0;
bIcon = (wndPtr->dwStyle & WS_MINIMIZE && GetClassWord(wndPtr->hwndSelf, GCW_HICON));
bIcon = (wndPtr->dwStyle & WS_MINIMIZE && GetClassLongA(hwnd, GCL_HICON));
wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT;
......@@ -756,7 +756,7 @@ static HRGN RDW_Paint( WND* wndPtr, HRGN hrgn, UINT flags, UINT ex )
*/
HDC hDC;
HWND hWnd = wndPtr->hwndSelf;
BOOL bIcon = ((wndPtr->dwStyle & WS_MINIMIZE) && GetClassWord(wndPtr->hwndSelf, GCW_HICON));
BOOL bIcon = ((wndPtr->dwStyle & WS_MINIMIZE) && GetClassLongA(hWnd, GCL_HICON));
/* Erase/update the window itself ... */
......@@ -814,20 +814,18 @@ static HRGN RDW_Paint( WND* wndPtr, HRGN hrgn, UINT flags, UINT ex )
if( wndPtr->child && !(flags & RDW_NOCHILDREN) && !(wndPtr->dwStyle & WS_MINIMIZE)
&& ((flags & RDW_ALLCHILDREN) || !(wndPtr->dwStyle & WS_CLIPCHILDREN)) )
{
WND** list, **ppWnd;
HWND *list, *phwnd;
if( (list = WIN_BuildWinArray( wndPtr, 0, NULL )) )
if( (list = WIN_BuildWinArray( wndPtr->hwndSelf )) )
{
wndPtr = NULL;
for (ppWnd = list; *ppWnd; ppWnd++)
for (phwnd = list; *phwnd; phwnd++)
{
WIN_UpdateWndPtr(&wndPtr,*ppWnd);
if (!IsWindow(wndPtr->hwndSelf)) continue;
if ( (wndPtr->dwStyle & WS_VISIBLE) &&
(wndPtr->hrgnUpdate || (wndPtr->flags & WIN_INTERNAL_PAINT)) )
hrgn = RDW_Paint( wndPtr, hrgn, flags, ex );
if (!(wndPtr = WIN_FindWndPtr( *phwnd ))) continue;
if ( (wndPtr->dwStyle & WS_VISIBLE) &&
(wndPtr->hrgnUpdate || (wndPtr->flags & WIN_INTERNAL_PAINT)) )
hrgn = RDW_Paint( wndPtr, hrgn, flags, ex );
WIN_ReleaseWndPtr(wndPtr);
}
WIN_ReleaseWndPtr(wndPtr);
WIN_ReleaseWinArray(list);
}
}
......
......@@ -220,38 +220,32 @@ BOOL WINAPI ExitWindowsEx( UINT flags, DWORD reserved )
{
int i;
BOOL result;
WND **list, **ppWnd;
HWND *list, *phwnd;
/* We have to build a list of all windows first, as in EnumWindows */
if (!(list = WIN_BuildWinArray( WIN_GetDesktop(), 0, NULL )))
{
WIN_ReleaseDesktop();
return FALSE;
}
if (!(list = WIN_BuildWinArray( GetDesktopWindow() ))) return FALSE;
/* Send a WM_QUERYENDSESSION message to every window */
for (ppWnd = list, i = 0; *ppWnd; ppWnd++, i++)
for (i = 0; list[i]; i++)
{
/* Make sure that the window still exists */
if (!IsWindow( (*ppWnd)->hwndSelf )) continue;
if (!SendMessageW( (*ppWnd)->hwndSelf, WM_QUERYENDSESSION, 0, 0 ))
break;
if (!IsWindow( list[i] )) continue;
if (!SendMessageW( list[i], WM_QUERYENDSESSION, 0, 0 )) break;
}
result = !(*ppWnd);
result = !list[i];
/* Now notify all windows that got a WM_QUERYENDSESSION of the result */
for (ppWnd = list; i > 0; i--, ppWnd++)
for (phwnd = list; i > 0; i--, phwnd++)
{
if (!IsWindow( (*ppWnd)->hwndSelf )) continue;
SendMessageW( (*ppWnd)->hwndSelf, WM_ENDSESSION, result, 0 );
if (!IsWindow( *phwnd )) continue;
SendMessageW( *phwnd, WM_ENDSESSION, result, 0 );
}
WIN_ReleaseWinArray(list);
if (result) ExitKernel16();
WIN_ReleaseDesktop();
return FALSE;
}
......
......@@ -1570,37 +1570,33 @@ BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus)
/* send WM_ACTIVATEAPP if necessary */
if (hOldActiveQueue != hNewActiveQueue)
{
WND **list, **ppWnd;
WND *pDesktop = WIN_GetDesktop();
HWND *list, *phwnd;
DWORD old_thread = GetWindowThreadProcessId( hwndPrevActive, NULL );
DWORD new_thread = GetWindowThreadProcessId( hwndActive, NULL );
if ((list = WIN_BuildWinArray( pDesktop, 0, NULL )))
if ((list = WIN_BuildWinArray( GetDesktopWindow() )))
{
DWORD new_thread = GetWindowThreadProcessId( hwndActive, NULL );
for (ppWnd = list; *ppWnd; ppWnd++)
for (phwnd = list; *phwnd; phwnd++)
{
if (!IsWindow( (*ppWnd)->hwndSelf )) continue;
if ((*ppWnd)->hmemTaskQ == hOldActiveQueue)
SendMessageW( (*ppWnd)->hwndSelf, WM_ACTIVATEAPP, 0, new_thread );
if (!IsWindow( *phwnd )) continue;
if (GetWindowThreadProcessId( *phwnd, NULL ) == old_thread)
SendMessageW( *phwnd, WM_ACTIVATEAPP, 0, new_thread );
}
WIN_ReleaseWinArray(list);
}
hActiveQueue = hNewActiveQueue;
if ((list = WIN_BuildWinArray(pDesktop, 0, NULL )))
if ((list = WIN_BuildWinArray( GetDesktopWindow() )))
{
DWORD old_thread = GetWindowThreadProcessId( hwndPrevActive, NULL );
for (ppWnd = list; *ppWnd; ppWnd++)
for (phwnd = list; *phwnd; phwnd++)
{
if (!IsWindow( (*ppWnd)->hwndSelf )) continue;
if ((*ppWnd)->hmemTaskQ == hNewActiveQueue)
SendMessageW( (*ppWnd)->hwndSelf, WM_ACTIVATEAPP, 1, old_thread );
if (!IsWindow( *phwnd )) continue;
if (GetWindowThreadProcessId( *phwnd, NULL ) == new_thread)
SendMessageW( *phwnd, WM_ACTIVATEAPP, 1, old_thread );
}
WIN_ReleaseWinArray(list);
}
WIN_ReleaseDesktop();
if (hWnd && !IsWindow(hWnd)) goto CLEANUP;
}
......
......@@ -1109,11 +1109,12 @@ BOOL X11DRV_GetClipboardData(UINT wFormat)
* Any top level window can own the selection. See X11DRV_CLIPBOARD_Acquire
* for a more detailed description of this.
*/
void X11DRV_ResetSelectionOwner(WND *pWnd, BOOL bFooBar)
void X11DRV_ResetSelectionOwner(HWND hwnd, BOOL bFooBar)
{
Display *display = thread_display();
HWND hWndClipOwner = 0;
Window XWnd = get_whole_window(pWnd);
HWND tmp;
Window XWnd = X11DRV_get_whole_window(hwnd);
Atom xaClipboard;
BOOL bLostSelection = FALSE;
......@@ -1141,11 +1142,8 @@ void X11DRV_ResetSelectionOwner(WND *pWnd, BOOL bFooBar)
selectionPrevWindow = selectionWindow;
selectionWindow = None;
if( pWnd->next )
selectionWindow = get_whole_window(pWnd->next);
else if( pWnd->parent )
if( pWnd->parent->child != pWnd )
selectionWindow = get_whole_window(pWnd->parent->child);
if (!(tmp = GetWindow( hwnd, GW_HWNDNEXT ))) tmp = GetWindow( hwnd, GW_HWNDFIRST );
if (tmp && tmp != hwnd) selectionWindow = X11DRV_get_whole_window(tmp);
if( selectionWindow != None )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment