ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

pointer.c
Go to the documentation of this file.
00001 /*
00002  * ReactOS Generic Framebuffer display driver
00003  *
00004  * Copyright (C) 2007 Magnus Olsen
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License along
00017  * with this program; if not, write to the Free Software Foundation, Inc.,
00018  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00019  */
00020 
00021 #include "framebufacc.h"
00022 
00023 
00024 
00025 /*
00026  * DrvMovePointer
00027  *
00028  * Moves the pointer to a new position and ensures that GDI does not interfere
00029  * with the display of the pointer.
00030  *
00031  * Status
00032  *    @implemented
00033  */
00034 
00035 VOID APIENTRY
00036 DrvMovePointer(IN SURFOBJ *pso,
00037                IN LONG x,
00038                IN LONG y,
00039                IN RECTL *prcl)
00040 {
00041     PPDEV ppdev = (PPDEV) pso->dhpdev;
00042     DWORD returnedDataLength;
00043     VIDEO_POINTER_POSITION NewPointerPosition;
00044 
00045     x -= ppdev->ScreenOffsetXY.x;
00046     y -= ppdev->ScreenOffsetXY.y;
00047 
00048     /* position of (-1,-1) hide the pointer */
00049     if ((x == -1) || (y == -1))
00050     {
00051         if (EngDeviceIoControl(ppdev->hDriver, IOCTL_VIDEO_DISABLE_POINTER, NULL, 0, NULL, 0, &returnedDataLength))
00052         {
00053             /* hw did not disable the mouse, we try then with software */
00054             EngMovePointer(pso, x, y, prcl);
00055         }
00056     }
00057     else
00058     {
00059         /* Calc the mouse positions and set it to the new positions */
00060         NewPointerPosition.Column = (SHORT) x - (SHORT) (ppdev->PointerHotSpot.x);
00061         NewPointerPosition.Row    = (SHORT) y - (SHORT) (ppdev->PointerHotSpot.y);
00062 
00063         if (EngDeviceIoControl(ppdev->hDriver, IOCTL_VIDEO_SET_POINTER_POSITION, &NewPointerPosition,
00064                                sizeof(VIDEO_POINTER_POSITION), NULL, 0, &returnedDataLength))
00065         {
00066             /* hw did not disable the mouse, we try then with software */
00067             EngMovePointer(pso, x, y, prcl);
00068         }
00069     }
00070 }
00071 
00072 
00073 /*
00074  * DrvSetPointerShape
00075  *
00076  * Sets the new pointer shape.
00077  *
00078  * Status
00079  *    @implemented
00080  */
00081 
00082 ULONG APIENTRY
00083 DrvSetPointerShape(
00084    IN SURFOBJ *pso,
00085    IN SURFOBJ *psoMask,
00086    IN SURFOBJ *psoColor,
00087    IN XLATEOBJ *pxlo,
00088    IN LONG xHot,
00089    IN LONG yHot,
00090    IN LONG x,
00091    IN LONG y,
00092    IN RECTL *prcl,
00093    IN FLONG fl)
00094 {
00095     PPDEV   ppdev = (PPDEV) pso->dhpdev;
00096     ULONG returnedDataLength = 0;
00097 
00098     if (ppdev->pPointerAttributes == NULL)
00099     {
00100         /* hw did not support hw mouse pointer, we try then with software */
00101         return EngSetPointerShape(pso, psoMask, psoColor, pxlo, xHot, yHot, x, y, prcl, fl);
00102     }
00103 
00104     /* check see if the apps ask to hide the mouse or not */
00105     if (psoMask == (SURFOBJ *) NULL)
00106     {
00107         if (EngDeviceIoControl(ppdev->hDriver, IOCTL_VIDEO_DISABLE_POINTER, NULL, 0, NULL, 0, &returnedDataLength))
00108         {
00109             /* no hw support found for the mouse we try then the software version */
00110             return EngSetPointerShape(pso, psoMask, psoColor, pxlo, xHot, yHot, x, y, prcl, fl);
00111         }
00112 
00113         return TRUE;
00114     }
00115 
00116     /* set our hotspot */
00117     ppdev->PointerHotSpot.x = xHot;
00118     ppdev->PointerHotSpot.y = yHot;
00119 
00120     /* Set the hw mouse shape */
00121 
00122     if (psoColor != (SURFOBJ *) NULL)
00123     {
00124         /* We got a color mouse pointer */
00125         if ((ppdev->PointerCapabilities.Flags & VIDEO_MODE_COLOR_POINTER) &&
00126             (CopyColorPointer(ppdev, psoMask, psoColor, pxlo)) )
00127         {
00128             ppdev->pPointerAttributes->Flags |= VIDEO_MODE_COLOR_POINTER;
00129         }
00130         else
00131         {
00132             /* No color mouse pointer being set, so we need try the software version then */
00133             if (ppdev->HwMouseActive)
00134             {
00135                 ppdev->HwMouseActive = FALSE;
00136                 if (EngDeviceIoControl(ppdev->hDriver, IOCTL_VIDEO_DISABLE_POINTER, NULL, 0, NULL, 0, &returnedDataLength))
00137                 {
00138                     /* hw did not support hw mouse pointer, we try then with software */
00139                     return EngSetPointerShape(pso, psoMask, psoColor, pxlo, xHot, yHot, x, y, prcl, fl);
00140                 }
00141             }
00142             return SPS_DECLINE ;
00143         }
00144     }
00145     else
00146     {
00147         /* We got a mono mouse pointer */
00148         if ( (ppdev->PointerCapabilities.Flags & VIDEO_MODE_MONO_POINTER) &&
00149               (CopyMonoPointer(ppdev, psoMask)))
00150         {
00151             ppdev->pPointerAttributes->Flags |= VIDEO_MODE_MONO_POINTER;
00152         }
00153         else
00154         {
00155             /* No mono mouse pointer being set, so we need try the software version then */
00156             if (ppdev->HwMouseActive)
00157             {
00158                 ppdev->HwMouseActive = FALSE;
00159                 if (EngDeviceIoControl(ppdev->hDriver, IOCTL_VIDEO_DISABLE_POINTER, NULL, 0, NULL, 0, &returnedDataLength))
00160                 {
00161                     /* hw did not support hw mouse pointer, we try then with software */
00162                     return EngSetPointerShape(pso, psoMask, psoColor, pxlo, xHot, yHot, x, y, prcl, fl);
00163                 }
00164             }
00165             return SPS_DECLINE ;
00166         }
00167     }
00168 
00169     /* we goto hw mouse pointer then we contnue filling in more info */
00170 
00171     /* calc the mouse point positions */
00172     if ((x != -1) || (y != -1))
00173     {
00174         ppdev->pPointerAttributes->Column -= (SHORT)(ppdev->PointerHotSpot.x);
00175         ppdev->pPointerAttributes->Row -= (SHORT)(ppdev->PointerHotSpot.y);
00176     }
00177 
00178     /* set correct flags if it animated or need be updated anime or no flags at all */
00179     if (fl & SPS_ANIMATESTART)
00180     {
00181         ppdev->pPointerAttributes->Flags |= VIDEO_MODE_ANIMATE_START;
00182     }
00183     else if (fl & SPS_ANIMATEUPDATE)
00184     {
00185         ppdev->pPointerAttributes->Flags |= VIDEO_MODE_ANIMATE_UPDATE;
00186     }
00187 
00188     ppdev->pPointerAttributes->Enable = 1;
00189     ppdev->pPointerAttributes->Column = (SHORT)(x);
00190     ppdev->pPointerAttributes->Row    = (SHORT)(y);
00191 
00192     /* Set the new mouse pointer shape */
00193     if (EngDeviceIoControl(ppdev->hDriver, IOCTL_VIDEO_SET_POINTER_ATTR, ppdev->pPointerAttributes,
00194                            ppdev->PointerAttributesSize, NULL, 0, &returnedDataLength))
00195     {
00196             /* no hw support found for the mouse we try then the software version */
00197             return EngSetPointerShape(pso, psoMask, psoColor, pxlo, xHot, yHot, x, y, prcl, fl);
00198     }
00199 
00200     /* we got real hw support */
00201     ppdev->HwMouseActive = TRUE;
00202     return SPS_ACCEPT_NOEXCLUDE;
00203 }
00204 
00205 
00206 /* Internal api that are only use in DrvSetPointerShape */
00207 
00208 BOOL
00209 CopyColorPointer(PPDEV ppdev,
00210                 SURFOBJ *psoMask,
00211                 SURFOBJ *psoColor,
00212                 XLATEOBJ *pxlo)
00213 {
00214     /* FIXME unimplement */
00215     return FALSE;
00216 }
00217 
00218 BOOL
00219 CopyMonoPointer(PPDEV ppdev,
00220                 SURFOBJ *pso)
00221 {
00222     /* FIXME unimplement */
00223     return FALSE;
00224 }
00225 
00226 

Generated on Sat May 26 2012 04:36:55 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.