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

Side by Side Diff: ash/sticky_keys/sticky_keys_controller.cc

Issue 227113009: Fix sticky keys crash when handling synthetic events without a native event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: got reverted for a clang compile warning Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/sticky_keys/sticky_keys_controller.h ('k') | ash/sticky_keys/sticky_keys_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 ui::MouseWheelEvent new_event(event->native_event()); 72 aura::Window* source = static_cast<aura::Window*>(event->target());
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());
73 DispatchEvent(&new_event, target); 78 DispatchEvent(&new_event, target);
74 } else { 79 } else {
75 ui::MouseEvent new_event(event->native_event()); 80 aura::Window* source = static_cast<aura::Window*>(event->target());
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());
76 DispatchEvent(&new_event, target); 84 DispatchEvent(&new_event, target);
77 } 85 }
78 } 86 }
79 87
80 void StickyKeysHandlerDelegateImpl::DispatchScrollEvent( 88 void StickyKeysHandlerDelegateImpl::DispatchScrollEvent(
81 ui::ScrollEvent* event, 89 ui::ScrollEvent* event,
82 aura::Window* target) { 90 aura::Window* target) {
83 DispatchEvent(event, target); 91 DispatchEvent(event, target);
84 } 92 }
85 93
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 &xievent->mods.effective)); 527 &xievent->mods.effective));
520 } 528 }
521 } 529 }
522 #elif defined(USE_OZONE) 530 #elif defined(USE_OZONE)
523 NOTIMPLEMENTED() << "Modifier key is not handled"; 531 NOTIMPLEMENTED() << "Modifier key is not handled";
524 #endif 532 #endif
525 event->set_flags(event->flags() | modifier_flag_); 533 event->set_flags(event->flags() | modifier_flag_);
526 } 534 }
527 535
528 } // namespace ash 536 } // namespace ash
OLDNEW
« no previous file with comments | « ash/sticky_keys/sticky_keys_controller.h ('k') | ash/sticky_keys/sticky_keys_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698