Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit 75b4938

Browse files
committed
supports ipad landscape
1 parent 18a1921 commit 75b4938

File tree

4 files changed

+33
-12
lines changed

4 files changed

+33
-12
lines changed

HUDMainApplication.mm

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,21 @@ static UpDownBytes getUpDownBytes()
256256
}
257257
else
258258
{
259-
upDiff = (upDownBytes.outputBytes - prevOutputBytes) / UPDATE_INTERVAL;
260-
downDiff = (upDownBytes.inputBytes - prevInputBytes) / UPDATE_INTERVAL;
259+
if (upDownBytes.outputBytes > prevOutputBytes)
260+
upDiff = upDownBytes.outputBytes - prevOutputBytes;
261+
else
262+
upDiff = 0;
263+
264+
if (upDownBytes.inputBytes > prevInputBytes)
265+
downDiff = upDownBytes.inputBytes - prevInputBytes;
266+
else
267+
downDiff = 0;
261268
}
262269

263270
prevOutputBytes = upDownBytes.outputBytes;
264271
prevInputBytes = upDownBytes.inputBytes;
265272

266-
if (!SHOW_ALWAYS && ((upDiff < 2 * KILOBYTES && downDiff < 2 * KILOBYTES) || (upDiff > 500 * MEGABYTES && downDiff > 500 * MEGABYTES)))
273+
if (!SHOW_ALWAYS && (upDiff < 2 * KILOBYTES && downDiff < 2 * KILOBYTES))
267274
{
268275
shouldUpdateSpeedLabel = NO;
269276
return nil;
@@ -722,7 +729,18 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
722729
_windowHostingController = [[objc_getClass("SBSAccessibilityWindowHostingController") alloc] init];
723730
unsigned int _contextId = [self.window _contextId];
724731
double windowLevel = [self.window windowLevel];
725-
[_windowHostingController registerWindowWithContextID:_contextId atLevel:windowLevel];
732+
733+
#pragma clang diagnostic push
734+
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
735+
// [_windowHostingController registerWindowWithContextID:_contextId atLevel:windowLevel];
736+
NSMethodSignature *signature = [NSMethodSignature signatureWithObjCTypes:"v@:Id"];
737+
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
738+
[invocation setTarget:_windowHostingController];
739+
[invocation setSelector:NSSelectorFromString(@"registerWindowWithContextID:atLevel:")];
740+
[invocation setArgument:&_contextId atIndex:2];
741+
[invocation setArgument:&windowLevel atIndex:3];
742+
[invocation invoke];
743+
#pragma clang diagnostic pop
726744

727745
return YES;
728746
}
@@ -1023,6 +1041,7 @@ - (void)updateViewConstraints
10231041
[NSLayoutConstraint deactivateConstraints:_constraints];
10241042
[_constraints removeAllObjects];
10251043

1044+
BOOL isPad = ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad);
10261045
UILayoutGuide *layoutGuide = self.view.safeAreaLayoutGuide;
10271046

10281047
if (_orientation == UIInterfaceOrientationLandscapeLeft || _orientation == UIInterfaceOrientationLandscapeRight)
@@ -1032,7 +1051,7 @@ - (void)updateViewConstraints
10321051
[_contentView.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor constant:(layoutGuide.layoutFrame.origin.y > 1) ? -20 : -4],
10331052
]];
10341053

1035-
[_constraints addObject:[_contentView.topAnchor constraintEqualToAnchor:self.view.topAnchor constant:10]];
1054+
[_constraints addObject:[_contentView.topAnchor constraintEqualToAnchor:self.view.topAnchor constant:(isPad ? 30 : 10)]];
10361055
}
10371056
else
10381057
{
@@ -1044,7 +1063,7 @@ - (void)updateViewConstraints
10441063
if (layoutGuide.layoutFrame.origin.y > 1)
10451064
[_constraints addObject:[_contentView.topAnchor constraintEqualToAnchor:layoutGuide.topAnchor constant:-10]];
10461065
else
1047-
[_constraints addObject:[_contentView.topAnchor constraintEqualToAnchor:layoutGuide.topAnchor constant:20]];
1066+
[_constraints addObject:[_contentView.topAnchor constraintEqualToAnchor:layoutGuide.topAnchor constant:(isPad ? 30 : 20)]];
10481067
}
10491068

