soft keyboard fixes

This commit is contained in:
True Zhuanjia committed 2026-04-26 21:40:24 +08:00
1 parent 9e2ef6cc0d
commit e8d864ff66
2 files changed
+22 -13

No files matched your search

+2 -2
View File
@@ -41,7 +41,7 @@ private enum InputAccessoryBarMetrics {
static let releaseDuration: TimeInterval = 0.18 static let releaseDuration: TimeInterval = 0.18
static let reorderAnimationDuration: TimeInterval = 0.2 static let reorderAnimationDuration: TimeInterval = 0.2
static let deleteButtonSize: CGFloat = 22 static let deleteButtonSize: CGFloat = 22
static let deleteButtonHitExpansion: CGFloat = 10 static let deleteButtonHitExpansion: CGFloat = 23
static let dragScale: CGFloat = 1.06 static let dragScale: CGFloat = 1.06
static let dragLiftY: CGFloat = -2 static let dragLiftY: CGFloat = -2
static let editOverlayDimAlpha: CGFloat = 0.001 static let editOverlayDimAlpha: CGFloat = 0.001
@@ -439,7 +439,7 @@ private final class InputAccessoryBarItemView: UIView {
button.frame = CGRect(x: 0, y: 0, width: bounds.width, height: InputAccessoryBarMetrics.pillHeight) button.frame = CGRect(x: 0, y: 0, width: bounds.width, height: InputAccessoryBarMetrics.pillHeight)
deleteButton.frame = CGRect( deleteButton.frame = CGRect(
x: bounds.width - InputAccessoryBarMetrics.deleteButtonSize + 2, x: bounds.width - InputAccessoryBarMetrics.deleteButtonSize + 2,
y: -8, y: 0,
width: InputAccessoryBarMetrics.deleteButtonSize, width: InputAccessoryBarMetrics.deleteButtonSize,
height: InputAccessoryBarMetrics.deleteButtonSize height: InputAccessoryBarMetrics.deleteButtonSize
) )
+20 -11
View File
@@ -262,6 +262,8 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
- (void)keyboardWillShow:(NSNotification *)notification{ - (void)keyboardWillShow:(NSNotification *)notification{
// NSLog(@"keyboard will show markmark %f", CACurrentMediaTime()); // NSLog(@"keyboard will show markmark %f", CACurrentMediaTime());
dockedKeyboardActionDetected = true; dockedKeyboardActionDetected = true;
NSLog(@"keyboard will show markmark %d", isInputingText);
if(settings.liftStreamViewForKeyboard && !isInputingText){ if(settings.liftStreamViewForKeyboard && !isInputingText){
isInputingText = true; isInputingText = true;
@@ -312,16 +314,17 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
} }
- (void)handleNonStandardKeyboard:(NSNotification *)notification{ - (void)handleNonStandardKeyboard:(NSNotification *)notification{
if(!self->dockedKeyboardActionDetected){ dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC));
dispatch_after(delayTime, dispatch_get_main_queue(), ^{// Code to execute after the delay
[self->keyboardToggleTip removeFromSuperview]; if(!self->dockedKeyboardActionDetected){
[self refreshKeyboardToggleRecognizer:settings.keyboardToggleFingers.intValue]; [self->keyboardToggleTip removeFromSuperview];
if(!self->isInputingText) [self keyboardWillHide];
self->dockedKeyboardActionDetected = false; [self refreshKeyboardToggleRecognizer:self->settings.keyboardToggleFingers.intValue];
self->isInputingText = !self->isInputingText; self->dockedKeyboardActionDetected = false;
}
} return;
return; });
/* /*
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC)); dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC));
dispatch_after(delayTime, dispatch_get_main_queue(), ^{// Code to execute after the delay dispatch_after(delayTime, dispatch_get_main_queue(), ^{// Code to execute after the delay
@@ -494,7 +497,13 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
[keyInputField.undoManager disableUndoRegistration]; [keyInputField.undoManager disableUndoRegistration];
//[keyboardToggleTip removeFromSuperview]; //[keyboardToggleTip removeFromSuperview];
} }
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.025 * NSEC_PER_SEC));
dispatch_after(delayTime, dispatch_get_main_queue(), ^{// Code to execute after the delay
if(!self->dockedKeyboardActionDetected) self->isInputingText = !self->isInputingText;
});
} }
- (void)startInteractionTimer { - (void)startInteractionTimer {
@@ -1012,7 +1021,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
[touchHandler touchesBegan:touches withEvent:event]; [touchHandler touchesBegan:touches withEvent:event];
return; //This is a native touch oriented fork, in pure native touch mode, this call back method deals with native touch only. return; //This is a native touch oriented fork, in pure native touch mode, this call back method deals with native touch only.
} }
else if(touchMode == RelativeTouch && keyboardToggleRecognizer.numberOfTouchesRequired == 1) return; // else if(touchMode == RelativeTouch && keyboardToggleRecognizer.numberOfTouchesRequired == 1) return;
NSMutableSet* pencilTouches = [NSMutableSet set]; NSMutableSet* pencilTouches = [NSMutableSet set];
for (UITouch* touch in touches) { for (UITouch* touch in touches) {