Fixed Mouse In/Out event and the internal state of SFOpenGLView when the window is resized

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1796 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
mantognini 2011-02-11 15:41:55 +00:00
parent f85a1794bc
commit 8675cb364c
2 changed files with 14 additions and 3 deletions

View File

@ -178,6 +178,17 @@ sf::Key::Code NonLocalizedKeys(unsigned short keycode);
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
-(void)frameDidChange:(NSNotification *)notification -(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. // Adapt tracking area for mouse mouse event.
[self removeTrackingRect:myTrackingTag]; [self removeTrackingRect:myTrackingTag];
myTrackingTag = [self addTrackingRect:[self frame] myTrackingTag = [self addTrackingRect:[self frame]

View File

@ -88,6 +88,9 @@ WindowImplCocoa::WindowImplCocoa(VideoMode mode,
{ {
SetUpPoolAndApplication(); SetUpPoolAndApplication();
// Transform the app process.
SetUpProcessAsApplication();
// Don't forget to update our parent (that is, WindowImpl) size : // Don't forget to update our parent (that is, WindowImpl) size :
myWidth = mode.Width; myWidth = mode.Width;
myHeight = mode.Height; myHeight = mode.Height;
@ -374,9 +377,6 @@ void WindowImplCocoa::SetUpPoolAndApplication(void)
// Create the pool. // Create the pool.
myPool = [[NSAutoreleasePool alloc] init]; myPool = [[NSAutoreleasePool alloc] init];
// Transform the app process.
SetUpProcessAsApplication();
} }