From 6e361ec59fb9a416644c60fc58c336c6d63315a3 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Sun, 25 Jan 2004 16:47:10 +0000 Subject: [PATCH] More work on software mouse pointer implementation. svn path=/trunk/; revision=7876 --- reactos/subsys/win32k/eng/mouse.c | 42 +++++++++++++++++++++++++++--- reactos/subsys/win32k/objects/dc.c | 18 ++++++++++--- 2 files changed, 53 insertions(+), 7 deletions(-) diff --git a/reactos/subsys/win32k/eng/mouse.c b/reactos/subsys/win32k/eng/mouse.c index 447a5b23f9a..73e3eaeaa66 100644 --- a/reactos/subsys/win32k/eng/mouse.c +++ b/reactos/subsys/win32k/eng/mouse.c @@ -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: mouse.c,v 1.57 2004/01/24 19:47:05 navaraf Exp $ +/* $Id: mouse.c,v 1.58 2004/01/25 16:47:09 navaraf Exp $ * * PROJECT: ReactOS kernel * PURPOSE: Mouse @@ -40,6 +40,9 @@ #include "include/window.h" #include "include/cursoricon.h" #include "include/callback.h" +#include "include/palette.h" +#include "include/inteng.h" +#include "include/eng.h" #include #define NDEBUG @@ -706,6 +709,12 @@ EngSetPointerShape( ppdev->PointerSaveSurface = NULL; } + if (ppdev->PointerXlateObject != NULL) + { + EngDeleteXlate(ppdev->PointerXlateObject); + ppdev->PointerXlateObject = NULL; + } + /* * See if we are being asked to hide the pointer. */ @@ -723,8 +732,6 @@ EngSetPointerShape( ppdev->PointerAttributes.Width = psoMask->lDelta << 3; ppdev->PointerAttributes.Height = (psoMask->cjBits / psoMask->lDelta) >> 1; - ppdev->PointerXlateObject = pxlo; - if (psoColor != NULL) { SIZEL Size; @@ -756,6 +763,35 @@ EngSetPointerShape( psoMask->lDelta, psoMask->iBitmapFormat, 0, Bits); } + /* + * Create and XLATEOBJ that will be used for drawing masks. + * FIXME: We should get this in pxlo parameter! + */ + +/* + ppdev->PointerXlateObject = pxlo; +*/ + + { + HPALETTE BWPalette, DestPalette; + ULONG BWColors[] = {0, 0xFFFFFF}; + PDC Dc; + PPALGDI PalObj; + LONG DestMode; + + BWPalette = EngCreatePalette(PAL_INDEXED, sizeof(BWColors) / sizeof(ULONG), + BWColors, 0, 0, 0); + Dc = DC_LockDc(IntGetScreenDC()); + DestPalette = Dc->w.hPalette; + PalObj = PALETTE_LockPalette(DestPalette); + DestMode = PalObj->Mode; + PALETTE_UnlockPalette(DestPalette); + DC_UnlockDc(IntGetScreenDC()); + ppdev->PointerXlateObject = IntEngCreateXlate(DestMode, PAL_INDEXED, + DestPalette, BWPalette); + EngDeletePalette(BWPalette); + } + /* * Create surface for saving the pixels under the cursor. */ diff --git a/reactos/subsys/win32k/objects/dc.c b/reactos/subsys/win32k/objects/dc.c index c5ba1865980..5c1fed554e1 100644 --- a/reactos/subsys/win32k/objects/dc.c +++ b/reactos/subsys/win32k/objects/dc.c @@ -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: dc.c,v 1.118 2004/01/16 23:29:10 gvg Exp $ +/* $Id: dc.c,v 1.119 2004/01/25 16:47:10 navaraf Exp $ * * DC.C - Device context functions * @@ -474,6 +474,8 @@ IntCreatePrimarySurface() BOOL GotDriver; BOOL DoDefault; + RtlZeroMemory(&PrimarySurface, sizeof(PrimarySurface)); + ExInitializeFastMutex(&PrimarySurface.DriverLock); /* Open the miniport driver */ @@ -544,9 +546,6 @@ IntCreatePrimarySurface() DPRINT("Building DDI Functions\n"); - /* Make sure the non existant functions are NULL */ - RtlZeroMemory(&PrimarySurface.DriverFunctions, sizeof(PrimarySurface.DriverFunctions)); - /* Construct DDI driver function dispatch table */ if (! DRIVER_BuildDDIFunctions(&DED, &PrimarySurface.DriverFunctions)) { @@ -652,8 +651,19 @@ IntCreatePrimarySurface() VOID FASTCALL IntDestroyPrimarySurface() { +#if 0 + PSURFOBJ SurfObj; + PSURFGDI SurfGDI; +#endif + DRIVER_UnreferenceDriver(L"DISPLAY"); +#if 0 + DPRINT("Hiding mouse pointer\n" ); + SurfObj = (PSURFOBJ)AccessUserObject((ULONG) PrimarySurface.Handle); + SurfGDI = (PSURFGDI)AccessInternalObject((ULONG) PrimarySurface.Handle); + SurfGDI->SetPointerShape(SurfObj, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0); +#endif DPRINT("Reseting display\n" ); PrimarySurface.DriverFunctions.AssertMode(PrimarySurface.PDev, FALSE); PrimarySurface.DriverFunctions.DisableSurface(PrimarySurface.PDev);