Skip to content

Commit 71c9d3a

Browse files
authored
Fix - Windows DDA Grabber updates image when mouse is moved (hyperion-project#2003)
1 parent e8b66a2 commit 71c9d3a

3 files changed

Lines changed: 41 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717

1818
### 🔧 Changed
1919

20+
- **Fixes:**
21+
- Windows DDA Grabber - Prevent image updates when mouse is moved. Provide a Warning on incomptible setting. (#2002)
2022
---
2123

2224
### 🗑️ Removed

include/grabber/dda/DDAGrabber.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ class DDAGrabber : public Grabber
6161
///
6262
bool restartCapture();
6363

64+
///
65+
/// Validates the cursor settings and report,
66+
/// if a setting results in that the mouse cursor is part of the capture.
67+
///
68+
void validateCursorSettings();
69+
6470
void computeCropBox(int sourceWidth, int sourceHeight, D3D11_BOX& box) const;
6571

6672
private:

libsrc/grabber/dda/DDAGrabber.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,31 @@ DDAGrabber::~DDAGrabber()
117117
}
118118
}
119119

120+
void DDAGrabber::validateCursorSettings()
121+
{
122+
// 1. Check for Mouse Trails (The most common culprit for "baked-in" cursors)
123+
int trailLines = 0;
124+
if (SystemParametersInfo(SPI_GETMOUSETRAILS, 0, &trailLines, 0))
125+
{
126+
if (trailLines > 1)
127+
{
128+
Warning(_log, "Incompatible Setting Detected: 'Display pointer trails' is ENABLED. "
129+
"A mouse cursor will appear in your screen capture. Disable this in Windows Mouse settings.");
130+
}
131+
}
132+
133+
// 2. Check for Cursor Shadow (Can also trigger software compositing on older drivers/hardware)
134+
BOOL shadowEnabled = FALSE;
135+
if (SystemParametersInfo(SPI_GETCURSORSHADOW, 0, &shadowEnabled, 0))
136+
{
137+
if (shadowEnabled)
138+
{
139+
Info(_log, "Note: 'Pointer shadow' is enabled. If a mouse cursor appears in capture, "
140+
"try disabling this setting in Windows.");
141+
}
142+
}
143+
}
144+
120145
bool DDAGrabber::setupDisplay()
121146
{
122147
qCDebug(grabber_screen_flow) << "Setting up DDA grabber for display" << d->display;
@@ -203,6 +228,8 @@ bool DDAGrabber::restartCapture()
203228
return false;
204229
}
205230

231+
validateCursorSettings();
232+
206233
qCDebug(grabber_screen_flow) << "Restarting capture for display" << d->display;
207234

208235
if (d->dxgiAdapter == nullptr)
@@ -455,6 +482,12 @@ int DDAGrabber::grabFrame(Image<ColorRgb>& image, bool /*forceUpdate*/)
455482
if (SUCCEEDED(hr))
456483
{
457484
d->isFrameAcquired = true;
485+
// If no pixels changed, skip immediately. This handles the "Only Mouse Moved" case
486+
if (frameInfo.AccumulatedFrames == 0) {
487+
SafeReleaseFrame(d->desktopDuplication);
488+
d->isFrameAcquired = false;
489+
return -1;
490+
}
458491
}
459492

460493
// --- Error Handling ---

0 commit comments

Comments
 (0)