diff options
author | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-15 03:48:38 +0000 |
---|---|---|
committer | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-15 03:48:38 +0000 |
commit | 5aee7bef490cabc7c93c372b5dc712673f41dbca (patch) | |
tree | 848589c5ac0c28cfbc45a6c3fa89c7bde3335087 /chromeos | |
parent | 4a8220904ce32c2a75c1c92dadcc0c183d56cdf2 (diff) | |
download | chromium_src-5aee7bef490cabc7c93c372b5dc712673f41dbca.zip chromium_src-5aee7bef490cabc7c93c372b5dc712673f41dbca.tar.gz chromium_src-5aee7bef490cabc7c93c372b5dc712673f41dbca.tar.bz2 |
Add placeholder methods around displays, for option UI.
Following methods are added to OutputConfigurator interface:
- GetDisplayMode(): used to show the options UI.
- SetDisplayMode(State): should be called when the user changes display mode in the options UI.
Following field is added to gfx::Display:
- name: to denote which monitors is which, in the option UI.
see the mock image of crbug.com/130385
BUG=130385
TEST=compilation succeeded. Make sure Ctrl-F4 behavior is not changed.
Review URL: https://chromiumcodereview.appspot.com/10539129
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142336 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r-- | chromeos/monitor/output_configurator.cc | 42 | ||||
-rw-r--r-- | chromeos/monitor/output_configurator.h | 7 |
2 files changed, 31 insertions, 18 deletions
diff --git a/chromeos/monitor/output_configurator.cc b/chromeos/monitor/output_configurator.cc index 451ca1f..e52cd22 100644 --- a/chromeos/monitor/output_configurator.cc +++ b/chromeos/monitor/output_configurator.cc @@ -630,13 +630,6 @@ bool OutputConfigurator::CycleDisplayMode() { VLOG(1) << "CycleDisplayMode"; bool did_change = false; if (is_running_on_chrome_os_) { - Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); - CHECK(display != NULL); - XGrabServer(display); - Window window = DefaultRootWindow(display); - XRRScreenResources* screen = XRRGetScreenResources(display, window); - CHECK(screen != NULL); - // Rules: // - if there are 0 or 1 displays, do nothing and return false. // - use y-coord of CRTCs to determine if we are mirror, primary-first, or @@ -659,16 +652,8 @@ bool OutputConfigurator::CycleDisplayMode() { // Do nothing - we aren't in a mode which we can rotate. break; } - if (STATE_INVALID != new_state) { - UpdateCacheAndXrandrToState(display, - screen, - window, - new_state); - did_change = true; - } - - XRRFreeScreenResources(screen); - XUngrabServer(display); + if (STATE_INVALID != new_state) + did_change = SetDisplayMode(new_state); } return did_change; } @@ -730,6 +715,28 @@ bool OutputConfigurator::ScreenPowerSet(bool power_on, bool all_displays) { return success; } +bool OutputConfigurator::SetDisplayMode(State new_state) { + if (output_state_ == STATE_INVALID || + output_state_ == STATE_HEADLESS || + output_state_ == STATE_SINGLE) + return false; + + Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); + CHECK(display != NULL); + XGrabServer(display); + Window window = DefaultRootWindow(display); + XRRScreenResources* screen = XRRGetScreenResources(display, window); + CHECK(screen != NULL); + + UpdateCacheAndXrandrToState(display, + screen, + window, + new_state); + XRRFreeScreenResources(screen); + XUngrabServer(display); + return true; +} + bool OutputConfigurator::Dispatch(const base::NativeEvent& event) { // Ignore this event if the Xrandr extension isn't supported. if (is_running_on_chrome_os_ && @@ -783,4 +790,3 @@ void OutputConfigurator::CheckIsProjectingAndNotify() { } } // namespace chromeos - diff --git a/chromeos/monitor/output_configurator.h b/chromeos/monitor/output_configurator.h index 229515b..ad1318e 100644 --- a/chromeos/monitor/output_configurator.h +++ b/chromeos/monitor/output_configurator.h @@ -62,6 +62,8 @@ class CHROMEOS_EXPORT OutputConfigurator : public MessageLoop::Dispatcher { OutputConfigurator(); virtual ~OutputConfigurator(); + State output_state() const { return output_state_; } + // Called when the user hits ctrl-F4 to request a display mode change. // This method should only return false if it was called in a single-head or // headless mode. @@ -72,6 +74,11 @@ class CHROMEOS_EXPORT OutputConfigurator : public MessageLoop::Dispatcher { // the display(s) in question so that the low power state is engaged. bool ScreenPowerSet(bool power_on, bool all_displays); + // Force switching the display mode to |new_state|. This method is used when + // the user explicitly changes the display mode in the options UI. Returns + // false if it was called in a single-head or headless mode. + bool SetDisplayMode(State new_state); + // Called when an RRNotify event is received. The implementation is // interested in the cases of RRNotify events which correspond to output // add/remove events. Note that Output add/remove events are sent in response |