Commit 9036babe authored by cpu@chromium.org's avatar cpu@chromium.org

Add edge gesture so you can easily go from fullscreen and back. Currently you...

Add edge gesture so you can easily go from fullscreen and back. Currently you can go into fullscreen via he wrench menu but cannot go out of fullscreen because the edge allowance is not enough.

This btw the same behavior we have since m26 for metro.

BUG=174738

Review URL: https://codereview.chromium.org/73063002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235844 0039d316-1c4b-4281-b951-d872f2087c98
parent e47b0a0a
...@@ -56,6 +56,10 @@ typedef winfoundtn::ITypedEventHandler< ...@@ -56,6 +56,10 @@ typedef winfoundtn::ITypedEventHandler<
winui::Core::CoreWindow*, winui::Core::CoreWindow*,
winui::Core::WindowSizeChangedEventArgs*> SizeChangedHandler; winui::Core::WindowSizeChangedEventArgs*> SizeChangedHandler;
typedef winfoundtn::ITypedEventHandler<
winui::Input::EdgeGesture*,
winui::Input::EdgeGestureEventArgs*> EdgeEventHandler;
// This function is exported by chrome.exe. // This function is exported by chrome.exe.
typedef int (__cdecl *BreakpadExceptionHandler)(EXCEPTION_POINTERS* info); typedef int (__cdecl *BreakpadExceptionHandler)(EXCEPTION_POINTERS* info);
...@@ -530,6 +534,22 @@ ChromeAppViewAsh::SetWindow(winui::Core::ICoreWindow* window) { ...@@ -530,6 +534,22 @@ ChromeAppViewAsh::SetWindow(winui::Core::ICoreWindow* window) {
&window_activated_token_); &window_activated_token_);
CheckHR(hr); CheckHR(hr);
// Register for edge gesture notifications.
mswr::ComPtr<winui::Input::IEdgeGestureStatics> edge_gesture_statics;
hr = winrt_utils::CreateActivationFactory(
RuntimeClass_Windows_UI_Input_EdgeGesture,
edge_gesture_statics.GetAddressOf());
CheckHR(hr);
mswr::ComPtr<winui::Input::IEdgeGesture> edge_gesture;
hr = edge_gesture_statics->GetForCurrentView(&edge_gesture);
CheckHR(hr);
hr = edge_gesture->add_Completed(mswr::Callback<EdgeEventHandler>(
this, &ChromeAppViewAsh::OnEdgeGestureCompleted).Get(),
&edgeevent_token_);
CheckHR(hr);
// By initializing the direct 3D swap chain with the corewindow // By initializing the direct 3D swap chain with the corewindow
// we can now directly blit to it from the browser process. // we can now directly blit to it from the browser process.
direct3d_helper_.Initialize(window); direct3d_helper_.Initialize(window);
...@@ -1066,6 +1086,17 @@ HRESULT ChromeAppViewAsh::HandleProtocolRequest( ...@@ -1066,6 +1086,17 @@ HRESULT ChromeAppViewAsh::HandleProtocolRequest(
return S_OK; return S_OK;
} }
HRESULT ChromeAppViewAsh::OnEdgeGestureCompleted(
winui::Input::IEdgeGesture* gesture,
winui::Input::IEdgeGestureEventArgs* args) {
// Swipe from edge gesture (and win+z) is equivalent to pressing F11.
// TODO(cpu): Make this cleaner for m33.
ui_channel_->Send(new MetroViewerHostMsg_KeyDown(VK_F11, 1, 0, 0));
::Sleep(15);
ui_channel_->Send(new MetroViewerHostMsg_KeyUp(VK_F11, 1, 0, 0));
return S_OK;
}
void ChromeAppViewAsh::OnSearchRequest(const string16& search_string) { void ChromeAppViewAsh::OnSearchRequest(const string16& search_string) {
DCHECK(ui_channel_); DCHECK(ui_channel_);
ui_channel_->Send(new MetroViewerHostMsg_SearchRequest(search_string)); ui_channel_->Send(new MetroViewerHostMsg_SearchRequest(search_string));
......
...@@ -121,6 +121,9 @@ class ChromeAppViewAsh ...@@ -121,6 +121,9 @@ class ChromeAppViewAsh
// Helper to handle http/https url requests in ASH. // Helper to handle http/https url requests in ASH.
HRESULT HandleProtocolRequest(winapp::Activation::IActivatedEventArgs* args); HRESULT HandleProtocolRequest(winapp::Activation::IActivatedEventArgs* args);
HRESULT OnEdgeGestureCompleted(winui::Input::IEdgeGesture* gesture,
winui::Input::IEdgeGestureEventArgs* args);
// Tasks posted to the UI thread to initiate the search/url navigation // Tasks posted to the UI thread to initiate the search/url navigation
// requests. // requests.
void OnSearchRequest(const string16& search_string); void OnSearchRequest(const string16& search_string);
...@@ -143,6 +146,7 @@ class ChromeAppViewAsh ...@@ -143,6 +146,7 @@ class ChromeAppViewAsh
EventRegistrationToken accel_keyup_token_; EventRegistrationToken accel_keyup_token_;
EventRegistrationToken window_activated_token_; EventRegistrationToken window_activated_token_;
EventRegistrationToken sizechange_token_; EventRegistrationToken sizechange_token_;
EventRegistrationToken edgeevent_token_;
// Keep state about which button is currently down, if any, as PointerMoved // Keep state about which button is currently down, if any, as PointerMoved
// events do not contain that state, but Ash's MouseEvents need it. // events do not contain that state, but Ash's MouseEvents need it.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment