diff --git a/Limelight/Input/StreamView.m b/Limelight/Input/StreamView.m index 2676959..86ab0be 100644 --- a/Limelight/Input/StreamView.m +++ b/Limelight/Input/StreamView.m @@ -22,6 +22,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; KeyboardInputField* keyInputField; BOOL isInputingText; + NSMutableSet* keysDown; float streamAspectRatio; @@ -53,6 +54,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; TemporarySettings* settings = [[[DataManager alloc] init] getSettings]; + keysDown = [[NSMutableSet alloc] init]; keyInputField = [[KeyboardInputField alloc] initWithFrame:CGRectZero]; [keyInputField setKeyboardType:UIKeyboardTypeDefault]; [keyInputField setAutocorrectionType:UITextAutocorrectionTypeNo]; @@ -424,8 +426,10 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; if (isToggleable){ if (isOn){ LiSendKeyboardEvent(keyCode, KEY_ACTION_DOWN, 0); + [keysDown addObject:@(keyCode)]; } else { LiSendKeyboardEvent(keyCode, KEY_ACTION_UP, 0); + [keysDown removeObject:@(keyCode)]; } } else { @@ -765,6 +769,13 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; return NO; } +- (void)textFieldDidEndEditing:(UITextField *)textField { + for (NSNumber* keyCode in keysDown) { + LiSendKeyboardEvent([keyCode shortValue], KEY_ACTION_UP, 0); + } + [keysDown removeAllObjects]; +} + - (void)onKeyboardPressed:(UITextField *)textField { NSString* inputText = textField.text; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{