VirtualBox

Changeset 22469 in vbox for trunk


Ignore:
Timestamp:
Aug 26, 2009 12:50:12 PM (15 years ago)
Author:
vboxsync
Message:

Additions/WINNT: re-enable the host mouse cursor when the guest requests it, second version

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Miniport
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp

    r22465 r22469  
    13751375
    13761376/**
     1377 * Send a request to the host to make the absolute pointer visible
     1378 */
     1379static BOOLEAN ShowPointer(PVOID HwDeviceExtension)
     1380{
     1381    LogRelFlowFunc(("\n"));
     1382    BOOLEAN Result;
     1383
     1384    if (DEV_MOUSE_HIDDEN((PDEVICE_EXTENSION)HwDeviceExtension))
     1385    {
     1386        // tell the host to use the guest's pointer
     1387        VIDEO_POINTER_ATTRIBUTES PointerAttributes;
     1388
     1389        /* Visible and No Shape means Show the pointer.
     1390         * It is enough to init only this field.
     1391         */
     1392        PointerAttributes.Enable = VBOX_MOUSE_POINTER_VISIBLE;
     1393
     1394#ifndef VBOX_WITH_HGSMI
     1395        Result = vboxUpdatePointerShape(&PointerAttributes, sizeof (PointerAttributes));
     1396#else
     1397        Result = vboxUpdatePointerShape(((PDEVICE_EXTENSION)HwDeviceExtension)->pPrimary, &PointerAttributes, sizeof (PointerAttributes));
     1398#endif /* VBOX_WITH_HGSMI */
     1399
     1400        if (Result)
     1401            DEV_SET_MOUSE_SHOWN((PDEVICE_EXTENSION)HwDeviceExtension);
     1402        else
     1403            dprintf(("VBoxVideo::ShowPointer: Could not show the hardware pointer -> fallback\n"));
     1404    }
     1405    LogRelFlowFunc(("returning %d\n", Result));
     1406    return Result;
     1407}
     1408
     1409/**
    13771410 * VBoxVideoStartIO
    13781411 *
     
    15841617            dprintf(("VBoxVideo::VBoxVideoStartIO: IOCTL_VIDEO_ENABLE_POINTER\n"));
    15851618            // find out whether the host wants absolute positioning
     1619            /// @todo this is now obsolete - remove it?
    15861620            if (vboxQueryHostWantsAbsolute())
    1587             {
    1588                 // tell the host to use the guest's pointer
     1621                Result = ShowPointer(HwDeviceExtension);
     1622            else
     1623            {
     1624                // fallback to software pointer
     1625                RequestPacket->StatusBlock->Status = ERROR_INVALID_FUNCTION;
     1626                Result = FALSE;
     1627            }
     1628            break;
     1629        }
     1630
     1631        // hide the pointer
     1632        case IOCTL_VIDEO_DISABLE_POINTER:
     1633        {
     1634            dprintf(("VBoxVideo::VBoxVideoStartIO: IOCTL_VIDEO_DISABLE_POINTER\n"));
     1635            // find out whether the host wants absolute positioning
     1636            if (vboxQueryHostWantsAbsolute())
     1637            {
     1638                // tell the host to hide pointer
    15891639                VIDEO_POINTER_ATTRIBUTES PointerAttributes;
    15901640
    1591                 /* Visible and No Shape means Show the pointer.
     1641                /* Enable == 0 means no shape, not visible.
    15921642                 * It is enough to init only this field.
    15931643                 */
    1594                 PointerAttributes.Enable = VBOX_MOUSE_POINTER_VISIBLE;
     1644                PointerAttributes.Enable = 0;
    15951645
    15961646#ifndef VBOX_WITH_HGSMI
     
    16001650#endif /* VBOX_WITH_HGSMI */
    16011651
    1602                 if (!Result)
    1603                     dprintf(("VBoxVideo::VBoxVideoStartIO: Could not hide hardware pointer -> fallback\n"));
    1604             } else
    1605             {
    1606                 // fallback to software pointer
    1607                 RequestPacket->StatusBlock->Status = ERROR_INVALID_FUNCTION;
    1608                 Result = FALSE;
    1609             }
    1610             break;
    1611         }
    1612 
    1613         // hide the pointer
    1614         case IOCTL_VIDEO_DISABLE_POINTER:
    1615         {
    1616             dprintf(("VBoxVideo::VBoxVideoStartIO: IOCTL_VIDEO_DISABLE_POINTER\n"));
    1617             // find out whether the host wants absolute positioning
    1618             if (vboxQueryHostWantsAbsolute())
    1619             {
    1620                 // tell the host to hide pointer
    1621                 VIDEO_POINTER_ATTRIBUTES PointerAttributes;
    1622 
    1623                 /* Enable == 0 means no shape, not visible.
    1624                  * It is enough to init only this field.
    1625                  */
    1626                 PointerAttributes.Enable = 0;
    1627 
    1628 #ifndef VBOX_WITH_HGSMI
    1629                 Result = vboxUpdatePointerShape(&PointerAttributes, sizeof (PointerAttributes));
    1630 #else
    1631                 Result = vboxUpdatePointerShape(((PDEVICE_EXTENSION)HwDeviceExtension)->pPrimary, &PointerAttributes, sizeof (PointerAttributes));
    1632 #endif /* VBOX_WITH_HGSMI */
    1633 
    1634                 if (!Result)
     1652                if (Result)
     1653                    DEV_SET_MOUSE_HIDDEN((PDEVICE_EXTENSION)HwDeviceExtension);
     1654                else
    16351655                    dprintf(("VBoxVideo::VBoxVideoStartIO: Could not hide hardware pointer -> fallback\n"));
    16361656            } else
     
    17021722        case IOCTL_VIDEO_SET_POINTER_POSITION:
    17031723        {
    1704             /// @todo There is an issue when we disable pointer integration.
    1705             // The guest pointer will be invisible. We have to somehow cause
    1706             // the pointer attributes to be set again. But how? The same holds
    1707             // true for the opposite case where we get two pointers.
    1708 
    1709             //dprintf(("VBoxVideo::VBoxVideoStartIO: IOCTL_VIDEO_SET_POINTER_POSITION\n"));
    17101724            // find out whether the host wants absolute positioning
     1725            /// @todo this is now obsolete - remove it?
    17111726            if (vboxQueryHostWantsAbsolute())
    1712             {
    1713                 // @todo we are supposed to show currently invisible pointer?
    1714                 Result = TRUE;
    1715             } else
     1727                Result = ShowPointer(HwDeviceExtension);
     1728            else
    17161729            {
    17171730                // fallback to software pointer
  • trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h

    r22465 r22469  
    126126           ULONG ulMaxFrameBufferSize;         /* The size of the VRAM allocated for the a single framebuffer. */
    127127
     128           BOOLEAN fMouseHidden;               /* Has the mouse cursor been hidden by the guest? */
     129
    128130#ifndef VBOX_WITH_HGSMI
    129131           ULONG ulDisplayInformationSize;     /* The size of the Display information, which is at offset:
     
    164166#endif /* VBOX_WITH_HGSMI */
    165167} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
     168
     169#define DEV_MOUSE_HIDDEN(dev) ((dev)->pPrimary->u.primary.fMouseHidden)
     170#define DEV_SET_MOUSE_HIDDEN(dev)   \
     171do { \
     172    (dev)->pPrimary->u.primary.fMouseHidden = TRUE; \
     173} while (0)
     174#define DEV_SET_MOUSE_SHOWN(dev)   \
     175do { \
     176    (dev)->pPrimary->u.primary.fMouseHidden = FALSE; \
     177} while (0)
    166178
    167179extern "C"
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette