summaryrefslogtreecommitdiffstats
path: root/ash/root_window_controller.cc
diff options
context:
space:
mode:
authormohsen@chromium.org <mohsen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-24 21:08:27 +0000
committermohsen@chromium.org <mohsen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-24 21:08:27 +0000
commit4aa0d84f4864b284ab93b2c5af9d9d96e5d3a4ac (patch)
treeb374508e859ee348527ac75b111d161a96a5af4e /ash/root_window_controller.cc
parentcc384b25fb73e9e3b5c44b9e9051c90229697ca5 (diff)
downloadchromium_src-4aa0d84f4864b284ab93b2c5af9d9d96e5d3a4ac.zip
chromium_src-4aa0d84f4864b284ab93b2c5af9d9d96e5d3a4ac.tar.gz
chromium_src-4aa0d84f4864b284ab93b2c5af9d9d96e5d3a4ac.tar.bz2
Swap touch HUD when switching primary display
When a display is set as the primary display, its root window (and all its children, including the widget showing the touch HUD) is replaced with the old one's. But, the touch HUD widget is bound to display and should not be swapped between the two displays. So, after swapping the root windows, touch HUDs are swapped back to their own display. BUG=172237 Review URL: https://chromiumcodereview.appspot.com/13460017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196235 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/root_window_controller.cc')
-rw-r--r--ash/root_window_controller.cc22
1 files changed, 4 insertions, 18 deletions
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index 991f1eb..e4472e0d 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -166,7 +166,8 @@ RootWindowController::RootWindowController(aura::RootWindow* root_window)
: root_window_(root_window),
root_window_layout_(NULL),
shelf_(NULL),
- panel_layout_manager_(NULL) {
+ panel_layout_manager_(NULL),
+ touch_observer_hud_(NULL) {
SetRootWindowController(root_window, this);
screen_dimmer_.reset(new ScreenDimmer(root_window));
@@ -199,9 +200,6 @@ RootWindowController* RootWindowController::ForActiveRootWindow() {
}
void RootWindowController::Shutdown() {
- // Remove touch observer HUD.
- SetTouchObserverHUD(NULL);
-
CloseChildWindows();
if (Shell::GetActiveRootWindow() == root_window_) {
Shell::GetInstance()->set_active_root_window(
@@ -299,12 +297,8 @@ void RootWindowController::CreateContainers() {
// Create touch observer HUD if needed. HUD should be created after the
// containers have been created, so that its widget can be added to them.
CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(switches::kAshTouchHud)) {
- int64 id = root_window_->GetProperty(kDisplayIdKey);
- const gfx::Display& display = Shell::GetInstance()->display_manager()->
- GetDisplayForId(id);
- SetTouchObserverHUD(new TouchObserverHUD(display));
- }
+ if (command_line->HasSwitch(switches::kAshTouchHud))
+ touch_observer_hud_ = new TouchObserverHUD(root_window_.get());
}
void RootWindowController::CreateSystemBackground(
@@ -408,14 +402,6 @@ void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) {
ReparentAllWindows(root_window_.get(), dst);
}
-void RootWindowController::SetTouchObserverHUD(TouchObserverHUD* hud) {
- if (touch_observer_hud_)
- root_window_->RemovePreTargetHandler(touch_observer_hud_.get());
- if (hud)
- root_window_->AddPreTargetHandler(hud);
- touch_observer_hud_.reset(hud);
-}
-
ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() {
return shelf_.get() ? shelf_->shelf_layout_manager() : NULL;
}