WindowsCommunityToolkit icon indicating copy to clipboard operation
WindowsCommunityToolkit copied to clipboard

Gaze only works for initial UI thread of an application

Open peteams opened this issue 6 years ago • 2 comments

Describe the bug

The GazeInteraction library only provides support for the initial UI thread. If an application spawns a additional UI threads, GazeInteraction will be inactive. This was supported in the previous version (C++/CX) version.

  • [ ] Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work:

Steps to Reproduce

  • [ ] Can this be reproduced in the Sample App? (Either in a sample as-is or with new XAML pasted in the editor.) If so, please provide custom XAML or steps to reproduce. If not, let us know why it can't be reproduced (e.g. more complex setup, environment, dependencies, etc...)

Steps to reproduce the behavior:

  1. Build the toolkit solution
  2. Start the GazeInputTest application from the Tests folder and check the large buttons work
  3. Press the Spawn button to start a second UI thread for the application
  4. Notice that when the original UI is in focus it continues to work, but that the second UI is unresponsive to gaze

Expected behavior

Gaze should work on all UI threads.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment

NuGet Package(s): 

Package Version(s): 

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] May 2020 Update (19041)
- [ ] Insider Build (build number: )

App min and target version:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] May 2020 Update (19041)
- [ ] Insider Build (xxxxx)

Device form factor:
- [X] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio 
- [ ] 2017 (version: )
- [ ] 2019 (version: ) 
- [ ] 2019 Preview (version: )

Additional context

This is due to the instance variable for gaze engine being a simple static rather than a thread local static.

peteams avatar Nov 30 '20 21:11 peteams

Hello peteams, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

ghost avatar Nov 30 '20 21:11 ghost

Thanks for gatching this @peteams! Was probably lost in the translation and difference with how the languages work, glad it seems like a straight-forward fix.

michael-hawker avatar Nov 30 '20 21:11 michael-hawker