21 #include "../../SDL_internal.h" 23 #if SDL_VIDEO_DRIVER_WINRT 27 #include <windows.foundation.h> 28 #include <EventToken.h> 34 #include "../SDL_sysvideo.h" 42 static Platform::WeakReference WINRT_MainThreadDispatcher;
51 MIDL_INTERFACE(
"1DB9A292-CC78-4173-BE45-B61E67283EA7")
52 IGameBarStatics_ : public IInspectable
55 virtual HRESULT STDMETHODCALLTYPE add_VisibilityChanged(
56 __FIEventHandler_1_IInspectable *handler,
57 Windows::Foundation::EventRegistrationToken *token) = 0;
59 virtual HRESULT STDMETHODCALLTYPE remove_VisibilityChanged(
60 Windows::Foundation::EventRegistrationToken token) = 0;
62 virtual HRESULT STDMETHODCALLTYPE add_IsInputRedirectedChanged(
63 __FIEventHandler_1_IInspectable *handler,
64 Windows::Foundation::EventRegistrationToken *token) = 0;
66 virtual HRESULT STDMETHODCALLTYPE remove_IsInputRedirectedChanged(
67 Windows::Foundation::EventRegistrationToken token) = 0;
69 virtual HRESULT STDMETHODCALLTYPE get_Visible(
72 virtual HRESULT STDMETHODCALLTYPE get_IsInputRedirected(
77 static GUID IID_IGameBarStatics_ = { MAKELONG(0xA292, 0x1DB9), 0xCC78, 0x4173, { 0xBE, 0x45, 0xB6, 0x1E, 0x67, 0x28, 0x3E, 0xA7 } };
83 static IGameBarStatics_ *
86 wchar_t *wClassName = L
"Windows.Gaming.UI.GameBar";
88 IActivationFactory *pActivationFactory =
NULL;
89 IGameBarStatics_ *pGameBar =
NULL;
92 hr = ::WindowsCreateString(wClassName, (UINT32)wcslen(wClassName), &hClassName);
97 hr = Windows::Foundation::GetActivationFactory(hClassName, &pActivationFactory);
102 pActivationFactory->QueryInterface(IID_IGameBarStatics_, (
void **) &pGameBar);
105 if (pActivationFactory) {
106 pActivationFactory->Release();
109 ::WindowsDeleteString(hClassName);
115 WINRT_HandleGameBarIsInputRedirected_MainThread()
117 IGameBarStatics_ *gameBar;
118 boolean isInputRedirected = 0;
119 if (!WINRT_MainThreadDispatcher) {
123 gameBar = WINRT_GetGameBar();
128 if (
SUCCEEDED(gameBar->get_IsInputRedirected(&isInputRedirected))) {
129 if ( ! isInputRedirected) {
142 WINRT_HandleGameBarIsInputRedirected_NonMainThread(Platform::Object ^ o1, Platform::Object ^o2)
144 Windows::UI::Core::CoreDispatcher ^dispatcher = WINRT_MainThreadDispatcher.Resolve<Windows::UI::Core::CoreDispatcher>();
146 dispatcher->RunAsync(
147 Windows::UI::Core::CoreDispatcherPriority::Normal,
148 ref new Windows::UI::Core::DispatchedHandler(&WINRT_HandleGameBarIsInputRedirected_MainThread));
153 WINRT_InitGameBar(
_THIS)
156 IGameBarStatics_ *gameBar = WINRT_GetGameBar();
164 WINRT_MainThreadDispatcher = Windows::UI::Core::CoreWindow::GetForCurrentThread()->Dispatcher;
165 Windows::Foundation::EventHandler<Platform::Object ^> ^handler = \
166 ref
new Windows::Foundation::EventHandler<Platform::Object ^>(&WINRT_HandleGameBarIsInputRedirected_NonMainThread);
167 __FIEventHandler_1_IInspectable * pHandler =
reinterpret_cast<__FIEventHandler_1_IInspectable *
>(handler);
174 WINRT_QuitGameBar(
_THIS)
177 IGameBarStatics_ *gameBar;
181 gameBar = WINRT_GetGameBar();
190 WINRT_MainThreadDispatcher =
nullptr;
static SDL_VideoDevice * _this
HRESULT(WINAPI *GetDpiForMonitor)(HMONITOR hmonitor
GLsizei const GLfloat * value
Windows::Foundation::EventRegistrationToken gameBarIsInputRedirectedToken