Merge pull request #44 from brightray/fix-devtools-flash

Fix flash of page while resizing devtools NSSplitView divider.
This commit is contained in:
Adam Roben 2013-12-12 07:36:16 -08:00
commit dc3f2050c0
2 changed files with 22 additions and 3 deletions

View file

@ -2,7 +2,8 @@
@class BRYInspectableWebContentsViewPrivate;
@interface BRYInspectableWebContentsView : NSView <NSWindowDelegate> {
@interface BRYInspectableWebContentsView
: NSView<NSWindowDelegate, NSSplitViewDelegate> {
@private
BRYInspectableWebContentsViewPrivate *_private;
}

View file

@ -10,10 +10,21 @@
using namespace brightray;
@interface GraySplitView : NSSplitView
- (NSColor*)dividerColor;
@end
@implementation GraySplitView
- (NSColor*)dividerColor {
return [NSColor darkGrayColor];
}
@end
@interface BRYInspectableWebContentsViewPrivate : NSObject {
@public
InspectableWebContentsViewMac *inspectableWebContentsView;
NSSplitView *splitView;
GraySplitView *splitView;
NSWindow *window;
BOOL visible;
}
@ -45,7 +56,8 @@ void SetActive(content::WebContents* web_contents, bool active) {
_private = [[BRYInspectableWebContentsViewPrivate alloc] init];
_private->inspectableWebContentsView = inspectableWebContentsView;
_private->splitView = [[NSSplitView alloc] init];
_private->splitView = [[GraySplitView alloc] init];
_private->splitView.delegate = self;
[self addSubview:_private->splitView];
_private->splitView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
@ -207,6 +219,12 @@ void SetActive(content::WebContents* web_contents, bool active) {
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:newWindow];
}
#pragma mark - NSSplitViewDelegate
-(void)splitViewWillResizeSubviews:(NSNotification *)notification {
[[_private->splitView window] disableScreenUpdatesUntilFlush];
}
#pragma mark - NSWindowDelegate
- (BOOL)windowShouldClose:(id)sender {