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/controls/menu/menu_controller.h" | 5 #include "ui/views/controls/menu/menu_controller.h" |
6 | 6 |
7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "ui/views/mouse_constants.h" | 31 #include "ui/views/mouse_constants.h" |
32 #include "ui/views/view.h" | 32 #include "ui/views/view.h" |
33 #include "ui/views/view_constants.h" | 33 #include "ui/views/view_constants.h" |
34 #include "ui/views/views_delegate.h" | 34 #include "ui/views/views_delegate.h" |
35 #include "ui/views/widget/root_view.h" | 35 #include "ui/views/widget/root_view.h" |
36 #include "ui/views/widget/tooltip_manager.h" | 36 #include "ui/views/widget/tooltip_manager.h" |
37 #include "ui/views/widget/widget.h" | 37 #include "ui/views/widget/widget.h" |
38 | 38 |
39 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
40 #include "ui/base/win/internal_constants.h" | 40 #include "ui/base/win/internal_constants.h" |
41 #include "ui/gfx/win/dpi.h" | 41 #include "ui/gfx/screen_win.h" |
42 #include "ui/views/win/hwnd_util.h" | 42 #include "ui/views/win/hwnd_util.h" |
43 #endif | 43 #endif |
44 | 44 |
45 using base::Time; | 45 using base::Time; |
46 using base::TimeDelta; | 46 using base::TimeDelta; |
47 using ui::OSExchangeData; | 47 using ui::OSExchangeData; |
48 | 48 |
49 // Period of the scroll timer (in milliseconds). | 49 // Period of the scroll timer (in milliseconds). |
50 static const int kScrollTimerMS = 30; | 50 static const int kScrollTimerMS = 30; |
51 | 51 |
(...skipping 2197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2249 gfx::NativeWindow window = screen->GetWindowAtScreenPoint(screen_loc); | 2249 gfx::NativeWindow window = screen->GetWindowAtScreenPoint(screen_loc); |
2250 | 2250 |
2251 #if defined(OS_WIN) | 2251 #if defined(OS_WIN) |
2252 // Convert screen_loc to pixels for the Win32 API's like WindowFromPoint, | 2252 // Convert screen_loc to pixels for the Win32 API's like WindowFromPoint, |
2253 // PostMessage/SendMessage to work correctly. These API's expect the | 2253 // PostMessage/SendMessage to work correctly. These API's expect the |
2254 // coordinates to be in pixels. | 2254 // coordinates to be in pixels. |
2255 // PostMessage() to metro windows isn't allowed (access will be denied). Don't | 2255 // PostMessage() to metro windows isn't allowed (access will be denied). Don't |
2256 // try to repost with Win32 if the window under the mouse press is in metro. | 2256 // try to repost with Win32 if the window under the mouse press is in metro. |
2257 if (!ViewsDelegate::GetInstance() || | 2257 if (!ViewsDelegate::GetInstance() || |
2258 !ViewsDelegate::GetInstance()->IsWindowInMetro(window)) { | 2258 !ViewsDelegate::GetInstance()->IsWindowInMetro(window)) { |
2259 gfx::Point screen_loc_pixels = gfx::win::DIPToScreenPoint(screen_loc); | 2259 gfx::Point screen_loc_pixels = gfx::ScreenWin::DIPToScreenPoint(screen_loc); |
2260 HWND target_window = window ? HWNDForNativeWindow(window) : | 2260 HWND target_window = window ? HWNDForNativeWindow(window) : |
2261 WindowFromPoint(screen_loc_pixels.ToPOINT()); | 2261 WindowFromPoint(screen_loc_pixels.ToPOINT()); |
2262 HWND source_window = HWNDForNativeView(native_view); | 2262 HWND source_window = HWNDForNativeView(native_view); |
2263 if (!target_window || !source_window || | 2263 if (!target_window || !source_window || |
2264 GetWindowThreadProcessId(source_window, NULL) != | 2264 GetWindowThreadProcessId(source_window, NULL) != |
2265 GetWindowThreadProcessId(target_window, NULL)) { | 2265 GetWindowThreadProcessId(target_window, NULL)) { |
2266 // Even though we have mouse capture, windows generates a mouse event if | 2266 // Even though we have mouse capture, windows generates a mouse event if |
2267 // the other window is in a separate thread. Only repost an event if | 2267 // the other window is in a separate thread. Only repost an event if |
2268 // |target_window| and |source_window| were created on the same thread, | 2268 // |target_window| and |source_window| were created on the same thread, |
2269 // else double events can occur and lead to bad behavior. | 2269 // else double events can occur and lead to bad behavior. |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2486 } | 2486 } |
2487 } | 2487 } |
2488 | 2488 |
2489 gfx::Screen* MenuController::GetScreen() { | 2489 gfx::Screen* MenuController::GetScreen() { |
2490 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL; | 2490 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL; |
2491 return root ? gfx::Screen::GetScreenFor(root->GetNativeView()) | 2491 return root ? gfx::Screen::GetScreenFor(root->GetNativeView()) |
2492 : gfx::Screen::GetNativeScreen(); | 2492 : gfx::Screen::GetNativeScreen(); |
2493 } | 2493 } |
2494 | 2494 |
2495 } // namespace views | 2495 } // namespace views |
OLD | NEW |