1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-17 00:44:19 +00:00

Updated win32 Process::isForegroundProcess() method to use process ID

This commit is contained in:
ed 2017-01-16 14:02:53 +00:00
parent d0b0644af0
commit 46e21fef13

View file

@ -3245,17 +3245,10 @@ bool JUCE_CALLTYPE Process::isForegroundProcess()
if (fg == 0)
return true;
// when running as a plugin in IE8, the browser UI runs in a different process to the plugin, so
// process ID isn't a reliable way to check if the foreground window belongs to us - instead, we
// have to see if any of our windows are children of the foreground window
fg = GetAncestor (fg, GA_ROOT);
DWORD processID = 0;
GetWindowThreadProcessId (fg, &processID);
for (int i = ComponentPeer::getNumPeers(); --i >= 0;)
if (HWNDComponentPeer* const wp = dynamic_cast<HWNDComponentPeer*> (ComponentPeer::getPeer (i)))
if (wp->isInside (fg))
return true;
return false;
return (processID == GetCurrentProcessId());
}
// N/A on Windows as far as I know.