comparison src/video/cocoa/SDL_cocoaevents.m @ 4670:ad4f32e874ee

Added preliminary touch code to SDL_cocoakeyboard.m
author jimtla
date Sat, 24 Jul 2010 22:28:38 +0400
parents 62e6a6e9720b
children c0021a587dc7
comparison
equal deleted inserted replaced
4669:62e6a6e9720b 4670:ad4f32e874ee
190 while ([NSApp isRunning]) { 190 while ([NSApp isRunning]) {
191 NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; 191 NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ];
192 if ( event == nil ) { 192 if ( event == nil ) {
193 break; 193 break;
194 } 194 }
195
196 //printf("Type: %i, Subtype: %i\n",[event type],[event subtype]);
197
195 switch ([event type]) { 198 switch ([event type]) {
196 case NSLeftMouseDown: 199 case NSLeftMouseDown:
197 case NSOtherMouseDown: 200 case NSOtherMouseDown:
198 case NSRightMouseDown: 201 case NSRightMouseDown:
199 case NSLeftMouseUp: 202 case NSLeftMouseUp:
201 case NSRightMouseUp: 204 case NSRightMouseUp:
202 case NSLeftMouseDragged: 205 case NSLeftMouseDragged:
203 case NSRightMouseDragged: 206 case NSRightMouseDragged:
204 case NSOtherMouseDragged: /* usually middle mouse dragged */ 207 case NSOtherMouseDragged: /* usually middle mouse dragged */
205 case NSMouseMoved: 208 case NSMouseMoved:
209 printf("Mouse Type: %i, Subtype: %i\n",[event type],[event subtype]);
206 Cocoa_HandleMouseEvent(_this, event); 210 Cocoa_HandleMouseEvent(_this, event);
207 /* Pass through to NSApp to make sure everything stays in sync */ 211 /* Pass through to NSApp to make sure everything stays in sync */
208 [NSApp sendEvent:event]; 212 [NSApp sendEvent:event];
209 break; 213 break;
210 case NSKeyDown: 214 case NSKeyDown:
215 219
216 /* Add to support system-wide keyboard shortcuts like CMD+Space */ 220 /* Add to support system-wide keyboard shortcuts like CMD+Space */
217 if (([event modifierFlags] & NSCommandKeyMask) || [event type] == NSFlagsChanged) 221 if (([event modifierFlags] & NSCommandKeyMask) || [event type] == NSFlagsChanged)
218 [NSApp sendEvent: event]; 222 [NSApp sendEvent: event];
219 break; 223 break;
220 case NSBeginTouch: 224 case NSTabletPoint:
221 printf("Touch Event Received\n"); 225 printf("Tablet Event Received\n");
222 default: 226 default:
223 [NSApp sendEvent:event]; 227 [NSApp sendEvent:event];
224 break; 228 break;
225 } 229 }
226 } 230 }