Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Unified Diff: components/mus/ws/event_dispatcher.cc

Issue 1759523002: mus: Server-side implementation of modal windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698