]> git.saurik.com Git - iphone-api.git/blob - GraphicsServices/GSEvent.h
e3fa54e86002c192823ea102cf99392d847ff72e
[iphone-api.git] / GraphicsServices / GSEvent.h
1 /* iPhone Open SDK - Free Open Source Anti-Apple SDK
2 * Copyright (C) 2008-2009 Jay Freeman (saurik)
3 */
4
5 /*
6 * Redistribution and use in source and binary
7 * forms, with or without modification, are permitted
8 * provided that the following conditions are met:
9 *
10 * 1. Redistributions of source code must retain the
11 * above copyright notice, this list of conditions
12 * and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the
14 * above copyright notice, this list of conditions
15 * and the following disclaimer in the documentation
16 * and/or other materials provided with the
17 * distribution.
18 * 3. The name of the author may not be used to endorse
19 * or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS''
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
24 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
33 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
35 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37
38 #ifndef GRAPHICSSERVICES_GSEVENT_H_
39 #define GRAPHICSSERVICES_GSEVENT_H_
40
41 #include <mach/port.h>
42 #include <CoreGraphics/CGGeometry.h>
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48 struct GSPathInfo {
49 /*0x00:13c*/ uint8_t x00; // key
50 /*0x01:13d*/ uint8_t x01;
51 /*0x02:13e*/ uint8_t x02; // 2=no
52 /*0x03:13f*/ uint8_t x03;
53 /*0x04:140*/ uint32_t x04;
54 /*0x08:144*/ uint32_t x08;
55 /*0x0c:148*/ CGPoint position;
56 /*0x14:14c*/ uint32_t x14;
57 };
58
59 struct GSEventRecord {
60 /*0x00:08*/ uint32_t type;
61 /*0x04:0c*/ uint32_t subType;
62 /*0x08:10*/ CGPoint locationOnScreen;
63 /*0x10:18*/ CGPoint locationInWindow;
64 #if 1
65 /*0x18:20*/ uint32_t windowContextId; /*3*/
66 #endif
67 /*0x1c:24*/ uint64_t timestamp; //(GSCurrentEventTimestamp)
68 /*0x24:2c*/ uint32_t zero;
69 /*0x28:30*/ uint32_t modifierFlags;
70 /*0x2c:34*/ uint16_t eventNumber;
71 /*0x2e:36*/ uint16_t x2a;
72 /*0x30:38*/ uint32_t size;
73 };
74
75 struct __attribute__((__packed__)) GSEventKeyInfo {
76 /*0x30:38*/ uint32_t type;
77 /*0x34:3c*/ uint16_t character;
78 /*0x38:3e*/ uint16_t characterSet;
79 /*0x3a:40*/ uint8_t keyRepeating;
80 /*0x3b:41*/ uint8_t unknown;
81 };
82
83 struct GSEventHandInfo {
84 /*0x30:38:00:5c*/ uint32_t type;
85 /*0x34:3c:04:60*/ uint16_t x34;
86 /*0x38:3e:06:64*/ uint16_t x38;
87 /*0x3a:40:08:68*/ CGPoint x3a;
88 /*0x40:48:10:70*/ uint32_t x40; //handInfoScale scales
89 };
90
91 struct GSEventApplicationInfo {
92 /*0x30:00*/ uint32_t pid;
93 /*0x34:04*/ uint32_t x34;
94 /*0x38:08*/ char name[];
95 };
96
97 struct GSEventRecordInfo {
98 /*0x30:38:00:5c*/ struct GSEventHandInfo handInfo;
99 /*0x44:4c:14:74*/ uint32_t x44;
100 /*0x48:50:18:78*/ uint32_t x48; //handInfoScale scales
101 /*0x4c:54:1c:7c*/ uint32_t x4c;
102 /*0x50:58:20*/ uint8_t x50;
103 /*0x51:59:21*/ uint8_t pathPositions;
104 /*0x52:5a:22*/ uint16_t x52;
105 /*0x54:5c:24*/ struct GSPathInfo pathInfo[];
106 };
107
108 /*struct __GSEvent {
109 struct CFRuntimeBase base_;
110 struct GSEventRecord record_;
111 };*/
112
113 typedef struct __GSEvent *GSEventRef;
114
115 #define GSEventTypeKeyDown 0x000d
116
117 #define GSEventTypeAccelerometer 0x0017
118 #define GSEventTypeProximityStateChanged 0x0018
119 #define GSEventTypeDeviceOrientationChanged 0x0032
120 // 0x03c:loc_0018ac preferences
121
122 #define GSEventTypeMenuButtonDown 0x03e8
123 #define GSEventTypeMenuButtonUp 0x03e9
124 #define GSEventTypeVolumeUpButtonDown 0x03ee /*3*/
125 #define GSEventTypeVolumeUpButtonUp 0x03ef /*3*/
126 #define GSEventTypeVolumeDownButtonDown 0x03f0 /*3*/
127 #define GSEventTypeVolumeDownButtonUp 0x03f1 /*3*/
128 #define GSEventTypeLockButtonDown 0x03f2
129 #define GSEventTypeLockButtonUp 0x03f3
130 #define GSEventTypeRingerChanged0 0x03f4
131 #define GSEventTypeRingerChanged1 0x03f5
132 #define GSEventTypeLockDevice 0x03f6
133 #define GSEventTypeStatusBarMouseDown 0x03f7
134 #define GSEventTypeStatusBarMouseDragged 0x03f8
135 #define GSEventTypeStatusBarMouseUp 0x03f9
136 #define GSEventTypeHeadsetButtonDown 0x03fa
137 #define GSEventTypeHeadsetButtonUp 0x03fb
138
139 #define GSEventTypeVibrateForDuration 0x044c
140 #define GSEventTypeSetBacklightFactor 0x044e
141 #define GSEventTypeSetBacklightLevel 0x044f
142
143 #define GSEventTypeApplicationStarted 0x07d0
144 // 0x07d1 <- while SpringBoard is starting
145 #define GSEventTypeAnotherApplicationFinishedLauncing 0x07d2
146 #define GSEventTypeApplicationTerminateWithStatus 0x07d3
147 #define GSEventTypeApplicationSuspended 0x07d4
148 // 0x07d5:loc_000550 internal url
149 // 0x07d6:loc_000a20 external url
150 #define GSEventTypeApplicationExited 0x07d7
151 #define GSEventTypeApplicationShowHideSettings 0x07d8
152 #define GSEventTypeQuitTopApplication 0x07d9
153 #define GSEventTypeOtherApplicationWillSuspend 0x07da
154 #define GSEventTypeApplicationSuspendedSettingsUpdated 0x07db
155
156 #define GSEventTypeResetIdleTimer 0x0898
157 #define GSEventTypeResetIdleDuration 0x0899
158 #define GSEventTypeDumpUIHierarchy 0x09c4
159 #define GSEventTypeDumpScreenContents 0x09c5
160 #define GSEventTypeProcessScriptEvent 0x0a8c
161
162 #define GSEventTypeMouse 0x0bb9
163
164 #define GSEventTypeAccessoryAvailabilityChanged 0x0fa0
165 #define GSEventTypeAccessoryKeyStateChanged 0x0fa1
166 #define GSEventTypeAccessory 0x0fa2
167
168 #define GSEventTypeOutOfLineDataRequest 0x1388
169 #define GSEventTypeUrgentMemoryWarning 0x1770
170 #define GSEventTypeOutOfLineDataResponse 0x10001
171
172 #define GSMouseEventTypeDown 0x1
173 #define GSMouseEventTypeDragged 0x2
174 #define GSMouseEventTypeUp 0x6
175 #define GSMouseEventTypeCancel 0x8
176
177 uint64_t GSCurrentEventTimestamp(void);
178 struct GSEventHandInfo GSEventGetHandInfo(GSEventRef event);
179 struct CGRect GSEventGetLocationInWindow(GSEventRef event);
180 struct GSPathInfo GSEventGetPathInfoAtIndex(GSEventRef event, unsigned index);
181 void GSSendEvent(struct GSEventRecord *record, mach_port_name_t port);
182 void GSSendSystemEvent(struct GSEventRecord *record);
183 struct GSEventRecord *_GSEventGetGSEventRecord(GSEventRef event);
184 //GSEventCreateWithTypeAndLocation(); /*3*/
185 GSEventRef GSEventCreateWithEventRecord(struct GSEventRecord *record); /*3*/
186 CFTypeID GSEventGetTypeID(void);
187 CFPropertyListRef GSEventCreatePlistRepresentation(GSEventRef event);
188 GSEventRef _GSCreateSyntheticKeyEvent(UniChar key, BOOL up, BOOL repeating);
189 void _GSPostSyntheticKeyEvent(CFStringRef keys, BOOL up, BOOL repeating);
190
191 #ifdef __cplusplus
192 }
193 #endif
194
195 #endif//GRAPHICSSERVICES_GSEVENT_H_