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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 StickyKeysHandlerDelegateImpl::StickyKeysHandlerDelegateImpl() { | 52 StickyKeysHandlerDelegateImpl::StickyKeysHandlerDelegateImpl() { |
53 } | 53 } |
54 | 54 |
55 StickyKeysHandlerDelegateImpl::~StickyKeysHandlerDelegateImpl() { | 55 StickyKeysHandlerDelegateImpl::~StickyKeysHandlerDelegateImpl() { |
56 } | 56 } |
57 | 57 |
58 void StickyKeysHandlerDelegateImpl::DispatchKeyEvent(ui::KeyEvent* event, | 58 void StickyKeysHandlerDelegateImpl::DispatchKeyEvent(ui::KeyEvent* event, |
59 aura::Window* target) { | 59 aura::Window* target) { |
60 DCHECK(target); | 60 DCHECK(target); |
61 target->GetDispatcher()->AsRootWindowHostDelegate()->OnHostKeyEvent(event); | 61 target->GetDispatcher()->AsWindowTreeHostDelegate()->OnHostKeyEvent(event); |
62 } | 62 } |
63 | 63 |
64 void StickyKeysHandlerDelegateImpl::DispatchMouseEvent(ui::MouseEvent* event, | 64 void StickyKeysHandlerDelegateImpl::DispatchMouseEvent(ui::MouseEvent* event, |
65 aura::Window* target) { | 65 aura::Window* target) { |
66 DCHECK(target); | 66 DCHECK(target); |
67 // We need to send a new, untransformed mouse event to the host. | 67 // We need to send a new, untransformed mouse event to the host. |
68 if (event->IsMouseWheelEvent()) { | 68 if (event->IsMouseWheelEvent()) { |
69 ui::MouseWheelEvent new_event(*static_cast<ui::MouseWheelEvent*>(event)); | 69 ui::MouseWheelEvent new_event(*static_cast<ui::MouseWheelEvent*>(event)); |
70 target->GetDispatcher()->AsRootWindowHostDelegate() | 70 target->GetDispatcher()->AsWindowTreeHostDelegate() |
71 ->OnHostMouseEvent(&new_event); | 71 ->OnHostMouseEvent(&new_event); |
72 } else { | 72 } else { |
73 ui::MouseEvent new_event(*event, target, target->GetRootWindow()); | 73 ui::MouseEvent new_event(*event, target, target->GetRootWindow()); |
74 target->GetDispatcher()->AsRootWindowHostDelegate() | 74 target->GetDispatcher()->AsWindowTreeHostDelegate() |
75 ->OnHostMouseEvent(&new_event); | 75 ->OnHostMouseEvent(&new_event); |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 void StickyKeysHandlerDelegateImpl::DispatchScrollEvent( | 79 void StickyKeysHandlerDelegateImpl::DispatchScrollEvent( |
80 ui::ScrollEvent* event, | 80 ui::ScrollEvent* event, |
81 aura::Window* target) { | 81 aura::Window* target) { |
82 DCHECK(target); | 82 DCHECK(target); |
83 target->GetDispatcher()->AsRootWindowHostDelegate() | 83 target->GetDispatcher()->AsWindowTreeHostDelegate() |
84 ->OnHostScrollEvent(event); | 84 ->OnHostScrollEvent(event); |
85 } | 85 } |
86 | 86 |
87 } // namespace | 87 } // namespace |
88 | 88 |
89 /////////////////////////////////////////////////////////////////////////////// | 89 /////////////////////////////////////////////////////////////////////////////// |
90 // StickyKeys | 90 // StickyKeys |
91 StickyKeysController::StickyKeysController() | 91 StickyKeysController::StickyKeysController() |
92 : enabled_(false), | 92 : enabled_(false), |
93 shift_sticky_key_( | 93 shift_sticky_key_( |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 &xievent->mods.effective)); | 438 &xievent->mods.effective)); |
439 } | 439 } |
440 } | 440 } |
441 #elif defined(USE_OZONE) | 441 #elif defined(USE_OZONE) |
442 NOTIMPLEMENTED() << "Modifier key is not handled"; | 442 NOTIMPLEMENTED() << "Modifier key is not handled"; |
443 #endif | 443 #endif |
444 event->set_flags(event->flags() | modifier_flag_); | 444 event->set_flags(event->flags() | modifier_flag_); |
445 } | 445 } |
446 | 446 |
447 } // namespace ash | 447 } // namespace ash |
OLD | NEW |