[Bug 48121] New: Unity games do not fire OnApplicationFocus/OnApplicationPause events on focus regain
WineHQ Bugzilla
wine-bugs at winehq.org
Sun Nov 17 12:15:25 CST 2019
https://bugs.winehq.org/show_bug.cgi?id=48121
Bug ID: 48121
Summary: Unity games do not fire
OnApplicationFocus/OnApplicationPause events on focus
regain
Product: Wine
Version: unspecified
Hardware: x86
OS: Linux
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: user32
Assignee: wine-bugs at winehq.org
Reporter: dt at zeroitlab.com
Distribution: ---
Created attachment 65713
--> https://bugs.winehq.org/attachment.cgi?id=65713
Proof of concept patch
I've tested with both stable and staging, neither gets unity to fire
OnApplicationFocus and OnApplicationPause events on focus regain. I've tracked
this down by reverse engineering the native unity binary.
There are 4 window messages to which the unity engine reacts by firing these
internal events. They are:
1. WM_SIZE (when wParam == 0 && unity's window is active)
2. WM_EXITSIZEMOVE
3. WM_NCPOINTERUP
4. WM_NCPOINTERDOWN (when DragDetect() says the pointer is in bounds for the
window; pointer coordinates are passed in lparam)
Of all these events, it seems to me, that the ones we should be firing and are
not currently, are WM_NCPOINTERUP and WM_NCPOINTERDOWN.
I was not sure how to get the pointer coordinates, but I was able to confirm
this finding, by firing WM_NCPOINTERUP with wparam=0, lparam=0 on focus regain
because that event had no such bounds check in the unity engine code. With this
change, my target application indeed unpauses.
Observing the issue is fairly easy,
https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnApplicationFocus.html
adding this example behaviour to the camera and building the project for
windows then running it in wine reproduces.
--
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.
More information about the wine-bugs
mailing list