Skip to content

Commit

Permalink
fix issues/102
Browse files Browse the repository at this point in the history
  • Loading branch information
dongyuwei committed Apr 12, 2022
1 parent 82c69b7 commit 7aa67df
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/AnnotationWinController.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ + (id)sharedController {
- (void)awakeFromNib {
sharedController = self;
self.width = 160;
//self.height = 282;
// self.height = 282;

[self.panel orderFront:nil];
[self.panel setLevel:CGShieldingWindowLevel() + 1];
// Make sure panel can float over full screen apps
// self.panel.collectionBehavior = NSWindowCollectionBehaviorCanJoinAllSpaces;
// self.panel.collectionBehavior = NSWindowCollectionBehaviorCanJoinAllSpaces;
[self.panel setStyleMask:NSWindowStyleMaskBorderless];
[self performSelector:@selector(hideWindow) withObject:nil afterDelay:0.01];
// [self showWindow:NSMakePoint(10, self.height + 10)]; //for dev debug
Expand Down
9 changes: 6 additions & 3 deletions src/InputController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
extern ConversionEngine *engine;

typedef NSInteger KeyCode;
static const KeyCode KEY_RETURN = 36, KEY_SPACE = 49, KEY_DELETE = 51, KEY_ESC = 53, KEY_ARROW_DOWN = 125, KEY_ARROW_UP = 126;
static const KeyCode KEY_RETURN = 36, KEY_SPACE = 49, KEY_DELETE = 51, KEY_ESC = 53, KEY_ARROW_DOWN = 125, KEY_ARROW_UP = 126,
KEY_RIGHT_SHIFT = 60;

@implementation InputController

Expand All @@ -23,12 +24,14 @@ - (BOOL)handleEvent:(NSEvent *)event client:(id)sender {
bool handled = NO;
switch ([event type]) {
case NSEventTypeFlagsChanged:
// NSLog(@"hallelujah event modifierFlags %lu, event keyCode: %@", (unsigned long)[event modifierFlags], [event keyCode]);

if (_lastEventTypes[1] == NSEventTypeFlagsChanged && _lastModifiers[1] == modifiers) {
return YES;
}

if (modifiers == 0 && _lastEventTypes[1] == NSEventTypeFlagsChanged && _lastModifiers[1] == NSEventModifierFlagShift &&
!(_lastModifiers[0] & NSEventModifierFlagShift)) {
[event keyCode] == KEY_RIGHT_SHIFT && !(_lastModifiers[0] & NSEventModifierFlagShift)) {

_defaultEnglishMode = !_defaultEnglishMode;
if (_defaultEnglishMode) {
Expand Down Expand Up @@ -304,7 +307,7 @@ - (void)_updateComposedBuffer:(NSAttributedString *)candidateString {

- (void)activateServer:(id)sender {
[sender overrideKeyboardWithKeyboardNamed:@"com.apple.keylayout.US"];

if (_annotationWin == nil) {
_annotationWin = [AnnotationWinController sharedController];
}
Expand Down

0 comments on commit 7aa67df

Please sign in to comment.