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

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: 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..0a759cd34e887eafd71933ee04c26d4e698f9c71 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();
+
+ if (result == mojom::EventResult::UNHANDLED && post_target_accelerator) {
+ std::unique_ptr<ui::Event> event = std::move(event_awaiting_input_ack_);
sadrul 2016/07/27 16:31:47 Should we always reset |event_awaiting_input_ack_|
sky 2016/07/27 16:34:49 Isn't that what the std::move does? Or did you mea
sadrul 2016/07/27 16:36:01 Yep. I mean, should we do that even if result != U
sky 2016/07/27 16:46:01 Ah, I got it. It doesn't matter because of Process
+ OnAccelerator(post_target_accelerator->id(), *event,
AcceleratorPhase::POST);
}
@@ -236,14 +240,14 @@ void WindowManagerState::OnAcceleratorAck(mojom::EventResult result) {
event_dispatch_phase_ = EventDispatchPhase::NONE;
if (result == mojom::EventResult::UNHANDLED) {
+ std::unique_ptr<ui::Event> event = std::move(event_awaiting_input_ack_);
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);
+ std::unique_ptr<ui::Event> event = std::move(event_awaiting_input_ack_);
+ 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