Browse Source

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

tags/2021-05-28
ed 8 years ago
parent
commit
46e21fef13
1 changed files with 3 additions and 10 deletions
  1. +3
    -10
      modules/juce_gui_basics/native/juce_win32_Windowing.cpp

+ 3
- 10
modules/juce_gui_basics/native/juce_win32_Windowing.cpp 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);
for (int i = ComponentPeer::getNumPeers(); --i >= 0;)
if (HWNDComponentPeer* const wp = dynamic_cast<HWNDComponentPeer*> (ComponentPeer::getPeer (i)))
if (wp->isInside (fg))
return true;
DWORD processID = 0;
GetWindowThreadProcessId (fg, &processID);
return false;
return (processID == GetCurrentProcessId());
}
// N/A on Windows as far as I know.


Loading…
Cancel
Save