diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-19 21:52:02 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-19 21:52:02 +0000 |
commit | 1d5d999a2c4f32f517e4424b8c2f3c13d5613336 (patch) | |
tree | cdc0a6fe235ab3256461a79e2dcba92ddc35ae6a | |
parent | eeb9ccb477c1f1939b7bf70ec954c6df2a838405 (diff) | |
download | chromium_src-1d5d999a2c4f32f517e4424b8c2f3c13d5613336.zip chromium_src-1d5d999a2c4f32f517e4424b8c2f3c13d5613336.tar.gz chromium_src-1d5d999a2c4f32f517e4424b8c2f3c13d5613336.tar.bz2 |
Use XRANR definition for rotation
Changed to use xrandr's definition as discussed offline.
Removed command line switch as this is no longer needed.
BUG=196434
TEST=none
Review URL: https://chromiumcodereview.appspot.com/12700024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189123 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/ash_switches.cc | 6 | ||||
-rw-r--r-- | ash/ash_switches.h | 1 | ||||
-rw-r--r-- | ash/display/display_controller.cc | 33 |
3 files changed, 21 insertions, 19 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc index 44adc42..b85ae86 100644 --- a/ash/ash_switches.cc +++ b/ash/ash_switches.cc @@ -102,12 +102,6 @@ const char kAshImmersiveHideTabIndicators[] = // Specifies the internal display's ui scale. const char kAshInternalDisplayUIScale[] = "ash-internal-display-ui-scale"; -// Overrides all displays' orientation. The value should be one of 0 -// (normal), 1 (90 degrees clockwise), 2 (180 degrees) or 3 (270 -// degrees clockwise). -const char kAshOverrideDisplayOrientation[] = - "ash-override-display-orientation"; - // Specifies the layout mode and offsets for the secondary display for // testing. The format is "<t|r|b|l>,<offset>" where t=TOP, r=RIGHT, // b=BOTTOM and L=LEFT. For example, 'r,-100' means the secondary display diff --git a/ash/ash_switches.h b/ash/ash_switches.h index 5e815ad..d6aa587 100644 --- a/ash/ash_switches.h +++ b/ash/ash_switches.h @@ -47,7 +47,6 @@ ASH_EXPORT extern const char kAshInternalDisplayUIScale[]; ASH_EXPORT extern const char kAshSecondaryDisplayLayout[]; ASH_EXPORT extern const char kAshTouchHud[]; ASH_EXPORT extern const char kAuraLegacyPowerButton[]; -ASH_EXPORT extern const char kAshOverrideDisplayOrientation[]; } // namespace switches } // namespace ash diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc index 551214d..d16af04 100644 --- a/ash/display/display_controller.cc +++ b/ash/display/display_controller.cc @@ -36,6 +36,11 @@ #include "base/time.h" #include "chromeos/display/output_configurator.h" #include "ui/base/x/x11_util.h" + +// Including this at the bottom to avoid other +// potential conflict with chrome headers. +#include <X11/extensions/Xrandr.h> +#undef RootWindow #endif // defined(OS_CHROMEOS) DECLARE_WINDOW_PROPERTY_TYPE(gfx::Display::Rotation); @@ -161,22 +166,26 @@ void SetDisplayPropertiesOnHostWindow(aura::RootWindow* root, const char kScaleFactorProp[] = "_CHROME_DISPLAY_SCALE_FACTOR"; const char kInternalProp[] = "_CHROME_DISPLAY_INTERNAL"; const char kCARDINAL[] = "CARDINAL"; - - CommandLine* command_line = CommandLine::ForCurrentProcess(); - int rotation = static_cast<int>(info.rotation()); - if (command_line->HasSwitch(switches::kAshOverrideDisplayOrientation)) { - std::string value = command_line-> - GetSwitchValueASCII(switches::kAshOverrideDisplayOrientation); - DCHECK(base::StringToInt(value, &rotation)); - DCHECK(0 <= rotation && rotation <= 3) << "Invalid rotation value=" - << rotation; - if (rotation < 0 || rotation > 3) - rotation = 0; + int xrandr_rotation = RR_Rotate_0; + switch (info.rotation()) { + case gfx::Display::ROTATE_0: + xrandr_rotation = RR_Rotate_0; + break; + case gfx::Display::ROTATE_90: + xrandr_rotation = RR_Rotate_90; + break; + case gfx::Display::ROTATE_180: + xrandr_rotation = RR_Rotate_180; + break; + case gfx::Display::ROTATE_270: + xrandr_rotation = RR_Rotate_270; + break; } + int internal = display.IsInternal() ? 1 : 0; gfx::AcceleratedWidget xwindow = root->GetAcceleratedWidget(); ui::SetIntProperty(xwindow, kInternalProp, kCARDINAL, internal); - ui::SetIntProperty(xwindow, kRotationProp, kCARDINAL, rotation); + ui::SetIntProperty(xwindow, kRotationProp, kCARDINAL, xrandr_rotation); ui::SetIntProperty(xwindow, kScaleFactorProp, kCARDINAL, |