Ignore:
Timestamp:
Apr 28, 2010, 8:41:11 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: Added a special direct Dive framebuffer access mode that hides the mouse pointer to avoid screen corruption under it that takes place when the video driver uses a software mouse pointer (activated by QT_PM_DIVE=FBSWM).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/painting/qwindowsurface_pm.cpp

    r713 r714  
    254254static HDIVE diveHandle = NULLHANDLE;
    255255static char *diveFrameBuf = NULL;
     256static bool diveHideMouse = false;
     257
     258static LONG mousePtrSize = 0;
    256259
    257260////////////////////////////////////////////////////////////////////////////////
     
    663666                // use direct framebuffer access
    664667                diveUseFB = true;
     668            } else if (diveEnv == "FBSWM") {
     669                // use direct framebuffer access, hide the mouse pointer
     670                diveUseFB = true;
     671                diveHideMouse = true;
    665672            } else {
    666673                // disable DIVE by default due to bugs in the Panorama driver
     
    776783                    }
    777784                }
     785
     786                mousePtrSize = WinQuerySysValue(HWND_DESKTOP, SV_CXPOINTER);
    778787            }
    779788        }
     
    781790        DEBUG_VAR(diveDllOK);
    782791        DEBUG_VAR(diveUseFB);
     792        DEBUG_VAR(diveHideMouse);
    783793    }
    784794
     
    884894
    885895    const int srcBytesPerLine = d->image->bytesPerLine();
     896
     897    bool ptrHidden = false;
     898    if (diveHideMouse) {
     899        // DIVE is not able to preserve the software mouse pointer when
     900        // painting over it using the direct framebuffer access. We have to
     901        // hide it to avoid screen corruption underneath
     902        POINTL ptrPos;
     903        if (WinQueryPointerPos(HWND_DESKTOP, &ptrPos)) {
     904            ptrPos.x -= d->setup.lScreenPosX;
     905            ptrPos.y = diveCaps.ulVerticalResolution - ptrPos.y - 1 -
     906                       d->setup.lScreenPosY;
     907            // keep a safety zone around the rectangle to each direction
     908            // as we don't know the exact mouse pointer configuration
     909            if (ptrPos.x >= (src.left() - mousePtrSize) &&
     910                ptrPos.x <= (src.right() + mousePtrSize) &&
     911                ptrPos.y >= (src.top() - mousePtrSize) &&
     912                ptrPos.y <= (src.bottom() + mousePtrSize))
     913                ptrHidden = WinShowPointer(HWND_DESKTOP, FALSE);
     914        }
     915    }
    886916
    887917    if (DiveAcquireFrameBuffer(d->hDive, &rclDst) == DIVE_SUCCESS) {
     
    10311061        DiveDeacquireFrameBuffer(d->hDive);
    10321062    }
     1063
     1064    if (ptrHidden)
     1065        WinShowPointer(HWND_DESKTOP, TRUE);
    10331066}
    10341067
Note: See TracChangeset for help on using the changeset viewer.