10501069
[_constraints addObjectsFromArray:@[

MainApplication.mm

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ - (void)loadView
9090
[self.view addGestureRecognizer:tap];
9191
[self.view setUserInteractionEnabled:YES];
9292

93+
BOOL isPad = ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad);
94+
9395
_topLeftButton = [UIButton buttonWithType:UIButtonTypeSystem];
9496
[_topLeftButton setTintColor:[UIColor whiteColor]];
9597
[_topLeftButton addTarget:self action:@selector(tapTopLeftButton:) forControlEvents:UIControlEventTouchUpInside];
@@ -105,7 +107,7 @@ - (void)loadView
105107
UILayoutGuide *safeArea = self.view.safeAreaLayoutGuide;
106108
[_topLeftButton setTranslatesAutoresizingMaskIntoConstraints:NO];
107109
[NSLayoutConstraint activateConstraints:@[
108-
[_topLeftButton.topAnchor constraintEqualToAnchor:safeArea.topAnchor constant:28.0f],
110+
[_topLeftButton.topAnchor constraintEqualToAnchor:safeArea.topAnchor constant:(isPad ? 40.0f : 28.f)],
109111
[_topLeftButton.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor constant:20.0f],
110112
[_topLeftButton.widthAnchor constraintEqualToConstant:40.0f],
111113
[_topLeftButton.heightAnchor constraintEqualToConstant:40.0f],
@@ -125,7 +127,7 @@ - (void)loadView
125127
}
126128
[_topRightButton setTranslatesAutoresizingMaskIntoConstraints:NO];
127129
[NSLayoutConstraint activateConstraints:@[
128-
[_topRightButton.topAnchor constraintEqualToAnchor:safeArea.topAnchor constant:28.0f],
130+
[_topRightButton.topAnchor constraintEqualToAnchor:safeArea.topAnchor constant:(isPad ? 40.0f : 28.f)],
129131
[_topRightButton.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor constant:-20.0f],
130132
[_topRightButton.widthAnchor constraintEqualToConstant:40.0f],
131133
[_topRightButton.heightAnchor constraintEqualToConstant:40.0f],
@@ -145,7 +147,7 @@ - (void)loadView
145147
}
146148
[_topCenterButton setTranslatesAutoresizingMaskIntoConstraints:NO];
147149
[NSLayoutConstraint activateConstraints:@[
148-
[_topCenterButton.topAnchor constraintEqualToAnchor:safeArea.topAnchor constant:28.0f],
150+
[_topCenterButton.topAnchor constraintEqualToAnchor:safeArea.topAnchor constant:(isPad ? 40.0f : 28.f)],
149151
[_topCenterButton.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor],
150152
[_topCenterButton.widthAnchor constraintEqualToConstant:40.0f],
151153
[_topCenterButton.heightAnchor constraintEqualToConstant:40.0f],

layout/Applications/XXTAssistiveTouch.app/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<key>CFBundleDisplayName</key>
1212
<string>TrollSpeed</string>
1313
<key>CFBundleVersion</key>
14-
<string>1.8</string>
14+
<string>1.8.1</string>
1515
<key>CFBundleExecutable</key>
1616
<string>XXTAssistiveTouch</string>
1717
<key>NSPrincipalClass</key>
@@ -39,6 +39,6 @@
3939
<key>NSHumanReadableCopyright</key>
4040
<string>Copyright © 2009 Apple Inc. All Rights Reserved.</string>
4141
<key>CFBundleShortVersionString</key>
42-
<string>1.8</string>
42+
<string>1.8.1</string>
4343
</dict>
4444
</plist>

layout/DEBIAN/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: ch.xxtou.hud
22
Name: HUD App
3-
Version: 1.8
3+
Version: 1.8.1
44
Section: Tweaks
55
Depends: firmware (>= 13.0), mobilesubstrate (>= 0.9.7000), com.rpetrich.rocketbootstrap (>= 1.0.9)
66
Architecture: iphoneos-arm

0 commit comments

Comments
 (0)