From e8d864ff663a8a58d26cfed3004cca88f82afc58 Mon Sep 17 00:00:00 2001 From: True Zhuanjia Date: Sun, 26 Apr 2026 21:40:24 +0800 Subject: [PATCH] soft keyboard fixes --- VoidLink/Input/InputAccessoryBar.swift | 4 ++-- VoidLink/Input/StreamView.m | 31 +++++++++++++++++--------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/VoidLink/Input/InputAccessoryBar.swift b/VoidLink/Input/InputAccessoryBar.swift index cac2519e..88643244 100644 --- a/VoidLink/Input/InputAccessoryBar.swift +++ b/VoidLink/Input/InputAccessoryBar.swift @@ -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 ) diff --git a/VoidLink/Input/StreamView.m b/VoidLink/Input/StreamView.m index 2a736405..8050a77e 100644 --- a/VoidLink/Input/StreamView.m +++ b/VoidLink/Input/StreamView.m @@ -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) {