| 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 "chrome/browser/ui/tabs/dock_info.h" | 5 #include "chrome/browser/ui/tabs/dock_info.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // Window is topmost, stop iterating. | 74 // Window is topmost, stop iterating. |
| 75 is_top_most_ = true; | 75 is_top_most_ = true; |
| 76 return true; | 76 return true; |
| 77 } | 77 } |
| 78 | 78 |
| 79 if (!ui::IsWindowVisible(window)) { | 79 if (!ui::IsWindowVisible(window)) { |
| 80 // The window isn't visible, keep iterating. | 80 // The window isn't visible, keep iterating. |
| 81 return false; | 81 return false; |
| 82 } | 82 } |
| 83 | 83 |
| 84 gfx::Rect rect; | 84 if (ui::WindowContainsPoint(window, screen_loc_)) |
| 85 if (ui::GetWindowRect(window, &rect) && rect.Contains(screen_loc_)) { | |
| 86 // At this point we haven't found our target window, so this window is | |
| 87 // higher in the z-order than the target window. If this window contains | |
| 88 // the point, then we can stop the search now because this window is | |
| 89 // obscuring the target window at this point. | |
| 90 return true; | 85 return true; |
| 91 } | |
| 92 | 86 |
| 93 return false; | 87 return false; |
| 94 } | 88 } |
| 95 | 89 |
| 96 private: | 90 private: |
| 97 TopMostFinder(XID window, | 91 TopMostFinder(XID window, |
| 98 const gfx::Point& screen_loc, | 92 const gfx::Point& screen_loc, |
| 99 const std::set<GtkWidget*>& ignore) | 93 const std::set<GtkWidget*>& ignore) |
| 100 : BaseWindowFinder(ignore), | 94 : BaseWindowFinder(ignore), |
| 101 target_(window), | 95 target_(window), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 if (BaseWindowFinder::ShouldIgnoreWindow(window)) | 136 if (BaseWindowFinder::ShouldIgnoreWindow(window)) |
| 143 return false; | 137 return false; |
| 144 | 138 |
| 145 // Check if this window is in our process. | 139 // Check if this window is in our process. |
| 146 if (!BrowserWindowGtk::GetBrowserWindowForXID(window)) | 140 if (!BrowserWindowGtk::GetBrowserWindowForXID(window)) |
| 147 return false; | 141 return false; |
| 148 | 142 |
| 149 if (!ui::IsWindowVisible(window)) | 143 if (!ui::IsWindowVisible(window)) |
| 150 return false; | 144 return false; |
| 151 | 145 |
| 152 gfx::Rect rect; | 146 if (ui::WindowContainsPoint(window, screen_loc_)) { |
| 153 if (ui::GetWindowRect(window, &rect) && rect.Contains(screen_loc_)) { | |
| 154 result_ = window; | 147 result_ = window; |
| 155 return true; | 148 return true; |
| 156 } | 149 } |
| 157 | 150 |
| 158 return false; | 151 return false; |
| 159 } | 152 } |
| 160 | 153 |
| 161 private: | 154 private: |
| 162 LocalProcessWindowFinder(const gfx::Point& screen_loc, | 155 LocalProcessWindowFinder(const gfx::Point& screen_loc, |
| 163 const std::set<GtkWidget*>& ignore) | 156 const std::set<GtkWidget*>& ignore) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 199 |
| 207 void DockInfo::SizeOtherWindowTo(const gfx::Rect& bounds) const { | 200 void DockInfo::SizeOtherWindowTo(const gfx::Rect& bounds) const { |
| 208 gtk_window_move(window(), bounds.x(), bounds.y()); | 201 gtk_window_move(window(), bounds.x(), bounds.y()); |
| 209 gtk_window_resize(window(), bounds.width(), bounds.height()); | 202 gtk_window_resize(window(), bounds.width(), bounds.height()); |
| 210 } | 203 } |
| 211 | 204 |
| 212 // static | 205 // static |
| 213 int DockInfo::GetHotSpotDeltaY() { | 206 int DockInfo::GetHotSpotDeltaY() { |
| 214 return TabGtk::GetMinimumUnselectedSize().height() - 1; | 207 return TabGtk::GetMinimumUnselectedSize().height() - 1; |
| 215 } | 208 } |
| OLD | NEW |