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

Unified Diff: ash/accelerators/accelerator_controller.cc

Issue 21297003: Add ability to set resolution on external display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | ash/ash.gyp » ('j') | ash/display/display_change_observer_x11.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_controller.cc
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index 8b9f9d4c4cdcf3c3b5d0a2da7034290a7a2389c1..386d9c119680f5234ea9ffe4b6348a9dd980080f 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -71,6 +71,8 @@
#include "base/chromeos/chromeos_version.h"
#endif // defined(OS_CHROMEOS)
+#include "ash/display/display_info.h"
oshima 2013/07/31 16:39:11 Changes in this file is just for my testing and I'
Daniel Erat 2013/07/31 17:34:05 am i misunderstanding? the change in e.g. HandleSc
oshima 2013/07/31 21:59:49 Sorry if it wasn't clear enough. It was for me to
+
namespace ash {
namespace {
@@ -193,13 +195,45 @@ gfx::Display::Rotation GetNextRotation(gfx::Display::Rotation current) {
case gfx::Display::ROTATE_270:
return gfx::Display::ROTATE_0;
}
- NOTREACHED() << "Unknown rotation:" << current;
+ NOTREACHED() << "Unknown rotatgion:" << current;
Daniel Erat 2013/07/31 17:34:05 nit: s/rotatgion/rotation/
return gfx::Display::ROTATE_0;
}
+const gfx::Size& FindNextResolution(
+ const std::vector<internal::Resolution>& resolutions,
+ const gfx::Size& current_resolution) {
+ std::vector<internal::Resolution>::const_iterator iter =
+ resolutions.begin();
+ for (; iter != resolutions.end(); ++iter) {
+ if (iter->size == current_resolution) {
+ ++iter;
+ break;
+ }
+ }
+ if (iter == resolutions.end())
+ return resolutions[0].size;
+ else
+ return iter->size;
+}
+
bool HandleScaleUI(bool up) {
internal::DisplayManager* display_manager =
Shell::GetInstance()->display_manager();
+
+ gfx::Point point = Shell::GetScreen()->GetCursorScreenPoint();
+ gfx::Display display = Shell::GetScreen()->GetDisplayNearestPoint(point);
+ if (!display.IsInternal()) {
+ const DisplayInfo& info = display_manager->GetDisplayInfo(display.id());
+ if (info.resolutions().empty()) {
+ LOG(ERROR) << "No resolution found:";
+ return false;
+ }
+ const gfx::Size& next_resolution =
+ FindNextResolution(info.resolutions(), info.bounds_in_pixel().size());
+ display_manager->SetDisplayResolution(display.id(), next_resolution);
+ return true;
+ }
+
int64 display_id = display_manager->GetDisplayIdForUIScaling();
if (display_id == gfx::Display::kInvalidDisplayID)
return false;
« no previous file with comments | « no previous file | ash/ash.gyp » ('j') | ash/display/display_change_observer_x11.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698