Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "ui/aura/root_window.h" | 5 #include "ui/aura/root_window.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "ui/aura/aura_switches.h" | 15 #include "ui/aura/aura_switches.h" |
| 16 #include "ui/aura/client/activation_client.h" | 16 #include "ui/aura/client/activation_client.h" |
| 17 #include "ui/aura/client/capture_client.h" | 17 #include "ui/aura/client/capture_client.h" |
| 18 #include "ui/aura/client/drag_drop_client.h" | |
| 19 #include "ui/aura/client/event_client.h" | 18 #include "ui/aura/client/event_client.h" |
| 20 #include "ui/aura/client/screen_position_client.h" | 19 #include "ui/aura/client/screen_position_client.h" |
| 21 #include "ui/aura/display_manager.h" | 20 #include "ui/aura/display_manager.h" |
| 22 #include "ui/aura/env.h" | 21 #include "ui/aura/env.h" |
| 23 #include "ui/aura/event_filter.h" | 22 #include "ui/aura/event_filter.h" |
| 24 #include "ui/aura/focus_manager.h" | 23 #include "ui/aura/focus_manager.h" |
| 25 #include "ui/aura/root_window_host.h" | 24 #include "ui/aura/root_window_host.h" |
| 26 #include "ui/aura/root_window_observer.h" | 25 #include "ui/aura/root_window_observer.h" |
| 27 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
| 28 #include "ui/aura/window_delegate.h" | 27 #include "ui/aura/window_delegate.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 CancelLock(); | 96 CancelLock(); |
| 98 } | 97 } |
| 99 | 98 |
| 100 void CompositorLock::CancelLock() { | 99 void CompositorLock::CancelLock() { |
| 101 if (!root_window_) | 100 if (!root_window_) |
| 102 return; | 101 return; |
| 103 root_window_->UnlockCompositor(); | 102 root_window_->UnlockCompositor(); |
| 104 root_window_ = NULL; | 103 root_window_ = NULL; |
| 105 } | 104 } |
| 106 | 105 |
| 107 bool RootWindow::hide_host_cursor_ = false; | |
| 108 | |
| 109 //////////////////////////////////////////////////////////////////////////////// | 106 //////////////////////////////////////////////////////////////////////////////// |
| 110 // RootWindow, public: | 107 // RootWindow, public: |
| 111 | 108 |
| 112 RootWindow::RootWindow(const gfx::Rect& initial_bounds) | 109 RootWindow::RootWindow(const gfx::Rect& initial_bounds) |
| 113 : Window(NULL), | 110 : Window(NULL), |
| 114 ALLOW_THIS_IN_INITIALIZER_LIST( | 111 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 115 host_(RootWindowHost::Create(this, initial_bounds))), | 112 host_(RootWindowHost::Create(this, initial_bounds))), |
| 116 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)), | 113 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)), |
| 117 ALLOW_THIS_IN_INITIALIZER_LIST(event_factory_(this)), | 114 ALLOW_THIS_IN_INITIALIZER_LIST(event_factory_(this)), |
| 118 mouse_button_flags_(0), | 115 mouse_button_flags_(0), |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 SetLastMouseLocation(this, ui::ConvertPointToDIP(layer(), point)); | 220 SetLastMouseLocation(this, ui::ConvertPointToDIP(layer(), point)); |
| 224 | 221 |
| 225 synthesize_mouse_move_ = false; | 222 synthesize_mouse_move_ = false; |
| 226 } | 223 } |
| 227 | 224 |
| 228 gfx::Point RootWindow::GetHostOrigin() const { | 225 gfx::Point RootWindow::GetHostOrigin() const { |
| 229 return host_->GetBounds().origin(); | 226 return host_->GetBounds().origin(); |
| 230 } | 227 } |
| 231 | 228 |
| 232 void RootWindow::SetCursor(gfx::NativeCursor cursor) { | 229 void RootWindow::SetCursor(gfx::NativeCursor cursor) { |
| 233 // If a drag is in progress, the DragDropClient should override the cursor. | |
| 234 client::DragDropClient* dnd_client = client::GetDragDropClient(this); | |
| 235 if (dnd_client && dnd_client->IsDragDropInProgress()) | |
| 236 cursor = dnd_client->GetDragCursor(); | |
| 237 | |
| 238 last_cursor_ = cursor; | 230 last_cursor_ = cursor; |
| 239 // A lot of code seems to depend on NULL cursors actually showing an arrow, | 231 // A lot of code seems to depend on NULL cursors actually showing an arrow, |
| 240 // so just pass everything along to the host. | 232 // so just pass everything along to the host. |
| 241 host_->SetCursor(cursor); | 233 host_->SetCursor(cursor); |
| 242 } | 234 } |
| 243 | 235 |
| 244 void RootWindow::ShowCursor(bool show) { | 236 void RootWindow::ShowCursor(bool show) { |
| 245 // Send entered / exited so that visual state can be updated to match | 237 // Send entered / exited so that visual state can be updated to match |
| 246 // cursor state. | 238 // cursor state. |
| 247 if (show != cursor_shown_) { | 239 if (show != cursor_shown_) { |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 509 } | 501 } |
| 510 | 502 |
| 511 //////////////////////////////////////////////////////////////////////////////// | 503 //////////////////////////////////////////////////////////////////////////////// |
| 512 // RootWindow, ui::LayerDelegate implementation: | 504 // RootWindow, ui::LayerDelegate implementation: |
| 513 | 505 |
| 514 void RootWindow::OnDeviceScaleFactorChanged( | 506 void RootWindow::OnDeviceScaleFactorChanged( |
| 515 float device_scale_factor) { | 507 float device_scale_factor) { |
| 516 if (cursor_shown_) | 508 if (cursor_shown_) |
| 517 ShowCursor(false); | 509 ShowCursor(false); |
| 518 host_->OnDeviceScaleFactorChanged(device_scale_factor); | 510 host_->OnDeviceScaleFactorChanged(device_scale_factor); |
| 519 Window::OnDeviceScaleFactorChanged(device_scale_factor); | 511 Window::OnDeviceScaleFactorChanged(device_scale_factor); |
|
oshima
2012/09/07 19:52:01
don't we have to update cursor manager here?
mazda
2012/09/07 22:38:14
Now the cursor is set based on the current cursor
oshima
2012/09/07 23:08:20
what happen when I switch to mirroring, which can
mazda
2012/09/08 00:27:02
That case needs to be handled. I added code to upd
| |
| 520 if (cursor_shown_) | 512 if (cursor_shown_) |
| 521 ShowCursor(true); | 513 ShowCursor(true); |
| 522 } | 514 } |
| 523 | 515 |
| 524 //////////////////////////////////////////////////////////////////////////////// | 516 //////////////////////////////////////////////////////////////////////////////// |
| 525 // RootWindow, overridden from aura::Window: | 517 // RootWindow, overridden from aura::Window: |
| 526 | 518 |
| 527 bool RootWindow::CanFocus() const { | 519 bool RootWindow::CanFocus() const { |
| 528 return IsVisible(); | 520 return IsVisible(); |
| 529 } | 521 } |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1064 void RootWindow::UnlockCompositor() { | 1056 void RootWindow::UnlockCompositor() { |
| 1065 DCHECK(compositor_lock_); | 1057 DCHECK(compositor_lock_); |
| 1066 compositor_lock_ = NULL; | 1058 compositor_lock_ = NULL; |
| 1067 if (draw_on_compositor_unlock_) { | 1059 if (draw_on_compositor_unlock_) { |
| 1068 draw_on_compositor_unlock_ = false; | 1060 draw_on_compositor_unlock_ = false; |
| 1069 ScheduleDraw(); | 1061 ScheduleDraw(); |
| 1070 } | 1062 } |
| 1071 } | 1063 } |
| 1072 | 1064 |
| 1073 } // namespace aura | 1065 } // namespace aura |
| OLD | NEW |