summaryrefslogtreecommitdiffstats
path: root/win8/metro_driver
diff options
context:
space:
mode:
authorrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-12 15:22:48 +0000
committerrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-12 15:22:48 +0000
commit5c9a15d0495f289a0c1943ead17b58e06230047a (patch)
tree24bed350fabab8a79f235f86c35c60f2f7bf9aa5 /win8/metro_driver
parent9982c80fc3a544687e9eb0ca9fa27a0db2dcbb1a (diff)
downloadchromium_src-5c9a15d0495f289a0c1943ead17b58e06230047a.zip
chromium_src-5c9a15d0495f289a0c1943ead17b58e06230047a.tar.gz
chromium_src-5c9a15d0495f289a0c1943ead17b58e06230047a.tar.bz2
Revert revert of 201771: Fix Ash on Windows multi-monitor support.
The patch is unchanged but the previously failing multi-monitor test has been disabled since WinAsh doesn't support simultaneous multi-monitors (this patch just makes moving the single-monitor Ash desktop between different monitors). TBR=cpu,cevans Original description: > Fix Ash on Windows multi-monitor support and snap-view sizing. > > Plumb through window size events to the remote root window host. > Also add an initial sizing message to get Ash's initial state to be correct. > > BUG=236379 > TEST=Move Ash from one monitor to another with a different size, observe that things resize themselves correctly. Also, snap Ash, observe similar goodness. > > Review URL: https://chromiumcodereview.appspot.com/15599002 BUG=236379 TEST=ash_unittests Review URL: https://chromiumcodereview.appspot.com/16267004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205791 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'win8/metro_driver')
-rw-r--r--win8/metro_driver/chrome_app_view_ash.cc35
-rw-r--r--win8/metro_driver/chrome_app_view_ash.h4
2 files changed, 39 insertions, 0 deletions
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc
index 8a9e8a1..530d62c 100644
--- a/win8/metro_driver/chrome_app_view_ash.cc
+++ b/win8/metro_driver/chrome_app_view_ash.cc
@@ -55,6 +55,10 @@ typedef winfoundtn::ITypedEventHandler<
winui::Core::CoreWindow*,
winui::Core::WindowActivatedEventArgs*> WindowActivatedHandler;
+typedef winfoundtn::ITypedEventHandler<
+ winui::Core::CoreWindow*,
+ winui::Core::WindowSizeChangedEventArgs*> SizeChangedHandler;
+
// This function is exported by chrome.exe.
typedef int (__cdecl *BreakpadExceptionHandler)(EXCEPTION_POINTERS* info);
@@ -329,6 +333,11 @@ ChromeAppViewAsh::SetWindow(winui::Core::ICoreWindow* window) {
hr = interop->get_WindowHandle(&core_window_hwnd_);
CheckHR(hr);
+ hr = window_->add_SizeChanged(mswr::Callback<SizeChangedHandler>(
+ this, &ChromeAppViewAsh::OnSizeChanged).Get(),
+ &sizechange_token_);
+ CheckHR(hr);
+
// Register for pointer and keyboard notifications. We forward
// them to the browser process via IPC.
hr = window_->add_PointerMoved(mswr::Callback<PointerEventHandler>(
@@ -448,6 +457,14 @@ ChromeAppViewAsh::Run() {
gfx::NativeViewId(core_window_hwnd_)));
DVLOG(1) << "ICoreWindow sent " << core_window_hwnd_;
+ // Send an initial size message so that the Ash root window host gets sized
+ // correctly.
+ RECT rect = {0};
+ ::GetWindowRect(core_window_hwnd_, &rect);
+ ui_channel_->Send(
+ new MetroViewerHostMsg_WindowSizeChanged(rect.right - rect.left,
+ rect.bottom - rect.top));
+
// And post the task that'll do the inner Metro message pumping to it.
ui_loop_.PostTask(FROM_HERE, base::Bind(&RunMessageLoop, dispatcher.Get()));
ui_loop_.Run();
@@ -911,6 +928,24 @@ void ChromeAppViewAsh::OnNavigateToUrl(const string16& url) {
ui_channel_->Send(new MetroViewerHostMsg_OpenURL(url));
}
+HRESULT ChromeAppViewAsh::OnSizeChanged(winui::Core::ICoreWindow* sender,
+ winui::Core::IWindowSizeChangedEventArgs* args) {
+ if (!window_) {
+ return S_OK;
+ }
+
+ winfoundtn::Size size;
+ HRESULT hr = args->get_Size(&size);
+ if (FAILED(hr))
+ return hr;
+
+ uint32 cx = static_cast<uint32>(size.Width);
+ uint32 cy = static_cast<uint32>(size.Height);
+
+ DVLOG(1) << "Window size changed: width=" << cx << ", height=" << cy;
+ ui_channel_->Send(new MetroViewerHostMsg_WindowSizeChanged(cx, cy));
+ return S_OK;
+}
///////////////////////////////////////////////////////////////////////////////
diff --git a/win8/metro_driver/chrome_app_view_ash.h b/win8/metro_driver/chrome_app_view_ash.h
index a8f388e..52ab382 100644
--- a/win8/metro_driver/chrome_app_view_ash.h
+++ b/win8/metro_driver/chrome_app_view_ash.h
@@ -122,6 +122,9 @@ class ChromeAppViewAsh
void OnSearchRequest(const string16& search_string);
void OnNavigateToUrl(const string16& url);
+ HRESULT OnSizeChanged(winui::Core::ICoreWindow* sender,
+ winui::Core::IWindowSizeChangedEventArgs* args);
+
mswr::ComPtr<winui::Core::ICoreWindow> window_;
mswr::ComPtr<winapp::Core::ICoreApplicationView> view_;
EventRegistrationToken activated_token_;
@@ -136,6 +139,7 @@ class ChromeAppViewAsh
EventRegistrationToken accel_keydown_token_;
EventRegistrationToken accel_keyup_token_;
EventRegistrationToken window_activated_token_;
+ EventRegistrationToken sizechange_token_;
// Keep state about which button is currently down, if any, as PointerMoved
// events do not contain that state, but Ash's MouseEvents need it.