mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Reduced cursor flickering during temporary mode changes
This commit is contained in:
parent
0a67b4aa00
commit
439750e174
@ -1412,7 +1412,8 @@ namespace D3dDdi
|
|||||||
}
|
}
|
||||||
|
|
||||||
Gdi::Cursor::setMonitorClipRect(clipRect);
|
Gdi::Cursor::setMonitorClipRect(clipRect);
|
||||||
Gdi::Cursor::setEmulated(mi.isEmulated);
|
DDraw::RealPrimarySurface::setEmulatedCursor(0 != g_presentationRect.left || 0 != g_presentationRect.top ||
|
||||||
|
Rect::getSize(mi.rcEmulated) != Rect::getSize(g_presentationRect));
|
||||||
Gdi::VirtualScreen::setFullscreenMode(m_origData.Flags.MatchGdiPrimary);
|
Gdi::VirtualScreen::setFullscreenMode(m_origData.Flags.MatchGdiPrimary);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1421,7 +1422,7 @@ namespace D3dDdi
|
|||||||
|
|
||||||
g_presentationRect = {};
|
g_presentationRect = {};
|
||||||
Gdi::VirtualScreen::setFullscreenMode(false);
|
Gdi::VirtualScreen::setFullscreenMode(false);
|
||||||
Gdi::Cursor::setEmulated(false);
|
DDraw::RealPrimarySurface::setEmulatedCursor(false);
|
||||||
Gdi::Cursor::setMonitorClipRect({});
|
Gdi::Cursor::setMonitorClipRect({});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@ namespace
|
|||||||
DDSURFACEDESC2 g_surfaceDesc = {};
|
DDSURFACEDESC2 g_surfaceDesc = {};
|
||||||
DDraw::IReleaseNotifier g_releaseNotifier(onRelease);
|
DDraw::IReleaseNotifier g_releaseNotifier(onRelease);
|
||||||
|
|
||||||
|
bool g_emulatedCursor = false;
|
||||||
bool g_isFullscreen = false;
|
bool g_isFullscreen = false;
|
||||||
bool g_isExclusiveFullscreen = false;
|
bool g_isExclusiveFullscreen = false;
|
||||||
DDraw::Surface* g_lastFlipSurface = nullptr;
|
DDraw::Surface* g_lastFlipSurface = nullptr;
|
||||||
@ -478,6 +479,11 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
prevFullscreenWindow = fullscreenWindow;
|
prevFullscreenWindow = fullscreenWindow;
|
||||||
|
|
||||||
|
if (Gdi::Cursor::isEmulated() != g_emulatedCursor)
|
||||||
|
{
|
||||||
|
Gdi::Cursor::setEmulated(g_emulatedCursor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned WINAPI updateThreadProc(LPVOID /*lpParameter*/)
|
unsigned WINAPI updateThreadProc(LPVOID /*lpParameter*/)
|
||||||
@ -827,6 +833,11 @@ namespace DDraw
|
|||||||
g_qpcUpdatePresentationWindow = Time::queryPerformanceCounter() + Time::g_qpcFrequency / 5;
|
g_qpcUpdatePresentationWindow = Time::queryPerformanceCounter() + Time::g_qpcFrequency / 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RealPrimarySurface::setEmulatedCursor(bool emulated)
|
||||||
|
{
|
||||||
|
g_emulatedCursor = emulated;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT RealPrimarySurface::setGammaRamp(DDGAMMARAMP* rampData)
|
HRESULT RealPrimarySurface::setGammaRamp(DDGAMMARAMP* rampData)
|
||||||
{
|
{
|
||||||
DDraw::ScopedThreadLock lock;
|
DDraw::ScopedThreadLock lock;
|
||||||
|
@ -29,6 +29,7 @@ namespace DDraw
|
|||||||
static void scheduleOverlayUpdate();
|
static void scheduleOverlayUpdate();
|
||||||
static void scheduleUpdate();
|
static void scheduleUpdate();
|
||||||
static void schedulePresentationWindowUpdate();
|
static void schedulePresentationWindowUpdate();
|
||||||
|
static void setEmulatedCursor(bool emulated);
|
||||||
static HRESULT setGammaRamp(DDGAMMARAMP* rampData);
|
static HRESULT setGammaRamp(DDGAMMARAMP* rampData);
|
||||||
static void setPresentationWindowTopmost();
|
static void setPresentationWindowTopmost();
|
||||||
static void setUpdateReady();
|
static void setUpdateReady();
|
||||||
|
@ -319,6 +319,11 @@ namespace
|
|||||||
void fixPopupMenuPosition(WINDOWPOS& wp)
|
void fixPopupMenuPosition(WINDOWPOS& wp)
|
||||||
{
|
{
|
||||||
RECT mr = DDraw::PrimarySurface::getMonitorRect();
|
RECT mr = DDraw::PrimarySurface::getMonitorRect();
|
||||||
|
if (IsRectEmpty(&mr))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (wp.flags & SWP_NOSIZE)
|
if (wp.flags & SWP_NOSIZE)
|
||||||
{
|
{
|
||||||
RECT r = {};
|
RECT r = {};
|
||||||
@ -433,7 +438,7 @@ namespace
|
|||||||
{
|
{
|
||||||
LRESULT result = CallWindowProc(origWndProc, hwnd, msg, wParam, lParam);
|
LRESULT result = CallWindowProc(origWndProc, hwnd, msg, wParam, lParam);
|
||||||
auto& wp = *reinterpret_cast<WINDOWPOS*>(lParam);
|
auto& wp = *reinterpret_cast<WINDOWPOS*>(lParam);
|
||||||
if (Gdi::Cursor::isEmulated() && !(wp.flags & SWP_NOMOVE))
|
if (!(wp.flags & SWP_NOMOVE))
|
||||||
{
|
{
|
||||||
fixPopupMenuPosition(wp);
|
fixPopupMenuPosition(wp);
|
||||||
}
|
}
|
||||||
|
@ -516,21 +516,23 @@ namespace
|
|||||||
|
|
||||||
void onInitMenuPopup(HMENU menu)
|
void onInitMenuPopup(HMENU menu)
|
||||||
{
|
{
|
||||||
if (Gdi::Cursor::isEmulated())
|
RECT mr = DDraw::PrimarySurface::getMonitorRect();
|
||||||
|
if (IsRectEmpty(&mr))
|
||||||
{
|
{
|
||||||
MENUINFO mi = {};
|
return;
|
||||||
mi.cbSize = sizeof(mi);
|
}
|
||||||
mi.fMask = MIM_MAXHEIGHT;
|
|
||||||
GetMenuInfo(menu, &mi);
|
|
||||||
|
|
||||||
RECT mr = DDraw::PrimarySurface::getMonitorRect();
|
MENUINFO mi = {};
|
||||||
UINT maxHeight = mr.bottom - mr.top;
|
mi.cbSize = sizeof(mi);
|
||||||
if (0 == mi.cyMax || mi.cyMax > maxHeight)
|
mi.fMask = MIM_MAXHEIGHT;
|
||||||
{
|
GetMenuInfo(menu, &mi);
|
||||||
g_menuMaxHeight[menu] = mi.cyMax;
|
|
||||||
mi.cyMax = maxHeight;
|
UINT maxHeight = mr.bottom - mr.top;
|
||||||
SetMenuInfo(menu, &mi);
|
if (0 == mi.cyMax || mi.cyMax > maxHeight)
|
||||||
}
|
{
|
||||||
|
g_menuMaxHeight[menu] = mi.cyMax;
|
||||||
|
mi.cyMax = maxHeight;
|
||||||
|
SetMenuInfo(menu, &mi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user