diff options
Diffstat (limited to 'win8')
-rw-r--r-- | win8/metro_driver/chrome_app_view_ash.cc | 21 | ||||
-rw-r--r-- | win8/metro_driver/chrome_app_view_ash.h | 4 |
2 files changed, 25 insertions, 0 deletions
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc index e9a9363..2214185 100644 --- a/win8/metro_driver/chrome_app_view_ash.cc +++ b/win8/metro_driver/chrome_app_view_ash.cc @@ -40,6 +40,10 @@ typedef winfoundtn::ITypedEventHandler< winui::Core::CoreWindow*, winui::Core::CharacterReceivedEventArgs*> CharEventHandler; +typedef winfoundtn::ITypedEventHandler< + winui::Core::CoreWindow*, + winui::Core::VisibilityChangedEventArgs*> VisibilityChangedHandler; + // This function is exported by chrome.exe. typedef int (__cdecl *BreakpadExceptionHandler)(EXCEPTION_POINTERS* info); @@ -283,6 +287,11 @@ ChromeAppViewAsh::SetWindow(winui::Core::ICoreWindow* window) { &character_received_token_); CheckHR(hr); + hr = window_->add_VisibilityChanged(mswr::Callback<VisibilityChangedHandler>( + this, &ChromeAppViewAsh::OnVisibilityChanged).Get(), + &visibility_changed_token_); + CheckHR(hr); + // By initializing the direct 3D swap chain with the corewindow // we can now directly blit to it from the browser process. direct3d_helper_.Initialize(window); @@ -488,6 +497,18 @@ HRESULT ChromeAppViewAsh::OnCharacterReceived( return S_OK; } +HRESULT ChromeAppViewAsh::OnVisibilityChanged( + winui::Core::ICoreWindow* sender, + winui::Core::IVisibilityChangedEventArgs* args) { + boolean visible = false; + HRESULT hr = args->get_Visible(&visible); + if (FAILED(hr)) + return hr; + + ui_channel_->Send(new MetroViewerHostMsg_VisibilityChanged(!!visible)); + return S_OK; +} + /////////////////////////////////////////////////////////////////////////////// diff --git a/win8/metro_driver/chrome_app_view_ash.h b/win8/metro_driver/chrome_app_view_ash.h index 886510c..1906297 100644 --- a/win8/metro_driver/chrome_app_view_ash.h +++ b/win8/metro_driver/chrome_app_view_ash.h @@ -56,6 +56,9 @@ class ChromeAppViewAsh HRESULT OnCharacterReceived(winui::Core::ICoreWindow* sender, winui::Core::ICharacterReceivedEventArgs* args); + HRESULT OnVisibilityChanged(winui::Core::ICoreWindow* sender, + winui::Core::IVisibilityChangedEventArgs* args); + mswr::ComPtr<winui::Core::ICoreWindow> window_; mswr::ComPtr<winapp::Core::ICoreApplicationView> view_; EventRegistrationToken activated_token_; @@ -66,6 +69,7 @@ class ChromeAppViewAsh EventRegistrationToken keydown_token_; EventRegistrationToken keyup_token_; EventRegistrationToken character_received_token_; + EventRegistrationToken visibility_changed_token_; metro_driver::Direct3DHelper direct3d_helper_; |