On 8/30/21 4:55 PM, Connor McAdams wrote:
On Sat, Aug 28, 2021 at 03:32:59PM +0200, Piotr Caban wrote:
On 8/12/21 9:07 PM, Connor McAdams wrote:
- info.cbSize = sizeof(info);
- if(GetGUIThreadInfo(GetWindowThreadProcessId(This->hwnd, NULL), &info) &&
info.hwndFocus == This->hwnd)
It doesn't really matter but you can just call GetGUIThreadInfo(0, &info) here. If This->hwnd thread is not foreground the hwnd comparison will always fail.
While you're fixing the function are you also planning to fix the STATE_SYSTEM_FOCUSABLE flag? It should probably look like this: if(GetForegroundWindow() == GetAncestor(This->hwnd, GA_ROOT)) V_I4(pvarState) |= STATE_SYSTEM_FOCUSABLE;
I tried the code you suggested, but it fails the tests. I'll do a bit more investigation, I'm not sure why it isn't working...
The comment was based on documentation that might be wrong. While the code looks suspicious feel free to leave it as is if it's hard to figure out how it should be done (maybe current code behaves the same as native).