From 7c4c90e02b427f0aaf99d5cee19abf1de5973df6 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Fri, 2 Nov 2007 00:03:02 +0000 Subject: [PATCH] rename framebuf_acc.* to framebufacc.* for rbuild can not handle _, forget about that implement DrvSetPointerShape, left todo is the copy process for mono and color pointer data before it is completed. svn path=/trunk/; revision=30059 --- .../video/displays/framebufacc/enable.c | 2 +- .../{framebuf_acc.def => framebufacc.def} | 0 .../{framebuf_acc.h => framebufacc.h} | 13 ++ ...framebuf_acc.rbuild => framebufacc.rbuild} | 6 +- .../{framebuf_acc.rc => framebufacc.rc} | 0 .../video/displays/framebufacc/palette.c | 2 +- .../video/displays/framebufacc/pointer.c | 134 +++++++++++++++++- .../video/displays/framebufacc/screen.c | 2 +- .../video/displays/framebufacc/surface.c | 5 +- 9 files changed, 152 insertions(+), 12 deletions(-) rename reactos/drivers/video/displays/framebufacc/{framebuf_acc.def => framebufacc.def} (100%) rename reactos/drivers/video/displays/framebufacc/{framebuf_acc.h => framebufacc.h} (94%) rename reactos/drivers/video/displays/framebufacc/{framebuf_acc.rbuild => framebufacc.rbuild} (76%) rename reactos/drivers/video/displays/framebufacc/{framebuf_acc.rc => framebufacc.rc} (100%) diff --git a/reactos/drivers/video/displays/framebufacc/enable.c b/reactos/drivers/video/displays/framebufacc/enable.c index 2558ba02c79..3892a356c6a 100644 --- a/reactos/drivers/video/displays/framebufacc/enable.c +++ b/reactos/drivers/video/displays/framebufacc/enable.c @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "framebuf_acc.h" +#include "framebufacc.h" static DRVFN DrvFunctionTable[] = { diff --git a/reactos/drivers/video/displays/framebufacc/framebuf_acc.def b/reactos/drivers/video/displays/framebufacc/framebufacc.def similarity index 100% rename from reactos/drivers/video/displays/framebufacc/framebuf_acc.def rename to reactos/drivers/video/displays/framebufacc/framebufacc.def diff --git a/reactos/drivers/video/displays/framebufacc/framebuf_acc.h b/reactos/drivers/video/displays/framebufacc/framebufacc.h similarity index 94% rename from reactos/drivers/video/displays/framebufacc/framebuf_acc.h rename to reactos/drivers/video/displays/framebufacc/framebufacc.h index 1cb2accd2ff..a3171a3fd09 100644 --- a/reactos/drivers/video/displays/framebufacc/framebuf_acc.h +++ b/reactos/drivers/video/displays/framebufacc/framebufacc.h @@ -92,6 +92,9 @@ typedef struct _PDEV } PDEV, *PPDEV; + + + #define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24)) #define DEVICE_NAME L"framebuf" @@ -187,4 +190,14 @@ IntSetPalette( IN ULONG iStart, IN ULONG cColors); +BOOL +CopyMonoPointer(PPDEV ppdev, + SURFOBJ *pso); + +BOOL +CopyColorPointer(PPDEV ppdev, + SURFOBJ *psoMask, + SURFOBJ *psoColor, + XLATEOBJ *pxlo); + #endif /* FRAMEBUF_H */ diff --git a/reactos/drivers/video/displays/framebufacc/framebuf_acc.rbuild b/reactos/drivers/video/displays/framebufacc/framebufacc.rbuild similarity index 76% rename from reactos/drivers/video/displays/framebufacc/framebuf_acc.rbuild rename to reactos/drivers/video/displays/framebufacc/framebufacc.rbuild index b45d3a1211f..1b73321ff3f 100644 --- a/reactos/drivers/video/displays/framebufacc/framebuf_acc.rbuild +++ b/reactos/drivers/video/displays/framebufacc/framebufacc.rbuild @@ -1,8 +1,8 @@ - - . + + . win32k libcntpr enable.c @@ -10,5 +10,5 @@ pointer.c screen.c surface.c - framebuf_acc.rc + framebufacc.rc diff --git a/reactos/drivers/video/displays/framebufacc/framebuf_acc.rc b/reactos/drivers/video/displays/framebufacc/framebufacc.rc similarity index 100% rename from reactos/drivers/video/displays/framebufacc/framebuf_acc.rc rename to reactos/drivers/video/displays/framebufacc/framebufacc.rc diff --git a/reactos/drivers/video/displays/framebufacc/palette.c b/reactos/drivers/video/displays/framebufacc/palette.c index 61daa3affc6..c167509e6f7 100644 --- a/reactos/drivers/video/displays/framebufacc/palette.c +++ b/reactos/drivers/video/displays/framebufacc/palette.c @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "framebuf_acc.h" +#include "framebufacc.h" /* * Standard color that must be in palette, because they're used for diff --git a/reactos/drivers/video/displays/framebufacc/pointer.c b/reactos/drivers/video/displays/framebufacc/pointer.c index 68e5121fde9..c7b5d88c29b 100644 --- a/reactos/drivers/video/displays/framebufacc/pointer.c +++ b/reactos/drivers/video/displays/framebufacc/pointer.c @@ -18,7 +18,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "framebuf_acc.h" +#include "framebufacc.h" + /* @@ -75,7 +76,7 @@ DrvMovePointer(IN SURFOBJ *pso, * Sets the new pointer shape. * * Status - * @unimplemented + * @implemented */ ULONG APIENTRY @@ -91,10 +92,135 @@ DrvSetPointerShape( IN RECTL *prcl, IN FLONG fl) { -/* return SPS_DECLINE;*/ - return EngSetPointerShape(pso, psoMask, psoColor, pxlo, xHot, yHot, x, y, prcl, fl); + PPDEV ppdev = (PPDEV) pso->dhpdev; + ULONG returnedDataLength = 0; + + if (ppdev->pPointerAttributes == NULL) + { + /* hw did not support hw mouse pointer, we try then with software */ + return EngSetPointerShape(pso, psoMask, psoColor, pxlo, xHot, yHot, x, y, prcl, fl); + } + + /* check see if the apps ask to hide the mouse or not */ + if (psoMask == (SURFOBJ *) NULL) + { + if (EngDeviceIoControl(ppdev->hDriver, IOCTL_VIDEO_DISABLE_POINTER, NULL, 0, NULL, 0, &returnedDataLength)) + { + /* no hw support found for the mouse we try then the software version */ + return EngSetPointerShape(pso, psoMask, psoColor, pxlo, xHot, yHot, x, y, prcl, fl); + } + + return TRUE; + } + + /* set our hotspot */ + ppdev->PointerHotSpot.x = xHot; + ppdev->PointerHotSpot.y = yHot; + + /* Set the hw mouse shape */ + + if (psoColor != (SURFOBJ *) NULL) + { + /* We got a color mouse pointer */ + if ((ppdev->PointerCapabilities.Flags & VIDEO_MODE_COLOR_POINTER) && + (CopyColorPointer(ppdev, psoMask, psoColor, pxlo)) ) + { + ppdev->pPointerAttributes->Flags |= VIDEO_MODE_COLOR_POINTER; + } + else + { + /* No color mouse pointer being set, so we need try the software version then */ + if (ppdev->HwMouseActive) + { + ppdev->HwMouseActive = FALSE; + if (EngDeviceIoControl(ppdev->hDriver, IOCTL_VIDEO_DISABLE_POINTER, NULL, 0, NULL, 0, &returnedDataLength)) + { + /* hw did not support hw mouse pointer, we try then with software */ + return EngSetPointerShape(pso, psoMask, psoColor, pxlo, xHot, yHot, x, y, prcl, fl); + } + } + return SPS_DECLINE ; + } + } + else + { + /* We got a mono mouse pointer */ + if ( (ppdev->PointerCapabilities.Flags & VIDEO_MODE_MONO_POINTER) && + (CopyMonoPointer(ppdev, psoMask))) + { + ppdev->pPointerAttributes->Flags |= VIDEO_MODE_MONO_POINTER; + } + else + { + /* No mono mouse pointer being set, so we need try the software version then */ + if (ppdev->HwMouseActive) + { + ppdev->HwMouseActive = FALSE; + if (EngDeviceIoControl(ppdev->hDriver, IOCTL_VIDEO_DISABLE_POINTER, NULL, 0, NULL, 0, &returnedDataLength)) + { + /* hw did not support hw mouse pointer, we try then with software */ + return EngSetPointerShape(pso, psoMask, psoColor, pxlo, xHot, yHot, x, y, prcl, fl); + } + } + return SPS_DECLINE ; + } + } + + /* we goto hw mouse pointer then we contnue filling in more info */ + + /* calc the mouse point positions */ + if ((x != -1) || (y != -1)) + { + ppdev->pPointerAttributes->Column -= (SHORT)(ppdev->PointerHotSpot.x); + ppdev->pPointerAttributes->Row -= (SHORT)(ppdev->PointerHotSpot.y); + } + + /* set correct flags if it animated or need be updated anime or no flags at all */ + if (fl & SPS_ANIMATESTART) + { + ppdev->pPointerAttributes->Flags |= VIDEO_MODE_ANIMATE_START; + } + else if (fl & SPS_ANIMATEUPDATE) + { + ppdev->pPointerAttributes->Flags |= VIDEO_MODE_ANIMATE_UPDATE; + } + + ppdev->pPointerAttributes->Enable = 1; + ppdev->pPointerAttributes->Column = (SHORT)(x); + ppdev->pPointerAttributes->Row = (SHORT)(y); + + /* Set the new mouse pointer shape */ + if (EngDeviceIoControl(ppdev->hDriver, IOCTL_VIDEO_SET_POINTER_ATTR, ppdev->pPointerAttributes, + ppdev->PointerAttributesSize, NULL, 0, &returnedDataLength)) + { + /* no hw support found for the mouse we try then the software version */ + return EngSetPointerShape(pso, psoMask, psoColor, pxlo, xHot, yHot, x, y, prcl, fl); + } + + /* we got real hw support */ + ppdev->HwMouseActive = TRUE; + return SPS_ACCEPT_NOEXCLUDE; } +/* Internal api that are only use in DrvSetPointerShape */ + +BOOL +CopyColorPointer(PPDEV ppdev, + SURFOBJ *psoMask, + SURFOBJ *psoColor, + XLATEOBJ *pxlo) +{ + /* FIXME unimplement */ + return FALSE; +} + +BOOL +CopyMonoPointer(PPDEV ppdev, + SURFOBJ *pso) +{ + /* FIXME unimplement */ + return FALSE; +} diff --git a/reactos/drivers/video/displays/framebufacc/screen.c b/reactos/drivers/video/displays/framebufacc/screen.c index de89ccd0053..6b9766e6215 100644 --- a/reactos/drivers/video/displays/framebufacc/screen.c +++ b/reactos/drivers/video/displays/framebufacc/screen.c @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "framebuf_acc.h" +#include "framebufacc.h" /* * GetAvailableModes diff --git a/reactos/drivers/video/displays/framebufacc/surface.c b/reactos/drivers/video/displays/framebufacc/surface.c index 0d04451c9ae..b1c0d551902 100644 --- a/reactos/drivers/video/displays/framebufacc/surface.c +++ b/reactos/drivers/video/displays/framebufacc/surface.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "framebuf_acc.h" +#include "framebufacc.h" BOOL InitSurface(PPDEV ppdev, @@ -156,7 +156,8 @@ DrvEnableSurface( } /* Rest the desktop vitual position */ - ppdev->ScreenOffsetXY = {0,0}; + ppdev->ScreenOffsetXY.x = 0; + ppdev->ScreenOffsetXY.y = 0; switch (ppdev->BitsPerPixel)