| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/event_utils.h" | 5 #include "ui/views/event_utils.h" |
| 6 | 6 |
| 7 #include <windowsx.h> | 7 #include <windowsx.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
| 11 #include "ui/events/event_constants.h" | 11 #include "ui/events/event_constants.h" |
| 12 #include "ui/gfx/point.h" | 12 #include "ui/gfx/point.h" |
| 13 | 13 |
| 14 namespace views { | 14 namespace views { |
| 15 | 15 |
| 16 #if defined(USE_AURA) | 16 #if defined(USE_AURA) |
| 17 bool RepostLocatedEventWin(HWND window, | 17 bool RepostLocatedEventWin(HWND window, |
| 18 const ui::LocatedEvent& event) { | 18 const ui::LocatedEvent& event) { |
| 19 #else | 19 #else |
| 20 bool RepostLocatedEvent(gfx::NativeWindow window | 20 bool RepostLocatedEvent(gfx::NativeWindow window, |
| 21 const ui::LocatedEvent& event) { | 21 const ui::LocatedEvent& event) { |
| 22 #endif | 22 #endif |
| 23 if (!window) | 23 if (!window) |
| 24 return false; | 24 return false; |
| 25 | 25 |
| 26 // Determine whether the click was in the client area or not. | 26 // Determine whether the click was in the client area or not. |
| 27 // NOTE: WM_NCHITTEST coordinates are relative to the screen. | 27 // NOTE: WM_NCHITTEST coordinates are relative to the screen. |
| 28 const gfx::Point screen_loc = event.location(); | 28 const gfx::Point screen_loc = event.location(); |
| 29 LRESULT nc_hit_result = SendMessage(window, WM_NCHITTEST, 0, | 29 LRESULT nc_hit_result = SendMessage(window, WM_NCHITTEST, 0, |
| 30 MAKELPARAM(screen_loc.x(), | 30 MAKELPARAM(screen_loc.x(), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 55 window_x = pt.x; | 55 window_x = pt.x; |
| 56 window_y = pt.y; | 56 window_y = pt.y; |
| 57 } | 57 } |
| 58 | 58 |
| 59 WPARAM target = in_client_area ? event.native_event().wParam : nc_hit_result; | 59 WPARAM target = in_client_area ? event.native_event().wParam : nc_hit_result; |
| 60 PostMessage(window, event_type, target, MAKELPARAM(window_x, window_y)); | 60 PostMessage(window, event_type, target, MAKELPARAM(window_x, window_y)); |
| 61 return true; | 61 return true; |
| 62 } | 62 } |
| 63 | 63 |
| 64 } // namespace views | 64 } // namespace views |
| OLD | NEW |