Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Added preliminary touch code to SDL_cocoakeyboard.m
Browse files Browse the repository at this point in the history
  • Loading branch information
jimtla committed Jul 24, 2010
1 parent f656482 commit 333f0ff
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Xcode/SDL/SDL.xcodeproj/project.pbxproj
Expand Up @@ -874,6 +874,7 @@
0C5AF5FD01191D2B7F000001 /* SDL_version.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_version.h; path = ../../include/SDL_version.h; sourceTree = SOURCE_ROOT; };
0C5AF5FE01191D2B7F000001 /* SDL_video.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_video.h; path = ../../include/SDL_video.h; sourceTree = SOURCE_ROOT; };
0C5AF5FF01191D2B7F000001 /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL.h; path = ../../include/SDL.h; sourceTree = SOURCE_ROOT; };
8C93F0EA11F803710014F54D /* gestureSDLTest-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "gestureSDLTest-Info.plist"; sourceTree = "<group>"; };
8CB0A76A11F6A84800CBA2DE /* SDL_x11clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11clipboard.c; sourceTree = "<group>"; };
8CB0A76B11F6A84800CBA2DE /* SDL_x11clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11clipboard.h; sourceTree = "<group>"; };
8CB0A77611F6A87F00CBA2DE /* SDL_gesture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_gesture.h; path = ../../include/SDL_gesture.h; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -1591,6 +1592,7 @@
BECDF66B0761BA81005FE872 /* Info-Framework.plist */,
BEC562FE0761C0E800A33029 /* Linked Frameworks */,
00D8D9F11195090700638393 /* testsdl-Info.plist */,
8C93F0EA11F803710014F54D /* gestureSDLTest-Info.plist */,
);
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";
name = SDLFramework;
Expand Down
8 changes: 6 additions & 2 deletions src/video/cocoa/SDL_cocoaevents.m
Expand Up @@ -192,6 +192,9 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sende
if ( event == nil ) {
break;
}

//printf("Type: %i, Subtype: %i\n",[event type],[event subtype]);

switch ([event type]) {
case NSLeftMouseDown:
case NSOtherMouseDown:
Expand All @@ -203,6 +206,7 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sende
case NSRightMouseDragged:
case NSOtherMouseDragged: /* usually middle mouse dragged */
case NSMouseMoved:
printf("Mouse Type: %i, Subtype: %i\n",[event type],[event subtype]);
Cocoa_HandleMouseEvent(_this, event);
/* Pass through to NSApp to make sure everything stays in sync */
[NSApp sendEvent:event];
Expand All @@ -217,8 +221,8 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sende
if (([event modifierFlags] & NSCommandKeyMask) || [event type] == NSFlagsChanged)
[NSApp sendEvent: event];
break;
case NSBeginTouch:
printf("Touch Event Received\n");
case NSTabletPoint:
printf("Tablet Event Received\n");
default:
[NSApp sendEvent:event];
break;
Expand Down
30 changes: 30 additions & 0 deletions src/video/cocoa/SDL_cocoakeyboard.m
Expand Up @@ -31,6 +31,8 @@
//#define DEBUG_IME NSLog
#define DEBUG_IME

#define DEBUG_TOUCH NSLog

#ifndef NX_DEVICERCTLKEYMASK
#define NX_DEVICELCTLKEYMASK 0x00000001
#endif
Expand Down Expand Up @@ -191,6 +193,34 @@ - (NSArray *) validAttributesForMarkedText
return [NSArray array];
}

// Touch Code Begins -----------

- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self setAcceptsTouchEvents:YES];
[self setWantsRestingTouches:YES];
DEBUG_TOUCH(@"Initializing Cocoa Touch System....");
//DEBUG_TOUCH(@"Accepts Touch events? %@",[self acceptsTouchEvents]);
}
return self;
}

- (void)touchesBeganWithEvent:(NSEvent *)event {
DEBUG_TOUCH(@"Finger Down");
}
- (void)touchesMovedWithEvent:(NSEvent *)event {
DEBUG_TOUCH(@"Finger Moved");
}
- (void)touchesEndedWithEvent:(NSEvent *)event {
DEBUG_TOUCH(@"Finger Up");
}
- (void)touchesCancelledWithEvent:(NSEvent *)event {
DEBUG_TOUCH(@"Finger Cancelled");
}

//Touch Code Ends --------------


@end

/* This is the original behavior, before support was added for
Expand Down
7 changes: 2 additions & 5 deletions touchTest/makefile
@@ -1,9 +1,6 @@
SDLTest : touchSimp.c touchPong.c
gcc gestureSDLTest.c -o gestureSDLTest `sdl-config --cflags --libs` -g
gcc gestureTest.c -o gestureTest `sdl-config --cflags --libs` -g
gcc touchTest.c -o touchTest `sdl-config --cflags --libs` -g
gcc touchSimp.c -o touchSimp `sdl-config --cflags --libs` -g
gcc touchPong.c -o touchPong `sdl-config --cflags --libs` -g
gcc parseDevicesTest.c -o parseDevicesTest -g




8 changes: 7 additions & 1 deletion touchTest/makefile~
@@ -1,3 +1,9 @@
SDLTest : touchSimp.c touchPong.c
gcc touchSimp.c -o touchSimp `sdl-config --cflags --libs` -gSDLTest :
gcc gestureSDLTest.c -o gestureSDLTest `sdl-config --cflags --libs` -g
gcc gestureTest.c -o gestureTest `sdl-config --cflags --libs` -g
gcc touchTest.c -o touchTest `sdl-config --cflags --libs` -g
gcc touchSimp.c -o touchSimp `sdl-config --cflags --libs` -g
gcc touchPong.c -o touchPong `sdl-config --cflags --libs` -g
gcc parseDevicesTest.c -o parseDevicesTest -g


0 comments on commit 333f0ff

Please sign in to comment.