Skip to content

Commit

Permalink
Squirrel: set alpha value to candidate window.
Browse files Browse the repository at this point in the history
  • Loading branch information
lotem committed Apr 3, 2012
1 parent 91fd522 commit 1be40cf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion SquirrelApplicationDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ -(void)loadConfig
_useUSKeyboardLayout = (BOOL)value;
}

SquirrelUIStyle style = { FALSE, nil, 0 };
SquirrelUIStyle style = { FALSE, nil, 0, 1.0 };
if (RimeConfigGetBool(&config, "style/horizontal", &value)) {
style.horizontal = (BOOL)value;
}
Expand All @@ -42,6 +42,11 @@ -(void)loadConfig
style.fontName = [[NSString alloc] initWithUTF8String:font_face];
}
RimeConfigGetInt(&config, "style/font_point", &style.fontSize);
RimeConfigGetDouble(&config, "style/alpha", &style.alpha);
if (style.alpha > 1.0)
style.alpha = 1.0;
else if (style.alpha < 0.1)
style.alpha = 0.1;
RimeConfigClose(&config);

[_panel updateUIStyle:&style];
Expand Down
1 change: 1 addition & 0 deletions SquirrelPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ typedef struct {
bool horizontal;
NSString* fontName;
int fontSize;
double alpha;
} SquirrelUIStyle;

@interface SquirrelPanel : NSObject {
Expand Down
1 change: 1 addition & 0 deletions SquirrelPanel.m
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ -(void)updateUIStyle:(SquirrelUIStyle *)style
else { // default font
[_attrs setObject:[NSFont userFontOfSize:style->fontSize] forKey:NSFontAttributeName];
}
[_window setAlphaValue:style->alpha];
}

@end

0 comments on commit 1be40cf

Please sign in to comment.