diff options
author | disher@chromium.org <disher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-01 16:03:14 +0000 |
---|---|---|
committer | disher@chromium.org <disher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-01 16:03:14 +0000 |
commit | 6f90c6062b0195c0232d87fe7c97730d0e537820 (patch) | |
tree | 41b61cbc746bcd4a98a766994ee0e48ca7babf12 /ash | |
parent | dfec1959de9bf1fff9a0b16d96cd64947f543d0f (diff) | |
download | chromium_src-6f90c6062b0195c0232d87fe7c97730d0e537820.zip chromium_src-6f90c6062b0195c0232d87fe7c97730d0e537820.tar.gz chromium_src-6f90c6062b0195c0232d87fe7c97730d0e537820.tar.bz2 |
Chrome version of monitor configuration code
New MonitorConfigurator class interprets events (ctrl-F4, display add/remove, and brightness-related CRTC state changes).
Ctrl-F4 events come in through the AcceleratorController.
Display add/remove events are interpretted by MonitorChangeObserverX11.
CRTC enable/disable events related to power management come over DBus and are interpretted by the new OutputObserver class.
BUG=chromium:126493
TEST=Manually tested with an additional display and mode switching on Lumpy.
Review URL: https://chromiumcodereview.appspot.com/10384103
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140031 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/accelerators/accelerator_controller.cc | 7 | ||||
-rw-r--r-- | ash/accelerators/accelerator_table.cc | 5 | ||||
-rw-r--r-- | ash/accelerators/accelerator_table.h | 1 | ||||
-rw-r--r-- | ash/shell.cc | 21 | ||||
-rw-r--r-- | ash/shell.h | 14 |
5 files changed, 47 insertions, 1 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index b22d059..efd6b9d 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -37,6 +37,10 @@ #include "ui/compositor/screen_rotation.h" #include "ui/oak/oak.h" +#if defined(OS_CHROMEOS) +#include "chromeos/monitor/output_configurator.h" +#endif // defined(OS_CHROMEOS) + namespace { bool HandleCycleWindowMRU(ash::WindowCycleController::Direction direction, @@ -329,6 +333,9 @@ bool AcceleratorController::AcceleratorPressed( return HandleCrosh(); case TOGGLE_SPOKEN_FEEDBACK: return HandleToggleSpokenFeedback(); + case CYCLE_DISPLAY_MODE: + ash::Shell::GetInstance()->output_configurator()->CycleDisplayMode(); + return true; #endif case EXIT: return HandleExit(); diff --git a/ash/accelerators/accelerator_table.cc b/ash/accelerators/accelerator_table.cc index c225674..7548145 100644 --- a/ash/accelerators/accelerator_table.cc +++ b/ash/accelerators/accelerator_table.cc @@ -30,6 +30,7 @@ const AcceleratorData kAcceleratorData[] = { #if defined(OS_CHROMEOS) { true, ui::VKEY_BRIGHTNESS_DOWN, ui::EF_NONE, BRIGHTNESS_DOWN }, { true, ui::VKEY_BRIGHTNESS_UP, ui::EF_NONE, BRIGHTNESS_UP }, + { true, ui::VKEY_F4, ui::EF_CONTROL_DOWN, CYCLE_DISPLAY_MODE }, { true, ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, LOCK_SCREEN }, { true, ui::VKEY_M, ui::EF_CONTROL_DOWN, OPEN_FILE_MANAGER }, { true, ui::VKEY_T, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, OPEN_CROSH }, @@ -108,7 +109,6 @@ const AcceleratorData kAcceleratorData[] = { // For testing on systems where Alt-Tab is already mapped. { true, ui::VKEY_W, ui::EF_ALT_DOWN, CYCLE_FORWARD_MRU }, { true, ui::VKEY_W, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, CYCLE_BACKWARD_MRU }, - { true, ui::VKEY_F4, ui::EF_CONTROL_DOWN, MONITOR_ADD_REMOVE }, { true, ui::VKEY_F4, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, MONITOR_CYCLE }, { true, ui::VKEY_HOME, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, MONITOR_TOGGLE_SCALE }, @@ -123,6 +123,9 @@ const size_t kAcceleratorDataLength = arraysize(kAcceleratorData); const AcceleratorAction kActionsAllowedAtLoginOrLockScreen[] = { BRIGHTNESS_DOWN, BRIGHTNESS_UP, +#if defined(OS_CHROMEOS) + CYCLE_DISPLAY_MODE, +#endif // defined(OS_CHROMEOS) NEXT_IME, PREVIOUS_IME, SWITCH_IME, // Switch to another IME depending on the accelerator. diff --git a/ash/accelerators/accelerator_table.h b/ash/accelerators/accelerator_table.h index 10d6ef7..53461db 100644 --- a/ash/accelerators/accelerator_table.h +++ b/ash/accelerators/accelerator_table.h @@ -58,6 +58,7 @@ enum AcceleratorAction { WINDOW_SNAP_LEFT, WINDOW_SNAP_RIGHT, #if defined(OS_CHROMEOS) + CYCLE_DISPLAY_MODE, LOCK_SCREEN, OPEN_CROSH, OPEN_FILE_MANAGER, diff --git a/ash/shell.cc b/ash/shell.cc index 84f1663..803c98a 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -94,6 +94,11 @@ #include "ash/accelerators/nested_dispatcher_controller.h" #endif +#if defined(OS_CHROMEOS) +#include "chromeos/monitor/output_configurator.h" +#include "ui/aura/dispatcher_linux.h" +#endif // defined(OS_CHROMEOS) + namespace ash { namespace { @@ -546,6 +551,9 @@ Shell::Shell(ShellDelegate* delegate) screen_(new ScreenAsh(root_window_.get())), root_filter_(NULL), delegate_(delegate), +#if defined(OS_CHROMEOS) + output_configurator_(new chromeos::OutputConfigurator()), +#endif // defined(OS_CHROMEOS) shelf_(NULL), panel_layout_manager_(NULL), root_window_layout_(NULL), @@ -553,6 +561,12 @@ Shell::Shell(ShellDelegate* delegate) browser_context_(NULL) { gfx::Screen::SetInstance(screen_); ui_controls::InstallUIControlsAura(CreateUIControlsAura(root_window_.get())); +#if defined(OS_CHROMEOS) + // OutputConfigurator needs to get events regarding added/removed outputs. + static_cast<aura::DispatcherLinux*>( + aura::Env::GetInstance()->GetDispatcher())->AddDispatcherForRootWindow( + output_configurator()); +#endif // defined(OS_CHROMEOS) } Shell::~Shell() { @@ -623,6 +637,13 @@ Shell::~Shell() { DCHECK(instance_ == this); instance_ = NULL; + +#if defined(OS_CHROMEOS) + // Remove OutputConfigurator from Dispatcher. + static_cast<aura::DispatcherLinux*>( + aura::Env::GetInstance()->GetDispatcher())->RemoveDispatcherForRootWindow( + output_configurator()); +#endif // defined(OS_CHROMEOS) } // static diff --git a/ash/shell.h b/ash/shell.h index 0e64b71..6e874c0 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -36,6 +36,9 @@ class InputMethodEventFilter; class RootWindowEventFilter; } } +namespace chromeos { +class OutputConfigurator; +} namespace content { class BrowserContext; } @@ -317,6 +320,12 @@ class ASH_EXPORT Shell { // Initialize the root window to be used for a secondary monitor. void InitRootWindowForSecondaryMonitor(aura::RootWindow* root); +#if defined(OS_CHROMEOS) + chromeos::OutputConfigurator* output_configurator() { + return output_configurator_.get(); + } +#endif // defined(OS_CHROMEOS) + private: FRIEND_TEST_ALL_PREFIXES(RootWindowEventFilterTest, MouseEventCursors); FRIEND_TEST_ALL_PREFIXES(RootWindowEventFilterTest, TransformActivate); @@ -413,6 +422,11 @@ class ASH_EXPORT Shell { // of layer animations for visual debugging. scoped_ptr<internal::SlowAnimationEventFilter> slow_animation_filter_; +#if defined(OS_CHROMEOS) + // Controls video output device state. + scoped_ptr<chromeos::OutputConfigurator> output_configurator_; +#endif // defined(OS_CHROMEOS) + // The shelf for managing the launcher and the status widget in non-compact // mode. Shell does not own the shelf. Instead, it is owned by container of // the status area. |