| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/widget/root_view.h" | 5 #include "views/widget/root_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 if (v != mouse_move_handler_) { | 297 if (v != mouse_move_handler_) { |
| 298 if (mouse_move_handler_ != NULL) | 298 if (mouse_move_handler_ != NULL) |
| 299 mouse_move_handler_->OnMouseExited(e); | 299 mouse_move_handler_->OnMouseExited(e); |
| 300 mouse_move_handler_ = v; | 300 mouse_move_handler_ = v; |
| 301 MouseEvent entered_event(e, this, mouse_move_handler_); | 301 MouseEvent entered_event(e, this, mouse_move_handler_); |
| 302 mouse_move_handler_->OnMouseEntered(entered_event); | 302 mouse_move_handler_->OnMouseEntered(entered_event); |
| 303 } | 303 } |
| 304 MouseEvent moved_event(e, this, mouse_move_handler_); | 304 MouseEvent moved_event(e, this, mouse_move_handler_); |
| 305 mouse_move_handler_->OnMouseMoved(moved_event); | 305 mouse_move_handler_->OnMouseMoved(moved_event); |
| 306 | 306 |
| 307 gfx::NativeCursor cursor = mouse_move_handler_->GetCursorForPoint( | 307 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) |
| 308 moved_event.type(), moved_event.location()); | 308 widget_->SetCursor(mouse_move_handler_->GetCursorForPoint( |
| 309 widget_->SetCursor(cursor); | 309 moved_event.type(), moved_event.location())); |
| 310 } else if (mouse_move_handler_ != NULL) { | 310 } else if (mouse_move_handler_ != NULL) { |
| 311 mouse_move_handler_->OnMouseExited(e); | 311 mouse_move_handler_->OnMouseExited(e); |
| 312 widget_->SetCursor(NULL); | |
| 313 } | 312 } |
| 314 } | 313 } |
| 315 | 314 |
| 316 void RootView::OnMouseExited(const MouseEvent& event) { | 315 void RootView::OnMouseExited(const MouseEvent& event) { |
| 317 if (mouse_move_handler_ != NULL) { | 316 if (mouse_move_handler_ != NULL) { |
| 318 mouse_move_handler_->OnMouseExited(event); | 317 mouse_move_handler_->OnMouseExited(event); |
| 319 mouse_move_handler_ = NULL; | 318 mouse_move_handler_ = NULL; |
| 320 } | 319 } |
| 321 } | 320 } |
| 322 | 321 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 if (mouse_pressed_handler_->GetWidget()) | 455 if (mouse_pressed_handler_->GetWidget()) |
| 457 ConvertPointToView(NULL, mouse_pressed_handler_, p); | 456 ConvertPointToView(NULL, mouse_pressed_handler_, p); |
| 458 } else | 457 } else |
| 459 ConvertPointToView(this, mouse_pressed_handler_, p); | 458 ConvertPointToView(this, mouse_pressed_handler_, p); |
| 460 return true; | 459 return true; |
| 461 } | 460 } |
| 462 | 461 |
| 463 // Input ----------------------------------------------------------------------- | 462 // Input ----------------------------------------------------------------------- |
| 464 | 463 |
| 465 void RootView::UpdateCursor(const MouseEvent& event) { | 464 void RootView::UpdateCursor(const MouseEvent& event) { |
| 465 if (event.flags() & ui::EF_IS_NON_CLIENT) |
| 466 return; |
| 467 |
| 466 gfx::NativeCursor cursor = NULL; | 468 gfx::NativeCursor cursor = NULL; |
| 469 #if defined(OS_WIN) |
| 470 static HCURSOR arrow = LoadCursor(NULL, IDC_ARROW); |
| 471 cursor = arrow; |
| 472 #endif |
| 473 |
| 467 View* v = GetEventHandlerForPoint(event.location()); | 474 View* v = GetEventHandlerForPoint(event.location()); |
| 468 if (v && v != this) { | 475 if (v && v != this) { |
| 469 gfx::Point l(event.location()); | 476 gfx::Point l(event.location()); |
| 470 View::ConvertPointToView(this, v, &l); | 477 View::ConvertPointToView(this, v, &l); |
| 471 cursor = v->GetCursorForPoint(event.type(), l); | 478 cursor = v->GetCursorForPoint(event.type(), l); |
| 472 } | 479 } |
| 473 widget_->SetCursor(cursor); | 480 widget_->SetCursor(cursor); |
| 474 } | 481 } |
| 475 | 482 |
| 476 void RootView::SetMouseLocationAndFlags(const MouseEvent& event) { | 483 void RootView::SetMouseLocationAndFlags(const MouseEvent& event) { |
| 477 last_mouse_event_flags_ = event.flags(); | 484 last_mouse_event_flags_ = event.flags(); |
| 478 last_mouse_event_x_ = event.x(); | 485 last_mouse_event_x_ = event.x(); |
| 479 last_mouse_event_y_ = event.y(); | 486 last_mouse_event_y_ = event.y(); |
| 480 } | 487 } |
| 481 | 488 |
| 482 } // namespace views | 489 } // namespace views |
| OLD | NEW |