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

Unified Diff: ash/display/display_controller.cc

Issue 10836046: Allow offset for secondary display position in chrome://settings/display. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « ash/display/display_controller.h ('k') | chrome/browser/chromeos/preferences.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_controller.cc
diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc
index a4eceb48bb21abb1c6697eb46ab5557eebcdd370..f532860b9a4fcbbc87e28f424a28ab270a58c720 100644
--- a/ash/display/display_controller.cc
+++ b/ash/display/display_controller.cc
@@ -23,7 +23,8 @@ namespace ash {
namespace internal {
DisplayController::DisplayController()
- : secondary_display_layout_(RIGHT) {
+ : secondary_display_layout_(RIGHT),
+ secondary_display_offset_(0) {
aura::Env::GetInstance()->display_manager()->AddObserver(this);
}
@@ -120,6 +121,11 @@ void DisplayController::SetSecondaryDisplayLayout(
UpdateDisplayBoundsForLayout();
}
+void DisplayController::SetSecondaryDisplayOffset(int offset) {
+ secondary_display_offset_ = offset;
+ UpdateDisplayBoundsForLayout();
+}
+
bool DisplayController::WarpMouseCursorIfNecessary(
aura::RootWindow* current_root,
const gfx::Point& point_in_root) {
@@ -235,18 +241,29 @@ void DisplayController::UpdateDisplayBoundsForLayout() {
gfx::Point new_secondary_origin = primary_bounds.origin();
// TODO(oshima|mukai): Implement more flexible layout.
+
+ // Ignore the offset in case that the secondary display doesn't share edges
+ // with the primary display.
+ int offset = secondary_display_layout_;
+ if (secondary_display_layout_ == TOP || secondary_display_layout_ == BOTTOM) {
+ if (offset > primary_bounds.width() || offset < -secondary_bounds.width())
+ offset = 0;
oshima_google 2012/08/06 05:44:37 I think it's better to adjust the offset (just kee
Jun Mukai 2012/08/06 06:58:35 Done.
+ } else {
+ if (offset > primary_bounds.height() || offset < -secondary_bounds.height())
+ offset = 0;
+ }
switch (secondary_display_layout_) {
case TOP:
- new_secondary_origin.Offset(0, -secondary_bounds.height());
+ new_secondary_origin.Offset(offset, -secondary_bounds.height());
break;
case RIGHT:
- new_secondary_origin.Offset(primary_bounds.width(), 0);
+ new_secondary_origin.Offset(primary_bounds.width(), offset);
break;
case BOTTOM:
- new_secondary_origin.Offset(0, primary_bounds.height());
+ new_secondary_origin.Offset(offset, primary_bounds.height());
break;
case LEFT:
- new_secondary_origin.Offset(-secondary_bounds.width(), 0);
+ new_secondary_origin.Offset(-secondary_bounds.width(), offset);
break;
}
gfx::Insets insets = secondary_display->GetWorkAreaInsets();
« no previous file with comments | « ash/display/display_controller.h ('k') | chrome/browser/chromeos/preferences.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698