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

Side by Side Diff: ui/aura/event.cc

Issue 8576005: IME (input method editor) support for Aura, part 3 of 3: Use ui::InputMethod in ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move to ash/ime/ Created 8 years, 12 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 | « ui/aura/event.h ('k') | ui/aura/event_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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/aura/event.h" 5 #include "ui/aura/event.h"
6 6
7 #if defined(USE_X11) 7 #if defined(USE_X11)
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 #endif 9 #endif
10 10
11 #include <cstring>
12
11 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
12 #include "ui/base/keycodes/keyboard_code_conversion.h" 14 #include "ui/base/keycodes/keyboard_code_conversion.h"
13 #include "ui/gfx/point3.h" 15 #include "ui/gfx/point3.h"
14 #include "ui/gfx/transform.h" 16 #include "ui/gfx/transform.h"
15 17
16 #if defined(USE_X11) 18 #if defined(USE_X11)
17 #include "ui/base/keycodes/keyboard_code_conversion_x.h" 19 #include "ui/base/keycodes/keyboard_code_conversion_x.h"
18 #endif 20 #endif
19 21
20 #if !defined(OS_WIN) 22 #if !defined(OS_WIN)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 56
55 namespace aura { 57 namespace aura {
56 58
57 Event::~Event() { 59 Event::~Event() {
58 #if defined(USE_X11) 60 #if defined(USE_X11)
59 if (delete_native_event_) 61 if (delete_native_event_)
60 delete native_event_; 62 delete native_event_;
61 #endif 63 #endif
62 } 64 }
63 65
66 bool Event::HasNativeEvent() const {
67 base::NativeEvent null_event;
68 std::memset(&null_event, 0, sizeof(null_event));
69 return !!std::memcmp(&native_event_, &null_event, sizeof(null_event));
70 }
71
64 Event::Event(ui::EventType type, int flags) 72 Event::Event(ui::EventType type, int flags)
65 : type_(type), 73 : type_(type),
66 time_stamp_(base::Time::NowFromSystemTime()), 74 time_stamp_(base::Time::NowFromSystemTime()),
67 flags_(flags), 75 flags_(flags),
68 delete_native_event_(false) { 76 delete_native_event_(false) {
69 Init(); 77 Init();
70 } 78 }
71 79
72 Event::Event(const base::NativeEvent& native_event, 80 Event::Event(const base::NativeEvent& native_event,
73 ui::EventType type, 81 ui::EventType type,
74 int flags) 82 int flags)
75 : type_(type), 83 : type_(type),
76 time_stamp_(base::Time::NowFromSystemTime()), 84 time_stamp_(base::Time::NowFromSystemTime()),
77 flags_(flags), 85 flags_(flags),
78 delete_native_event_(false) { 86 delete_native_event_(false) {
79 InitWithNativeEvent(native_event); 87 InitWithNativeEvent(native_event);
80 } 88 }
81 89
82 Event::Event(const Event& copy) 90 Event::Event(const Event& copy)
83 : native_event_(copy.native_event_), 91 : native_event_(copy.native_event_),
84 type_(copy.type_), 92 type_(copy.type_),
85 time_stamp_(copy.time_stamp_), 93 time_stamp_(copy.time_stamp_),
86 flags_(copy.flags_), 94 flags_(copy.flags_),
87 delete_native_event_(false) { 95 delete_native_event_(false) {
88 } 96 }
89 97
90 void Event::Init() { 98 void Event::Init() {
91 memset(&native_event_, 0, sizeof(native_event_)); 99 std::memset(&native_event_, 0, sizeof(native_event_));
92 } 100 }
93 101
94 void Event::InitWithNativeEvent(const base::NativeEvent& native_event) { 102 void Event::InitWithNativeEvent(const base::NativeEvent& native_event) {
95 native_event_ = native_event; 103 native_event_ = native_event;
96 } 104 }
97 105
98 LocatedEvent::LocatedEvent(const base::NativeEvent& native_event) 106 LocatedEvent::LocatedEvent(const base::NativeEvent& native_event)
99 : Event(native_event, 107 : Event(native_event,
100 ui::EventTypeFromNative(native_event), 108 ui::EventTypeFromNative(native_event),
101 ui::EventFlagsFromNative(native_event)), 109 ui::EventFlagsFromNative(native_event)),
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 #endif 290 #endif
283 return copy; 291 return copy;
284 } 292 }
285 293
286 ScrollEvent::ScrollEvent(const base::NativeEvent& native_event) 294 ScrollEvent::ScrollEvent(const base::NativeEvent& native_event)
287 : MouseEvent(native_event) { 295 : MouseEvent(native_event) {
288 ui::GetScrollOffsets(native_event, &x_offset_, &y_offset_); 296 ui::GetScrollOffsets(native_event, &x_offset_, &y_offset_);
289 } 297 }
290 298
291 } // namespace aura 299 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/event.h ('k') | ui/aura/event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698