Fix [#21689] for coordinate issue (y flipped) when setting mouse cursor position
authorDamien Plisson <damien.plisson@yahoo.fr>
Sun, 28 Mar 2010 19:42:08 +0000 (19:42 +0000)
committerDamien Plisson <damien.plisson@yahoo.fr>
Sun, 28 Mar 2010 19:42:08 +0000 (19:42 +0000)
Mem leak when using BGE fixed too.

intern/ghost/intern/GHOST_SystemCocoa.mm
source/blender/windowmanager/intern/wm_window.c

index 20d5cc7165add563c7b71fce7d65377aad9e98a8..b66b1e4033d96313744bd88d3a14318a96e345d8 100644 (file)
@@ -813,6 +813,7 @@ GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32
        GHOST_WindowCocoa* window = (GHOST_WindowCocoa*)m_windowManager->getActiveWindow();
        if (!window) return GHOST_kFailure;
 
+       NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        NSScreen *windowScreen = window->getScreen();
        NSRect screenRect = [windowScreen frame];
        
@@ -825,6 +826,7 @@ GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32
 
        CGDisplayMoveCursorToPoint((CGDirectDisplayID)[[[windowScreen deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue], CGPointMake(xf, yf));
 
+       [pool drain];
     return GHOST_kSuccess;
 }
 
index ea41f03d86470158ce153e005cef39cfac11cae9..150e6db35cb29428da582fd357727603eb5b1cdc 100644 (file)
@@ -1057,7 +1057,9 @@ void WM_cursor_warp(wmWindow *win, int x, int y)
        if (win && win->ghostwin) {
                int oldx=x, oldy=y;
 
+#if !defined(__APPLE__) || !defined(GHOST_COCOA)
                y= win->sizey -y - 1;
+#endif
                GHOST_ClientToScreen(win->ghostwin, x, y, &x, &y);
                GHOST_SetCursorPosition(g_system, x, y);