5
// Created by döme on 25.10.2009.
9
* Copyright (c) 2009 Doemoetoer Gulyas.
10
* All rights reserved.
12
* Redistribution and use in source and binary forms, with or without
13
* modification, are permitted provided that the following conditions
15
* 1. Redistributions of source code must retain the above copyright
16
* notice, this list of conditions and the following disclaimer.
17
* 2. Redistributions in binary form must reproduce the above copyright
18
* notice, this list of conditions and the following disclaimer in the
19
* documentation and/or other materials provided with the distribution.
20
* 3. The name of the author may not be used to endorse or promote products
21
* derived from this software without specific prior written permission.
23
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
#include <sys/socket.h>
40
#include <netinet/in.h>
41
#include <arpa/inet.h>
46
//#import "GraphicsServices.h"
48
NSString* TapIdKey = @"tapId";
49
NSString* TapDataKey = @"tapData";
50
NSString* TapTouchesKey = @"tapTouches";
51
NSString* TapGSEventKey = @"tapGSEvent";
52
NSString* TapTouchPhaseKey = @"tapTouchPhase";
53
NSString* TapRecordedEventKey = @"tapRecordedEvent";
54
NSString* TapAccelerationKey = @"tapAcceleration";
55
NSString* TapCompassKey = @"tapCompass";
56
NSString* TapLocationKey = @"tapLocation";
59
@implementation Tappity
63
if (!(self = [super init]))
74
@implementation UITouch (Synthesize)
76
- (id)initInView:(UIView *)view
82
if ([view isKindOfClass:[UIWindow class]])
84
frameInWindow = view.frame;
89
[view.window convertRect:view.frame fromView:view.superview];
95
frameInWindow.origin.x + 0.5 * frameInWindow.size.width,
96
frameInWindow.origin.y + 0.5 * frameInWindow.size.height);
97
_previousLocationInWindow = _locationInWindow;
99
UIView *target = [view.window hitTest:_locationInWindow withEvent:nil];
100
_view = [target retain];
101
_window = [view.window retain];
102
_phase = UITouchPhaseBegan;
103
_touchFlags._firstTouchForView = 1;
104
_touchFlags._isTap = 1;
105
_timestamp = [NSDate timeIntervalSinceReferenceDate];
110
- (void)changeToPhase:(UITouchPhase)phase
113
_timestamp = [NSDate timeIntervalSinceReferenceDate];
120
void _printGSPathPoint(GSTouchPointRef p)
122
// printf("P: 0x%08X 0x%08X 0x%08X 0x%08X (%G, %G)\n", p->unk0, p->unk1, p->unk2, p->unk5, p->x, p->y);
123
printf("P: 0x%08X %7G %7G (%G, %G)\n", p->unk0, p->unk1, p->touchSize, p->x, p->y);
126
void _printGSEvent(UIEvent* event)
128
GSEvent* e = [event _gsEvent];
129
// printf("%p, %p\n", event, e);
130
// printf("0x%08X 0x%08X 0x%08X\n", e->unk1, e->unk2, e->unk3);
132
// printf("type0 0x%08X type1 0x%08X r3 0x%08X\n", e->type0, e->type1, e->r3);
133
// printf("type10 0x%08X r11 0x%08X type12 0x%08X\n", e->type10, e->r11, e->type12);
134
// printf("gesture12 0x%08X gesture14 0x%08X\n", e->gesture13, e->gesture14);
136
// printf("avg0 (%5G, %5G), avg1 (%5G, %5G)\n", e->avgX0, e->avgY0, e->avgX1, e->avgY1);
137
// printf("(%d) %d\n", e->numInitialTouches, e->numCurrentTouches);
138
// printf("unk16 0x%08X unk17 0x%08X unk18 0x%08X unk19 0x%08X\n", e->unk16, e->unk17, e->unk18, e->unk19);
139
// printf("r20 0x%08X r21 0x%08X\n", e->r20, e->r21);
140
printf("points %d\n", e->numPoints);
142
// printf("unk9 0x%08X unk10 0x%08X unk11 0x%08X unk12 0x%08X\n", e->unk9, e->unk10, e->unk11, e->unk12);
143
// printf("%u.%u\n", e->timestamp_s, e->timestamp_ns);
144
// printf("%G\n", (double)e->timestamp*1e-9);
145
// printf("unk12 0x%08X unk13 0x%08X unk14 0x%08X unk15 0x%08X\n", e->unk12, e->unk13, e->unk14, e->unk15);
146
for(size_t i = 0; i < e->numPoints; ++i)
147
_printGSPathPoint(e->points+i);
151
@implementation GSEvent