| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/sticky_keys/sticky_keys_controller.h" | 5 #include "ash/sticky_keys/sticky_keys_controller.h" |
| 6 | 6 |
| 7 #if defined(USE_X11) | 7 #if defined(USE_X11) |
| 8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
| 9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
| 10 #undef RootWindow | 10 #undef RootWindow |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 void StickyKeysHandlerDelegateImpl::DispatchKeyEvent(ui::KeyEvent* event, | 62 void StickyKeysHandlerDelegateImpl::DispatchKeyEvent(ui::KeyEvent* event, |
| 63 aura::Window* target) { | 63 aura::Window* target) { |
| 64 DispatchEvent(event, target); | 64 DispatchEvent(event, target); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void StickyKeysHandlerDelegateImpl::DispatchMouseEvent(ui::MouseEvent* event, | 67 void StickyKeysHandlerDelegateImpl::DispatchMouseEvent(ui::MouseEvent* event, |
| 68 aura::Window* target) { | 68 aura::Window* target) { |
| 69 DCHECK(target); | 69 DCHECK(target); |
| 70 // We need to send a new, untransformed mouse event to the host. | 70 // We need to send a new, untransformed mouse event to the host. |
| 71 if (event->IsMouseWheelEvent()) { | 71 if (event->IsMouseWheelEvent()) { |
| 72 aura::Window* source = static_cast<aura::Window*>(event->target()); | 72 ui::MouseWheelEvent new_event(event->native_event()); |
| 73 ui::MouseWheelEvent new_event(*static_cast<ui::MouseWheelEvent*>(event), | |
| 74 source, | |
| 75 source->GetRootWindow()); | |
| 76 // Transform the location back to host coordinates before dispatching. | |
| 77 new_event.UpdateForRootTransform(source->GetHost()->GetRootTransform()); | |
| 78 DispatchEvent(&new_event, target); | 73 DispatchEvent(&new_event, target); |
| 79 } else { | 74 } else { |
| 80 aura::Window* source = static_cast<aura::Window*>(event->target()); | 75 ui::MouseEvent new_event(event->native_event()); |
| 81 ui::MouseEvent new_event(*event, source, source->GetRootWindow()); | |
| 82 // Transform the location back to host coordinates before dispatching. | |
| 83 new_event.UpdateForRootTransform(source->GetHost()->GetRootTransform()); | |
| 84 DispatchEvent(&new_event, target); | 76 DispatchEvent(&new_event, target); |
| 85 } | 77 } |
| 86 } | 78 } |
| 87 | 79 |
| 88 void StickyKeysHandlerDelegateImpl::DispatchScrollEvent( | 80 void StickyKeysHandlerDelegateImpl::DispatchScrollEvent( |
| 89 ui::ScrollEvent* event, | 81 ui::ScrollEvent* event, |
| 90 aura::Window* target) { | 82 aura::Window* target) { |
| 91 DispatchEvent(event, target); | 83 DispatchEvent(event, target); |
| 92 } | 84 } |
| 93 | 85 |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 &xievent->mods.effective)); | 519 &xievent->mods.effective)); |
| 528 } | 520 } |
| 529 } | 521 } |
| 530 #elif defined(USE_OZONE) | 522 #elif defined(USE_OZONE) |
| 531 NOTIMPLEMENTED() << "Modifier key is not handled"; | 523 NOTIMPLEMENTED() << "Modifier key is not handled"; |
| 532 #endif | 524 #endif |
| 533 event->set_flags(event->flags() | modifier_flag_); | 525 event->set_flags(event->flags() | modifier_flag_); |
| 534 } | 526 } |
| 535 | 527 |
| 536 } // namespace ash | 528 } // namespace ash |
| OLD | NEW |