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

Side by Side Diff: ash/root_window_controller.cc

Issue 21519002: Prevent mouse from getting stuck on second display in login (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't create target window if a session is already active Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/root_window_controller.h ('k') | ash/root_window_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/root_window_controller.h" 5 #include "ash/root_window_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/ash_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 30 matching lines...) Expand all
41 #include "ash/wm/toplevel_window_event_handler.h" 41 #include "ash/wm/toplevel_window_event_handler.h"
42 #include "ash/wm/window_properties.h" 42 #include "ash/wm/window_properties.h"
43 #include "ash/wm/window_util.h" 43 #include "ash/wm/window_util.h"
44 #include "ash/wm/workspace_controller.h" 44 #include "ash/wm/workspace_controller.h"
45 #include "base/command_line.h" 45 #include "base/command_line.h"
46 #include "base/time/time.h" 46 #include "base/time/time.h"
47 #include "ui/aura/client/aura_constants.h" 47 #include "ui/aura/client/aura_constants.h"
48 #include "ui/aura/client/tooltip_client.h" 48 #include "ui/aura/client/tooltip_client.h"
49 #include "ui/aura/root_window.h" 49 #include "ui/aura/root_window.h"
50 #include "ui/aura/window.h" 50 #include "ui/aura/window.h"
51 #include "ui/aura/window_delegate.h"
51 #include "ui/aura/window_observer.h" 52 #include "ui/aura/window_observer.h"
53 #include "ui/base/hit_test.h"
52 #include "ui/base/models/menu_model.h" 54 #include "ui/base/models/menu_model.h"
53 #include "ui/gfx/screen.h" 55 #include "ui/gfx/screen.h"
54 #include "ui/keyboard/keyboard_controller.h" 56 #include "ui/keyboard/keyboard_controller.h"
55 #include "ui/keyboard/keyboard_util.h" 57 #include "ui/keyboard/keyboard_util.h"
56 #include "ui/views/controls/menu/menu_runner.h" 58 #include "ui/views/controls/menu/menu_runner.h"
57 #include "ui/views/corewm/visibility_controller.h" 59 #include "ui/views/corewm/visibility_controller.h"
58 #include "ui/views/view_model.h" 60 #include "ui/views/view_model.h"
59 #include "ui/views/view_model_utils.h" 61 #include "ui/views/view_model_utils.h"
60 62
61 namespace ash { 63 namespace ash {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 void SetUsesScreenCoordinates(aura::Window* container) { 159 void SetUsesScreenCoordinates(aura::Window* container) {
158 container->SetProperty(internal::kUsesScreenCoordinatesKey, true); 160 container->SetProperty(internal::kUsesScreenCoordinatesKey, true);
159 } 161 }
160 162
161 // Mark the container window so that a widget added to this container will 163 // Mark the container window so that a widget added to this container will
162 // say in the same root window regardless of the bounds specified. 164 // say in the same root window regardless of the bounds specified.
163 void DescendantShouldStayInSameRootWindow(aura::Window* container) { 165 void DescendantShouldStayInSameRootWindow(aura::Window* container) {
164 container->SetProperty(internal::kStayInSameRootWindowKey, true); 166 container->SetProperty(internal::kStayInSameRootWindowKey, true);
165 } 167 }
166 168
169 // A window delegate which does nothing. Used to create a window that
170 // is a event target, but do nothing.
171 class EmptyWindowDelegate : public aura::WindowDelegate {
172 public:
173 EmptyWindowDelegate() {}
174 virtual ~EmptyWindowDelegate() {}
175
176 // aura::WindowDelegate overrides:
177 virtual gfx::Size GetMinimumSize() const OVERRIDE {
178 return gfx::Size();
179 }
180 virtual gfx::Size GetMaximumSize() const OVERRIDE {
181 return gfx::Size();
182 }
183 virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
184 const gfx::Rect& new_bounds) OVERRIDE {
185 }
186 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE {
187 return gfx::kNullCursor;
188 }
189 virtual int GetNonClientComponent(
190 const gfx::Point& point) const OVERRIDE {
191 return HTNOWHERE;
192 }
193 virtual bool ShouldDescendIntoChildForEventHandling(
194 aura::Window* child,
195 const gfx::Point& location) OVERRIDE {
196 return false;
197 }
198 virtual bool CanFocus() OVERRIDE {
199 return false;
200 }
201 virtual void OnCaptureLost() OVERRIDE {
202 }
203 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
204 }
205 virtual void OnDeviceScaleFactorChanged(
206 float device_scale_factor) OVERRIDE {
207 }
208 virtual void OnWindowDestroying() OVERRIDE {}
209 virtual void OnWindowDestroyed() OVERRIDE {}
210 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE {
211 }
212 virtual bool HasHitTestMask() const OVERRIDE {
213 return false;
214 }
215 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {}
216 virtual scoped_refptr<ui::Texture> CopyTexture() OVERRIDE {
217 NOTREACHED();
218 return scoped_refptr<ui::Texture>();
219 }
220
221 private:
222 DISALLOW_COPY_AND_ASSIGN(EmptyWindowDelegate);
223 };
224
167 } // namespace 225 } // namespace
168 226
169 namespace internal { 227 namespace internal {
170 228
171 RootWindowController::RootWindowController(aura::RootWindow* root_window) 229 RootWindowController::RootWindowController(aura::RootWindow* root_window)
172 : root_window_(root_window), 230 : root_window_(root_window),
173 root_window_layout_(NULL), 231 root_window_layout_(NULL),
174 docked_layout_manager_(NULL), 232 docked_layout_manager_(NULL),
175 panel_layout_manager_(NULL), 233 panel_layout_manager_(NULL),
176 touch_hud_debug_(NULL), 234 touch_hud_debug_(NULL),
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 panel_layout_manager_->SetLauncher(shelf_->launcher()); 352 panel_layout_manager_->SetLauncher(shelf_->launcher());
295 if (docked_layout_manager_) { 353 if (docked_layout_manager_) {
296 docked_layout_manager_->SetLauncher(shelf_->launcher()); 354 docked_layout_manager_->SetLauncher(shelf_->launcher());
297 if (shelf_->shelf_layout_manager()) 355 if (shelf_->shelf_layout_manager())
298 docked_layout_manager_->AddObserver(shelf_->shelf_layout_manager()); 356 docked_layout_manager_->AddObserver(shelf_->shelf_layout_manager());
299 } 357 }
300 } 358 }
301 359
302 void RootWindowController::UpdateAfterLoginStatusChange( 360 void RootWindowController::UpdateAfterLoginStatusChange(
303 user::LoginStatus status) { 361 user::LoginStatus status) {
362 if (status != user::LOGGED_IN_NONE)
363 mouse_event_target_.reset();
304 if (shelf_->status_area_widget()) 364 if (shelf_->status_area_widget())
305 shelf_->status_area_widget()->UpdateAfterLoginStatusChange(status); 365 shelf_->status_area_widget()->UpdateAfterLoginStatusChange(status);
306 } 366 }
307 367
308 void RootWindowController::HandleInitialDesktopBackgroundAnimationStarted() { 368 void RootWindowController::HandleInitialDesktopBackgroundAnimationStarted() {
309 if (CommandLine::ForCurrentProcess()->HasSwitch( 369 if (CommandLine::ForCurrentProcess()->HasSwitch(
310 switches::kAshAnimateFromBootSplashScreen) && 370 switches::kAshAnimateFromBootSplashScreen) &&
311 boot_splash_screen_.get()) { 371 boot_splash_screen_.get()) {
312 // Make the splash screen fade out so it doesn't obscure the desktop 372 // Make the splash screen fade out so it doesn't obscure the desktop
313 // wallpaper's brightness/grayscale animation. 373 // wallpaper's brightness/grayscale animation.
(...skipping 18 matching lines...) Expand all
332 // |desktop_widget_| should be the same animating widget we try to move 392 // |desktop_widget_| should be the same animating widget we try to move
333 // to |kDesktopController|. Otherwise, we may close |desktop_widget_| 393 // to |kDesktopController|. Otherwise, we may close |desktop_widget_|
334 // before move it to |kDesktopController|. 394 // before move it to |kDesktopController|.
335 DCHECK_EQ(controller->widget(), widget); 395 DCHECK_EQ(controller->widget(), widget);
336 // Release the old controller and close its background widget. 396 // Release the old controller and close its background widget.
337 SetWallpaperController(controller); 397 SetWallpaperController(controller);
338 } 398 }
339 } 399 }
340 400
341 void RootWindowController::CloseChildWindows() { 401 void RootWindowController::CloseChildWindows() {
402 mouse_event_target_.reset();
403
342 if (!shelf_.get()) 404 if (!shelf_.get())
343 return; 405 return;
344 // panel_layout_manager_ needs to be shut down before windows are destroyed. 406 // panel_layout_manager_ needs to be shut down before windows are destroyed.
345 if (panel_layout_manager_) { 407 if (panel_layout_manager_) {
346 panel_layout_manager_->Shutdown(); 408 panel_layout_manager_->Shutdown();
347 panel_layout_manager_ = NULL; 409 panel_layout_manager_ = NULL;
348 } 410 }
349 // docked_layout_manager_ needs to be shut down before windows are destroyed. 411 // docked_layout_manager_ needs to be shut down before windows are destroyed.
350 if (docked_layout_manager_) { 412 if (docked_layout_manager_) {
351 if (shelf_->shelf_layout_manager()) 413 if (shelf_->shelf_layout_manager())
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 538
477 DCHECK(!shelf_.get()); 539 DCHECK(!shelf_.get());
478 aura::Window* shelf_container = 540 aura::Window* shelf_container =
479 GetContainer(internal::kShellWindowId_ShelfContainer); 541 GetContainer(internal::kShellWindowId_ShelfContainer);
480 // TODO(harrym): Remove when status area is view. 542 // TODO(harrym): Remove when status area is view.
481 aura::Window* status_container = 543 aura::Window* status_container =
482 GetContainer(internal::kShellWindowId_StatusContainer); 544 GetContainer(internal::kShellWindowId_StatusContainer);
483 shelf_.reset(new ShelfWidget( 545 shelf_.reset(new ShelfWidget(
484 shelf_container, status_container, workspace_controller())); 546 shelf_container, status_container, workspace_controller()));
485 547
548 if (!Shell::GetInstance()->session_state_delegate()->
549 IsActiveUserSessionStarted()) {
550 // This window exists only to be a event target on login screen.
551 // It does not have to handle events, nor be visible.
552 mouse_event_target_.reset(new aura::Window(new EmptyWindowDelegate));
553 mouse_event_target_->Init(ui::LAYER_NOT_DRAWN);
554
555 aura::Window* lock_background_container =
556 GetContainer(internal::kShellWindowId_LockScreenBackgroundContainer);
557 lock_background_container->AddChild(mouse_event_target_.get());
558 mouse_event_target_->Show();
559 }
560
486 // Create Docked windows layout manager 561 // Create Docked windows layout manager
487 aura::Window* docked_container = GetContainer( 562 aura::Window* docked_container = GetContainer(
488 internal::kShellWindowId_DockedContainer); 563 internal::kShellWindowId_DockedContainer);
489 docked_layout_manager_ = 564 docked_layout_manager_ =
490 new internal::DockedWindowLayoutManager(docked_container); 565 new internal::DockedWindowLayoutManager(docked_container);
491 docked_container_handler_.reset( 566 docked_container_handler_.reset(
492 new ToplevelWindowEventHandler(docked_container)); 567 new ToplevelWindowEventHandler(docked_container));
493 docked_container->SetLayoutManager(docked_layout_manager_); 568 docked_container->SetLayoutManager(docked_layout_manager_);
494 569
495 // Create Panel layout manager 570 // Create Panel layout manager
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 790
716 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { 791 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) {
717 if (enabled) 792 if (enabled)
718 EnableTouchHudProjection(); 793 EnableTouchHudProjection();
719 else 794 else
720 DisableTouchHudProjection(); 795 DisableTouchHudProjection();
721 } 796 }
722 797
723 } // namespace internal 798 } // namespace internal
724 } // namespace ash 799 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller.h ('k') | ash/root_window_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698