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

Side by Side Diff: ppapi/c/pp_input_event.h

Issue 5001002: A second attempt at forcing 8-byte alignment of the time stamp.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | « no previous file | ppapi/c/ppp_instance.h » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef PPAPI_C_PP_INPUT_EVENT_H_ 5 #ifndef PPAPI_C_PP_INPUT_EVENT_H_
6 #define PPAPI_C_PP_INPUT_EVENT_H_ 6 #define PPAPI_C_PP_INPUT_EVENT_H_
7 7
8 /** 8 /**
9 * @file 9 * @file
10 * Defines the API ... 10 * Defines the API ...
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 uint32_t modifier; 143 uint32_t modifier;
144 144
145 float delta_x; 145 float delta_x;
146 float delta_y; 146 float delta_y;
147 float wheel_ticks_x; 147 float wheel_ticks_x;
148 float wheel_ticks_y; 148 float wheel_ticks_y;
149 149
150 PP_Bool scroll_by_page; 150 PP_Bool scroll_by_page;
151 }; 151 };
152 152
153 /* Ensure the elements of the struct (especially the time_stamp) are aligned on
154 8-byte boundaries, since some compilers align doubles on 8-byte boundaries
155 for 32-bit x86, and some align on 4-byte boundaries. */
156 #pragma pack(push, 8)
157 struct PP_InputEvent { 153 struct PP_InputEvent {
158 /** Identifies the type of the event. */ 154 /** Identifies the type of the event. */
159 PP_InputEvent_Type type; 155 PP_InputEvent_Type type;
160 156
157 /* Ensure the time_stamp is aligned on an 8-byte boundary relative to the
158 start of the struct. Some compilers align doubles on 8-byte boundaries
159 for 32-bit x86, and some align on 4-byte boundaries. */
160 int32_t padding;
161
161 /** 162 /**
162 * When this event was generated. This is not relative to any particular 163 * When this event was generated. This is not relative to any particular
163 * epoch, the most you can do is compare time stamps. 164 * epoch, the most you can do is compare time stamps.
164 */ 165 */
165 PP_TimeTicks time_stamp; 166 PP_TimeTicks time_stamp;
166 167
167 /** Event-specific data. */ 168 /** Event-specific data. */
168 union { 169 union {
169 struct PP_InputEvent_Key key; 170 struct PP_InputEvent_Key key;
170 struct PP_InputEvent_Character character; 171 struct PP_InputEvent_Character character;
171 struct PP_InputEvent_Mouse mouse; 172 struct PP_InputEvent_Mouse mouse;
172 struct PP_InputEvent_Wheel wheel; 173 struct PP_InputEvent_Wheel wheel;
173 174
174 /** 175 /**
175 * Allows new events to be added without changing the size of this 176 * Allows new events to be added without changing the size of this
176 * struct. 177 * struct.
177 */ 178 */
178 char padding[64]; 179 char padding[64];
179 } u; 180 } u;
180 }; 181 };
181 #pragma pack(pop)
182 /* TODO(dmichael): Figure out why the input event is not 80 bytes wide on Mac.
183 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent, 80); 182 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent, 80);
184 */
185 183
186 /** 184 /**
187 * @} 185 * @}
188 * End of addtogroup PP 186 * End of addtogroup PP
189 */ 187 */
190 188
191 #endif // PPAPI_C_PP_INPUT_EVENT_H_ 189 #endif // PPAPI_C_PP_INPUT_EVENT_H_
OLDNEW
« no previous file with comments | « no previous file | ppapi/c/ppp_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698