OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/mus/ws/event_dispatcher.h" | 5 #include "components/mus/ws/event_dispatcher.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "cc/surfaces/surface_hittest.h" | 9 #include "cc/surfaces/surface_hittest.h" |
10 #include "components/mus/surfaces/surfaces_state.h" | 10 #include "components/mus/surfaces/surfaces_state.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 flags & (mojom::EVENT_FLAGS_LEFT_MOUSE_BUTTON | | 27 flags & (mojom::EVENT_FLAGS_LEFT_MOUSE_BUTTON | |
28 mojom::EVENT_FLAGS_MIDDLE_MOUSE_BUTTON | | 28 mojom::EVENT_FLAGS_MIDDLE_MOUSE_BUTTON | |
29 mojom::EVENT_FLAGS_RIGHT_MOUSE_BUTTON); | 29 mojom::EVENT_FLAGS_RIGHT_MOUSE_BUTTON); |
30 return mouse_only_flags == mojom::EVENT_FLAGS_LEFT_MOUSE_BUTTON || | 30 return mouse_only_flags == mojom::EVENT_FLAGS_LEFT_MOUSE_BUTTON || |
31 mouse_only_flags == mojom::EVENT_FLAGS_MIDDLE_MOUSE_BUTTON || | 31 mouse_only_flags == mojom::EVENT_FLAGS_MIDDLE_MOUSE_BUTTON || |
32 mouse_only_flags == mojom::EVENT_FLAGS_RIGHT_MOUSE_BUTTON; | 32 mouse_only_flags == mojom::EVENT_FLAGS_RIGHT_MOUSE_BUTTON; |
33 } | 33 } |
34 | 34 |
35 bool IsLocationInNonclientArea(const ServerWindow* target, | 35 bool IsLocationInNonclientArea(const ServerWindow* target, |
36 const gfx::Point& location) { | 36 const gfx::Point& location) { |
37 return target->parent() && | 37 if (!target->parent()) |
38 !target->client_area().Contains(location); | 38 return false; |
| 39 |
| 40 gfx::Rect client_area(target->bounds().size()); |
| 41 client_area.Inset(target->client_area()); |
| 42 return !client_area.Contains(location); |
39 } | 43 } |
40 | 44 |
41 gfx::Point EventLocationToPoint(const mojom::Event& event) { | 45 gfx::Point EventLocationToPoint(const mojom::Event& event) { |
42 return gfx::ToFlooredPoint(gfx::PointF(event.pointer_data->location->x, | 46 return gfx::ToFlooredPoint(gfx::PointF(event.pointer_data->location->x, |
43 event.pointer_data->location->y)); | 47 event.pointer_data->location->y)); |
44 } | 48 } |
45 | 49 |
46 } // namespace | 50 } // namespace |
47 | 51 |
48 class EventMatcher { | 52 class EventMatcher { |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 void EventDispatcher::OnWindowVisibilityChanged(ServerWindow* window) { | 310 void EventDispatcher::OnWindowVisibilityChanged(ServerWindow* window) { |
307 CancelPointerEventsToTarget(window); | 311 CancelPointerEventsToTarget(window); |
308 } | 312 } |
309 | 313 |
310 void EventDispatcher::OnWindowDestroyed(ServerWindow* window) { | 314 void EventDispatcher::OnWindowDestroyed(ServerWindow* window) { |
311 CancelPointerEventsToTarget(window); | 315 CancelPointerEventsToTarget(window); |
312 } | 316 } |
313 | 317 |
314 } // namespace ws | 318 } // namespace ws |
315 } // namespace mus | 319 } // namespace mus |
OLD | NEW |