116 CRITICAL_SECTION rep;
117
118 CriticalSection(const CriticalSection&);
119 const CriticalSection& operator =(const CriticalSection&);
120
121 public:
122 virtual void Enter() {
123 ::EnterCriticalSection(&rep);
124 }
125 virtual BOOL TryEnter() {
126 return ::TryEnterCriticalSection(&rep);
127 }
128 virtual void Leave() {
129 ::LeaveCriticalSection(&rep);
130 }
131 };
132
133 // Macros for using CriticalSection objects that help trace
134 // lock/unlock actions
135
136 /* Use THIS_FILE when it is available. */
137 #ifndef THIS_FILE
138 #define THIS_FILE __FILE__
139 #endif
140
141 #define CRITICAL_SECTION_ENTER(cs) { \
142 J2dTraceLn4(J2D_TRACE_VERBOSE2, \
143 "CS.Wait: tid, cs, file, line = 0x%x, 0x%x, %s, %d", \
144 GetCurrentThreadId(), &(cs), THIS_FILE, __LINE__); \
145 (cs).Enter(); \
146 J2dTraceLn4(J2D_TRACE_VERBOSE2, \
147 "CS.Enter: tid, cs, file, line = 0x%x, 0x%x, %s, %d", \
148 GetCurrentThreadId(), &(cs), THIS_FILE, __LINE__); \
149 }
150
151 #define CRITICAL_SECTION_LEAVE(cs) { \
152 J2dTraceLn4(J2D_TRACE_VERBOSE2, \
153 "CS.Leave: tid, cs, file, line = 0x%x, 0x%x, %s, %d", \
154 GetCurrentThreadId(), &(cs), THIS_FILE, __LINE__); \
155 (cs).Leave(); \
156 J2dTraceLn4(J2D_TRACE_VERBOSE2, \
157 "CS.Left: tid, cs, file, line = 0x%x, 0x%x, %s, %d", \
158 GetCurrentThreadId(), &(cs), THIS_FILE, __LINE__); \
159 }
160
161 // Redefine WinAPI values related to touch input, if OS < Windows 7.
162 #if (!defined(WINVER) || ((WINVER) < 0x0601))
163 /*
164 * RegisterTouchWindow flag values
165 */
166 #define TWF_FINETOUCH (0x00000001)
167 #define TWF_WANTPALM (0x00000002)
168
169 #define WM_TOUCH 0x0240
170
171 /*
172 * Touch input handle
173 */
174 typedef HANDLE HTOUCHINPUT;
175
176 typedef struct tagTOUCHINPUT {
177 LONG x;
178 LONG y;
|
116 CRITICAL_SECTION rep;
117
118 CriticalSection(const CriticalSection&);
119 const CriticalSection& operator =(const CriticalSection&);
120
121 public:
122 virtual void Enter() {
123 ::EnterCriticalSection(&rep);
124 }
125 virtual BOOL TryEnter() {
126 return ::TryEnterCriticalSection(&rep);
127 }
128 virtual void Leave() {
129 ::LeaveCriticalSection(&rep);
130 }
131 };
132
133 // Macros for using CriticalSection objects that help trace
134 // lock/unlock actions
135
136 #define CRITICAL_SECTION_ENTER(cs) { \
137 J2dTraceLn4(J2D_TRACE_VERBOSE2, \
138 "CS.Wait: tid, cs, file, line = 0x%x, 0x%x, %s, %d", \
139 GetCurrentThreadId(), &(cs), __FILE__, __LINE__); \
140 (cs).Enter(); \
141 J2dTraceLn4(J2D_TRACE_VERBOSE2, \
142 "CS.Enter: tid, cs, file, line = 0x%x, 0x%x, %s, %d", \
143 GetCurrentThreadId(), &(cs), __FILE__, __LINE__); \
144 }
145
146 #define CRITICAL_SECTION_LEAVE(cs) { \
147 J2dTraceLn4(J2D_TRACE_VERBOSE2, \
148 "CS.Leave: tid, cs, file, line = 0x%x, 0x%x, %s, %d", \
149 GetCurrentThreadId(), &(cs), __FILE__, __LINE__); \
150 (cs).Leave(); \
151 J2dTraceLn4(J2D_TRACE_VERBOSE2, \
152 "CS.Left: tid, cs, file, line = 0x%x, 0x%x, %s, %d", \
153 GetCurrentThreadId(), &(cs), __FILE__, __LINE__); \
154 }
155
156 // Redefine WinAPI values related to touch input, if OS < Windows 7.
157 #if (!defined(WINVER) || ((WINVER) < 0x0601))
158 /*
159 * RegisterTouchWindow flag values
160 */
161 #define TWF_FINETOUCH (0x00000001)
162 #define TWF_WANTPALM (0x00000002)
163
164 #define WM_TOUCH 0x0240
165
166 /*
167 * Touch input handle
168 */
169 typedef HANDLE HTOUCHINPUT;
170
171 typedef struct tagTOUCHINPUT {
172 LONG x;
173 LONG y;
|