Skip to content

Commit 46c51fa

Browse files
planetchilimarkgalvan-intel
authored andcommitted
Only upgrade to child process window if it is larger than 640x480
Fix for issue #218
1 parent d67a497 commit 46c51fa

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

IntelPresentMon/Core/source/kernel/OverlayContainer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ namespace p2c::kern
112112
void OverlayContainer::RegisterWindowSpawn(DWORD pid, HWND hWnd, const RECT& r)
113113
{
114114
p2cvlog(procwatch).note(std::format(L"register-win-spawn-entry | hwn:{:8x}", (uintptr_t)hWnd)).commit();
115+
// update "main" window in ancestor map for related process
115116
// no need for mtx here since the window event listener runs on kernel thread (msg pump)
116117
if (auto i = ancestorMap.find(pid); i != ancestorMap.end()) {
117118
const auto prevHwnd = i->second.hWnd;
@@ -137,8 +138,9 @@ namespace p2c::kern
137138
// if an update occurred, consider retargetting process
138139
if (i->second.hWnd == hWnd) {
139140
// case when we are in root and hit a child spawn window of interest
140-
if (pid != rootPid && curPid == rootPid) {
141-
p2cvlog(procwatch).note(std::format(L"register-win-spawn-upg-root-to-child | hwn: {:5} => {:5}", rootPid, pid)).commit();
141+
// only migrate to child if window area is greater than 640x480
142+
if (pid != rootPid && curPid == rootPid && win::RectToDims(r).GetArea() >= (640 * 480)) {
143+
p2cvlog(procwatch).note(std::format(L"register-win-spawn-upg-root-to-child | pid: {:5} => {:5}", rootPid, pid)).commit();
142144
curPid = pid;
143145
pOverlay = pOverlay->RetargetPidClone(i->second);
144146
}

IntelPresentMon/Core/source/kernel/WindowSpawnHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace p2c::kern
1111
{
1212
WindowSpawnHandler::WindowSpawnHandler(DWORD pid, OverlayContainer* pOverlay) : pid{ pid }, pOverlay{ pOverlay }
1313
{
14-
p2cvlog(procwatch).note(std::format(L"win spawn handler ctor | pid:{:5x}", pid)).commit();
14+
p2cvlog(procwatch).note(std::format(L"win spawn handler ctor | pid:{:5}", pid)).commit();
1515
}
1616

1717
win::EventHookHandler::Filter WindowSpawnHandler::GetFilter() const

0 commit comments

Comments
 (0)