| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ozone/platform/dri/dri_window_manager.h" | 5 #include "ui/ozone/platform/dri/dri_window_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/ozone/platform/dri/dri_cursor.h" | 8 #include "ui/ozone/platform/dri/dri_cursor.h" |
| 9 #include "ui/ozone/platform/dri/dri_window.h" | 9 #include "ui/ozone/platform/dri/dri_window.h" |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 DriWindow* DriWindowManager::GetWindow(gfx::AcceleratedWidget widget) { | 56 DriWindow* DriWindowManager::GetWindow(gfx::AcceleratedWidget widget) { |
| 57 WidgetToWindowMap::iterator it = window_map_.find(widget); | 57 WidgetToWindowMap::iterator it = window_map_.find(widget); |
| 58 if (it != window_map_.end()) | 58 if (it != window_map_.end()) |
| 59 return it->second; | 59 return it->second; |
| 60 | 60 |
| 61 NOTREACHED() << "Attempting to get non-existing window " << widget; | 61 NOTREACHED() << "Attempting to get non-existing window " << widget; |
| 62 return NULL; | 62 return NULL; |
| 63 } | 63 } |
| 64 | 64 |
| 65 DriWindow* DriWindowManager::GetWindowAt(const gfx::Point& location) { |
| 66 for (auto it = window_map_.begin(); it != window_map_.end(); ++it) |
| 67 if (it->second->GetBounds().Contains(location)) |
| 68 return it->second; |
| 69 |
| 70 return NULL; |
| 71 } |
| 72 |
| 65 void DriWindowManager::ResetCursorLocation() { | 73 void DriWindowManager::ResetCursorLocation() { |
| 66 gfx::AcceleratedWidget cursor_widget = gfx::kNullAcceleratedWidget; | 74 gfx::AcceleratedWidget cursor_widget = gfx::kNullAcceleratedWidget; |
| 67 gfx::PointF location; | 75 gfx::PointF location; |
| 68 if (!window_map_.empty()) { | 76 if (!window_map_.empty()) { |
| 69 WidgetToWindowMap::iterator it = window_map_.begin(); | 77 WidgetToWindowMap::iterator it = window_map_.begin(); |
| 70 cursor_widget = it->first; | 78 cursor_widget = it->first; |
| 71 location = GetDefaultCursorLocation(it->second); | 79 location = GetDefaultCursorLocation(it->second); |
| 72 } | 80 } |
| 73 | 81 |
| 74 cursor_->MoveCursorTo(cursor_widget, location); | 82 cursor_->MoveCursorTo(cursor_widget, location); |
| 75 } | 83 } |
| 76 | 84 |
| 77 } // namespace ui | 85 } // namespace ui |
| OLD | NEW |