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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/sel_universal/non_standard_pepper_events.cc
===================================================================
--- src/trusted/sel_universal/non_standard_pepper_events.cc (revision 0)
+++ src/trusted/sel_universal/non_standard_pepper_events.cc (revision 0)
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2011 The Native Client Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+// This file provides utilty functions for creating custom pepper events
+// which do not interfere with regualar pepper events.
+
+#include <stdint.h>
+#include "ppapi/c/pp_input_event.h"
+
+#include "native_client/src/trusted/sel_universal/primitives.h"
+
+namespace {
+const int PP_INPUTEVENT_USER = 88;
+const int PP_INPUTEVENT_TERMINATION = 90;
+
+// ppapi does not have a user defined event notion.
+// c.f. ppapi/c/pp_input_event.h
+typedef struct {
+ int code;
+ int data1;
+ int data2;
+} PP_InputEvent_User;
+
+
+PP_InputEvent_User* GetUserEvent(PP_InputEvent* event) {
+ return reinterpret_cast<PP_InputEvent_User*>(&event->u);
+}
+
+} // namespace
+
+
+bool IsInvalidEvent(PP_InputEvent* event) {
+ return event->type == PP_INPUTEVENT_TYPE_UNDEFINED;
+}
+
+
+void MakeInvalidEvent(PP_InputEvent* event) {
+ event->type = PP_INPUTEVENT_TYPE_UNDEFINED;
+}
+
+
+bool IsTerminationEvent(PP_InputEvent* event) {
+ return event->type == PP_INPUTEVENT_TERMINATION;
+}
+
+
+void MakeTerminationEvent(PP_InputEvent* event) {
+ event->type = (PP_InputEvent_Type) PP_INPUTEVENT_TERMINATION;
+}
+
+
+bool IsUserEvent(PP_InputEvent* event) {
+ return event->type == PP_INPUTEVENT_USER;
+}
+
+
+int GetCodeFromUserEvent(PP_InputEvent* event) {
+ return GetUserEvent(event)->code;
+}
+
+
+int GetData1FromUserEvent(PP_InputEvent* event) {
+ return GetUserEvent(event)->data1;
+}
+
+
+int GetData2FromUserEvent(PP_InputEvent* event) {
+ return GetUserEvent(event)->data2;
+}
+
+
+void MakeUserEvent(PP_InputEvent* event, int code, int data1, int data2) {
+ event->type = (PP_InputEvent_Type) PP_INPUTEVENT_USER;
+ PP_InputEvent_User* user = GetUserEvent(event);
+ user->code = code;
+ user->data1 = data1;
+ user->data2 = data2;
+}
« 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