mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 07:56:59 +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;
|
ULONG i;
|
||||||
LONG mouse_cx = 0, mouse_cy = 0;
|
LONG mouse_cx = 0, mouse_cy = 0;
|
||||||
HDC hDC = RetrieveDisplayHDC();
|
/* HDC hDC = RetrieveDisplayHDC();
|
||||||
PDC dc = DC_HandleToPtr(hDC);
|
PDC dc = DC_HandleToPtr(hDC);
|
||||||
PSURFOBJ SurfObj = (PSURFOBJ)AccessUserObject(dc->Surface);
|
PSURFOBJ SurfObj = (PSURFOBJ)AccessUserObject(dc->Surface);
|
||||||
PSURFGDI SurfGDI = (PSURFGDI)AccessInternalObject(dc->Surface);
|
PSURFGDI SurfGDI = (PSURFGDI)AccessInternalObject(dc->Surface);
|
||||||
RECTL MouseRect;
|
RECTL MouseRect; */
|
||||||
|
|
||||||
PDEVICE_OBJECT ClassDeviceObject = NULL;
|
PDEVICE_OBJECT ClassDeviceObject = NULL;
|
||||||
PFILE_OBJECT FileObject = 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_x > 620) mouse_x = 620;
|
||||||
if(mouse_y > 460) mouse_y = 460;
|
if(mouse_y > 460) mouse_y = 460;
|
||||||
|
|
||||||
if((SafetySwitch == FALSE) && (SafetySwitch2 == FALSE))
|
if((SafetySwitch == FALSE) && (SafetySwitch2 == FALSE)) ;
|
||||||
SurfGDI->MovePointer(SurfObj, mouse_x, mouse_y, &MouseRect);
|
/* SurfGDI->MovePointer(SurfObj, mouse_x, mouse_y, &MouseRect); */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ NTSTATUS ConnectMouseClassDriver()
|
||||||
|
|
||||||
return ioStatus.Status;
|
return ioStatus.Status;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
void TestMouse()
|
void TestMouse()
|
||||||
{
|
{
|
||||||
HDC hDC = RetrieveDisplayHDC();
|
HDC hDC = RetrieveDisplayHDC();
|
||||||
|
@ -149,15 +149,6 @@ void TestMouse()
|
||||||
RECTL MouseRect;
|
RECTL MouseRect;
|
||||||
|
|
||||||
// Draw a test mouse cursor
|
// 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_width = 16;
|
||||||
mouse_height = 16;
|
mouse_height = 16;
|
||||||
|
|
||||||
|
@ -199,3 +190,4 @@ void TestMouse()
|
||||||
ConnectMouseClassDriver();
|
ConnectMouseClassDriver();
|
||||||
MouseEnabled = TRUE;
|
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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -565,9 +565,14 @@ NtUserShowWindow(
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
LONG nCmdShow)
|
LONG nCmdShow)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
PWINDOW_OBJECT WindowObject;
|
||||||
|
|
||||||
return 0;
|
GuiCheck();
|
||||||
|
|
||||||
|
WindowObject = USEROBJ_HandleToPtr (hWnd, UO_WINDOW_MAGIC);
|
||||||
|
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD
|
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
|
* DC.C - Device context functions
|
||||||
*
|
*
|
||||||
|
@ -82,16 +82,10 @@ INT STDCALL func_name( HDC hdc, INT mode ) \
|
||||||
|
|
||||||
// --------------------------------------------------------- File Statics
|
// --------------------------------------------------------- File Statics
|
||||||
|
|
||||||
static HDC hDISPLAY_DC = NULL; // handle to the DISPLAY HDC
|
|
||||||
static void W32kSetDCState16(HDC hDC, HDC hDCSave);
|
static void W32kSetDCState16(HDC hDC, HDC hDCSave);
|
||||||
|
|
||||||
// ----------------------------------------------------- Public Functions
|
// ----------------------------------------------------- Public Functions
|
||||||
|
|
||||||
HDC RetrieveDisplayHDC(VOID)
|
|
||||||
{
|
|
||||||
return hDISPLAY_DC;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL STDCALL W32kCancelDC(HDC hDC)
|
BOOL STDCALL W32kCancelDC(HDC hDC)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
|
@ -102,18 +96,11 @@ HDC STDCALL W32kCreateCompatableDC(HDC hDC)
|
||||||
PDC NewDC, OrigDC = NULL;
|
PDC NewDC, OrigDC = NULL;
|
||||||
HBITMAP hBitmap;
|
HBITMAP hBitmap;
|
||||||
|
|
||||||
if(hDC == 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);
|
OrigDC = DC_HandleToPtr(hDC);
|
||||||
if (OrigDC == NULL)
|
if (OrigDC == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate a new DC based on the original DC's device */
|
/* Allocate a new DC based on the original DC's device */
|
||||||
NewDC = DC_AllocDC(OrigDC->DriverName);
|
NewDC = DC_AllocDC(OrigDC->DriverName);
|
||||||
|
@ -307,14 +294,6 @@ HDC STDCALL W32kCreateDC(LPCWSTR Driver,
|
||||||
W32kSetTextColor(hNewDC, RGB(0xff, 0xff, 0xff));
|
W32kSetTextColor(hNewDC, RGB(0xff, 0xff, 0xff));
|
||||||
W32kSetTextAlign(hNewDC, TA_BASELINE);
|
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;
|
return hNewDC;
|
||||||
|
|
||||||
Failure:
|
Failure:
|
||||||
|
@ -1157,15 +1136,7 @@ PDC DC_AllocDC(LPCWSTR Driver)
|
||||||
|
|
||||||
PDC DC_FindOpenDC(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;
|
return NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DC_InitDC(PDC DCToInit)
|
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 (DIB_GetBitmapInfo( header, &width, &height, &bpp, &compr ) == -1) return 0;
|
||||||
if (height < 0) height = -height;
|
if (height < 0) height = -height;
|
||||||
|
|
||||||
// Check if we should create a monochrome or color bitmap.
|
// Check if we should create a monochrome or color bitmap. We create a monochrome bitmap only if it has exactly 2
|
||||||
// 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.
|
||||||
// colors, which are black followed by white, nothing else.
|
|
||||||
// In all other cases, we create a color bitmap.
|
|
||||||
|
|
||||||
if (bpp != 1) fColor = TRUE;
|
if (bpp != 1) fColor = TRUE;
|
||||||
else if ((coloruse != DIB_RGB_COLORS) ||
|
else if ((coloruse != DIB_RGB_COLORS) ||
|
||||||
|
@ -307,12 +305,10 @@ HBITMAP STDCALL W32kCreateDIBitmap(HDC hdc, const BITMAPINFOHEADER *header,
|
||||||
{
|
{
|
||||||
rgb++;
|
rgb++;
|
||||||
col = RGB( rgb->rgbRed, rgb->rgbGreen, rgb->rgbBlue );
|
col = RGB( rgb->rgbRed, rgb->rgbGreen, rgb->rgbBlue );
|
||||||
|
|
||||||
// If the second color is white, create a monochrome bitmap
|
// If the second color is white, create a monochrome bitmap
|
||||||
fColor = (col != RGB(0xff,0xff,0xff));
|
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 fColor = TRUE;
|
||||||
}
|
}
|
||||||
else if (data->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
|
else if (data->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
|
||||||
|
@ -337,9 +333,16 @@ HBITMAP STDCALL W32kCreateDIBitmap(HDC hdc, const BITMAPINFOHEADER *header,
|
||||||
|
|
||||||
// Now create the bitmap
|
// 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);
|
else handle = W32kCreateBitmap(width, height, 1, 1, NULL);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue