Skip to content

Commit

Permalink
Better focusing with software kb
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Dec 9, 2021
1 parent 30260ce commit c233d0c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
10 changes: 10 additions & 0 deletions Blink/SmarterKeys/SmarterTermInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,16 @@ extension SmarterTermInput {
}
}

override func canBeFocused() -> Bool {
let res = super.canBeFocused()

if res == false {
return KBTracker.shared.input == self
}

return res
}

override func onMods() {
kbView.stopRepeats()
}
Expand Down
2 changes: 2 additions & 0 deletions KB/Native/Views/KBWebViewBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)_keyboardDidHide:(NSNotification *)notification;
- (void)_keyboardDidShow:(NSNotification *)notification;

- (BOOL)canBeFocused;


@end

Expand Down
4 changes: 2 additions & 2 deletions KB/Native/Views/KBWebViewBase.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ + (void)load {
UIView * mayBeUs = [[me superview] superview];
if ([mayBeUs isKindOfClass:[KBWebViewBase class]]) {
KBWebViewBase * base = (KBWebViewBase *)mayBeUs;
arg1 = [base _canBeFocused];
arg1 = [base canBeFocused];
if (arg1) {
((void (*)(id, SEL, void*, BOOL, BOOL, BOOL, id))original)(me, selector, arg0, arg1, arg2, arg3, arg4);
}
Expand All @@ -125,7 +125,7 @@ + (void)load {
method_setImplementation(method, override);
}

- (BOOL)_canBeFocused {
- (BOOL)canBeFocused {
return self.userInteractionEnabled && _focused;
}

Expand Down

0 comments on commit c233d0c

Please sign in to comment.