reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 1 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 2 | * Copyright 2006 The Android Open Source Project |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 3 | * |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef SkEvent_DEFINED |
| 9 | #define SkEvent_DEFINED |
| 10 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 11 | #include "SkMetaData.h" |
| 12 | #include "SkString.h" |
| 13 | |
Hal Canary | 20de615 | 2017-02-23 13:24:49 -0500 | [diff] [blame] | 14 | class SkDOM; |
| 15 | struct SkDOMNode; |
| 16 | |
halcanary | 4dbbd04 | 2016-06-07 17:21:10 -0700 | [diff] [blame] | 17 | #include "../private/SkLeanWindows.h" |
| 18 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 19 | /** Unique 32bit id used to identify an instance of SkEventSink. When events are |
| 20 | posted, they are posted to a specific sinkID. When it is time to dispatch the |
| 21 | event, the sinkID is used to find the specific SkEventSink object. If it is found, |
| 22 | its doEvent() method is called with the event. |
| 23 | */ |
| 24 | typedef uint32_t SkEventSinkID; |
| 25 | |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 26 | /** |
| 27 | * \class SkEvent |
| 28 | * |
| 29 | * When an event is dispatched from the event queue, it is either sent to |
| 30 | * the eventsink matching the target ID (if not 0), or the target proc is |
| 31 | * called (if not NULL). |
| 32 | */ |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 33 | class SkEvent { |
| 34 | public: |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 35 | /** |
| 36 | * Function pointer that takes an event, returns true if it "handled" it. |
| 37 | */ |
| 38 | typedef bool (*Proc)(const SkEvent& evt); |
| 39 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 40 | SkEvent(); |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 41 | explicit SkEvent(const SkString& type, SkEventSinkID = 0); |
| 42 | explicit SkEvent(const char type[], SkEventSinkID = 0); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 43 | SkEvent(const SkEvent& src); |
| 44 | ~SkEvent(); |
| 45 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 46 | /** Copy the event's type into the specified SkString parameter */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 47 | void getType(SkString* str) const; |
| 48 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 49 | /** Returns true if the event's type matches exactly the specified type (case sensitive) */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 50 | bool isType(const SkString& str) const; |
| 51 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 52 | /** Returns true if the event's type matches exactly the specified type (case sensitive) */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 53 | bool isType(const char type[], size_t len = 0) const; |
| 54 | |
| 55 | /** |
| 56 | * Set the event's type to the specified string. |
| 57 | */ |
| 58 | void setType(const SkString&); |
| 59 | |
| 60 | /** |
| 61 | * Set the event's type to the specified string. |
| 62 | */ |
| 63 | void setType(const char type[], size_t len = 0); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 64 | |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 65 | /** |
| 66 | * Return the target ID, or 0 if there is none. |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 67 | * |
| 68 | * When an event is dispatched from the event queue, it is either sent to |
| 69 | * the eventsink matching the targetID (if not 0), or the target proc is |
| 70 | * called (if not NULL). |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 71 | */ |
| 72 | SkEventSinkID getTargetID() const { return fTargetID; } |
| 73 | |
| 74 | /** |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 75 | * Set the target ID for this event. 0 means none. Calling this will |
| 76 | * automatically clear the targetProc to null. |
| 77 | * |
| 78 | * When an event is dispatched from the event queue, it is either sent to |
| 79 | * the eventsink matching the targetID (if not 0), or the target proc is |
| 80 | * called (if not NULL). |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 81 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 82 | SkEvent* setTargetID(SkEventSinkID targetID) { |
Ben Wagner | a93a14a | 2017-08-28 10:34:05 -0400 | [diff] [blame] | 83 | fTargetProc = nullptr; |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 84 | fTargetID = targetID; |
| 85 | return this; |
| 86 | } |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 87 | |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 88 | /** |
| 89 | * Return the target proc, or NULL if it has none. |
| 90 | * |
| 91 | * When an event is dispatched from the event queue, it is either sent to |
| 92 | * the eventsink matching the targetID (if not 0), or the target proc is |
| 93 | * called (if not NULL). |
| 94 | */ |
| 95 | Proc getTargetProc() const { return fTargetProc; } |
| 96 | |
| 97 | /** |
| 98 | * Set the target ID for this event. NULL means none. Calling this will |
| 99 | * automatically clear the targetID to 0. |
| 100 | * |
| 101 | * When an event is dispatched from the event queue, it is either sent to |
| 102 | * the eventsink matching the targetID (if not 0), or the target proc is |
| 103 | * called (if not NULL). |
| 104 | */ |
| 105 | SkEvent* setTargetProc(Proc proc) { |
| 106 | fTargetID = 0; |
| 107 | fTargetProc = proc; |
| 108 | return this; |
| 109 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 110 | |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 111 | /** |
| 112 | * Return the event's unnamed 32bit field. Default value is 0 |
| 113 | */ |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 114 | uint32_t getFast32() const { return f32; } |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 115 | |
| 116 | /** |
| 117 | * Set the event's unnamed 32bit field. |
| 118 | */ |
| 119 | void setFast32(uint32_t x) { f32 = x; } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 120 | |
| 121 | /** Return true if the event contains the named 32bit field, and return the field |
| 122 | in value (if value is non-null). If there is no matching named field, return false |
| 123 | and ignore the value parameter. |
| 124 | */ |
Ben Wagner | a93a14a | 2017-08-28 10:34:05 -0400 | [diff] [blame] | 125 | bool findS32(const char name[], int32_t* value = nullptr) const { |
| 126 | return fMeta.findS32(name, value); |
| 127 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 128 | /** Return true if the event contains the named SkScalar field, and return the field |
| 129 | in value (if value is non-null). If there is no matching named field, return false |
| 130 | and ignore the value parameter. |
| 131 | */ |
Ben Wagner | a93a14a | 2017-08-28 10:34:05 -0400 | [diff] [blame] | 132 | bool findScalar(const char name[], SkScalar* value = nullptr) const { |
| 133 | return fMeta.findScalar(name, value); |
| 134 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 135 | /** Return true if the event contains the named SkScalar field, and return the fields |
| 136 | in value[] (if value is non-null), and return the number of SkScalars in count (if count is non-null). |
| 137 | If there is no matching named field, return false and ignore the value and count parameters. |
| 138 | */ |
Ben Wagner | a93a14a | 2017-08-28 10:34:05 -0400 | [diff] [blame] | 139 | const SkScalar* findScalars(const char name[], int* count, SkScalar values[] = nullptr) const { |
| 140 | return fMeta.findScalars(name, count, values); |
| 141 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 142 | /** Return the value of the named string field, or if no matching named field exists, return null. |
| 143 | */ |
| 144 | const char* findString(const char name[]) const { return fMeta.findString(name); } |
| 145 | /** Return true if the event contains the named pointer field, and return the field |
| 146 | in value (if value is non-null). If there is no matching named field, return false |
| 147 | and ignore the value parameter. |
| 148 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 149 | bool findPtr(const char name[], void** value) const { return fMeta.findPtr(name, value); } |
| 150 | bool findBool(const char name[], bool* value) const { return fMeta.findBool(name, value); } |
Ben Wagner | a93a14a | 2017-08-28 10:34:05 -0400 | [diff] [blame] | 151 | const void* findData(const char name[], size_t* byteCount = nullptr) const { |
reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame] | 152 | return fMeta.findData(name, byteCount); |
| 153 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 154 | |
| 155 | /** Returns true if ethe event contains the named 32bit field, and if it equals the specified value */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 156 | bool hasS32(const char name[], int32_t value) const { return fMeta.hasS32(name, value); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 157 | /** Returns true if ethe event contains the named SkScalar field, and if it equals the specified value */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 158 | bool hasScalar(const char name[], SkScalar value) const { return fMeta.hasScalar(name, value); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 159 | /** Returns true if ethe event contains the named string field, and if it equals (using strcmp) the specified value */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 160 | bool hasString(const char name[], const char value[]) const { return fMeta.hasString(name, value); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 161 | /** Returns true if ethe event contains the named pointer field, and if it equals the specified value */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 162 | bool hasPtr(const char name[], void* value) const { return fMeta.hasPtr(name, value); } |
| 163 | bool hasBool(const char name[], bool value) const { return fMeta.hasBool(name, value); } |
reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame] | 164 | bool hasData(const char name[], const void* data, size_t byteCount) const { |
| 165 | return fMeta.hasData(name, data, byteCount); |
| 166 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 167 | |
| 168 | /** Add/replace the named 32bit field to the event. In XML use the subelement <data name=... s32=... /> */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 169 | void setS32(const char name[], int32_t value) { fMeta.setS32(name, value); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 170 | /** Add/replace the named SkScalar field to the event. In XML use the subelement <data name=... scalar=... /> */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 171 | void setScalar(const char name[], SkScalar value) { fMeta.setScalar(name, value); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 172 | /** Add/replace the named SkScalar[] field to the event. */ |
Ben Wagner | a93a14a | 2017-08-28 10:34:05 -0400 | [diff] [blame] | 173 | SkScalar* setScalars(const char name[], int count, const SkScalar values[] = nullptr) { |
| 174 | return fMeta.setScalars(name, count, values); |
| 175 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 176 | /** Add/replace the named string field to the event. In XML use the subelement <data name=... string=... */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 177 | void setString(const char name[], const SkString& value) { fMeta.setString(name, value.c_str()); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 178 | /** Add/replace the named string field to the event. In XML use the subelement <data name=... string=... */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 179 | void setString(const char name[], const char value[]) { fMeta.setString(name, value); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 180 | /** Add/replace the named pointer field to the event. There is no XML equivalent for this call */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 181 | void setPtr(const char name[], void* value) { fMeta.setPtr(name, value); } |
| 182 | void setBool(const char name[], bool value) { fMeta.setBool(name, value); } |
reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame] | 183 | void setData(const char name[], const void* data, size_t byteCount) { |
| 184 | fMeta.setData(name, data, byteCount); |
| 185 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 186 | |
| 187 | /** Return the underlying metadata object */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 188 | SkMetaData& getMetaData() { return fMeta; } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 189 | /** Return the underlying metadata object */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 190 | const SkMetaData& getMetaData() const { return fMeta; } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 191 | |
| 192 | /** Call this to initialize the event from the specified XML node */ |
Hal Canary | 20de615 | 2017-02-23 13:24:49 -0500 | [diff] [blame] | 193 | void inflate(const SkDOM&, const SkDOMNode*); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 194 | |
Ben Wagner | a93a14a | 2017-08-28 10:34:05 -0400 | [diff] [blame] | 195 | SkDEBUGCODE(void dump(const char title[] = nullptr);) |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 196 | |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 197 | /////////////////////////////////////////////////////////////////////////// |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 198 | |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 199 | /** |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 200 | * Post to the event queue using the event's targetID or target-proc. |
| 201 | * |
| 202 | * The event must be dynamically allocated, as ownership is transferred to |
| 203 | * the event queue. It cannot be allocated on the stack or in a global. |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 204 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 205 | void post() { |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 206 | return this->postDelay(0); |
| 207 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 208 | |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 209 | /** |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 210 | * Post to the event queue using the event's targetID or target-proc and |
| 211 | * the specifed millisecond delay. |
| 212 | * |
| 213 | * The event must be dynamically allocated, as ownership is transferred to |
| 214 | * the event queue. It cannot be allocated on the stack or in a global. |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 215 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 216 | void postDelay(SkMSec delay); |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 217 | |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 218 | /** |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 219 | * Post to the event queue using the event's targetID or target-proc. |
| 220 | * The event will be delivered no sooner than the specified millisecond |
benjaminwagner | ec4d4d7 | 2016-03-25 12:59:53 -0700 | [diff] [blame] | 221 | * time, as measured by GetMSecsSinceStartup(). |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 222 | * |
| 223 | * The event must be dynamically allocated, as ownership is transferred to |
| 224 | * the event queue. It cannot be allocated on the stack or in a global. |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 225 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 226 | void postTime(SkMSec time); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 227 | |
benjaminwagner | ec4d4d7 | 2016-03-25 12:59:53 -0700 | [diff] [blame] | 228 | /** |
| 229 | * Returns ~zero the first time it's called, then returns the number of |
| 230 | * milliseconds since the first call. Behavior is undefined if the program |
| 231 | * runs more than ~25 days. |
| 232 | */ |
| 233 | static SkMSec GetMSecsSinceStartup(); |
| 234 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 235 | /////////////////////////////////////////////// |
| 236 | /** Porting layer must call these functions **/ |
| 237 | /////////////////////////////////////////////// |
| 238 | |
| 239 | /** Global initialization function for the SkEvent system. Should be called exactly |
| 240 | once before any other event method is called, and should be called after the |
| 241 | call to SkGraphics::Init(). |
| 242 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 243 | static void Init(); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 244 | /** Global cleanup function for the SkEvent system. Should be called exactly once after |
mtklein | fe81e2d | 2015-09-09 07:35:42 -0700 | [diff] [blame] | 245 | all event methods have been called. |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 246 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 247 | static void Term(); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 248 | |
| 249 | /** Call this to process one event from the queue. If it returns true, there are more events |
| 250 | to process. |
| 251 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 252 | static bool ProcessEvent(); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 253 | /** Call this whenever the requested timer has expired (requested by a call to SetQueueTimer). |
| 254 | It will post any delayed events whose time as "expired" onto the event queue. |
| 255 | It may also call SignalQueueTimer() and SignalNonEmptyQueue(). |
| 256 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 257 | static void ServiceQueueTimer(); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 258 | |
reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame] | 259 | /** Return the number of queued events. note that this value may be obsolete |
| 260 | upon return, since another thread may have called ProcessEvent() or |
| 261 | Post() after the count was made. |
| 262 | */ |
| 263 | static int CountEventsOnQueue(); |
| 264 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 265 | //////////////////////////////////////////////////// |
| 266 | /** Porting layer must implement these functions **/ |
| 267 | //////////////////////////////////////////////////// |
| 268 | |
| 269 | /** Called whenever an SkEvent is posted to an empty queue, so that the OS |
| 270 | can be told to later call Dequeue(). |
| 271 | */ |
| 272 | static void SignalNonEmptyQueue(); |
| 273 | /** Called whenever the delay until the next delayed event changes. If zero is |
| 274 | passed, then there are no more queued delay events. |
| 275 | */ |
| 276 | static void SignalQueueTimer(SkMSec delay); |
| 277 | |
tfarina@chromium.org | 887760f | 2012-10-01 16:14:21 +0000 | [diff] [blame] | 278 | #if defined(SK_BUILD_FOR_WIN) |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 279 | static bool WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 280 | #endif |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 281 | |
| 282 | private: |
| 283 | SkMetaData fMeta; |
| 284 | mutable char* fType; // may be characters with low bit set to know that it is not a pointer |
| 285 | uint32_t f32; |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 286 | |
| 287 | // 'there can be only one' (non-zero) between target-id and target-proc |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 288 | SkEventSinkID fTargetID; |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 289 | Proc fTargetProc; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 290 | |
| 291 | // these are for our implementation of the event queue |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 292 | SkMSec fTime; |
| 293 | SkEvent* fNextEvent; // either in the delay or normal event queue |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 294 | |
| 295 | void initialize(const char* type, size_t typeLen, SkEventSinkID); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 296 | |
| 297 | static bool Enqueue(SkEvent* evt); |
| 298 | static SkMSec EnqueueTime(SkEvent* evt, SkMSec time); |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 299 | static SkEvent* Dequeue(); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 300 | static bool QHasEvents(); |
| 301 | }; |
| 302 | |
| 303 | #endif |