Added preliminary touch code to SDL_cocoakeyboard.m
authorjimtla
Sat, 24 Jul 2010 22:28:38 +0400
changeset 4670ad4f32e874ee
parent 4669 62e6a6e9720b
child 4671 1f0e8f6417d9
Added preliminary touch code to SDL_cocoakeyboard.m
Xcode/SDL/SDL.xcodeproj/project.pbxproj
src/video/cocoa/SDL_cocoaevents.m
src/video/cocoa/SDL_cocoakeyboard.m
touchTest/makefile
touchTest/makefile~
     1.1 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Thu Jul 22 08:12:28 2010 +0400
     1.2 +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Sat Jul 24 22:28:38 2010 +0400
     1.3 @@ -874,6 +874,7 @@
     1.4  		0C5AF5FD01191D2B7F000001 /* SDL_version.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_version.h; path = ../../include/SDL_version.h; sourceTree = SOURCE_ROOT; };
     1.5  		0C5AF5FE01191D2B7F000001 /* SDL_video.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_video.h; path = ../../include/SDL_video.h; sourceTree = SOURCE_ROOT; };
     1.6  		0C5AF5FF01191D2B7F000001 /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL.h; path = ../../include/SDL.h; sourceTree = SOURCE_ROOT; };
     1.7 +		8C93F0EA11F803710014F54D /* gestureSDLTest-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "gestureSDLTest-Info.plist"; sourceTree = "<group>"; };
     1.8  		8CB0A76A11F6A84800CBA2DE /* SDL_x11clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11clipboard.c; sourceTree = "<group>"; };
     1.9  		8CB0A76B11F6A84800CBA2DE /* SDL_x11clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11clipboard.h; sourceTree = "<group>"; };
    1.10  		8CB0A77611F6A87F00CBA2DE /* SDL_gesture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_gesture.h; path = ../../include/SDL_gesture.h; sourceTree = SOURCE_ROOT; };
    1.11 @@ -1591,6 +1592,7 @@
    1.12  				BECDF66B0761BA81005FE872 /* Info-Framework.plist */,
    1.13  				BEC562FE0761C0E800A33029 /* Linked Frameworks */,
    1.14  				00D8D9F11195090700638393 /* testsdl-Info.plist */,
    1.15 +				8C93F0EA11F803710014F54D /* gestureSDLTest-Info.plist */,
    1.16  			);
    1.17  			comments = "To build Universal Binaries, we have experimented with a variety of different options.\nThe complication is that we must retain compatibility with at least 10.2. \nThe Universal Binary defaults only work for > 10.3.9\n\nSo far, we have found:\ngcc 4.0.0 with Xcode 2.1 always links against libgcc_s. gcc 4.0.1 from Xcode 2.2 fixes this problem.\n\nBut gcc 4.0 will not work with < 10.3.9 because we continue to get an undefined symbol to _fprintf$LDBL128.\nSo we must use gcc 3.3 on PPC to accomplish 10.2 support. (But 4.0 is required for i386.)\n\nSetting the deployment target to 10.4 will disable prebinding, so for PPC, we set it less than 10.4 to preserve prebinding for legacy support.\n\nSetting the PPC SDKROOT to /Developers/SDKs/MacOSX10.2.8.sdk will link to 63.0.0 libSystem.B.dylib. Leaving it at current or 10.4u links to 88.1.2. However, as long as we are using gcc 3.3, it doesn't seem to matter as testing has demonstrated both will run. We have decided not to invoke the 10.2.8 SDK because it is not a default installed component with Xcode which will probably cause most people problems. However, rather than deleting the SDKROOT_ppc entry entirely, we have mapped it to 10.4u in case we decide we need to change this setting.\n\nTo use Altivec or SSE, we needed architecture specific flags:\nOTHER_CFLAGS_ppc\nOTHER_CFLAGS_i386\nOTHER_CFLAGS=$(OTHER_CFLAGS_($CURRENT_ARCH))\n\nThe general OTHER_CFLAGS needed to be manually mapped to architecture specific options because Xcode didn't do this automatically for us.\n\n\n";
    1.18  			name = SDLFramework;
     2.1 --- a/src/video/cocoa/SDL_cocoaevents.m	Thu Jul 22 08:12:28 2010 +0400
     2.2 +++ b/src/video/cocoa/SDL_cocoaevents.m	Sat Jul 24 22:28:38 2010 +0400
     2.3 @@ -192,6 +192,9 @@
     2.4          if ( event == nil ) {
     2.5              break;
     2.6          }
     2.7 +		
     2.8 +	//printf("Type: %i, Subtype: %i\n",[event type],[event subtype]);
     2.9 +		
    2.10          switch ([event type]) {
    2.11          case NSLeftMouseDown:
    2.12          case NSOtherMouseDown:
    2.13 @@ -203,6 +206,7 @@
    2.14          case NSRightMouseDragged:
    2.15          case NSOtherMouseDragged: /* usually middle mouse dragged */
    2.16          case NSMouseMoved:
    2.17 +	  printf("Mouse Type: %i, Subtype: %i\n",[event type],[event subtype]);
    2.18              Cocoa_HandleMouseEvent(_this, event);
    2.19              /* Pass through to NSApp to make sure everything stays in sync */
    2.20              [NSApp sendEvent:event];
    2.21 @@ -217,8 +221,8 @@
    2.22              if (([event modifierFlags] & NSCommandKeyMask) || [event type] == NSFlagsChanged)
    2.23                 [NSApp sendEvent: event];
    2.24              break;
    2.25 -		case NSBeginTouch:
    2.26 -			printf("Touch Event Received\n");
    2.27 +	case NSTabletPoint:
    2.28 +	  printf("Tablet Event Received\n");
    2.29          default:
    2.30              [NSApp sendEvent:event];
    2.31              break;
     3.1 --- a/src/video/cocoa/SDL_cocoakeyboard.m	Thu Jul 22 08:12:28 2010 +0400
     3.2 +++ b/src/video/cocoa/SDL_cocoakeyboard.m	Sat Jul 24 22:28:38 2010 +0400
     3.3 @@ -31,6 +31,8 @@
     3.4  //#define DEBUG_IME NSLog
     3.5  #define DEBUG_IME
     3.6  
     3.7 +#define DEBUG_TOUCH NSLog
     3.8 +
     3.9  #ifndef NX_DEVICERCTLKEYMASK
    3.10      #define NX_DEVICELCTLKEYMASK    0x00000001
    3.11  #endif
    3.12 @@ -191,6 +193,34 @@
    3.13      return [NSArray array];
    3.14  }
    3.15  
    3.16 +// Touch Code Begins -----------
    3.17 +
    3.18 +- (id)initWithFrame:(CGRect)frame {
    3.19 +  if (self = [super initWithFrame:frame]) {
    3.20 +    [self setAcceptsTouchEvents:YES];
    3.21 +    [self setWantsRestingTouches:YES];
    3.22 +    DEBUG_TOUCH(@"Initializing Cocoa Touch System....");
    3.23 +    //DEBUG_TOUCH(@"Accepts Touch events? %@",[self acceptsTouchEvents]);
    3.24 +  }
    3.25 +  return self;
    3.26 +}
    3.27 +
    3.28 +- (void)touchesBeganWithEvent:(NSEvent *)event {
    3.29 +  DEBUG_TOUCH(@"Finger Down");
    3.30 +}
    3.31 +- (void)touchesMovedWithEvent:(NSEvent *)event {
    3.32 +  DEBUG_TOUCH(@"Finger Moved");
    3.33 +}
    3.34 +- (void)touchesEndedWithEvent:(NSEvent *)event {
    3.35 +  DEBUG_TOUCH(@"Finger Up");
    3.36 +}
    3.37 +- (void)touchesCancelledWithEvent:(NSEvent *)event {
    3.38 +  DEBUG_TOUCH(@"Finger Cancelled");
    3.39 +}
    3.40 +
    3.41 +//Touch Code Ends --------------
    3.42 +
    3.43 +
    3.44  @end
    3.45  
    3.46  /* This is the original behavior, before support was added for 
     4.1 --- a/touchTest/makefile	Thu Jul 22 08:12:28 2010 +0400
     4.2 +++ b/touchTest/makefile	Sat Jul 24 22:28:38 2010 +0400
     4.3 @@ -1,9 +1,6 @@
     4.4  SDLTest : touchSimp.c touchPong.c
     4.5  	gcc gestureSDLTest.c -o gestureSDLTest `sdl-config --cflags --libs` -g
     4.6 -	gcc gestureTest.c -o gestureTest `sdl-config --cflags --libs` -g
     4.7 -	gcc touchTest.c -o touchTest `sdl-config --cflags --libs` -g		
     4.8 -	gcc touchSimp.c -o touchSimp `sdl-config --cflags --libs` -g
     4.9 -	gcc touchPong.c -o touchPong `sdl-config --cflags --libs` -g
    4.10 -	gcc parseDevicesTest.c -o parseDevicesTest -g
    4.11  
    4.12  
    4.13 +
    4.14 +
     5.1 --- a/touchTest/makefile~	Thu Jul 22 08:12:28 2010 +0400
     5.2 +++ b/touchTest/makefile~	Sat Jul 24 22:28:38 2010 +0400
     5.3 @@ -1,3 +1,9 @@
     5.4  SDLTest : touchSimp.c touchPong.c
     5.5 -	gcc touchSimp.c -o touchSimp `sdl-config --cflags --libs` -gSDLTest : 
     5.6 +	gcc gestureSDLTest.c -o gestureSDLTest `sdl-config --cflags --libs` -g
     5.7 +	gcc gestureTest.c -o gestureTest `sdl-config --cflags --libs` -g
     5.8 +	gcc touchTest.c -o touchTest `sdl-config --cflags --libs` -g		
     5.9 +	gcc touchSimp.c -o touchSimp `sdl-config --cflags --libs` -g
    5.10  	gcc touchPong.c -o touchPong `sdl-config --cflags --libs` -g
    5.11 +	gcc parseDevicesTest.c -o parseDevicesTest -g
    5.12 +
    5.13 +