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