Skip to content

FIX: Input devices sometimes marked as disabled on reconnect#1524

Merged
Rene-Damm merged 4 commits intodevelopfrom
fix-out-of-focus-reconnect
Apr 8, 2022
Merged

FIX: Input devices sometimes marked as disabled on reconnect#1524
Rene-Damm merged 4 commits intodevelopfrom
fix-out-of-focus-reconnect

Conversation

@unity-cwells
Copy link
Copy Markdown
Collaborator

@unity-cwells unity-cwells commented Mar 23, 2022

Description

If a InputDevice is disconnected while an app is out-of-focus and the the device's InputDevice.DeviceFlags.DisabledWhileInBackground flag is set, the flag will remain set upon reconnect even if the app has since regained focus. This results in the device incorrectly appearing as disabled until the next focus change event. This PR corrects this by clearing the InputDevice.DeviceFlags.DisabledWhileInBackground on reconnection of a device. If the app is still out-of-focus during reconnect and the flag is valid, this will be detected and set as normal during the call to InputManager.AddDevice().

Changes made

Fixed an issue where InputDevice.enabled could return false when a device was disconnected while an application was out-of-focus and then re-connected when in-focus

Checklist

Before review:

  • Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • FogBugz ticket attached, example ([case %number%](https://issuetracker.unity3d.com/issues/...)).
    • FogBugz is marked as "Resolved" with next release version correctly set.
  • Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration tests.
  • Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

@unity-cwells unity-cwells marked this pull request as ready for review March 24, 2022 14:40
@unity-cwells unity-cwells requested a review from Rene-Damm March 24, 2022 14:55
Copy link
Copy Markdown
Contributor

@Rene-Damm Rene-Damm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs test.

@Rene-Damm Rene-Damm merged commit 524455d into develop Apr 8, 2022
@Rene-Damm Rene-Damm deleted the fix-out-of-focus-reconnect branch April 8, 2022 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants