-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Make sure MinMaxCloseControl supports fullscreen and tablet mode #6660
Conversation
@@ -788,6 +810,15 @@ void NonClientIslandWindow::_UpdateFrameMargins() const noexcept | |||
return FALSE; | |||
} | |||
|
|||
WRL::ComPtr<IUIViewSettingsInterop> interop; | |||
Windows::Foundation::GetActivationFactory(WRL::Wrappers::HStringReference( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DHowett Please tell me how to convert it from WRL to winrt🙏🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, to convert this from WRL to WinRT, all you need to do is.. replace all this code with:
auto viewSettingsForWindow = winrt::Windows::UI::ViewManagement::UIViewSettings::GetForWindow(hwnd);
C++/WinRT makes winrt look like modern C++, so you don't need to do any weird smart pointer types or IID management.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, but if you have to use an Interop class... then things get weird and annoying. You actually can't use c++/winrt directly for this. lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, using an interop class is the only way I know of. Summoning the legend himself for guidance : @oldnewthing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh you mean
UIViewSettings viewSettingsForWindow{ nullptr };
get_activation_factory<IUIViewSettingsInterop>(name_of<UIViewSettings>())->
GetForWindow(hwnd, guid_of<UIViewSettings>(), put_abi(viewSettingsForWindow));
or if you like one-liners
auto viewSettingsForWindow =
capture<IInspectable>(
get_activation_factory<IUIViewSettingsInterop>(name_of<UIViewSettings>()),
&IUIViewSettingsInterop::GetForWindow,
hwnd).as<UIViewSettings>();
Hey this one's been sitting open for quite some time now - @AnuthaDev any plans to come back around and finish this one? |
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment. |
Summary of the Pull Request
Caption buttons support fullscreen and tablet mode
References
https://devblogs.microsoft.com/oldnewthing/?p=93815
https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/move-to-winrt-from-wrl
https://devblogs.microsoft.com/oldnewthing/20170405-00/?p=95905
PR Checklist
Detailed Description of the Pull Request / Additional comments
Used this to add support for detecting tablet mode
The PR is a work in progress and the code doesn't work in its current state
Validation Steps Performed
None
You know how it is, coded on phone, can't get it to compile 😔