diff options
author | 2011-10-10 16:38:58 +0000 | |
---|---|---|
committer | 2011-10-10 16:38:58 +0000 | |
commit | bb3f4a8d0a58a8857050a7b6a907b190d261681d (patch) | |
tree | 38a61a9a6712e273f594fc6b8ff6c351d8f97a9a /src | |
parent | 719fd045abb1f26f99cf35708413886b9eafcc1e (diff) |
Bug fixes:
- Mac SampleApp resize and maximize bug
- Mac SampleApp now accepts/dispatches mouse moved events
- SampleAnimator: moved drawColor outside so the sample draws a background every drawing call
- Removed SampleExtractAlpha from the repository and SampleApp.gyp
http://codereview.appspot.com/5249054/
git-svn-id: http://skia.googlecode.com/svn/trunk@2448 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/mac/SampleAppDelegate.mm | 1 | ||||
-rw-r--r-- | src/utils/mac/SkNSView.h | 1 | ||||
-rw-r--r-- | src/utils/mac/SkNSView.mm | 28 |
3 files changed, 21 insertions, 9 deletions
diff --git a/src/utils/mac/SampleAppDelegate.mm b/src/utils/mac/SampleAppDelegate.mm index c54a8a30cf..91dcada888 100644 --- a/src/utils/mac/SampleAppDelegate.mm +++ b/src/utils/mac/SampleAppDelegate.mm @@ -5,6 +5,7 @@ -(void) applicationDidFinishLaunching:(NSNotification *)aNotification { //Load specified skia views after launching fView.fOptionsDelegate = fOptions; + [fWindow setAcceptsMouseMovedEvents:YES]; [fOptions registerMenus:fView.fWind->getMenus()]; } diff --git a/src/utils/mac/SkNSView.h b/src/utils/mac/SkNSView.h index 5ae7ad5833..87c2727d18 100644 --- a/src/utils/mac/SkNSView.h +++ b/src/utils/mac/SkNSView.h @@ -35,6 +35,7 @@ class SkEvent; - (id)initWithDefaults; - (void)setUpWindow; +- (void)resizeSkView:(NSSize)newSize; - (void)setSkTitle:(const char*)title; - (void)onAddMenu:(const SkOSMenu*)menu; - (void)onUpdateMenu:(const SkOSMenu*)menu; diff --git a/src/utils/mac/SkNSView.mm b/src/utils/mac/SkNSView.mm index 8e9e30f7dc..c498bf5f09 100644 --- a/src/utils/mac/SkNSView.mm +++ b/src/utils/mac/SkNSView.mm @@ -53,17 +53,19 @@ return YES; } -- (void)viewDidEndLiveResize { - NSSize s = [self frame].size; - if (NULL != fWind && fWind->width() != s.width && fWind->height() != s.height) { - fWind->resize(s.width, s.height); - if (nil != fGLContext) { - [fGLContext update]; - glClear(GL_STENCIL_BUFFER_BIT); - } +- (void)resizeSkView:(NSSize)newSize { + if (NULL != fWind && (fWind->width() != newSize.width || fWind->height() != newSize.height)) { + fWind->resize(newSize.width, newSize.height); + glClear(GL_STENCIL_BUFFER_BIT); + [fGLContext update]; } } +- (void) setFrameSize:(NSSize)newSize { + [super setFrameSize:newSize]; + [self resizeSkView:newSize]; +} + - (void)dealloc { delete fWind; self.fGLContext = nil; @@ -71,7 +73,7 @@ [super dealloc]; } -/////////////////////////////////////////////0////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// - (void)drawSkia { fRedrawRequestPending = false; @@ -204,6 +206,14 @@ static SkKey raw2key(UInt32 raw) } } +- (void)mouseMoved:(NSEvent *)event { + NSPoint p = [event locationInWindow]; + if ([self mouse:p inRect:[self bounds]] && NULL != fWind) { + NSPoint loc = [self convertPoint:p fromView:nil]; + fWind->handleClick(loc.x, loc.y, SkView::Click::kMoved_State, self); + } +} + - (void)mouseUp:(NSEvent *)event { NSPoint p = [event locationInWindow]; if ([self mouse:p inRect:[self bounds]] && NULL != fWind) { |