From a1eade38f42cdbda649ef38b2dd180aa73c9c8ab Mon Sep 17 00:00:00 2001 From: mantognini Date: Fri, 10 Dec 2010 14:50:29 +0000 Subject: [PATCH] -update old USE_OS_X_VERSION_10_* macros -fix setCursorPositionToX:Y: git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1752 4e206d99-4929-0410-ac5d-dfc041789085 --- src/SFML/Window/OSX/SFWindowController.h | 4 ++-- src/SFML/Window/OSX/SFWindowController.mm | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/SFML/Window/OSX/SFWindowController.h b/src/SFML/Window/OSX/SFWindowController.h index c229a2cd..7dfb6458 100644 --- a/src/SFML/Window/OSX/SFWindowController.h +++ b/src/SFML/Window/OSX/SFWindowController.h @@ -51,9 +51,9 @@ namespace sf { /// as handle to WindowImpl. //////////////////////////////////////////////////////////// -#ifdef USE_OS_X_VERSION_10_4 +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 // NSWindowDelegate is only define since 10.6 @interface SFWindowController : NSResponder { -#else /* USE_OS_X_VERSION_10_6 */ +#else @interface SFWindowController : NSResponder { #endif NSWindow* myWindow; diff --git a/src/SFML/Window/OSX/SFWindowController.mm b/src/SFML/Window/OSX/SFWindowController.mm index 1565f97d..c839c72c 100644 --- a/src/SFML/Window/OSX/SFWindowController.mm +++ b/src/SFML/Window/OSX/SFWindowController.mm @@ -109,7 +109,7 @@ backing:NSBackingStoreBuffered defer:NO]; /* - "YES" make some "invalid drawable". + "YES" produces some "invalid drawable". See http://www.cocoabuilder.com/archive/cocoa/152482-nsviews-and-nsopenglcontext-invalid-drawable-error.html [...] @@ -226,6 +226,11 @@ //////////////////////////////////////////////////////// -(void)setCursorPositionToX:(unsigned int)x Y:(unsigned int)y { + // Create a SFML event. + if (myRequester == 0) return; + + myRequester->MouseMovedAt(x, y); + // Flip for SFML window coordinate system y = NSHeight([myWindow frame]) - y; @@ -243,6 +248,12 @@ // Place the cursor. CGDisplayMoveCursorToPoint(screenNumber, CGPointMake(screenCoord.x, screenCoord.y)); + /* + CGDisplayMoveCursorToPoint -- Discussion : + + No events are generated as a result of this move. + Points that lie outside the desktop are clipped to the desktop. + */ }