summaryrefslogtreecommitdiffstats
path: root/win8
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-13 03:35:02 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-13 03:35:02 +0000
commit00d3a7620f415e424ceace688bb3371d18296835 (patch)
treea17cf1e6dc8faef24b8267c293df12effe9520b8 /win8
parentdbd338c407ffa968e72857a5956aac8cabf0db72 (diff)
downloadchromium_src-00d3a7620f415e424ceace688bb3371d18296835.zip
chromium_src-00d3a7620f415e424ceace688bb3371d18296835.tar.gz
chromium_src-00d3a7620f415e424ceace688bb3371d18296835.tar.bz2
Send the device scale factor from Windows 8 ASH during initialization via the MetroViewerHostMsg_SetTargetSurface IPC message.
cpu, please review everything. sky, please review the ash/chrome/ui portions. I added a dependency on gfx in the metro_driver project for a subsequent change to send the correct device scale factor on Windows 8 as the metro API does not appear to work correctly causing text, etc to appear very small on high dpi monitors with scales above 125%. BUG=371219 R=cpu,sky Review URL: https://codereview.chromium.org/271543009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269993 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'win8')
-rw-r--r--win8/metro_driver/chrome_app_view_ash.cc10
-rw-r--r--win8/metro_driver/chrome_app_view_ash.h3
-rw-r--r--win8/metro_driver/display_properties.cc11
-rw-r--r--win8/metro_driver/metro_driver.gyp1
-rw-r--r--win8/viewer/metro_viewer_process_host.h3
5 files changed, 16 insertions, 12 deletions
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc
index 981a21c..49d517e 100644
--- a/win8/metro_driver/chrome_app_view_ash.cc
+++ b/win8/metro_driver/chrome_app_view_ash.cc
@@ -74,6 +74,8 @@ struct Globals {
BreakpadExceptionHandler breakpad_exception_handler;
} globals;
+extern float GetModernUIScale();
+
namespace {
enum KeyModifier {
@@ -506,7 +508,8 @@ class ChromeAppViewAsh::PointerInfoHandler {
ChromeAppViewAsh::ChromeAppViewAsh()
: mouse_down_flags_(ui::EF_NONE),
ui_channel_(nullptr),
- core_window_hwnd_(NULL) {
+ core_window_hwnd_(NULL),
+ scale_(0) {
DVLOG(1) << __FUNCTION__;
globals.previous_state =
winapp::Activation::ApplicationExecutionState_NotRunning;
@@ -625,6 +628,9 @@ ChromeAppViewAsh::SetWindow(winui::Core::ICoreWindow* window) {
// we can now directly blit to it from the browser process.
direct3d_helper_.Initialize(window);
DVLOG(1) << "Initialized Direct3D.";
+
+ scale_ = GetModernUIScale();
+ DVLOG(1) << "Scale is " << scale_;
return S_OK;
}
@@ -669,7 +675,7 @@ ChromeAppViewAsh::Run() {
// Upon receipt of the MetroViewerHostMsg_SetTargetSurface message the
// browser will use D3D from the browser process to present to our Window.
ui_channel_->Send(new MetroViewerHostMsg_SetTargetSurface(
- gfx::NativeViewId(core_window_hwnd_)));
+ gfx::NativeViewId(core_window_hwnd_), scale_));
DVLOG(1) << "ICoreWindow sent " << core_window_hwnd_;
// Send an initial size message so that the Ash root window host gets sized
diff --git a/win8/metro_driver/chrome_app_view_ash.h b/win8/metro_driver/chrome_app_view_ash.h
index 5de9f67..174836d 100644
--- a/win8/metro_driver/chrome_app_view_ash.h
+++ b/win8/metro_driver/chrome_app_view_ash.h
@@ -232,6 +232,9 @@ class ChromeAppViewAsh
// For IME support.
scoped_ptr<metro_driver::InputSource> input_source_;
scoped_ptr<metro_driver::TextService> text_service_;
+
+ // The device scale factor.
+ float scale_;
};
#endif // WIN8_METRO_DRIVER_CHROME_APP_VIEW_ASH_H_
diff --git a/win8/metro_driver/display_properties.cc b/win8/metro_driver/display_properties.cc
index f1653fd..7eb557f 100644
--- a/win8/metro_driver/display_properties.cc
+++ b/win8/metro_driver/display_properties.cc
@@ -9,15 +9,10 @@
#include <wrl\wrappers\corewrappers.h>
#include <windows.foundation.h>
#include <windows.graphics.display.h>
-#include "base/win/scoped_com_initializer.h"
+#include "ui/gfx/win/dpi.h"
#include "winrt_utils.h"
-#pragma comment(lib, "runtimeobject.lib")
-
-extern "C" {
-
-__declspec(dllexport) float GetModernUIScale() {
- base::win::ScopedCOMInitializer com_init;
+float GetModernUIScale() {
Microsoft::WRL::ComPtr<
ABI::Windows::Graphics::Display::IDisplayPropertiesStatics>
display_properties;
@@ -30,5 +25,3 @@ __declspec(dllexport) float GetModernUIScale() {
}
return 1.0f;
}
-
-}
diff --git a/win8/metro_driver/metro_driver.gyp b/win8/metro_driver/metro_driver.gyp
index 3cd62ef..5c12c04 100644
--- a/win8/metro_driver/metro_driver.gyp
+++ b/win8/metro_driver/metro_driver.gyp
@@ -73,6 +73,7 @@
'../../ipc/ipc.gyp:ipc',
'../../sandbox/sandbox.gyp:sandbox',
'../../ui/metro_viewer/metro_viewer.gyp:metro_viewer_messages',
+ '../../ui/gfx/gfx.gyp:gfx',
'../../url/url.gyp:url_lib',
'metro_driver_version_resources',
],
diff --git a/win8/viewer/metro_viewer_process_host.h b/win8/viewer/metro_viewer_process_host.h
index a7dc9d4..bb97001 100644
--- a/win8/viewer/metro_viewer_process_host.h
+++ b/win8/viewer/metro_viewer_process_host.h
@@ -64,7 +64,8 @@ class MetroViewerProcessHost : public IPC::Listener,
// Called over IPC by the viewer process to tell this host that it should be
// drawing to |target_surface|.
- virtual void OnSetTargetSurface(gfx::NativeViewId target_surface) = 0;
+ virtual void OnSetTargetSurface(gfx::NativeViewId target_surface,
+ float device_scale) = 0;
// Called over IPC by the viewer process to request that the url passed in be
// opened.