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

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 nits, rename 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
nfullagar1 2013/05/30 00:47:04 what about focus change PSE_INSTANCE_DIDCHANGEFOCU
noelallen1 2013/05/30 03:10:05 Done.
46 /* From DidChangeView, contains a view resource */
47 PSE_INSTANCE_DIDCHANGEVIEW = 4,
48
49 /* When the 3D context is lost, no resource. */
50 PSE_GRAPHICS3D_GRAPHICS3DCONTEXTLOST = 8,
51
52 /* When the mouse lock is lost. */
53 PSE_MOUSELOCK_MOUSELOCKLOST = 16,
54
55 /* Enable all events. */
56 PSE_ALL = -1,
57 } PSEventType;
58
59
60 // Generic Event
61 typedef struct {
62 PSEventType type;
63 union {
64 PP_Bool as_bool;
65 PP_Resource as_resource;
66 struct PP_Var as_var;
67 };
68 } PSEvent;
69
70
71 /**
72 * Function for queuing, acquiring, and releasing events.
73 */
74 PSEvent* PSEventTryAcquire();
75 PSEvent* PSEventWaitAcquire();
76 PSEvent* PSWaitForAcquireEvent();
77 void PSEventRelease(PSEvent* event);
78 void PSEventSetFilter(uint32_t);
79
80 /**
81 * PSPostEvent
82 *
83 * Creates and adds an event of the specified type to the event queue if
84 * that event type is not currently filtered.
85 */
86 void PSEventPost(PSEventType type);
87 void PSEventPostBool(PSEventType type, PP_Bool state);
88 void PSEventPostVar(PSEventType type, struct PP_Var var);
89 void PSEventPostResource(PSEventType type, PP_Resource resource);
90
91 EXTERN_C_END
92
93 #endif // PPAPI_SIMPLE_PS_EVENT_H_
94
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698