Commit fa42aa81 authored by Alexandre Julliard's avatar Alexandre Julliard

Removed WIN_GetDesktop().

parent 588ff374
...@@ -1284,22 +1284,20 @@ static HWND query_zorder( Display *display, HWND hWndCheck) ...@@ -1284,22 +1284,20 @@ static HWND query_zorder( Display *display, HWND hWndCheck)
{ {
HWND hwndInsertAfter = HWND_TOP; HWND hwndInsertAfter = HWND_TOP;
WND *pWndCheck = WIN_FindWndPtr(hWndCheck); WND *pWndCheck = WIN_FindWndPtr(hWndCheck);
WND *pDesktop = WIN_GetDesktop(); WND *top = WIN_FindWndPtr( GetTopWindow(0) );
WND *pWnd, *pWndZ = WIN_LockWndPtr(pDesktop->child); WND *pWnd, *pWndZ = top;
Window w, parent, *children = NULL; Window w, parent, *children = NULL;
unsigned total, check, pos, best; unsigned total, check, pos, best;
if( !__check_query_condition(&pWndZ, &pWnd) ) if( !__check_query_condition(&pWndZ, &pWnd) )
{ {
WIN_ReleaseWndPtr(pWndCheck); WIN_ReleaseWndPtr(pWndCheck);
WIN_ReleaseWndPtr(pDesktop->child); WIN_ReleaseWndPtr(top);
WIN_ReleaseDesktop();
return hwndInsertAfter; return hwndInsertAfter;
} }
WIN_LockWndPtr(pWndZ); WIN_LockWndPtr(pWndZ);
WIN_LockWndPtr(pWnd); WIN_LockWndPtr(pWnd);
WIN_ReleaseWndPtr(pDesktop->child); WIN_ReleaseWndPtr(top);
WIN_ReleaseDesktop();
parent = __get_common_ancestor( display, get_whole_window(pWndZ), parent = __get_common_ancestor( display, get_whole_window(pWndZ),
get_whole_window(pWnd), &children, &total ); get_whole_window(pWnd), &children, &total );
......
...@@ -84,8 +84,6 @@ extern WND* WIN_FindWndPtr( HWND hwnd ); ...@@ -84,8 +84,6 @@ extern WND* WIN_FindWndPtr( HWND hwnd );
extern WND* WIN_LockWndPtr(WND *wndPtr); extern WND* WIN_LockWndPtr(WND *wndPtr);
extern void WIN_ReleaseWndPtr(WND *wndPtr); extern void WIN_ReleaseWndPtr(WND *wndPtr);
extern void WIN_UpdateWndPtr(WND **oldPtr,WND *newPtr); extern void WIN_UpdateWndPtr(WND **oldPtr,WND *newPtr);
extern WND* WIN_GetDesktop(void);
extern void WIN_ReleaseDesktop(void);
extern void WIN_DumpWindow( HWND hwnd ); extern void WIN_DumpWindow( HWND hwnd );
extern void WIN_WalkWindows( HWND hwnd, int indent ); extern void WIN_WalkWindows( HWND hwnd, int indent );
extern BOOL WIN_UnlinkWindow( HWND hwnd ); extern BOOL WIN_UnlinkWindow( HWND hwnd );
......
...@@ -165,7 +165,7 @@ static HRGN WIN_UpdateNCRgn(WND* wnd, HRGN hRgn, UINT uncFlags ) ...@@ -165,7 +165,7 @@ static HRGN WIN_UpdateNCRgn(WND* wnd, HRGN hRgn, UINT uncFlags )
wnd->hwndSelf, wnd->hrgnUpdate, hRgn, uncFlags, wnd->flags & WIN_NEEDS_NCPAINT); wnd->hwndSelf, wnd->hrgnUpdate, hRgn, uncFlags, wnd->flags & WIN_NEEDS_NCPAINT);
/* desktop window doesn't have a nonclient area */ /* desktop window doesn't have a nonclient area */
if(wnd == WIN_GetDesktop()) if(wnd->hwndSelf == GetDesktopWindow())
{ {
wnd->flags &= ~WIN_NEEDS_NCPAINT; wnd->flags &= ~WIN_NEEDS_NCPAINT;
if( wnd->hrgnUpdate > 1 ) if( wnd->hrgnUpdate > 1 )
...@@ -174,10 +174,8 @@ static HRGN WIN_UpdateNCRgn(WND* wnd, HRGN hRgn, UINT uncFlags ) ...@@ -174,10 +174,8 @@ static HRGN WIN_UpdateNCRgn(WND* wnd, HRGN hRgn, UINT uncFlags )
{ {
hrgnRet = wnd->hrgnUpdate; hrgnRet = wnd->hrgnUpdate;
} }
WIN_ReleaseDesktop();
return hrgnRet; return hrgnRet;
} }
WIN_ReleaseDesktop();
if ((wnd->hwndSelf == GetForegroundWindow()) && if ((wnd->hwndSelf == GetForegroundWindow()) &&
!(wnd->flags & WIN_NCACTIVATED) ) !(wnd->flags & WIN_NCACTIVATED) )
...@@ -498,7 +496,6 @@ HBRUSH16 WINAPI GetControlBrush16( HWND16 hwnd, HDC16 hdc, UINT16 ctlType ) ...@@ -498,7 +496,6 @@ HBRUSH16 WINAPI GetControlBrush16( HWND16 hwnd, HDC16 hdc, UINT16 ctlType )
static void RDW_ValidateParent(WND *wndChild) static void RDW_ValidateParent(WND *wndChild)
{ {
WND *wndParent = WIN_LockWndPtr(wndChild->parent); WND *wndParent = WIN_LockWndPtr(wndChild->parent);
WND *wndDesktop = WIN_GetDesktop();
HRGN hrg; HRGN hrg;
if (wndChild->hrgnUpdate == 1 ) { if (wndChild->hrgnUpdate == 1 ) {
...@@ -511,7 +508,7 @@ static void RDW_ValidateParent(WND *wndChild) ...@@ -511,7 +508,7 @@ static void RDW_ValidateParent(WND *wndChild)
} else } else
hrg = wndChild->hrgnUpdate; hrg = wndChild->hrgnUpdate;
while ((wndParent) && (wndParent != wndDesktop) ) { while ((wndParent) && (wndParent->hwndSelf != GetDesktopWindow()) ) {
if (!(wndParent->dwStyle & WS_CLIPCHILDREN)) if (!(wndParent->dwStyle & WS_CLIPCHILDREN))
{ {
if (wndParent->hrgnUpdate != 0) if (wndParent->hrgnUpdate != 0)
...@@ -543,7 +540,6 @@ static void RDW_ValidateParent(WND *wndChild) ...@@ -543,7 +540,6 @@ static void RDW_ValidateParent(WND *wndChild)
} }
if (hrg != wndChild->hrgnUpdate) DeleteObject( hrg ); if (hrg != wndChild->hrgnUpdate) DeleteObject( hrg );
WIN_ReleaseWndPtr(wndParent); WIN_ReleaseWndPtr(wndParent);
WIN_ReleaseDesktop();
} }
/*********************************************************************** /***********************************************************************
......
...@@ -216,44 +216,6 @@ void WIN_DumpWindow( HWND hwnd ) ...@@ -216,44 +216,6 @@ void WIN_DumpWindow( HWND hwnd )
/*********************************************************************** /***********************************************************************
* WIN_WalkWindows
*
* Walk the windows tree and print each window on stderr.
*/
void WIN_WalkWindows( HWND hwnd, int indent )
{
WND *ptr;
char className[80];
ptr = hwnd ? WIN_FindWndPtr( hwnd ) : WIN_GetDesktop();
if (!ptr)
{
WARN("Invalid window handle %04x\n", hwnd );
return;
}
if (!indent) /* first time around */
DPRINTF( "%-16.16s %-8.8s %-6.6s %-17.17s %-8.8s %s\n",
"hwnd", " wndPtr", "queue", "Class Name", " Style", " WndProc"
" Text");
while (ptr)
{
DPRINTF( "%*s%04x%*s", indent, "", ptr->hwndSelf, 13-indent,"");
GetClassNameA( ptr->hwndSelf, className, sizeof(className) );
DPRINTF( "%08lx %-6.4x %-17.17s %08x %08x %.14s\n",
(DWORD)ptr, ptr->hmemTaskQ, className,
(UINT)ptr->dwStyle, (UINT)ptr->winproc,
ptr->text ? debugstr_w(ptr->text) : "<null>");
if (ptr->child) WIN_WalkWindows( ptr->child->hwndSelf, indent+1 );
WIN_UpdateWndPtr(&ptr,ptr->next);
}
}
/***********************************************************************
* WIN_UnlinkWindow * WIN_UnlinkWindow
* *
* Remove a window from the siblings linked list. * Remove a window from the siblings linked list.
...@@ -1206,12 +1168,8 @@ BOOL WINAPI DestroyWindow( HWND hwnd ) ...@@ -1206,12 +1168,8 @@ BOOL WINAPI DestroyWindow( HWND hwnd )
/* Initialization */ /* Initialization */
if (hwnd == GetDesktopWindow()) return FALSE; /* Can't destroy desktop */
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE; if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
if (wndPtr == pWndDesktop)
{
retvalue = FALSE; /* Can't destroy desktop */
goto end;
}
/* Look whether the focus is within the tree of windows we will /* Look whether the focus is within the tree of windows we will
* be destroying. * be destroying.
...@@ -1548,24 +1506,6 @@ HWND WINAPI FindWindowW( LPCWSTR className, LPCWSTR title ) ...@@ -1548,24 +1506,6 @@ HWND WINAPI FindWindowW( LPCWSTR className, LPCWSTR title )
/********************************************************************** /**********************************************************************
* WIN_GetDesktop
* returns a locked pointer
*/
WND *WIN_GetDesktop(void)
{
return WIN_LockWndPtr(pWndDesktop);
}
/**********************************************************************
* WIN_ReleaseDesktop
* unlock the desktop pointer
*/
void WIN_ReleaseDesktop(void)
{
WIN_ReleaseWndPtr(pWndDesktop);
}
/**********************************************************************
* GetDesktopWindow (USER.286) * GetDesktopWindow (USER.286)
*/ */
HWND16 WINAPI GetDesktopWindow16(void) HWND16 WINAPI GetDesktopWindow16(void)
...@@ -2433,15 +2373,8 @@ HWND16 WINAPI GetTopWindow16( HWND16 hwnd ) ...@@ -2433,15 +2373,8 @@ HWND16 WINAPI GetTopWindow16( HWND16 hwnd )
*/ */
HWND WINAPI GetTopWindow( HWND hwnd ) HWND WINAPI GetTopWindow( HWND hwnd )
{ {
HWND retval = 0; if (!hwnd) hwnd = GetDesktopWindow();
WND * wndPtr = (hwnd) ? return GetWindow( hwnd, GW_CHILD );
WIN_FindWndPtr( hwnd ) : WIN_GetDesktop();
if (wndPtr && wndPtr->child)
retval = wndPtr->child->hwndSelf;
WIN_ReleaseWndPtr(wndPtr);
return retval;
} }
......
...@@ -1550,14 +1550,11 @@ BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus) ...@@ -1550,14 +1550,11 @@ BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus)
if (wndPtr && !(wndPtr->dwStyle & WS_CHILD) && !(wndPtr->dwExStyle & WS_EX_MANAGED)) if (wndPtr && !(wndPtr->dwStyle & WS_CHILD) && !(wndPtr->dwExStyle & WS_EX_MANAGED))
{ {
/* check Z-order and bring hWnd to the top */ /* check Z-order and bring hWnd to the top */
for (wndTemp = WIN_LockWndPtr(WIN_GetDesktop()->child); wndTemp; WIN_UpdateWndPtr(&wndTemp,wndTemp->next)) HWND tmp = GetTopWindow(0);
{ while (tmp && !(GetWindowLongA( tmp, GWL_STYLE ) & WS_VISIBLE))
if (wndTemp->dwStyle & WS_VISIBLE) break; tmp = GetWindow( tmp, GW_HWNDNEXT );
}
WIN_ReleaseDesktop();
WIN_ReleaseWndPtr(wndTemp);
if( wndTemp != wndPtr ) if( tmp != hWnd )
SetWindowPos(hWnd, HWND_TOP, 0,0,0,0, SetWindowPos(hWnd, HWND_TOP, 0,0,0,0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE ); SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
if (!IsWindow(hWnd)) if (!IsWindow(hWnd))
......
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