Skip to content

Commit

Permalink
WIP: unlock floating keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
khanhduytran0 committed Mar 5, 2024
1 parent aadb738 commit 9615244
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 15 deletions.
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ INSTALL_TARGET_PROCESSES = SpringBoard
include $(THEOS)/makefiles/common.mk
# TARGET_CODESIGN = fastPathSign

TWEAK_NAME = TrollPad
TWEAK_NAME = TrollPadSB TrollPadUI

TrollPad_FILES = Tweak.x TrollPadPrefs/NSUserDefaults+hook.x TPPrefsObserver.m
TrollPad_CFLAGS = -fobjc-arc
TrollPad_LDFLAGS = -lMobileGestalt
TrollPadSB_FILES = TweakSB.x TrollPadPrefs/NSUserDefaults+hook.x TPPrefsObserver.m
TrollPadSB_CFLAGS = -fobjc-arc
TrollPadSB_LDFLAGS = -lMobileGestalt
# TrollPad_PRIVATE_FRAMEWORKS = BoardServices SpringBoard

TrollPadUI_FILES = TweakUI.x
TrollPadUI_CFLAGS = -fobjc-arc

include $(THEOS_MAKE_PATH)/tweak.mk
SUBPROJECTS += TrollPadPrefs
include $(THEOS_MAKE_PATH)/aggregate.mk
File renamed without changes.
7 changes: 7 additions & 0 deletions TrollPadUI.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
Filter = {
Bundles = (
"com.apple.UIKit"
);
};
}
11 changes: 0 additions & 11 deletions Tweak.x → TweakSB.x
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@ static TPPrefsObserver* pref;

static uint16_t forcePadIdiom = 0;

/*
%hook UIWindowScene
- (UIEdgeInsets)_safeAreaInsetsForInterfaceOrientation:(NSInteger)orientation {
forcePadIdiom++;
UIEdgeInsets result = %orig;
forcePadIdiom--;
return result;
}
%end
*/

%hook UIDevice
- (UIUserInterfaceIdiom)userInterfaceIdiom {
// Ever wondered how I obtained those random functions to hook? This is my way
Expand Down
17 changes: 17 additions & 0 deletions TweakUI.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#import <UIKit/UIKit.h>

// Unlock iPadOS keyboard
BOOL forcePadKBIdiom = YES;
UIUserInterfaceIdiom UIKeyboardGetSafeDeviceIdiom();
%hookf(UIUserInterfaceIdiom, UIKeyboardGetSafeDeviceIdiom) {
return forcePadKBIdiom ? UIUserInterfaceIdiomPad : %orig;
}

%hook UIKeyboardImpl
+ (UIEdgeInsets)deviceSpecificPaddingForInterfaceOrientation:(NSUInteger)arg1 inputMode:(id)arg2 {
forcePadKBIdiom = NO;
UIEdgeInsets result = %orig;
forcePadKBIdiom = YES;
return result;
}
%end

0 comments on commit 9615244

Please sign in to comment.