Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow widgets to take foreground rights on user interaction #3117

Merged
merged 3 commits into from
Jun 4, 2024

Conversation

krschau
Copy link
Collaborator

@krschau krschau commented Jun 4, 2024

Summary of the pull request

Various widgets launch UI, and it is a problem when they can't launch to the foreground because they don't have foreground rights. When a user interacts with a widget, we notify the widget of that interaction (so they can respond to it) via the Widget.NotifyActionInvokedAsync() API. Before we call that API, we should give the widget process foreground rights, so they can take them and launch to the foreground if they choose.

References and relevant issues

#2747

Detailed description of the pull request / Additional comments

Validation steps performed

PR checklist

  • Closes #xxx
  • Tests added/passed
  • Documentation updated

// CoAllowSetForegroundWindow must be called on a raw COM interface, not a .NET CCW, in order to work correctly, since
// the underlying functionality is implemented by COM runtime and the object itself. CoAllowSetForegroundWindow wrapper
// below takes a WinRT object and extracts the raw COM interface pointer from it before calling native CoAllowSetForegroundWindow.
[DllImport("ole32.dll", ExactSpelling = true, PreserveSig = false, SetLastError = true)]
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: nativemethods.txt

Copy link
Contributor

Choose a reason for hiding this comment

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

+1. But checking this in now for Canary this week.

@EricJohnson327 EricJohnson327 merged commit 5388785 into main Jun 4, 2024
4 checks passed
@EricJohnson327 EricJohnson327 deleted the user/krschau/widget-foreground branch June 4, 2024 22:45
@krschau krschau modified the milestone: Dev Home 0.15 Jun 5, 2024
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.

4 participants