-
Notifications
You must be signed in to change notification settings - Fork 3
/
Tweak.xm
58 lines (46 loc) · 1.28 KB
/
Tweak.xm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// Tweak.xm
// Fingertips
//
// Draw all touches within a window for screen recording/mockup purposes
//
// Credit to app framework:
// https://github.com/mapbox/Fingertips
//
//
#include "libcolorpicker.h"
#include "MBFingerTipWindow.h"
// Declare ourselves a global to hit
static MBFingerTipWindow *_rtWindow;
%hook UIApplication
// This isn't likely the best method to hook, just a repurposed one, but it works :)
-(UIWindow *)keyWindow
{
UIWindow *o = %orig;
if (!_rtWindow)
{
_rtWindow = [[MBFingerTipWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
// _rtWindow.overlayWindow isn't registering properly in every app; need to look at what can be done there.
}
return o;
}
%end
%hook MBFingerTipOverlayWindow
//super hacky fix for showing our view on the lockscreen
- (BOOL)_shouldCreateContextAsSecure {
UIColor *coolColor = LCPParseColorString(@"ffffff", @"#ff0000");
return YES;
}
%end
// Hook every window.
%hook UIWindow
- (void)sendEvent:(UIEvent *)event
{
%orig;
//if (self != [[UIApplication sharedApplication] keyWindow]) return;
// Make sure we dont accidentally create an unending loop
if (self==_rtWindow) return;
// Now that the app has registered input, tell the window to draw the touch.
if (_rtWindow) [_rtWindow sendEvent:event];
}
%end