soft keyboard fixes

This commit is contained in:
True Zhuanjia
2026-04-26 21:40:24 +08:00
parent 9e2ef6cc0d
commit e8d864ff66
2 changed files with 22 additions and 13 deletions
+2 -2
View File
@@ -41,7 +41,7 @@ private enum InputAccessoryBarMetrics {
static let releaseDuration: TimeInterval = 0.18
static let reorderAnimationDuration: TimeInterval = 0.2
static let deleteButtonSize: CGFloat = 22
static let deleteButtonHitExpansion: CGFloat = 10
static let deleteButtonHitExpansion: CGFloat = 23
static let dragScale: CGFloat = 1.06
static let dragLiftY: CGFloat = -2
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)
deleteButton.frame = CGRect(
x: bounds.width - InputAccessoryBarMetrics.deleteButtonSize + 2,
y: -8,
y: 0,
width: 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{
// NSLog(@"keyboard will show markmark %f", CACurrentMediaTime());
dockedKeyboardActionDetected = true;
NSLog(@"keyboard will show markmark %d", isInputingText);
if(settings.liftStreamViewForKeyboard && !isInputingText){
isInputingText = true;
@@ -312,16 +314,17 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
}
- (void)handleNonStandardKeyboard:(NSNotification *)notification{
if(!self->dockedKeyboardActionDetected){
[self->keyboardToggleTip removeFromSuperview];
[self refreshKeyboardToggleRecognizer:settings.keyboardToggleFingers.intValue];
self->dockedKeyboardActionDetected = false;
self->isInputingText = !self->isInputingText;
}
return;
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
if(!self->dockedKeyboardActionDetected){
[self->keyboardToggleTip removeFromSuperview];
if(!self->isInputingText) [self keyboardWillHide];
[self refreshKeyboardToggleRecognizer:self->settings.keyboardToggleFingers.intValue];
self->dockedKeyboardActionDetected = false;
}
return;
});
/*
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
@@ -494,7 +497,13 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
[keyInputField.undoManager disableUndoRegistration];
//[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 {
@@ -1012,7 +1021,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
[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.
}
else if(touchMode == RelativeTouch && keyboardToggleRecognizer.numberOfTouchesRequired == 1) return;
// else if(touchMode == RelativeTouch && keyboardToggleRecognizer.numberOfTouchesRequired == 1) return;
NSMutableSet* pencilTouches = [NSMutableSet set];
for (UITouch* touch in touches) {