Minor bug fix.

svn path=/trunk/; revision=4073
This commit is contained in:
Eugene Ingerman 2003-01-25 23:06:32 +00:00
parent 9715d6594d
commit 6a14e674e4
2 changed files with 65 additions and 62 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: pointer.c,v 1.12 2002/09/30 19:45:19 dwelch Exp $ /* $Id: pointer.c,v 1.13 2003/01/25 23:06:32 ei Exp $
* *
* PROJECT: ReactOS VGA16 display driver * PROJECT: ReactOS VGA16 display driver
* FILE: drivers/dd/vga/display/objects/pointer.c * FILE: drivers/dd/vga/display/objects/pointer.c
@ -72,9 +72,9 @@ VGADDI_BltPointerToVGA(ULONG StartX, ULONG StartY, ULONG SizeX,
Mask &= ~((1 << (8 - (EndX % 8))) - 1); Mask &= ~((1 << (8 - (EndX % 8))) - 1);
} }
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x8); WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x8);
WRITE_PORT_UCHAR((PUCHAR)GRA_D, Mask); WRITE_PORT_UCHAR((PUCHAR)GRA_D, Mask);
/* Write the mask. */ /* Write the mask. */
Video = (PUCHAR)vidmem + StartY * 80 + (StartX >> 3); Video = (PUCHAR)vidmem + StartY * 80 + (StartX >> 3);
Src = MaskBits; Src = MaskBits;
for (i = 0; i < SizeY; i++, Video+=80, Src+=MaskPitch) for (i = 0; i < SizeY; i++, Video+=80, Src+=MaskPitch)
@ -97,9 +97,9 @@ VGADDI_BltPointerToVGA(ULONG StartX, ULONG StartY, ULONG SizeX,
/* Fill any whole rows of eight pixels. */ /* Fill any whole rows of eight pixels. */
Left = (StartX + 7) & ~0x7; Left = (StartX + 7) & ~0x7;
Length = (EndX >> 3) - (Left >> 3); Length = (EndX >> 3) - (Left >> 3);
for (i = StartY; i < EndY; i++) for (i = StartY; i < EndY; i++)
{ {
Video = (PUCHAR)vidmem + i * 80 + (Left >> 3); Video = (PUCHAR)vidmem + i * 80 + (Left >> 3);
Src = MaskBits + (i - StartY) * MaskPitch; Src = MaskBits + (i - StartY) * MaskPitch;
for (j = 0; j < Length; j++, Video++, Src++) for (j = 0; j < Length; j++, Video++, Src++)
@ -185,19 +185,19 @@ DrvMovePointer(IN PSURFOBJ pso,
IN PRECTL prcl) IN PRECTL prcl)
{ {
PPDEV ppdev = (PPDEV)pso->dhpdev; PPDEV ppdev = (PPDEV)pso->dhpdev;
if (x == -1) if (x < 0 )
{ {
/* x == -1 and y == -1 indicates we must hide the cursor */ /* x < 0 and y < 0 indicates we must hide the cursor */
VGADDI_HideCursor(ppdev); VGADDI_HideCursor(ppdev);
return; return;
} }
ppdev->xyCursor.x = x; ppdev->xyCursor.x = x;
ppdev->xyCursor.y = y; ppdev->xyCursor.y = y;
VGADDI_ShowCursor(ppdev); VGADDI_ShowCursor(ppdev);
/* Give feedback on the new cursor rectangle */ /* Give feedback on the new cursor rectangle */
/*if (prcl != NULL) ComputePointerRect(ppdev, prcl);*/ /*if (prcl != NULL) ComputePointerRect(ppdev, prcl);*/
} }
@ -224,7 +224,7 @@ DrvSetPointerShape(PSURFOBJ pso,
NewHeight = (psoMask->cjBits / psoMask->lDelta) / 2; NewHeight = (psoMask->cjBits / psoMask->lDelta) / 2;
/* Hide the cursor */ /* Hide the cursor */
if(ppdev->pPointerAttributes->Enable != 0) if(ppdev->pPointerAttributes->Enable != 0)
{ {
VGADDI_HideCursor(ppdev); VGADDI_HideCursor(ppdev);
} }
@ -256,7 +256,7 @@ DrvSetPointerShape(PSURFOBJ pso,
ImageBehindCursor = VGADDI_AllocSavedScreenBits(SavedMemSize); ImageBehindCursor = VGADDI_AllocSavedScreenBits(SavedMemSize);
} }
/* Copy the new cursor in. */ /* Copy the new cursor in. */
for (i = 0; i < (NewHeight * 2); i++) for (i = 0; i < (NewHeight * 2); i++)
{ {
Src = (PUCHAR)psoMask->pvBits; Src = (PUCHAR)psoMask->pvBits;
@ -281,7 +281,7 @@ DrvSetPointerShape(PSURFOBJ pso,
VGADDI_ShowCursor(ppdev); VGADDI_ShowCursor(ppdev);
} }
VOID VOID
VGADDI_HideCursor(PPDEV ppdev) VGADDI_HideCursor(PPDEV ppdev)
{ {
ULONG i, j, cx, cy, bitpos; ULONG i, j, cx, cy, bitpos;
@ -291,7 +291,7 @@ VGADDI_HideCursor(PPDEV ppdev)
SizeX = ((oldx + ppdev->pPointerAttributes->Width) + 7) & ~0x7; SizeX = ((oldx + ppdev->pPointerAttributes->Width) + 7) & ~0x7;
SizeX -= (oldx & ~0x7); SizeX -= (oldx & ~0x7);
VGADDI_BltFromSavedScreenBits(oldx & ~0x7, VGADDI_BltFromSavedScreenBits(oldx & ~0x7,
oldy, oldy,
ImageBehindCursor, ImageBehindCursor,
SizeX, SizeX,
ppdev->pPointerAttributes->Height); ppdev->pPointerAttributes->Height);
@ -299,14 +299,14 @@ VGADDI_HideCursor(PPDEV ppdev)
ppdev->pPointerAttributes->Enable = 0; ppdev->pPointerAttributes->Enable = 0;
} }
VOID VOID
VGADDI_ShowCursor(PPDEV ppdev) VGADDI_ShowCursor(PPDEV ppdev)
{ {
ULONG i, j, cx, cy; ULONG i, j, cx, cy;
PUCHAR AndMask; PUCHAR AndMask;
ULONG SizeX; ULONG SizeX;
if (ppdev->pPointerAttributes->Enable != 0) if (ppdev->pPointerAttributes->Enable != 0)
{ {
VGADDI_HideCursor(ppdev); VGADDI_HideCursor(ppdev);
} }
@ -318,6 +318,7 @@ VGADDI_ShowCursor(PPDEV ppdev)
/* Used to repaint background */ /* Used to repaint background */
SizeX = ((cx + ppdev->pPointerAttributes->Width) + 7) & ~0x7; SizeX = ((cx + ppdev->pPointerAttributes->Width) + 7) & ~0x7;
SizeX -= (cx & ~0x7); SizeX -= (cx & ~0x7);
VGADDI_BltToSavedScreenBits(ImageBehindCursor, VGADDI_BltToSavedScreenBits(ImageBehindCursor,
cx & ~0x7, cx & ~0x7,
cy, cy,
@ -326,14 +327,14 @@ VGADDI_ShowCursor(PPDEV ppdev)
/* Display the cursor. */ /* Display the cursor. */
AndMask = ppdev->pPointerAttributes->Pixels + AndMask = ppdev->pPointerAttributes->Pixels +
ppdev->pPointerAttributes->WidthInBytes * ppdev->pPointerAttributes->WidthInBytes *
ppdev->pPointerAttributes->Height; ppdev->pPointerAttributes->Height;
VGADDI_BltPointerToVGA(ppdev->xyCursor.x, VGADDI_BltPointerToVGA(ppdev->xyCursor.x,
ppdev->xyCursor.y, ppdev->xyCursor.y,
ppdev->pPointerAttributes->Width, ppdev->pPointerAttributes->Width,
ppdev->pPointerAttributes->Height, ppdev->pPointerAttributes->Height,
AndMask, AndMask,
VGA_AND); VGA_AND);
VGADDI_BltPointerToVGA(ppdev->xyCursor.x, VGADDI_BltPointerToVGA(ppdev->xyCursor.x,
ppdev->xyCursor.y, ppdev->xyCursor.y,
ppdev->pPointerAttributes->Width, ppdev->pPointerAttributes->Width,

View file

@ -1,4 +1,4 @@
/* $Id: defwnd.c,v 1.17 2003/01/24 22:42:15 jfilby Exp $ /* $Id: defwnd.c,v 1.18 2003/01/25 23:05:36 ei 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
@ -107,10 +107,10 @@ DefFrameProcW(HWND hWnd,
} }
BOOL BOOL
DefWndRedrawIconTitle(HWND hWnd) DefWndRedrawIconTitle(HWND hWnd)
{ {
PINTERNALPOS lpPos = (PINTERNALPOS)GetPropA(hWnd, PINTERNALPOS lpPos = (PINTERNALPOS)GetPropA(hWnd,
(LPSTR)(DWORD)AtomInternalPos); (LPSTR)(DWORD)AtomInternalPos);
if (lpPos != NULL) if (lpPos != NULL)
{ {
@ -187,7 +187,7 @@ void UserGetInsideRectNC( HWND hwnd, RECT *rect )
/* Remove frame from rectangle */ /* Remove frame from rectangle */
if (UserHasThickFrameStyle(Style, ExStyle )) if (UserHasThickFrameStyle(Style, ExStyle ))
{ {
InflateRect( rect, -GetSystemMetrics(SM_CXFRAME), InflateRect( rect, -GetSystemMetrics(SM_CXFRAME),
-GetSystemMetrics(SM_CYFRAME) ); -GetSystemMetrics(SM_CYFRAME) );
} }
else else
@ -222,8 +222,8 @@ void UserDrawSysButton( HWND hwnd, HDC hdc, BOOL down )
UserGetInsideRectNC( hwnd, &rect ); UserGetInsideRectNC( hwnd, &rect );
hdcMem = CreateCompatibleDC( hdc ); hdcMem = CreateCompatibleDC( hdc );
hbitmap = SelectObject( hdcMem, hbitmapClose ); hbitmap = SelectObject( hdcMem, hbitmapClose );
BitBlt(hdc, rect.left, rect.top, GetSystemMetrics(SM_CXSIZE), BitBlt(hdc, rect.left, rect.top, GetSystemMetrics(SM_CXSIZE),
GetSystemMetrics(SM_CYSIZE), hdcMem, GetSystemMetrics(SM_CYSIZE), hdcMem,
(Style & WS_CHILD) ? GetSystemMetrics(SM_CXSIZE) : 0, 0, (Style & WS_CHILD) ? GetSystemMetrics(SM_CXSIZE) : 0, 0,
down ? NOTSRCCOPY : SRCCOPY ); down ? NOTSRCCOPY : SRCCOPY );
SelectObject( hdcMem, hbitmap ); SelectObject( hdcMem, hbitmap );
@ -237,7 +237,7 @@ static void UserDrawMaxButton( HWND hwnd, HDC hdc, BOOL down )
UserGetInsideRectNC( hwnd, &rect ); UserGetInsideRectNC( hwnd, &rect );
hdcMem = CreateCompatibleDC( hdc ); hdcMem = CreateCompatibleDC( hdc );
SelectObject( hdcMem, (IsZoomed(hwnd) SelectObject( hdcMem, (IsZoomed(hwnd)
? (down ? hbitmapRestoreD : hbitmapRestore) ? (down ? hbitmapRestoreD : hbitmapRestore)
: (down ? hbitmapMaximizeD : hbitmapMaximize)) ); : (down ? hbitmapMaximizeD : hbitmapMaximize)) );
BitBlt( hdc, rect.right - GetSystemMetrics(SM_CXSMSIZE) - 1, rect.top, BitBlt( hdc, rect.right - GetSystemMetrics(SM_CXSMSIZE) - 1, rect.top,
@ -250,16 +250,16 @@ static void UserDrawMinButton( HWND hwnd, HDC hdc, BOOL down)
{ {
RECT rect; RECT rect;
HDC hdcMem; HDC hdcMem;
UserGetInsideRectNC(hwnd, &rect); UserGetInsideRectNC(hwnd, &rect);
hdcMem = CreateCompatibleDC(hdc); hdcMem = CreateCompatibleDC(hdc);
SelectObject(hdcMem, (down ? hbitmapMinimizeD : hbitmapMinimize)); SelectObject(hdcMem, (down ? hbitmapMinimizeD : hbitmapMinimize));
if (GetWindowLong(hwnd, GWL_STYLE) & WS_MAXIMIZEBOX) if (GetWindowLong(hwnd, GWL_STYLE) & WS_MAXIMIZEBOX)
{ {
rect.right -= GetSystemMetrics(SM_CXSMSIZE)+1; rect.right -= GetSystemMetrics(SM_CXSMSIZE)+1;
} }
BitBlt( hdc, rect.right - GetSystemMetrics(SM_CXSMSIZE) - 1, rect.top, BitBlt( hdc, rect.right - GetSystemMetrics(SM_CXSMSIZE) - 1, rect.top,
GetSystemMetrics(SM_CXSMSIZE) + 1, GetSystemMetrics(SM_CYSMSIZE), GetSystemMetrics(SM_CXSMSIZE) + 1, GetSystemMetrics(SM_CYSMSIZE),
hdcMem, 0, 0, hdcMem, 0, 0,
SRCCOPY ); SRCCOPY );
DeleteDC( hdcMem ); DeleteDC( hdcMem );
@ -272,7 +272,7 @@ static void UserDrawCaptionNC( HDC hdc, RECT *rect, HWND hwnd,
char buffer[256]; char buffer[256];
if (!hbitmapClose) if (!hbitmapClose)
{ {
hbitmapClose = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_CLOSE)); hbitmapClose = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_CLOSE));
hbitmapMinimize = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_REDUCE) ); hbitmapMinimize = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_REDUCE) );
hbitmapMinimizeD = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_REDUCED) ); hbitmapMinimizeD = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_REDUCED) );
@ -281,7 +281,7 @@ static void UserDrawCaptionNC( HDC hdc, RECT *rect, HWND hwnd,
hbitmapRestore = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_RESTORE) ); hbitmapRestore = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_RESTORE) );
hbitmapRestoreD = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_RESTORED) ); hbitmapRestoreD = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_RESTORED) );
} }
if (GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_DLGMODALFRAME) if (GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_DLGMODALFRAME)
{ {
HBRUSH hbrushOld = SelectObject(hdc, GetSysColorBrush(COLOR_WINDOW) ); HBRUSH hbrushOld = SelectObject(hdc, GetSysColorBrush(COLOR_WINDOW) );
@ -313,10 +313,10 @@ static void UserDrawCaptionNC( HDC hdc, RECT *rect, HWND hwnd,
UserDrawMinButton( hwnd, hdc, FALSE ); UserDrawMinButton( hwnd, hdc, FALSE );
r.right -= GetSystemMetrics(SM_CXSMSIZE) + 1; r.right -= GetSystemMetrics(SM_CXSMSIZE) + 1;
} }
FillRect( hdc, &r, GetSysColorBrush(active ? COLOR_ACTIVECAPTION : FillRect( hdc, &r, GetSysColorBrush(active ? COLOR_ACTIVECAPTION :
COLOR_INACTIVECAPTION) ); COLOR_INACTIVECAPTION) );
if (GetWindowTextA( hwnd, buffer, sizeof(buffer) )) if (GetWindowTextA( hwnd, buffer, sizeof(buffer) ))
{ {
NONCLIENTMETRICS nclm; NONCLIENTMETRICS nclm;
@ -359,7 +359,7 @@ UserDrawFrameNC(HDC hdc, RECT* rect, BOOL dlgFrame, BOOL active)
SelectObject( hdc, GetSysColorBrush(active ? COLOR_ACTIVEBORDER : SelectObject( hdc, GetSysColorBrush(active ? COLOR_ACTIVEBORDER :
COLOR_INACTIVEBORDER) ); COLOR_INACTIVEBORDER) );
} }
/* Draw frame */ /* Draw frame */
PatBlt( hdc, rect->left, rect->top, PatBlt( hdc, rect->left, rect->top,
rect->right - rect->left, height, PATCOPY ); rect->right - rect->left, height, PATCOPY );
@ -373,22 +373,22 @@ UserDrawFrameNC(HDC hdc, RECT* rect, BOOL dlgFrame, BOOL active)
if (dlgFrame) if (dlgFrame)
{ {
InflateRect( rect, -width, -height ); InflateRect( rect, -width, -height );
} }
else else
{ {
INT decYOff = GetSystemMetrics(SM_CXFRAME) + INT decYOff = GetSystemMetrics(SM_CXFRAME) +
GetSystemMetrics(SM_CXSIZE) - 1; GetSystemMetrics(SM_CXSIZE) - 1;
INT decXOff = GetSystemMetrics(SM_CYFRAME) + INT decXOff = GetSystemMetrics(SM_CYFRAME) +
GetSystemMetrics(SM_CYSIZE) - 1; GetSystemMetrics(SM_CYSIZE) - 1;
/* Draw inner rectangle */ /* Draw inner rectangle */
SelectObject( hdc, GetStockObject(NULL_BRUSH) ); SelectObject( hdc, GetStockObject(NULL_BRUSH) );
Rectangle( hdc, rect->left + width, rect->top + height, Rectangle( hdc, rect->left + width, rect->top + height,
rect->right - width , rect->bottom - height ); rect->right - width , rect->bottom - height );
/* Draw the decorations */ /* Draw the decorations */
MoveToEx( hdc, rect->left, rect->top + decYOff, NULL ); MoveToEx( hdc, rect->left, rect->top + decYOff, NULL );
LineTo( hdc, rect->left + width, rect->top + decYOff ); LineTo( hdc, rect->left + width, rect->top + decYOff );
MoveToEx( hdc, rect->right - 1, rect->top + decYOff, NULL ); MoveToEx( hdc, rect->right - 1, rect->top + decYOff, NULL );
@ -397,7 +397,7 @@ UserDrawFrameNC(HDC hdc, RECT* rect, BOOL dlgFrame, BOOL active)
LineTo( hdc, rect->left + width, rect->bottom - decYOff ); LineTo( hdc, rect->left + width, rect->bottom - decYOff );
MoveToEx( hdc, rect->right - 1, rect->bottom - decYOff, NULL ); MoveToEx( hdc, rect->right - 1, rect->bottom - decYOff, NULL );
LineTo( hdc, rect->right - width - 1, rect->bottom - decYOff ); LineTo( hdc, rect->right - width - 1, rect->bottom - decYOff );
MoveToEx( hdc, rect->left + decXOff, rect->top, NULL ); MoveToEx( hdc, rect->left + decXOff, rect->top, NULL );
LineTo( hdc, rect->left + decXOff, rect->top + height); LineTo( hdc, rect->left + decXOff, rect->top + height);
MoveToEx( hdc, rect->left + decXOff, rect->bottom - 1, NULL ); MoveToEx( hdc, rect->left + decXOff, rect->bottom - 1, NULL );
@ -406,7 +406,7 @@ UserDrawFrameNC(HDC hdc, RECT* rect, BOOL dlgFrame, BOOL active)
LineTo( hdc, rect->right - decXOff, rect->top + height ); LineTo( hdc, rect->right - decXOff, rect->top + height );
MoveToEx( hdc, rect->right - decXOff, rect->bottom - 1, NULL ); MoveToEx( hdc, rect->right - decXOff, rect->bottom - 1, NULL );
LineTo( hdc, rect->right - decXOff, rect->bottom - height - 1 ); LineTo( hdc, rect->right - decXOff, rect->bottom - height - 1 );
InflateRect( rect, -width - 1, -height - 1 ); InflateRect( rect, -width - 1, -height - 1 );
} }
} }
@ -734,13 +734,13 @@ DefWndTrackMinMaxBox(HWND hWnd, WPARAM wParam)
if (wParam == HTMINBUTTON) if (wParam == HTMINBUTTON)
{ {
SendMessageA(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, SendMessageA(hWnd, WM_SYSCOMMAND, SC_MINIMIZE,
MAKELONG(Msg.pt.x, Msg.pt.y)); MAKELONG(Msg.pt.x, Msg.pt.y));
} }
else else
{ {
SendMessageA(hWnd, WM_SYSCOMMAND, SendMessageA(hWnd, WM_SYSCOMMAND,
IsZoomed(hWnd) ? SC_RESTORE : SC_MAXIMIZE, IsZoomed(hWnd) ? SC_RESTORE : SC_MAXIMIZE,
MAKELONG(Msg.pt.x, Msg.pt.y)); MAKELONG(Msg.pt.x, Msg.pt.y));
} }
} }
@ -756,8 +756,8 @@ DefWndDrawSysButton(HWND hWnd, HDC hDC, BOOL Down)
hDcMem = CreateCompatibleDC(hDC); hDcMem = CreateCompatibleDC(hDC);
hSavedBitmap = SelectObject(hDcMem, hbitmapClose); hSavedBitmap = SelectObject(hDcMem, hbitmapClose);
BitBlt(hDC, Rect.left, Rect.top, GetSystemMetrics(SM_CXSIZE), BitBlt(hDC, Rect.left, Rect.top, GetSystemMetrics(SM_CXSIZE),
GetSystemMetrics(SM_CYSIZE), hDcMem, GetSystemMetrics(SM_CYSIZE), hDcMem,
(GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD) ? (GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD) ?
GetSystemMetrics(SM_CXSIZE): 0, 0, Down ? NOTSRCCOPY : SRCCOPY); GetSystemMetrics(SM_CXSIZE): 0, 0, Down ? NOTSRCCOPY : SRCCOPY);
SelectObject(hDcMem, hSavedBitmap); SelectObject(hDcMem, hSavedBitmap);
DeleteDC(hDcMem); DeleteDC(hDcMem);
@ -787,7 +787,7 @@ DefWndHandleLButtonDownNC(HWND hWnd, WPARAM wParam, LPARAM lParam)
DefWndDrawSysButton(hWnd, hDC, TRUE); DefWndDrawSysButton(hWnd, hDC, TRUE);
ReleaseDC(hWnd, hDC); ReleaseDC(hWnd, hDC);
} }
SendMessageA(hWnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU, SendMessageA(hWnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU,
lParam); lParam);
} }
break; break;
@ -843,7 +843,7 @@ DefWndSetRedraw(HWND hWnd, WPARAM wParam)
{ {
} }
LRESULT LRESULT
DefWndHandleSetCursor(HWND hWnd, WPARAM wParam, LPARAM lParam) DefWndHandleSetCursor(HWND hWnd, WPARAM wParam, LPARAM lParam)
{ {
/* Not for child windows. */ /* Not for child windows. */
@ -920,7 +920,7 @@ DefWndAdjustRect(RECT* Rect, ULONG Style, BOOL Menu, ULONG ExStyle)
if (UserHasThickFrameStyle(Style, ExStyle)) if (UserHasThickFrameStyle(Style, ExStyle))
{ {
InflateRect(Rect, GetSystemMetrics(SM_CXFRAME), InflateRect(Rect, GetSystemMetrics(SM_CXFRAME),
GetSystemMetrics(SM_CYFRAME)); GetSystemMetrics(SM_CYFRAME));
} }
else if (UserHasDlgFrameStyle(Style, ExStyle)) else if (UserHasDlgFrameStyle(Style, ExStyle))
@ -935,7 +935,7 @@ DefWndAdjustRect(RECT* Rect, ULONG Style, BOOL Menu, ULONG ExStyle)
} }
if (Style & WS_CAPTION) if (Style & WS_CAPTION)
{ {
Rect->top -= GetSystemMetrics(SM_CYCAPTION) - Rect->top -= GetSystemMetrics(SM_CYCAPTION) -
GetSystemMetrics(SM_CYBORDER); GetSystemMetrics(SM_CYBORDER);
} }
if (Menu) if (Menu)
@ -1088,7 +1088,7 @@ User32DefWindowProc(HWND hWnd,
Pt.x = SLOWORD(lParam); Pt.x = SLOWORD(lParam);
Pt.y = SHIWORD(lParam); Pt.y = SHIWORD(lParam);
if (GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD) if (GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD)
{ {
ScreenToClient(GetParent(hWnd), &Pt); ScreenToClient(GetParent(hWnd), &Pt);
@ -1250,12 +1250,12 @@ User32DefWindowProc(HWND hWnd,
BOOL bResult; BOOL bResult;
if (bUnicode) if (bUnicode)
{ {
bResult = SendMessageW(GetParent(hWnd), WM_SETCURSOR, bResult = SendMessageW(GetParent(hWnd), WM_SETCURSOR,
wParam, lParam); wParam, lParam);
} }
else else
{ {
bResult = SendMessageA(GetParent(hWnd), WM_SETCURSOR, bResult = SendMessageA(GetParent(hWnd), WM_SETCURSOR,
wParam, lParam); wParam, lParam);
} }
if (bResult) if (bResult)
@ -1264,7 +1264,7 @@ User32DefWindowProc(HWND hWnd,
} }
} }
} }
return(DefWndHandleSetCursor(hWnd, wParam, lParam)); return(DefWndHandleSetCursor(hWnd, wParam, lParam));
} }
case WM_SYSCOMMAND: case WM_SYSCOMMAND:
@ -1288,7 +1288,7 @@ User32DefWindowProc(HWND hWnd,
(!(GetWindowLongW(hWnd, GWL_STYLE) & WS_VISIBLE) && wParam)) (!(GetWindowLongW(hWnd, GWL_STYLE) & WS_VISIBLE) && wParam))
{ {
return(0); return(0);
} }
ShowWindow(hWnd, wParam ? SW_SHOWNOACTIVATE : SW_HIDE); ShowWindow(hWnd, wParam ? SW_SHOWNOACTIVATE : SW_HIDE);
break; break;
} }
@ -1404,7 +1404,7 @@ DefWindowProcA(HWND hWnd,
CREATESTRUCTA* Cs = (CREATESTRUCTA*)lParam; CREATESTRUCTA* Cs = (CREATESTRUCTA*)lParam;
if (HIWORD(Cs->lpszName)) if (HIWORD(Cs->lpszName))
{ {
WindowTextAtom = WindowTextAtom =
(LPSTR)(ULONG)GlobalAddAtomA("USER32!WindowTextAtomA"); (LPSTR)(ULONG)GlobalAddAtomA("USER32!WindowTextAtomA");
WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0, WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0,
strlen(Cs->lpszName) * sizeof(CHAR)); strlen(Cs->lpszName) * sizeof(CHAR));
@ -1453,8 +1453,8 @@ DefWindowProcA(HWND hWnd,
{ {
if (WindowTextAtom != 0) if (WindowTextAtom != 0)
{ {
WindowTextAtom = WindowTextAtom =
(LPSTR)(DWORD)GlobalAddAtomA("USER32!WindowTextAtomW"); (LPSTR)(DWORD)GlobalAddAtomA("USER32!WindowTextAtomW");
} }
if (WindowTextAtom != 0 && if (WindowTextAtom != 0 &&
(WindowText = GetPropA(hWnd, WindowTextAtom)) == NULL) (WindowText = GetPropA(hWnd, WindowTextAtom)) == NULL)
@ -1507,7 +1507,7 @@ DefWindowProcW(HWND hWnd,
CREATESTRUCTW* Cs = (CREATESTRUCTW*)lParam; CREATESTRUCTW* Cs = (CREATESTRUCTW*)lParam;
if (HIWORD(Cs->lpszName)) if (HIWORD(Cs->lpszName))
{ {
WindowTextAtom = WindowTextAtom =
(LPWSTR)(DWORD)GlobalAddAtomW(L"USER32!WindowTextAtomW"); (LPWSTR)(DWORD)GlobalAddAtomW(L"USER32!WindowTextAtomW");
WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0, WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0,
wcslen(Cs->lpszName) * sizeof(WCHAR)); wcslen(Cs->lpszName) * sizeof(WCHAR));
@ -1556,8 +1556,8 @@ DefWindowProcW(HWND hWnd,
{ {
if (WindowTextAtom != 0) if (WindowTextAtom != 0)
{ {
WindowTextAtom = WindowTextAtom =
(LPWSTR)(DWORD)GlobalAddAtom(L"USER32!WindowTextAtomW"); (LPWSTR)(DWORD)GlobalAddAtom(L"USER32!WindowTextAtomW");
} }
if (WindowTextAtom != 0 && if (WindowTextAtom != 0 &&
(WindowText = GetPropW(hWnd, WindowTextAtom)) == NULL) (WindowText = GetPropW(hWnd, WindowTextAtom)) == NULL)
@ -1569,6 +1569,8 @@ DefWindowProcW(HWND hWnd,
wcscpy(WindowText, (PWSTR)lParam); wcscpy(WindowText, (PWSTR)lParam);
SetPropW(hWnd, WindowTextAtom, WindowText); SetPropW(hWnd, WindowTextAtom, WindowText);
} }
//FIXME: return correct code
return TRUE;
case WM_NCDESTROY: case WM_NCDESTROY:
{ {