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

Side by Side Diff: src/trusted/sel_universal/non_standard_pepper_events.cc

Issue 7046064: Some small refactoring and renaming of sel_universel pepper emulation components. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 9 years, 6 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
(Empty)
1 /*
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7 // This file provides utilty functions for creating custom pepper events
8 // which do not interfere with regualar pepper events.
9
10 #include <stdint.h>
11 #include "ppapi/c/pp_input_event.h"
12
13 #include "native_client/src/trusted/sel_universal/primitives.h"
14
15 namespace {
16 const int PP_INPUTEVENT_USER = 88;
17 const int PP_INPUTEVENT_TERMINATION = 90;
18
19 // ppapi does not have a user defined event notion.
20 // c.f. ppapi/c/pp_input_event.h
21 typedef struct {
22 int code;
23 int data1;
24 int data2;
25 } PP_InputEvent_User;
26
27
28 PP_InputEvent_User* GetUserEvent(PP_InputEvent* event) {
29 return reinterpret_cast<PP_InputEvent_User*>(&event->u);
30 }
31
32 } // namespace
33
34
35 bool IsInvalidEvent(PP_InputEvent* event) {
36 return event->type == PP_INPUTEVENT_TYPE_UNDEFINED;
37 }
38
39
40 void MakeInvalidEvent(PP_InputEvent* event) {
41 event->type = PP_INPUTEVENT_TYPE_UNDEFINED;
42 }
43
44
45 bool IsTerminationEvent(PP_InputEvent* event) {
46 return event->type == PP_INPUTEVENT_TERMINATION;
47 }
48
49
50 void MakeTerminationEvent(PP_InputEvent* event) {
51 event->type = (PP_InputEvent_Type) PP_INPUTEVENT_TERMINATION;
52 }
53
54
55 bool IsUserEvent(PP_InputEvent* event) {
56 return event->type == PP_INPUTEVENT_USER;
57 }
58
59
60 int GetCodeFromUserEvent(PP_InputEvent* event) {
61 return GetUserEvent(event)->code;
62 }
63
64
65 int GetData1FromUserEvent(PP_InputEvent* event) {
66 return GetUserEvent(event)->data1;
67 }
68
69
70 int GetData2FromUserEvent(PP_InputEvent* event) {
71 return GetUserEvent(event)->data2;
72 }
73
74
75 void MakeUserEvent(PP_InputEvent* event, int code, int data1, int data2) {
76 event->type = (PP_InputEvent_Type) PP_INPUTEVENT_USER;
77 PP_InputEvent_User* user = GetUserEvent(event);
78 user->code = code;
79 user->data1 = data1;
80 user->data2 = data2;
81 }
OLDNEW
« no previous file with comments | « src/trusted/sel_universal/multimedia_sdl.cc ('k') | src/trusted/sel_universal/pepper_emu_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698