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

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

Issue 15011003: ppapi_simple (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove raw Created 7 years, 7 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_PPAPI_EVENT_H_
7 #define PPAPI_SIMPLE_PPAPI_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
19 /**
20 * PSEvent
21 *
22 * The PSEvent system provides an in-order event processing mechanism.
23 * As Pepper events such as input, or focus and view changes arrive on the
24 * main pepper thread, they are placed on various FIFOs based on event type.
25 * For any given event type, only a single thread will process those events.
26 *
27 * By default, the "EventThread" will receive all messages. However any thread
28 * can call PSRequestEventsType to request that all new events of that type
29 * are placed on that particular thread's queue.
30 *
31 * This allows the developer to choose which threads handle which event types
32 * while keeping all events belonging to a particular thread in order. This
33 * is useful, for example, in the case of graphics to synchronize the size
34 * of the graphics context, with mouse clicks to correctly interpret location.
35 */
36
37
38 typedef enum {
39 PS_NO_EVENTS = 0, // Mask off all events
40 PS_MESSAGE_EVENT = 1, // From HandleMessage, contains a PP_Var
41 PS_VIEW_EVENT = 2, // From DidChangeView, contains a view resource
Sam Clegg 2013/05/29 04:48:25 We don't align the assignment operators normally d
noelallen_use_chromium 2013/05/30 00:25:07 Done.
42 PS_INPUT_EVENT = 4, // From HandleInputEvent, conatins an input resource
43 PS_FOCUS_EVENT = 8, // Focus change, contains a PP_Bool
44 PS_3D_LOST_EVENT = 16, // When the 3D context is lost, no resource.
45 PS_MOUSELOCK_EVENT = 32,// When the mouse lock is lost.
46 PS_ALL_EVENTS = -1, // Enable all events
47 } PSEventType;
48
49
50 // Generic Event
51 typedef struct {
52 PSEventType type;
53 union {
54 PP_Bool as_bool;
55 PP_Resource as_resource;
56 struct PP_Var as_var;
57 };
58 } PSEvent;
59
60
61 /**
62 * Function for queuing, acquiring, and releasing events.
63 */
64 PSEvent* PSCreateEvent();
65 PSEvent* PSTryToAcquireEvent();
66 PSEvent* PSWaitForAcquireEvent();
67 void PSReleaseEvent(PSEvent* event);
68 void PSSetEventFilter(uint32_t);
69
70 /**
71 * PSPostEvent
72 *
73 * Creates and adds an event of the specified type to the event queue if
74 * that event type is not currently filtered.
75 */
76 void PSPostEvent(PSEventType type);
77 void PSPostBoolEvent(PSEventType type, PP_Bool state);
78 void PSPostVarEvent(PSEventType type, struct PP_Var var);
79 void PSPostResourceEvent(PSEventType type, PP_Resource resource);
80
81 EXTERN_C_END
82
83 #endif // PPAPI_SIMPLE_PPAPI_EVENT_H_
84
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698