OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/exo/pointer.h" | 5 #include "components/exo/pointer.h" |
6 | 6 |
7 #include "ash/common/display/display_info.h" | 7 #include "ash/common/display/display_info.h" |
8 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 aura::client::GetCursorClient(focus_->window()->GetRootWindow()); | 116 aura::client::GetCursorClient(focus_->window()->GetRootWindow()); |
117 if (cursor_client) | 117 if (cursor_client) |
118 cursor_client->SetCursor( | 118 cursor_client->SetCursor( |
119 focus_->window()->GetCursor(gfx::ToFlooredPoint(location_))); | 119 focus_->window()->GetCursor(gfx::ToFlooredPoint(location_))); |
120 } | 120 } |
121 | 121 |
122 //////////////////////////////////////////////////////////////////////////////// | 122 //////////////////////////////////////////////////////////////////////////////// |
123 // ui::EventHandler overrides: | 123 // ui::EventHandler overrides: |
124 | 124 |
125 void Pointer::OnMouseEvent(ui::MouseEvent* event) { | 125 void Pointer::OnMouseEvent(ui::MouseEvent* event) { |
126 Surface* target = GetEffectiveTargetForEvent(event); | 126 Surface* target = GetEffectiveTargetForEvent(event); |
oshima
2016/07/13 21:34:00
can you move this after the following check?
same
hariank
2016/07/13 23:27:22
Done.
hariank
2016/07/13 23:27:22
Done.
| |
127 | 127 |
128 if (!ash::Shell::GetInstance()->CanWindowReceiveEvents( | |
reveman
2016/07/13 18:55:09
Can you add a short comment above this to explain
hariank
2016/07/13 23:27:22
Done.
| |
129 static_cast<aura::Window*>(event->target()))) { | |
130 event->StopPropagation(); | |
reveman
2016/07/13 18:55:09
Is it really correct to call StopPropagation here?
oshima
2016/07/13 21:34:00
Shell::CanWindowReceiveEvents is used to block eve
hariank
2016/07/13 23:27:22
Done.
reveman
2016/07/14 11:15:40
I'm still failing to see why StopPropagation shoul
oshima
2016/07/14 12:21:27
I think this is misunderstanding. The event receiv
reveman
2016/07/14 13:59:49
Right, pre target handler is for all windows. I ha
oshima
2016/07/14 14:38:27
We can skip it if you feel strongly about it, it w
| |
131 return; | |
132 } | |
133 | |
128 // If target is different than the current pointer focus then we need to | 134 // If target is different than the current pointer focus then we need to |
129 // generate enter and leave events. | 135 // generate enter and leave events. |
130 if (target != focus_) { | 136 if (target != focus_) { |
131 // First generate a leave event if we currently have a target in focus. | 137 // First generate a leave event if we currently have a target in focus. |
132 if (focus_) { | 138 if (focus_) { |
133 delegate_->OnPointerLeave(focus_); | 139 delegate_->OnPointerLeave(focus_); |
134 focus_->RemoveSurfaceObserver(this); | 140 focus_->RemoveSurfaceObserver(this); |
135 // Require SetCursor() to be called and cursor to be re-defined in | 141 // Require SetCursor() to be called and cursor to be re-defined in |
136 // response to each OnPointerEnter() call. | 142 // response to each OnPointerEnter() call. |
137 focus_->UnregisterCursorProvider(this); | 143 focus_->UnregisterCursorProvider(this); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
314 | 320 |
315 if (ui_scale != cursor_scale_) { | 321 if (ui_scale != cursor_scale_) { |
316 gfx::Transform transform; | 322 gfx::Transform transform; |
317 transform.Scale(ui_scale, ui_scale); | 323 transform.Scale(ui_scale, ui_scale); |
318 widget_->GetNativeWindow()->SetTransform(transform); | 324 widget_->GetNativeWindow()->SetTransform(transform); |
319 cursor_scale_ = ui_scale; | 325 cursor_scale_ = ui_scale; |
320 } | 326 } |
321 } | 327 } |
322 | 328 |
323 } // namespace exo | 329 } // namespace exo |
OLD | NEW |