| 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/views/corewm/tooltip_controller.h" | 5 #include "ui/views/corewm/tooltip_controller.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 capture_client->GetGlobalCaptureWindow(); | 76 capture_client->GetGlobalCaptureWindow(); |
| 77 if (capture_window && event_target != capture_window) | 77 if (capture_window && event_target != capture_window) |
| 78 return NULL; | 78 return NULL; |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 return event_target; | 81 return event_target; |
| 82 } | 82 } |
| 83 | 83 |
| 84 // If |target| has capture all events go to it, even if the mouse is | 84 // If |target| has capture all events go to it, even if the mouse is |
| 85 // really over another window. Find the real window the mouse is over. | 85 // really over another window. Find the real window the mouse is over. |
| 86 gfx::Point screen_loc(event.location()); | 86 gfx::Point screen_loc(gfx::ToFlooredPoint(event.location())); |
| 87 aura::client::GetScreenPositionClient(event_target->GetRootWindow())-> | 87 aura::client::GetScreenPositionClient(event_target->GetRootWindow())-> |
| 88 ConvertPointToScreen(event_target, &screen_loc); | 88 ConvertPointToScreen(event_target, &screen_loc); |
| 89 gfx::Screen* screen = gfx::Screen::GetScreenFor(event_target); | 89 gfx::Screen* screen = gfx::Screen::GetScreenFor(event_target); |
| 90 aura::Window* target = screen->GetWindowAtScreenPoint(screen_loc); | 90 aura::Window* target = screen->GetWindowAtScreenPoint(screen_loc); |
| 91 if (!target) | 91 if (!target) |
| 92 return NULL; | 92 return NULL; |
| 93 gfx::Point target_loc(screen_loc); | 93 gfx::Point target_loc(screen_loc); |
| 94 aura::client::GetScreenPositionClient(target->GetRootWindow())-> | 94 aura::client::GetScreenPositionClient(target->GetRootWindow())-> |
| 95 ConvertPointFromScreen(target, &target_loc); | 95 ConvertPointFromScreen(target, &target_loc); |
| 96 aura::Window* screen_target = target->GetEventHandlerForPoint(target_loc); | 96 aura::Window* screen_target = target->GetEventHandlerForPoint(target_loc); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 TooltipShownTimerFired(); | 178 TooltipShownTimerFired(); |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 | 181 |
| 182 void TooltipController::OnMouseEvent(ui::MouseEvent* event) { | 182 void TooltipController::OnMouseEvent(ui::MouseEvent* event) { |
| 183 switch (event->type()) { | 183 switch (event->type()) { |
| 184 case ui::ET_MOUSE_CAPTURE_CHANGED: | 184 case ui::ET_MOUSE_CAPTURE_CHANGED: |
| 185 case ui::ET_MOUSE_EXITED: | 185 case ui::ET_MOUSE_EXITED: |
| 186 case ui::ET_MOUSE_MOVED: | 186 case ui::ET_MOUSE_MOVED: |
| 187 case ui::ET_MOUSE_DRAGGED: { | 187 case ui::ET_MOUSE_DRAGGED: { |
| 188 curr_mouse_loc_ = event->location(); | 188 curr_mouse_loc_ = gfx::ToFlooredPoint(event->location()); |
| 189 aura::Window* target = GetTooltipTarget(*event, &curr_mouse_loc_); | 189 aura::Window* target = GetTooltipTarget(*event, &curr_mouse_loc_); |
| 190 SetTooltipWindow(target); | 190 SetTooltipWindow(target); |
| 191 if (tooltip_timer_.IsRunning()) | 191 if (tooltip_timer_.IsRunning()) |
| 192 tooltip_timer_.Reset(); | 192 tooltip_timer_.Reset(); |
| 193 | 193 |
| 194 if (tooltip_->IsVisible()) | 194 if (tooltip_->IsVisible()) |
| 195 UpdateIfRequired(); | 195 UpdateIfRequired(); |
| 196 break; | 196 break; |
| 197 } | 197 } |
| 198 case ui::ET_MOUSE_PRESSED: | 198 case ui::ET_MOUSE_PRESSED: |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 return; | 344 return; |
| 345 if (tooltip_window_) | 345 if (tooltip_window_) |
| 346 tooltip_window_->RemoveObserver(this); | 346 tooltip_window_->RemoveObserver(this); |
| 347 tooltip_window_ = target; | 347 tooltip_window_ = target; |
| 348 if (tooltip_window_) | 348 if (tooltip_window_) |
| 349 tooltip_window_->AddObserver(this); | 349 tooltip_window_->AddObserver(this); |
| 350 } | 350 } |
| 351 | 351 |
| 352 } // namespace corewm | 352 } // namespace corewm |
| 353 } // namespace views | 353 } // namespace views |
| OLD | NEW |