Fix candidate window visual artifacts

* Use a built-in window level instead of the non-standard one
* Don't force the window to re-draw
* Defer orderFront: and orderBack:
This commit is contained in:
Lukhnos Liu 2014-05-16 21:10:51 -07:00
parent 28ca23b453
commit e406645893
3 changed files with 6 additions and 6 deletions

View File

@ -138,10 +138,10 @@
- (void)setVisible:(BOOL)visible - (void)setVisible:(BOOL)visible
{ {
if (visible) { if (visible) {
[[self window] orderFront:self]; [[self window] performSelector:@selector(orderFront:) withObject:self afterDelay:0.0];
} }
else { else {
[[self window] orderOut:self]; [[self window] performSelector:@selector(orderOut:) withObject:self afterDelay:0.0];
} }
} }

View File

@ -52,7 +52,7 @@
NSUInteger styleMask = NSBorderlessWindowMask | NSNonactivatingPanelMask; NSUInteger styleMask = NSBorderlessWindowMask | NSNonactivatingPanelMask;
NSPanel *panel = [[[NSPanel alloc] initWithContentRect:contentRect styleMask:styleMask backing:NSBackingStoreBuffered defer:NO] autorelease]; NSPanel *panel = [[[NSPanel alloc] initWithContentRect:contentRect styleMask:styleMask backing:NSBackingStoreBuffered defer:NO] autorelease];
[panel setLevel:CGShieldingWindowLevel() + 1]; [panel setLevel:kCGPopUpMenuWindowLevel];
[panel setHasShadow:YES]; [panel setHasShadow:YES];
self = [self initWithWindow:panel]; self = [self initWithWindow:panel];
@ -229,7 +229,7 @@
frameRect.size = newSize; frameRect.size = newSize;
frameRect.origin = NSMakePoint(topLeftPoint.x, topLeftPoint.y - frameRect.size.height); frameRect.origin = NSMakePoint(topLeftPoint.x, topLeftPoint.y - frameRect.size.height);
[[self window] setFrame:frameRect display:YES]; [[self window] setFrame:frameRect display:NO];
[_candidateView setNeedsDisplay:YES]; [_candidateView setNeedsDisplay:YES];
} }

View File

@ -60,7 +60,7 @@ static const CGFloat kCandidateTextLeftMargin = 8.0;
NSUInteger styleMask = NSBorderlessWindowMask | NSNonactivatingPanelMask; NSUInteger styleMask = NSBorderlessWindowMask | NSNonactivatingPanelMask;
NSPanel *panel = [[[NSPanel alloc] initWithContentRect:contentRect styleMask:styleMask backing:NSBackingStoreBuffered defer:NO] autorelease]; NSPanel *panel = [[[NSPanel alloc] initWithContentRect:contentRect styleMask:styleMask backing:NSBackingStoreBuffered defer:NO] autorelease];
[panel setLevel:CGShieldingWindowLevel() + 1]; [panel setLevel:kCGPopUpMenuWindowLevel];
[panel setHasShadow:YES]; [panel setHasShadow:YES];
self = [self initWithWindow:panel]; self = [self initWithWindow:panel];
@ -396,6 +396,6 @@ static const CGFloat kCandidateTextLeftMargin = 8.0;
[_keyLabelStripView setFrame:NSMakeRect(0.0, 0.0, stripWidth, windowHeight)]; [_keyLabelStripView setFrame:NSMakeRect(0.0, 0.0, stripWidth, windowHeight)];
[_scrollView setFrame:NSMakeRect(stripWidth + 1.0, 0.0, tableViewStartWidth, windowHeight)]; [_scrollView setFrame:NSMakeRect(stripWidth + 1.0, 0.0, tableViewStartWidth, windowHeight)];
[[self window] setFrame:frameRect display:YES]; [[self window] setFrame:frameRect display:NO];
} }
@end @end