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

Side by Side Diff: native_client_sdk/src/examples/input_events/custom_events.cc

Issue 13488007: [NaCl SDK] Make the SDK examples buildable as a packaged app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix license headers Created 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <sstream> 5 #include <sstream>
6 6
7 #include "custom_events.h" 7 #include "custom_events.h"
8 8
9 namespace event_queue { 9 namespace event_queue {
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 if (modifier & kNumLockModifier) { 47 if (modifier & kNumLockModifier) {
48 s += "num-lock "; 48 s += "num-lock ";
49 } 49 }
50 return s; 50 return s;
51 } 51 }
52 52
53 53
54 std::string KeyEvent::ToString() const { 54 std::string KeyEvent::ToString() const {
55 std::ostringstream stream; 55 std::ostringstream stream;
56 stream << " Key event:" 56 stream << "Key event:"
57 << " modifier:" << string_event_modifiers() 57 << " modifier:" << string_event_modifiers()
58 << " key_code:" << key_code_ 58 << " key_code:" << key_code_
59 << " time:" << timestamp_ 59 << " time:" << timestamp_
60 << " text:" << text_ 60 << " text:" << text_
61 << "\n"; 61 << "\n";
62 return stream.str(); 62 return stream.str();
63 } 63 }
64 64
65 std::string MouseEvent::ToString() const { 65 std::string MouseEvent::ToString() const {
66 std::ostringstream stream; 66 std::ostringstream stream;
67 stream << " Mouse event:" 67 stream << "Mouse event:"
68 << " modifier:" << string_event_modifiers() 68 << " modifier:" << string_event_modifiers()
69 << " button:" << MouseButtonToString(mouse_button_) 69 << " button:" << MouseButtonToString(mouse_button_)
70 << " x:" << x_position_ 70 << " x:" << x_position_
71 << " y:" << y_position_ 71 << " y:" << y_position_
72 << " click_count:" << click_count_ 72 << " click_count:" << click_count_
73 << " time:" << timestamp_ 73 << " time:" << timestamp_
74 << "\n"; 74 << "\n";
75 return stream.str(); 75 return stream.str();
76 } 76 }
77 77
78 std::string WheelEvent::ToString() const { 78 std::string WheelEvent::ToString() const {
79 std::ostringstream stream; 79 std::ostringstream stream;
80 stream << "Wheel event." 80 stream << "Wheel event:"
81 << " modifier:" << string_event_modifiers() 81 << " modifier:" << string_event_modifiers()
82 << " deltax:" << delta_x_ 82 << " deltax:" << delta_x_
83 << " deltay:" << delta_y_ 83 << " deltay:" << delta_y_
84 << " wheel_ticks_x:" << ticks_x_ 84 << " wheel_ticks_x:" << ticks_x_
85 << " wheel_ticks_y:" << ticks_y_ 85 << " wheel_ticks_y:" << ticks_y_
86 << " scroll_by_page: " << scroll_by_page_ 86 << " scroll_by_page: " << scroll_by_page_
87 << " time:" << timestamp_ 87 << " time:" << timestamp_
88 << "\n"; 88 << "\n";
89 return stream.str(); 89 return stream.str();
90 } 90 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 touch.y = y; 137 touch.y = y;
138 touch.radii_x = radii_x; 138 touch.radii_x = radii_x;
139 touch.radii_y = radii_y; 139 touch.radii_y = radii_y;
140 touch.angle = angle; 140 touch.angle = angle;
141 touch.pressure = pressure; 141 touch.pressure = pressure;
142 touches.push_back(touch); 142 touches.push_back(touch);
143 } 143 }
144 144
145 std::string TouchEvent::ToString() const { 145 std::string TouchEvent::ToString() const {
146 std::ostringstream stream; 146 std::ostringstream stream;
147 stream << " Touch event:" << KindToString(kind_) 147 stream << "Touch event:" << KindToString(kind_)
148 << " modifier:" << string_event_modifiers(); 148 << " modifier:" << string_event_modifiers();
149 for (size_t i = 0; i < touches.size(); ++i) { 149 for (size_t i = 0; i < touches.size(); ++i) {
150 const Touch& touch = touches[i]; 150 const Touch& touch = touches[i];
151 stream << " x[" << touch.id << "]:" << touch.x 151 stream << " x[" << touch.id << "]:" << touch.x
152 << " y[" << touch.id << "]:" << touch.y 152 << " y[" << touch.id << "]:" << touch.y
153 << " radii_x[" << touch.id << "]:" << touch.radii_x 153 << " radii_x[" << touch.id << "]:" << touch.radii_x
154 << " radii_y[" << touch.id << "]:" << touch.radii_y 154 << " radii_y[" << touch.id << "]:" << touch.radii_y
155 << " angle[" << touch.id << "]:" << touch.angle 155 << " angle[" << touch.id << "]:" << touch.angle
156 << " pressure[" << touch.id << "]:" << touch.pressure; 156 << " pressure[" << touch.id << "]:" << touch.pressure;
157 } 157 }
158 stream << " time:" << timestamp_ << "\n"; 158 stream << " time:" << timestamp_ << "\n";
159 return stream.str(); 159 return stream.str();
160 } 160 }
161 161
162 } // end namespace 162 } // end namespace
163 163
OLDNEW
« no previous file with comments | « native_client_sdk/src/examples/hello_world_stdio/index.html ('k') | native_client_sdk/src/examples/input_events/example.dsc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698