Skip to content

Commit

Permalink
Forcibly enable resize corners for external display
Browse files Browse the repository at this point in the history
  • Loading branch information
khanhduytran0 committed Jul 9, 2024
1 parent 5acb911 commit 7b14462
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 3 deletions.
7 changes: 7 additions & 0 deletions SpringBoard.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
@property(nonatomic, assign) BOOL requirePointer, requireHardwareKeyboard;
@end

@interface SBFluidSwitcherItemContainer : UIView
- (BOOL)isResizingAllowed;
@end

@interface SBAppResizeGrabberView : UIView
@end

@interface SBWindowScene : UIWindowScene
- (BOOL)isExternalDisplayWindowScene;
@end
2 changes: 1 addition & 1 deletion TPPrefsObserver.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import <Foundation/Foundation.h>

@interface TPPrefsObserver : NSObject
@property(nonatomic, assign) BOOL allowLandscapeHomeScreen, forceEnableMedusaForLandscapeOnlyApps, useiPadAppSwitchingAnimation;
@property(nonatomic, assign) BOOL allowLandscapeHomeScreen, forceEnableMedusaForLandscapeOnlyApps, hideStageManagerResizeCorners, useiPadAppSwitchingAnimation;
@end
2 changes: 2 additions & 0 deletions TPPrefsObserver.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ - (instancetype)init {
self = [super init];
[self observeKey:@"TPAllowLandscapeHomeScreen"];
[self observeKey:@"TPForceEnableMedusaForLandscapeOnlyApps"];
[self observeKey:@"TPHideStageManagerResizeCorners"];
[self observeKey:@"TPUseiPadAppSwitchingAnimation"];
// Fetch keys
[self observeValueForKeyPath:nil ofObject:nil change:nil context:nil];
Expand All @@ -23,6 +24,7 @@ - (void)observeValueForKeyPath:(NSString *)
NSUserDefaults *defaults = NSUserDefaults.standardUserDefaults;
self.allowLandscapeHomeScreen = [defaults boolForKey:@"TPAllowLandscapeHomeScreen"];
self.forceEnableMedusaForLandscapeOnlyApps = [defaults boolForKey:@"TPForceEnableMedusaForLandscapeOnlyApps"];
self.hideStageManagerResizeCorners = [defaults boolForKey:@"TPHideStageManagerResizeCorners"];
self.useiPadAppSwitchingAnimation = [defaults boolForKey:@"TPUseiPadAppSwitchingAnimation"];
}
@end
12 changes: 12 additions & 0 deletions TrollPadPrefs/Resources/Root.plist
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@
<key>label</key>
<string>Use AirPlay as External Display</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<key>defaults</key>
<string>com.apple.springboard</string>
<key>key</key>
<string>TPHideStageManagerResizeCorners</string>
<key>label</key>
<string>Hide resize corners</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
Expand Down
23 changes: 22 additions & 1 deletion TweakSB.x
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,27 @@ static uint16_t forcePadIdiom = 0;
}
%end

// Forcibly enable resizable as iOS somehow disabled it in the external display
%hook SBFluidSwitcherItemContainer
- (void)setAllowedTouchResizeCorners:(NSUInteger)cornerMask {
// !self.isResizingAllowed &&
if (self._screen != UIScreen.mainScreen) {
%orig(15);
// 12 (binary 1100): enable resizing for bottoms
// 15 (binary 1111): enable resizing for all corners
} else {
%orig;
}
}
%end

%hook SBAppResizeGrabberView
- (void)setAlpha:(CGFloat)alpha {
%orig;
self.hidden = pref.hideStageManagerResizeCorners;
}
%end

%hook SBFluidSwitcherViewController
// Use iPadOS app switching animation instead
- (BOOL)isDevicePad {
Expand Down Expand Up @@ -316,7 +337,7 @@ static uint16_t forcePadIdiom = 0;
// Unlock external display support for MDC versions
int hookedExtDisplayEnabledFunc() {
// clang forgets to PAC this function, so we need this ugly line
int hack = 0; if (hack) { abort(); }
int hack = 0; if (hack) { printf(""); }

return 1;
}
Expand Down
4 changes: 4 additions & 0 deletions UIKitPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@
@interface UIStatusBar
- (_UIStatusBar *)statusBar;
@end

@interface UIView(private)
- (UIScreen *)_screen;
@end
2 changes: 1 addition & 1 deletion control
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: com.kdt.trollpad
Name: TrollPad
Version: 1.2.3
Version: 1.3
Architecture: iphoneos-arm
Description: Troll SpringBoard into thinking it's running on iPadOS.
Maintainer: khanhduytran0
Expand Down

0 comments on commit 7b14462

Please sign in to comment.