Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1460)

Unified Diff: ui/gfx/screen_win.cc

Issue 405993002: Set gfx::Display rotation on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/screen_win.cc
diff --git a/ui/gfx/screen_win.cc b/ui/gfx/screen_win.cc
index 4530642e24bcd7450f0eae014091b9c4b772d192..7dff9e90d8c686a899b75dfc1df303eb4f85d53b 100644
--- a/ui/gfx/screen_win.cc
+++ b/ui/gfx/screen_win.cc
@@ -31,6 +31,32 @@ gfx::Display GetDisplay(MONITORINFOEX& monitor_info) {
gfx::Display display(id, bounds);
display.set_work_area(gfx::Rect(monitor_info.rcWork));
display.SetScaleAndBounds(gfx::win::GetDeviceScaleFactor(), bounds);
+
+ DEVMODE mode;
+ memset(&mode, 0, sizeof(DEVMODE));
+ mode.dmSize = sizeof(DEVMODE);
+ mode.dmDriverExtra = 0;
+ if (EnumDisplaySettings(monitor_info.szDevice,
+ ENUM_CURRENT_SETTINGS,
+ &mode)) {
+ switch (mode.dmDisplayOrientation) {
+ case DMDO_DEFAULT:
+ display.set_rotation(gfx::Display::ROTATE_0);
+ break;
+ case DMDO_90:
+ display.set_rotation(gfx::Display::ROTATE_90);
+ break;
+ case DMDO_180:
+ display.set_rotation(gfx::Display::ROTATE_180);
+ break;
+ case DMDO_270:
+ display.set_rotation(gfx::Display::ROTATE_270);
+ break;
+ default:
+ NOTREACHED();
+ }
+ }
+
return display;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698