mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
Remove ugly hack for the current display DC
svn path=/trunk/; revision=2202
This commit is contained in:
parent
b3ab3efa96
commit
5a73b65484
4 changed files with 32 additions and 61 deletions
|
@ -55,11 +55,11 @@ VOID MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
|
|||
{
|
||||
ULONG i;
|
||||
LONG mouse_cx = 0, mouse_cy = 0;
|
||||
HDC hDC = RetrieveDisplayHDC();
|
||||
/* HDC hDC = RetrieveDisplayHDC();
|
||||
PDC dc = DC_HandleToPtr(hDC);
|
||||
PSURFOBJ SurfObj = (PSURFOBJ)AccessUserObject(dc->Surface);
|
||||
PSURFGDI SurfGDI = (PSURFGDI)AccessInternalObject(dc->Surface);
|
||||
RECTL MouseRect;
|
||||
RECTL MouseRect; */
|
||||
|
||||
PDEVICE_OBJECT ClassDeviceObject = NULL;
|
||||
PFILE_OBJECT FileObject = NULL;
|
||||
|
@ -86,8 +86,8 @@ VOID MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
|
|||
if(mouse_x > 620) mouse_x = 620;
|
||||
if(mouse_y > 460) mouse_y = 460;
|
||||
|
||||
if((SafetySwitch == FALSE) && (SafetySwitch2 == FALSE))
|
||||
SurfGDI->MovePointer(SurfObj, mouse_x, mouse_y, &MouseRect);
|
||||
if((SafetySwitch == FALSE) && (SafetySwitch2 == FALSE)) ;
|
||||
/* SurfGDI->MovePointer(SurfObj, mouse_x, mouse_y, &MouseRect); */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ NTSTATUS ConnectMouseClassDriver()
|
|||
|
||||
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
||||
|
||||
GDIInformation.CallBack = MouseGDICallBack;
|
||||
GDIInformation.CallBack = MouseGDICallBack;
|
||||
|
||||
irp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_MOUSE_CONNECT,
|
||||
ClassDeviceObject, &GDIInformation, sizeof(CLASS_INFORMATION), NULL, 0, TRUE, &event, &ioStatus);
|
||||
|
@ -131,7 +131,7 @@ NTSTATUS ConnectMouseClassDriver()
|
|||
|
||||
return ioStatus.Status;
|
||||
}
|
||||
|
||||
/*
|
||||
void TestMouse()
|
||||
{
|
||||
HDC hDC = RetrieveDisplayHDC();
|
||||
|
@ -149,15 +149,6 @@ void TestMouse()
|
|||
RECTL MouseRect;
|
||||
|
||||
// Draw a test mouse cursor
|
||||
/* Brush.iSolidColor = 1;
|
||||
EngLineTo(SurfObj, NULL, &Brush, 0, 0, 15, 0, NULL, 0);
|
||||
EngLineTo(SurfObj, NULL, &Brush, 0, 0, 0, 15, NULL, 0);
|
||||
EngLineTo(SurfObj, NULL, &Brush, 0, 15, 15, 0, NULL, 0);
|
||||
Brush.iSolidColor = 15;
|
||||
EngLineTo(SurfObj, NULL, &Brush, 1, 1, 13, 1, NULL, 0);
|
||||
EngLineTo(SurfObj, NULL, &Brush, 1, 1, 1, 13, NULL, 0);
|
||||
EngLineTo(SurfObj, NULL, &Brush, 1, 13, 13, 1, NULL, 0); */
|
||||
|
||||
mouse_width = 16;
|
||||
mouse_height = 16;
|
||||
|
||||
|
@ -199,3 +190,4 @@ void TestMouse()
|
|||
ConnectMouseClassDriver();
|
||||
MouseEnabled = TRUE;
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: window.c,v 1.2 2001/07/06 00:05:05 rex Exp $
|
||||
/* $Id: window.c,v 1.3 2001/08/28 18:16:32 jfilby Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -565,9 +565,14 @@ NtUserShowWindow(
|
|||
HWND hWnd,
|
||||
LONG nCmdShow)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
PWINDOW_OBJECT WindowObject;
|
||||
|
||||
return 0;
|
||||
GuiCheck();
|
||||
|
||||
WindowObject = USEROBJ_HandleToPtr (hWnd, UO_WINDOW_MAGIC);
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DWORD
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: dc.c,v 1.25 2001/06/30 17:43:05 jfilby Exp $
|
||||
/* $Id: dc.c,v 1.26 2001/08/28 18:16:32 jfilby Exp $
|
||||
*
|
||||
* DC.C - Device context functions
|
||||
*
|
||||
|
@ -82,16 +82,10 @@ INT STDCALL func_name( HDC hdc, INT mode ) \
|
|||
|
||||
// --------------------------------------------------------- File Statics
|
||||
|
||||
static HDC hDISPLAY_DC = NULL; // handle to the DISPLAY HDC
|
||||
static void W32kSetDCState16(HDC hDC, HDC hDCSave);
|
||||
|
||||
// ----------------------------------------------------- Public Functions
|
||||
|
||||
HDC RetrieveDisplayHDC(VOID)
|
||||
{
|
||||
return hDISPLAY_DC;
|
||||
}
|
||||
|
||||
BOOL STDCALL W32kCancelDC(HDC hDC)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
|
@ -102,17 +96,10 @@ HDC STDCALL W32kCreateCompatableDC(HDC hDC)
|
|||
PDC NewDC, OrigDC = NULL;
|
||||
HBITMAP hBitmap;
|
||||
|
||||
if(hDC == NULL)
|
||||
OrigDC = DC_HandleToPtr(hDC);
|
||||
if (OrigDC == NULL)
|
||||
{
|
||||
// The OrigDC is one the DC created to reference the DISPLAY (we assume such a DC exists)
|
||||
if(hDISPLAY_DC != NULL)
|
||||
OrigDC = DC_HandleToPtr(hDISPLAY_DC);
|
||||
} else {
|
||||
OrigDC = DC_HandleToPtr(hDC);
|
||||
if (OrigDC == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Allocate a new DC based on the original DC's device */
|
||||
|
@ -307,14 +294,6 @@ HDC STDCALL W32kCreateDC(LPCWSTR Driver,
|
|||
W32kSetTextColor(hNewDC, RGB(0xff, 0xff, 0xff));
|
||||
W32kSetTextAlign(hNewDC, TA_BASELINE);
|
||||
|
||||
// If we've created a DC for the DISPLAY, save the reference for later CreateCompatibleDC(NULL... usage
|
||||
if(wcscmp(Driver, L"DISPLAY") == 0)
|
||||
{
|
||||
hDISPLAY_DC = hNewDC;
|
||||
}
|
||||
|
||||
TestMouse();
|
||||
|
||||
return hNewDC;
|
||||
|
||||
Failure:
|
||||
|
@ -1157,15 +1136,7 @@ PDC DC_AllocDC(LPCWSTR Driver)
|
|||
|
||||
PDC DC_FindOpenDC(LPCWSTR Driver)
|
||||
{
|
||||
/* FIXME: This is just a hack to return the pointer to the DISPLAY DC.. must cater for others too! */
|
||||
|
||||
if(wcscmp(Driver, L"DISPLAY"))
|
||||
{
|
||||
return DC_HandleToPtr(hDISPLAY_DC);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
void DC_InitDC(PDC DCToInit)
|
||||
|
|
|
@ -287,10 +287,8 @@ HBITMAP STDCALL W32kCreateDIBitmap(HDC hdc, const BITMAPINFOHEADER *header,
|
|||
if (DIB_GetBitmapInfo( header, &width, &height, &bpp, &compr ) == -1) return 0;
|
||||
if (height < 0) height = -height;
|
||||
|
||||
// Check if we should create a monochrome or color bitmap.
|
||||
// We create a monochrome bitmap only if it has exactly 2
|
||||
// colors, which are black followed by white, nothing else.
|
||||
// In all other cases, we create a color bitmap.
|
||||
// Check if we should create a monochrome or color bitmap. We create a monochrome bitmap only if it has exactly 2
|
||||
// colors, which are black followed by white, nothing else. In all other cases, we create a color bitmap.
|
||||
|
||||
if (bpp != 1) fColor = TRUE;
|
||||
else if ((coloruse != DIB_RGB_COLORS) ||
|
||||
|
@ -307,18 +305,16 @@ HBITMAP STDCALL W32kCreateDIBitmap(HDC hdc, const BITMAPINFOHEADER *header,
|
|||
{
|
||||
rgb++;
|
||||
col = RGB( rgb->rgbRed, rgb->rgbGreen, rgb->rgbBlue );
|
||||
|
||||
// If the second color is white, create a monochrome bitmap
|
||||
fColor = (col != RGB(0xff,0xff,0xff));
|
||||
}
|
||||
// Note : If the first color of the colormap is white
|
||||
// followed by black, we have to create a color bitmap.
|
||||
// If we don't the white will be displayed in black later on!
|
||||
else fColor = TRUE;
|
||||
}
|
||||
else if (data->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
|
||||
{
|
||||
RGBTRIPLE *rgb = ((BITMAPCOREINFO *)data)->bmciColors;
|
||||
DWORD col = RGB( rgb->rgbtRed, rgb->rgbtGreen, rgb->rgbtBlue);
|
||||
DWORD col = RGB( rgb->rgbtRed, rgb->rgbtGreen, rgb->rgbtBlue);
|
||||
|
||||
if ((col == RGB(0,0,0)))
|
||||
{
|
||||
|
@ -337,9 +333,16 @@ HBITMAP STDCALL W32kCreateDIBitmap(HDC hdc, const BITMAPINFOHEADER *header,
|
|||
|
||||
// Now create the bitmap
|
||||
|
||||
if (fColor)
|
||||
if(fColor)
|
||||
{
|
||||
handle = W32kCreateCompatibleBitmap(RetrieveDisplayHDC(), width, height);
|
||||
// If we are using indexed colors, then we need to create a bitmap that is compatible with the palette
|
||||
if(coloruse == DIB_PAL_COLORS)
|
||||
{
|
||||
handle = W32kCreateCompatibleBitmap(hdc, width, height);
|
||||
}
|
||||
else if(coloruse == DIB_RGB_COLORS) {
|
||||
handle = W32kCreateBitmap(width, height, 1, 24, NULL);
|
||||
}
|
||||
}
|
||||
else handle = W32kCreateBitmap(width, height, 1, 1, NULL);
|
||||
|
||||
|
|
Loading…
Reference in a new issue