clip the moving rectangle to the desktop area. This doesn't work because our SelectObject() implementation doesn't handle regions right atm.

svn path=/trunk/; revision=8986
This commit is contained in:
Thomas Bluemel 2004-04-05 22:42:11 +00:00
parent 0a552285f3
commit 5aae8fca39

View file

@ -1,4 +1,4 @@
/* $Id: defwnd.c,v 1.130 2004/04/05 22:12:53 weiden Exp $ /* $Id: defwnd.c,v 1.131 2004/04/05 22:42:11 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
@ -458,19 +458,32 @@ UserDrawWindowFrame(HDC hdc, const RECT *rect,
} }
VOID STATIC VOID STATIC
UserDrawMovingFrame(HDC hdc, RECT *rect, BOOL thickframe) UserDrawMovingFrame(HDC hdc, RECT *rect, BOOL thickframe, HRGN ClipRgn)
{ {
if (thickframe) HGDIOBJ OldObj;
if(ClipRgn)
{ {
UserDrawWindowFrame(hdc, rect, GetSystemMetrics(SM_CXFRAME), OldObj = SelectObject(hdc, ClipRgn);
GetSystemMetrics(SM_CYFRAME)); }
if(thickframe)
{
UserDrawWindowFrame(hdc, rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME));
}
else
DrawFocusRect( hdc, rect );
if(ClipRgn)
{
SelectObject(hdc, OldObj);
} }
else DrawFocusRect( hdc, rect );
} }
VOID STATIC VOID STATIC
DefWndDoSizeMove(HWND hwnd, WORD wParam) DefWndDoSizeMove(HWND hwnd, WORD wParam)
{ {
HRGN DesktopRgn;
MSG msg; MSG msg;
RECT sizingRect, mouseRect, origRect, clipRect; RECT sizingRect, mouseRect, origRect, clipRect;
HDC hdc; HDC hdc;
@ -589,10 +602,12 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
{ {
/* Retrieve a default cache DC (without using the window style) */ /* Retrieve a default cache DC (without using the window style) */
hdc = GetDCEx(hWndParent, 0, DCX_CACHE); hdc = GetDCEx(hWndParent, 0, DCX_CACHE);
DesktopRgn = NULL;
} }
else else
{ {
hdc = GetDC( 0 ); hdc = GetDC( 0 );
DesktopRgn = CreateRectRgnIndirect(&clipRect);
} }
if( iconic ) /* create a cursor for dragging */ if( iconic ) /* create a cursor for dragging */
@ -606,7 +621,7 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
/* invert frame if WIN31_LOOK to indicate mouse click on caption */ /* invert frame if WIN31_LOOK to indicate mouse click on caption */
if( !iconic && !DragFullWindows) if( !iconic && !DragFullWindows)
{ {
UserDrawMovingFrame( hdc, &sizingRect, thickframe ); UserDrawMovingFrame( hdc, &sizingRect, thickframe, DesktopRgn );
} }
for(;;) for(;;)
@ -622,9 +637,9 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
if (msg.message == WM_PAINT) if (msg.message == WM_PAINT)
{ {
if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe ); if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe, DesktopRgn );
UpdateWindow( msg.hwnd ); UpdateWindow( msg.hwnd );
if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe ); if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe, DesktopRgn );
continue; continue;
} }
@ -673,7 +688,7 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx; else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx;
if (ON_TOP_BORDER(hittest)) newRect.top += dy; if (ON_TOP_BORDER(hittest)) newRect.top += dy;
else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy; else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy;
if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe ); if(!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe, DesktopRgn );
capturePoint = pt; capturePoint = pt;
/* determine the hit location */ /* determine the hit location */
@ -684,7 +699,7 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
if (!iconic) if (!iconic)
{ {
if(!DragFullWindows) if(!DragFullWindows)
UserDrawMovingFrame( hdc, &newRect, thickframe ); UserDrawMovingFrame( hdc, &newRect, thickframe, DesktopRgn );
else { else {
/* To avoid any deadlocks, all the locks on the windows /* To avoid any deadlocks, all the locks on the windows
structures must be suspended before the SetWindowPos */ structures must be suspended before the SetWindowPos */
@ -711,12 +726,18 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam)
DestroyCursor( hDragCursor ); DestroyCursor( hDragCursor );
} }
else if(!DragFullWindows) else if(!DragFullWindows)
UserDrawMovingFrame( hdc, &sizingRect, thickframe ); UserDrawMovingFrame( hdc, &sizingRect, thickframe, DesktopRgn );
if (Style & WS_CHILD) if (Style & WS_CHILD)
ReleaseDC( hWndParent, hdc ); ReleaseDC( hWndParent, hdc );
else else
{
ReleaseDC( 0, hdc ); ReleaseDC( 0, hdc );
if(DesktopRgn)
{
DeleteObject(DesktopRgn);
}
}
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);