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

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: SetAsModal -> SetModal + Other review comments addressed Created 4 years, 9 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
« no previous file with comments | « components/mus/ws/event_dispatcher.h ('k') | components/mus/ws/event_dispatcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/ws/event_dispatcher.cc
diff --git a/components/mus/ws/event_dispatcher.cc b/components/mus/ws/event_dispatcher.cc
index c7eca9ec50d4b1f5a6a7a1119c5bf07b656949e1..57efcc1d9da32e677b6579c82426a99450b3f9fb 100644
--- a/components/mus/ws/event_dispatcher.cc
+++ b/components/mus/ws/event_dispatcher.cc
@@ -235,14 +235,18 @@ void EventDispatcher::SetMousePointerScreenLocation(
UpdateCursorProviderByLastKnownLocation();
}
-void EventDispatcher::SetCaptureWindow(ServerWindow* window,
+bool EventDispatcher::SetCaptureWindow(ServerWindow* window,
bool in_nonclient_area) {
if (window == capture_window_)
- return;
+ return true;
+
+ // A window that is blocked by a modal window cannot gain capture.
+ if (window && window->IsBlockedByModalWindow())
+ return false;
if (capture_window_) {
// Stop observing old capture window. |pointer_targets_| are cleared on
- // intial setting of a capture window.
+ // initial setting of a capture window.
delegate_->OnServerWindowCaptureLost(capture_window_);
capture_window_->RemoveObserver(this);
} else {
@@ -264,7 +268,7 @@ void EventDispatcher::SetCaptureWindow(ServerWindow* window,
pair.second.is_mouse_event ? ui::EventPointerType::POINTER_TYPE_MOUSE
: ui::EventPointerType::POINTER_TYPE_TOUCH;
// TODO(jonross): Track previous location in PointerTarget for sending
- // cancels
+ // cancels.
ui::PointerEvent event(event_type, pointer_type, gfx::Point(),
gfx::Point(), ui::EF_NONE, pair.first,
ui::EventTimeForNow());
@@ -286,6 +290,7 @@ void EventDispatcher::SetCaptureWindow(ServerWindow* window,
capture_window_ = window;
capture_window_in_nonclient_area_ = in_nonclient_area;
+ return true;
}
void EventDispatcher::UpdateCursorProviderByLastKnownLocation() {
@@ -470,10 +475,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 = target_window->GetModalTarget();
pointer_target.is_mouse_event = event.IsMousePointerEvent();
pointer_target.in_nonclient_area =
+ target_window != pointer_target.window ||
IsLocationInNonclientArea(pointer_target.window, location);
pointer_target.is_pointer_down = event.type() == ui::ET_POINTER_DOWN;
return pointer_target;
« no previous file with comments | « components/mus/ws/event_dispatcher.h ('k') | components/mus/ws/event_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698