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
* 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
* 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);
}
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);
Src = MaskBits;
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. */
Left = (StartX + 7) & ~0x7;
Length = (EndX >> 3) - (Left >> 3);
Length = (EndX >> 3) - (Left >> 3);
for (i = StartY; i < EndY; i++)
{
{
Video = (PUCHAR)vidmem + i * 80 + (Left >> 3);
Src = MaskBits + (i - StartY) * MaskPitch;
for (j = 0; j < Length; j++, Video++, Src++)
@ -185,19 +185,19 @@ DrvMovePointer(IN PSURFOBJ pso,
IN PRECTL prcl)
{
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);
return;
}
ppdev->xyCursor.x = x;
ppdev->xyCursor.y = y;
VGADDI_ShowCursor(ppdev);
/* Give feedback on the new cursor rectangle */
/*if (prcl != NULL) ComputePointerRect(ppdev, prcl);*/
}
@ -224,7 +224,7 @@ DrvSetPointerShape(PSURFOBJ pso,
NewHeight = (psoMask->cjBits / psoMask->lDelta) / 2;
/* Hide the cursor */
if(ppdev->pPointerAttributes->Enable != 0)
if(ppdev->pPointerAttributes->Enable != 0)
{
VGADDI_HideCursor(ppdev);
}
@ -256,7 +256,7 @@ DrvSetPointerShape(PSURFOBJ pso,
ImageBehindCursor = VGADDI_AllocSavedScreenBits(SavedMemSize);
}
/* Copy the new cursor in. */
/* Copy the new cursor in. */
for (i = 0; i < (NewHeight * 2); i++)
{
Src = (PUCHAR)psoMask->pvBits;
@ -281,7 +281,7 @@ DrvSetPointerShape(PSURFOBJ pso,
VGADDI_ShowCursor(ppdev);
}
VOID
VOID
VGADDI_HideCursor(PPDEV ppdev)
{
ULONG i, j, cx, cy, bitpos;
@ -291,7 +291,7 @@ VGADDI_HideCursor(PPDEV ppdev)
SizeX = ((oldx + ppdev->pPointerAttributes->Width) + 7) & ~0x7;
SizeX -= (oldx & ~0x7);
VGADDI_BltFromSavedScreenBits(oldx & ~0x7,
oldy,
oldy,
ImageBehindCursor,
SizeX,
ppdev->pPointerAttributes->Height);
@ -299,14 +299,14 @@ VGADDI_HideCursor(PPDEV ppdev)
ppdev->pPointerAttributes->Enable = 0;
}
VOID
VOID
VGADDI_ShowCursor(PPDEV ppdev)
{
ULONG i, j, cx, cy;
PUCHAR AndMask;
ULONG SizeX;
if (ppdev->pPointerAttributes->Enable != 0)
if (ppdev->pPointerAttributes->Enable != 0)
{
VGADDI_HideCursor(ppdev);
}
@ -318,6 +318,7 @@ VGADDI_ShowCursor(PPDEV ppdev)
/* Used to repaint background */
SizeX = ((cx + ppdev->pPointerAttributes->Width) + 7) & ~0x7;
SizeX -= (cx & ~0x7);
VGADDI_BltToSavedScreenBits(ImageBehindCursor,
cx & ~0x7,
cy,
@ -326,14 +327,14 @@ VGADDI_ShowCursor(PPDEV ppdev)
/* Display the cursor. */
AndMask = ppdev->pPointerAttributes->Pixels +
ppdev->pPointerAttributes->WidthInBytes *
ppdev->pPointerAttributes->WidthInBytes *
ppdev->pPointerAttributes->Height;
VGADDI_BltPointerToVGA(ppdev->xyCursor.x,
ppdev->xyCursor.y,
ppdev->pPointerAttributes->Width,
ppdev->pPointerAttributes->Height,
AndMask,
VGA_AND);
VGA_AND);
VGADDI_BltPointerToVGA(ppdev->xyCursor.x,
ppdev->xyCursor.y,
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
* PROJECT: ReactOS user32.dll
@ -107,10 +107,10 @@ DefFrameProcW(HWND hWnd,
}
BOOL
BOOL
DefWndRedrawIconTitle(HWND hWnd)
{
PINTERNALPOS lpPos = (PINTERNALPOS)GetPropA(hWnd,
PINTERNALPOS lpPos = (PINTERNALPOS)GetPropA(hWnd,
(LPSTR)(DWORD)AtomInternalPos);
if (lpPos != NULL)
{
@ -187,7 +187,7 @@ void UserGetInsideRectNC( HWND hwnd, RECT *rect )
/* Remove frame from rectangle */
if (UserHasThickFrameStyle(Style, ExStyle ))
{
InflateRect( rect, -GetSystemMetrics(SM_CXFRAME),
InflateRect( rect, -GetSystemMetrics(SM_CXFRAME),
-GetSystemMetrics(SM_CYFRAME) );
}
else
@ -222,8 +222,8 @@ void UserDrawSysButton( HWND hwnd, HDC hdc, BOOL down )
UserGetInsideRectNC( hwnd, &rect );
hdcMem = CreateCompatibleDC( hdc );
hbitmap = SelectObject( hdcMem, hbitmapClose );
BitBlt(hdc, rect.left, rect.top, GetSystemMetrics(SM_CXSIZE),
GetSystemMetrics(SM_CYSIZE), hdcMem,
BitBlt(hdc, rect.left, rect.top, GetSystemMetrics(SM_CXSIZE),
GetSystemMetrics(SM_CYSIZE), hdcMem,
(Style & WS_CHILD) ? GetSystemMetrics(SM_CXSIZE) : 0, 0,
down ? NOTSRCCOPY : SRCCOPY );
SelectObject( hdcMem, hbitmap );
@ -237,7 +237,7 @@ static void UserDrawMaxButton( HWND hwnd, HDC hdc, BOOL down )
UserGetInsideRectNC( hwnd, &rect );
hdcMem = CreateCompatibleDC( hdc );
SelectObject( hdcMem, (IsZoomed(hwnd)
SelectObject( hdcMem, (IsZoomed(hwnd)
? (down ? hbitmapRestoreD : hbitmapRestore)
: (down ? hbitmapMaximizeD : hbitmapMaximize)) );
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;
HDC hdcMem;
UserGetInsideRectNC(hwnd, &rect);
hdcMem = CreateCompatibleDC(hdc);
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;
}
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,
SRCCOPY );
DeleteDC( hdcMem );
@ -272,7 +272,7 @@ static void UserDrawCaptionNC( HDC hdc, RECT *rect, HWND hwnd,
char buffer[256];
if (!hbitmapClose)
{
{
hbitmapClose = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_CLOSE));
hbitmapMinimize = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_REDUCE) );
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) );
hbitmapRestoreD = LoadBitmapW( 0, MAKEINTRESOURCE(OBM_RESTORED) );
}
if (GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_DLGMODALFRAME)
{
HBRUSH hbrushOld = SelectObject(hdc, GetSysColorBrush(COLOR_WINDOW) );
@ -313,10 +313,10 @@ static void UserDrawCaptionNC( HDC hdc, RECT *rect, HWND hwnd,
UserDrawMinButton( hwnd, hdc, FALSE );
r.right -= GetSystemMetrics(SM_CXSMSIZE) + 1;
}
FillRect( hdc, &r, GetSysColorBrush(active ? COLOR_ACTIVECAPTION :
COLOR_INACTIVECAPTION) );
if (GetWindowTextA( hwnd, buffer, sizeof(buffer) ))
{
NONCLIENTMETRICS nclm;
@ -359,7 +359,7 @@ UserDrawFrameNC(HDC hdc, RECT* rect, BOOL dlgFrame, BOOL active)
SelectObject( hdc, GetSysColorBrush(active ? COLOR_ACTIVEBORDER :
COLOR_INACTIVEBORDER) );
}
/* Draw frame */
PatBlt( hdc, rect->left, rect->top,
rect->right - rect->left, height, PATCOPY );
@ -373,22 +373,22 @@ UserDrawFrameNC(HDC hdc, RECT* rect, BOOL dlgFrame, BOOL active)
if (dlgFrame)
{
InflateRect( rect, -width, -height );
}
}
else
{
INT decYOff = GetSystemMetrics(SM_CXFRAME) +
INT decYOff = GetSystemMetrics(SM_CXFRAME) +
GetSystemMetrics(SM_CXSIZE) - 1;
INT decXOff = GetSystemMetrics(SM_CYFRAME) +
INT decXOff = GetSystemMetrics(SM_CYFRAME) +
GetSystemMetrics(SM_CYSIZE) - 1;
/* Draw inner rectangle */
SelectObject( hdc, GetStockObject(NULL_BRUSH) );
Rectangle( hdc, rect->left + width, rect->top + height,
rect->right - width , rect->bottom - height );
/* Draw the decorations */
MoveToEx( hdc, rect->left, rect->top + decYOff, NULL );
LineTo( hdc, rect->left + width, rect->top + decYOff );
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 );
MoveToEx( hdc, rect->right - 1, rect->bottom - decYOff, NULL );
LineTo( hdc, rect->right - width - 1, rect->bottom - decYOff );
MoveToEx( hdc, rect->left + decXOff, rect->top, NULL );
LineTo( hdc, rect->left + decXOff, rect->top + height);
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 );
MoveToEx( hdc, rect->right - decXOff, rect->bottom - 1, NULL );
LineTo( hdc, rect->right - decXOff, rect->bottom - height - 1 );
InflateRect( rect, -width - 1, -height - 1 );
}
}
@ -734,13 +734,13 @@ DefWndTrackMinMaxBox(HWND hWnd, WPARAM wParam)
if (wParam == HTMINBUTTON)
{
SendMessageA(hWnd, WM_SYSCOMMAND, SC_MINIMIZE,
SendMessageA(hWnd, WM_SYSCOMMAND, SC_MINIMIZE,
MAKELONG(Msg.pt.x, Msg.pt.y));
}
else
{
SendMessageA(hWnd, WM_SYSCOMMAND,
IsZoomed(hWnd) ? SC_RESTORE : SC_MAXIMIZE,
SendMessageA(hWnd, WM_SYSCOMMAND,
IsZoomed(hWnd) ? SC_RESTORE : SC_MAXIMIZE,
MAKELONG(Msg.pt.x, Msg.pt.y));
}
}
@ -756,8 +756,8 @@ DefWndDrawSysButton(HWND hWnd, HDC hDC, BOOL Down)
hDcMem = CreateCompatibleDC(hDC);
hSavedBitmap = SelectObject(hDcMem, hbitmapClose);
BitBlt(hDC, Rect.left, Rect.top, GetSystemMetrics(SM_CXSIZE),
GetSystemMetrics(SM_CYSIZE), hDcMem,
(GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD) ?
GetSystemMetrics(SM_CYSIZE), hDcMem,
(GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD) ?
GetSystemMetrics(SM_CXSIZE): 0, 0, Down ? NOTSRCCOPY : SRCCOPY);
SelectObject(hDcMem, hSavedBitmap);
DeleteDC(hDcMem);
@ -787,7 +787,7 @@ DefWndHandleLButtonDownNC(HWND hWnd, WPARAM wParam, LPARAM lParam)
DefWndDrawSysButton(hWnd, hDC, TRUE);
ReleaseDC(hWnd, hDC);
}
SendMessageA(hWnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU,
SendMessageA(hWnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU,
lParam);
}
break;
@ -843,7 +843,7 @@ DefWndSetRedraw(HWND hWnd, WPARAM wParam)
{
}
LRESULT
LRESULT
DefWndHandleSetCursor(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
/* Not for child windows. */
@ -920,7 +920,7 @@ DefWndAdjustRect(RECT* Rect, ULONG Style, BOOL Menu, ULONG ExStyle)
if (UserHasThickFrameStyle(Style, ExStyle))
{
InflateRect(Rect, GetSystemMetrics(SM_CXFRAME),
InflateRect(Rect, GetSystemMetrics(SM_CXFRAME),
GetSystemMetrics(SM_CYFRAME));
}
else if (UserHasDlgFrameStyle(Style, ExStyle))
@ -935,7 +935,7 @@ DefWndAdjustRect(RECT* Rect, ULONG Style, BOOL Menu, ULONG ExStyle)
}
if (Style & WS_CAPTION)
{
Rect->top -= GetSystemMetrics(SM_CYCAPTION) -
Rect->top -= GetSystemMetrics(SM_CYCAPTION) -
GetSystemMetrics(SM_CYBORDER);
}
if (Menu)
@ -1088,7 +1088,7 @@ User32DefWindowProc(HWND hWnd,
Pt.x = SLOWORD(lParam);
Pt.y = SHIWORD(lParam);
if (GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD)
{
ScreenToClient(GetParent(hWnd), &Pt);
@ -1250,12 +1250,12 @@ User32DefWindowProc(HWND hWnd,
BOOL bResult;
if (bUnicode)
{
bResult = SendMessageW(GetParent(hWnd), WM_SETCURSOR,
bResult = SendMessageW(GetParent(hWnd), WM_SETCURSOR,
wParam, lParam);
}
else
else
{
bResult = SendMessageA(GetParent(hWnd), WM_SETCURSOR,
bResult = SendMessageA(GetParent(hWnd), WM_SETCURSOR,
wParam, lParam);
}
if (bResult)
@ -1264,7 +1264,7 @@ User32DefWindowProc(HWND hWnd,
}
}
}
return(DefWndHandleSetCursor(hWnd, wParam, lParam));
return(DefWndHandleSetCursor(hWnd, wParam, lParam));
}
case WM_SYSCOMMAND:
@ -1288,7 +1288,7 @@ User32DefWindowProc(HWND hWnd,
(!(GetWindowLongW(hWnd, GWL_STYLE) & WS_VISIBLE) && wParam))
{
return(0);
}
}
ShowWindow(hWnd, wParam ? SW_SHOWNOACTIVATE : SW_HIDE);
break;
}
@ -1404,7 +1404,7 @@ DefWindowProcA(HWND hWnd,
CREATESTRUCTA* Cs = (CREATESTRUCTA*)lParam;
if (HIWORD(Cs->lpszName))
{
WindowTextAtom =
WindowTextAtom =
(LPSTR)(ULONG)GlobalAddAtomA("USER32!WindowTextAtomA");
WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0,
strlen(Cs->lpszName) * sizeof(CHAR));
@ -1453,8 +1453,8 @@ DefWindowProcA(HWND hWnd,
{
if (WindowTextAtom != 0)
{
WindowTextAtom =
(LPSTR)(DWORD)GlobalAddAtomA("USER32!WindowTextAtomW");
WindowTextAtom =
(LPSTR)(DWORD)GlobalAddAtomA("USER32!WindowTextAtomW");
}
if (WindowTextAtom != 0 &&
(WindowText = GetPropA(hWnd, WindowTextAtom)) == NULL)
@ -1507,7 +1507,7 @@ DefWindowProcW(HWND hWnd,
CREATESTRUCTW* Cs = (CREATESTRUCTW*)lParam;
if (HIWORD(Cs->lpszName))
{
WindowTextAtom =
WindowTextAtom =
(LPWSTR)(DWORD)GlobalAddAtomW(L"USER32!WindowTextAtomW");
WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0,
wcslen(Cs->lpszName) * sizeof(WCHAR));
@ -1556,8 +1556,8 @@ DefWindowProcW(HWND hWnd,
{
if (WindowTextAtom != 0)
{
WindowTextAtom =
(LPWSTR)(DWORD)GlobalAddAtom(L"USER32!WindowTextAtomW");
WindowTextAtom =
(LPWSTR)(DWORD)GlobalAddAtom(L"USER32!WindowTextAtomW");
}
if (WindowTextAtom != 0 &&
(WindowText = GetPropW(hWnd, WindowTextAtom)) == NULL)
@ -1569,6 +1569,8 @@ DefWindowProcW(HWND hWnd,
wcscpy(WindowText, (PWSTR)lParam);
SetPropW(hWnd, WindowTextAtom, WindowText);
}
//FIXME: return correct code
return TRUE;
case WM_NCDESTROY:
{