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

Unified Diff: services/ui/ws/window_manager_state.cc

Issue 2184613005: Fixes bug in accelerator handling in mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak Created 4 years, 5 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 | « no previous file | services/ui/ws/window_manager_state_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/window_manager_state.cc
diff --git a/services/ui/ws/window_manager_state.cc b/services/ui/ws/window_manager_state.cc
index cbec88f4bf3d07554d355b0bf828ed0fe9aa3b49..600228dce2b757f73bb0ee80dd0b46d056b7c31b 100644
--- a/services/ui/ws/window_manager_state.cc
+++ b/services/ui/ws/window_manager_state.cc
@@ -215,8 +215,12 @@ void WindowManagerState::OnEventAck(mojom::WindowTree* tree,
tree_awaiting_input_ack_ = nullptr;
event_ack_timer_.Stop();
- if (result == mojom::EventResult::UNHANDLED && post_target_accelerator_) {
- OnAccelerator(post_target_accelerator_->id(), *event_awaiting_input_ack_,
+ base::WeakPtr<Accelerator> post_target_accelerator = post_target_accelerator_;
+ post_target_accelerator_.reset();
+ std::unique_ptr<ui::Event> event = std::move(event_awaiting_input_ack_);
+
+ if (result == mojom::EventResult::UNHANDLED && post_target_accelerator) {
+ OnAccelerator(post_target_accelerator->id(), *event,
AcceleratorPhase::POST);
}
@@ -234,16 +238,15 @@ void WindowManagerState::OnAcceleratorAck(mojom::EventResult result) {
tree_awaiting_input_ack_ = nullptr;
event_ack_timer_.Stop();
event_dispatch_phase_ = EventDispatchPhase::NONE;
+ std::unique_ptr<ui::Event> event = std::move(event_awaiting_input_ack_);
if (result == mojom::EventResult::UNHANDLED) {
event_dispatcher_.ProcessEvent(
- *event_awaiting_input_ack_,
- EventDispatcher::AcceleratorMatchPhase::POST_ONLY);
+ *event, EventDispatcher::AcceleratorMatchPhase::POST_ONLY);
} else {
// We're not going to process the event any further, notify event observers.
// We don't do this first to ensure we don't send an event twice to clients.
- window_server()->SendToEventObservers(*event_awaiting_input_ack_, user_id(),
- nullptr);
+ window_server()->SendToEventObservers(*event, user_id(), nullptr);
ProcessNextEventFromQueue();
}
}
« no previous file with comments | « no previous file | services/ui/ws/window_manager_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698