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

Side by Side Diff: native_client_sdk/src/libraries/ppapi_simple/ps_event.h

Issue 15011003: ppapi_simple (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix enums Created 7 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 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5
6 #ifndef PPAPI_SIMPLE_PS_EVENT_H_
7 #define PPAPI_SIMPLE_PS_EVENT_H_
8
9 #include "ppapi/c/pp_bool.h"
10 #include "ppapi/c/pp_resource.h"
11 #include "ppapi/c/pp_var.h"
12
13 #include "utils/macros.h"
14
15 EXTERN_C_BEGIN
16
17 /**
18 * PSEvent
19 *
20 * The PSEvent system provides an in-order event processing mechanism.
21 * As Pepper events such as input, or focus and view changes arrive on the
22 * main pepper thread, they are placed on various FIFOs based on event type.
23 * For any given event type, only a single thread will process those events.
24 *
25 * By default, the "EventThread" will receive all messages. However any thread
26 * can call PSRequestEventsType to request that all new events of that type
27 * are placed on that particular thread's queue.
28 *
29 * This allows the developer to choose which threads handle which event types
30 * while keeping all events belonging to a particular thread in order. This
31 * is useful, for example, in the case of graphics to synchronize the size
32 * of the graphics context, with mouse clicks to correctly interpret location.
33 */
34
35
36 typedef enum {
37 /* Mask off all events. */
38 PSE_NONE = 0,
39
40 /* From HandleInputEvent, conatins an input resource. */
41 PSE_INSTANCE_HANDLEINPUT = 1,
42
43 /* From HandleMessage, contains a PP_Var. */
44 PSE_INSTANCE_HANDLEMESSAGE = 2,
45
46 /* From DidChangeView, contains a view resource */
47 PSE_INSTANCE_DIDCHANGEVIEW = 4,
48
49 /* From DidChangeFocus, contains a PP_Bool with the current focus state. */
50 PSE_INSTANCE_DIDCHANGEFOCUS = 8,
51
52 /* When the 3D context is lost, no resource. */
53 PSE_GRAPHICS3D_GRAPHICS3DCONTEXTLOST = 16,
54
55 /* When the mouse lock is lost. */
56 PSE_MOUSELOCK_MOUSELOCKLOST = 32,
57
58 /* Enable all events. */
59 PSE_ALL = -1,
60 } PSEventType;
61
62
63 // Generic Event
64 typedef struct {
65 PSEventType type;
66 union {
67 PP_Bool as_bool;
68 PP_Resource as_resource;
69 struct PP_Var as_var;
70 };
71 } PSEvent;
72
73
74 /**
75 * Function for queuing, acquiring, and releasing events.
76 */
77 PSEvent* PSEventTryAcquire();
78 PSEvent* PSEventWaitAcquire();
79 PSEvent* PSWaitForAcquireEvent();
binji 2013/05/30 05:07:50 remove
noelallen1 2013/05/30 18:07:19 Done.
80 void PSEventRelease(PSEvent* event);
81 void PSEventSetFilter(uint32_t);
binji 2013/05/30 05:07:50 might be nicer with PSEventTypeMask and above: typ
noelallen1 2013/05/30 18:07:19 Done.
82
83 /**
84 * PSPostEvent
binji 2013/05/30 05:07:50 PSEventPost though I prefer omitting this info, it
noelallen1 2013/05/30 18:07:19 Done.
85 *
86 * Creates and adds an event of the specified type to the event queue if
87 * that event type is not currently filtered.
88 */
89 void PSEventPost(PSEventType type);
90 void PSEventPostBool(PSEventType type, PP_Bool state);
91 void PSEventPostVar(PSEventType type, struct PP_Var var);
92 void PSEventPostResource(PSEventType type, PP_Resource resource);
93
94 EXTERN_C_END
95
96 #endif // PPAPI_SIMPLE_PS_EVENT_H_
97
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698