Chromium Code Reviews| Index: components/mus/ws/event_dispatcher.cc |
| diff --git a/components/mus/ws/event_dispatcher.cc b/components/mus/ws/event_dispatcher.cc |
| index ead61660ad570645411ad7e55eec1f77a37ee403..55717b553d90406d7974344f06d079abc2a2f7a6 100644 |
| --- a/components/mus/ws/event_dispatcher.cc |
| +++ b/components/mus/ws/event_dispatcher.cc |
| @@ -52,6 +52,16 @@ bool IsLocationInNonclientArea(const ServerWindow* target, |
| return true; |
| } |
| +ServerWindow* GetModalTargetForWindow(ServerWindow* target) { |
| + for (ServerWindow* window = target; window; window = window->parent()) { |
| + for (const auto& transient_child : window->transient_children()) { |
| + if (transient_child->is_modal()) |
| + return GetModalTargetForWindow(transient_child); |
| + } |
| + } |
| + return target; |
| +} |
| + |
| } // namespace |
| class EventMatcher { |
| @@ -443,10 +453,12 @@ EventDispatcher::PointerTarget EventDispatcher::PointerTargetForEvent( |
| const ui::PointerEvent& event) const { |
| PointerTarget pointer_target; |
| gfx::Point location(event.location()); |
| - pointer_target.window = |
| + ServerWindow* target_window = |
| FindDeepestVisibleWindowForEvents(root_, surface_id_, &location); |
| + pointer_target.window = GetModalTargetForWindow(target_window); |
| pointer_target.is_mouse_event = event.IsMousePointerEvent(); |
| pointer_target.in_nonclient_area = |
|
sky
2016/03/02 18:28:33
Aren't you going to use an enum to indicate modal?
mohsen
2016/03/03 22:54:59
Not at the moment. That enum would be useful if we
sky
2016/03/03 23:50:39
If you don't send a flag indicating this, I'm not
mohsen
2016/03/04 16:24:17
I've tested this code (using window_type_launcher)
|
| + target_window != pointer_target.window || |
| IsLocationInNonclientArea(pointer_target.window, location); |
| pointer_target.is_pointer_down = event.type() == ui::ET_POINTER_DOWN; |
| return pointer_target; |