diff --git a/src/SFML/Window/OSX/SFOpenGLView.mm b/src/SFML/Window/OSX/SFOpenGLView.mm index a358c296..9b6292c6 100644 --- a/src/SFML/Window/OSX/SFOpenGLView.mm +++ b/src/SFML/Window/OSX/SFOpenGLView.mm @@ -178,6 +178,17 @@ sf::Key::Code NonLocalizedKeys(unsigned short keycode); //////////////////////////////////////////////////////// -(void)frameDidChange:(NSNotification *)notification { + // Update mouse internal state. + BOOL mouseWasIn = myMouseIsIn; + myMouseIsIn = [self isMouseInside]; + + // Send event if needed. + if (mouseWasIn && !myMouseIsIn) { + [self mouseExited:nil]; + } else if (!mouseWasIn && myMouseIsIn) { + [self mouseEntered:nil]; + } + // Adapt tracking area for mouse mouse event. [self removeTrackingRect:myTrackingTag]; myTrackingTag = [self addTrackingRect:[self frame] diff --git a/src/SFML/Window/OSX/WindowImplCocoa.mm b/src/SFML/Window/OSX/WindowImplCocoa.mm index 76550e22..86180c08 100644 --- a/src/SFML/Window/OSX/WindowImplCocoa.mm +++ b/src/SFML/Window/OSX/WindowImplCocoa.mm @@ -88,6 +88,9 @@ WindowImplCocoa::WindowImplCocoa(VideoMode mode, { SetUpPoolAndApplication(); + // Transform the app process. + SetUpProcessAsApplication(); + // Don't forget to update our parent (that is, WindowImpl) size : myWidth = mode.Width; myHeight = mode.Height; @@ -374,9 +377,6 @@ void WindowImplCocoa::SetUpPoolAndApplication(void) // Create the pool. myPool = [[NSAutoreleasePool alloc] init]; - - // Transform the app process. - SetUpProcessAsApplication(); }