zenilib: zenilib/jni/external/sdl/src/video/cocoa/SDL_cocoakeyboard.m Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_cocoakeyboard.m
Go to the documentation of this file.
1 /*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20 */
21 #include "SDL_config.h"
22
23 #if SDL_VIDEO_DRIVER_COCOA
24
25 #include "SDL_cocoavideo.h"
26
27 #include "../../events/SDL_keyboard_c.h"
28 #include "../../events/scancodes_darwin.h"
29
30 #include <Carbon/Carbon.h>
31
32 /*#define DEBUG_IME NSLog */
33 #define DEBUG_IME(...)
34
35 #ifndef NX_DEVICERCTLKEYMASK
36 #define NX_DEVICELCTLKEYMASK 0x00000001
37 #endif
38 #ifndef NX_DEVICELSHIFTKEYMASK
39 #define NX_DEVICELSHIFTKEYMASK 0x00000002
40 #endif
41 #ifndef NX_DEVICERSHIFTKEYMASK
42 #define NX_DEVICERSHIFTKEYMASK 0x00000004
43 #endif
44 #ifndef NX_DEVICELCMDKEYMASK
45 #define NX_DEVICELCMDKEYMASK 0x00000008
46 #endif
47 #ifndef NX_DEVICERCMDKEYMASK
48 #define NX_DEVICERCMDKEYMASK 0x00000010
49 #endif
50 #ifndef NX_DEVICELALTKEYMASK
51 #define NX_DEVICELALTKEYMASK 0x00000020
52 #endif
53 #ifndef NX_DEVICERALTKEYMASK
54 #define NX_DEVICERALTKEYMASK 0x00000040
55 #endif
56 #ifndef NX_DEVICERCTLKEYMASK
57 #define NX_DEVICERCTLKEYMASK 0x00002000
58 #endif
59
60 @interface SDLTranslatorResponder : NSView <NSTextInput>
61 {
62 NSString *_markedText;
63 NSRange _markedRange;
64 NSRange _selectedRange;
65 SDL_Rect _inputRect;
66 }
67 - (void) doCommandBySelector:(SEL)myselector;
68 - (void) setInputRect:(SDL_Rect *) rect;
69 @end
70
71 @implementation SDLTranslatorResponder
72
73 - (void) setInputRect:(SDL_Rect *) rect
74 {
75 _inputRect = *rect;
76 }
77
78 - (void) insertText:(id) aString
79 {
80 const char *str;
81
82 DEBUG_IME(@"insertText: %@", aString);
83
84 /* Could be NSString or NSAttributedString, so we have
85 * to test and convert it before return as SDL event */
86 if ([aString isKindOfClass: [NSAttributedString class]])
87 str = [[aString string] UTF8String];
88 else
89 str = [aString UTF8String];
90
91 SDL_SendKeyboardText(str);
92 }
93
94 - (void) doCommandBySelector:(SEL) myselector
95 {
96 /* No need to do anything since we are not using Cocoa
97 selectors to handle special keys, instead we use SDL
98 key events to do the same job.
99 */
100 }
101
102 - (BOOL) hasMarkedText
103 {
104 return _markedText != nil;
105 }
106
107 - (NSRange) markedRange
108 {
109 return _markedRange;
110 }
111
112 - (NSRange) selectedRange
113 {
114 return _selectedRange;
115 }
116
117 - (void) setMarkedText:(id) aString
118 selectedRange:(NSRange) selRange
119 {
120 if ([aString isKindOfClass: [NSAttributedString class]])
121 aString = [aString string];
122
123 if ([aString length] == 0)
124 {
125 [self unmarkText];
126 return;
127 }
128
129 if (_markedText != aString)
130 {
131 [_markedText release];
132 _markedText = [aString retain];
133 }
134
135 _selectedRange = selRange;
136 _markedRange = NSMakeRange(0, [aString length]);
137
138 SDL_SendEditingText([aString UTF8String],
139 selRange.location, selRange.length);
140
141 DEBUG_IME(@"setMarkedText: %@, (%d, %d)", _markedText,
142 selRange.location, selRange.length);
143 }
144
145 - (void) unmarkText
146 {
147 [_markedText release];
148 _markedText = nil;
149
150 SDL_SendEditingText("", 0, 0);
151 }
152
153 - (NSRect) firstRectForCharacterRange: (NSRange) theRange
154 {
155 NSWindow *window = [self window];
156 NSRect contentRect = [window contentRectForFrameRect: [window frame]];
157 float windowHeight = contentRect.size.height;
158 NSRect rect = NSMakeRect(_inputRect.x, windowHeight - _inputRect.y - _inputRect.h,
159 _inputRect.w, _inputRect.h);
160
161 DEBUG_IME(@"firstRectForCharacterRange: (%d, %d): windowHeight = %g, rect = %@",
162 theRange.location, theRange.length, windowHeight,
163 NSStringFromRect(rect));
164 rect.origin = [[self window] convertBaseToScreen: rect.origin];
165
166 return rect;
167 }
168
169 - (NSAttributedString *) attributedSubstringFromRange: (NSRange) theRange
170 {
171 DEBUG_IME(@"attributedSubstringFromRange: (%d, %d)", theRange.location, theRange.length);
172 return nil;
173 }
174
175 - (NSInteger) conversationIdentifier
176 {
177 return (NSInteger) self;
178 }
179
180 /* This method returns the index for character that is
181 * nearest to thePoint. thPoint is in screen coordinate system.
182 */
183 - (NSUInteger) characterIndexForPoint:(NSPoint) thePoint
184 {
185 DEBUG_IME(@"characterIndexForPoint: (%g, %g)", thePoint.x, thePoint.y);
186 return 0;
187 }
188
189 /* This method is the key to attribute extension.
190 * We could add new attributes through this method.
191 * NSInputServer examines the return value of this
192 * method & constructs appropriate attributed string.
193 */
194 - (NSArray *) validAttributesForMarkedText
195 {
196 return [NSArray array];
197 }
198
199 @end
200
201 /* This is the original behavior, before support was added for
202 * differentiating between left and right versions of the keys.
203 */
204 static void
205 DoUnsidedModifiers(unsigned short scancode,
206 unsigned int oldMods, unsigned int newMods)
207 {
208 const int mapping[] = {
209 SDL_SCANCODE_CAPSLOCK,
210 SDL_SCANCODE_LSHIFT,
211 SDL_SCANCODE_LCTRL,
212 SDL_SCANCODE_LALT,
213 SDL_SCANCODE_LGUI
214 };
215 unsigned int i, bit;
216
217 /* Iterate through the bits, testing each against the current modifiers */
218 for (i = 0, bit = NSAlphaShiftKeyMask; bit <= NSCommandKeyMask; bit <<= 1, ++i) {
219 unsigned int oldMask, newMask;
220
221 oldMask = oldMods & bit;
222 newMask = newMods & bit;
223
224 if (oldMask && oldMask != newMask) { /* modifier up event */
225 /* If this was Caps Lock, we need some additional voodoo to make SDL happy */
226 if (bit == NSAlphaShiftKeyMask) {
227 SDL_SendKeyboardKey(SDL_PRESSED, mapping[i]);
228 }
229 SDL_SendKeyboardKey(SDL_RELEASED, mapping[i]);
230 } else if (newMask && oldMask != newMask) { /* modifier down event */
231 SDL_SendKeyboardKey(SDL_PRESSED, mapping[i]);
232 /* If this was Caps Lock, we need some additional voodoo to make SDL happy */
233 if (bit == NSAlphaShiftKeyMask) {
234 SDL_SendKeyboardKey(SDL_RELEASED, mapping[i]);
235 }
236 }
237 }
238 }
239
240 /* This is a helper function for HandleModifierSide. This
241 * function reverts back to behavior before the distinction between
242 * sides was made.
243 */
244 static void
245 HandleNonDeviceModifier(unsigned int device_independent_mask,
246 unsigned int oldMods,
247 unsigned int newMods,
248 SDL_Scancode scancode)
249 {
250 unsigned int oldMask, newMask;
251
252 /* Isolate just the bits we care about in the depedent bits so we can
253 * figure out what changed
254 */
255 oldMask = oldMods & device_independent_mask;
256 newMask = newMods & device_independent_mask;
257
258 if (oldMask && oldMask != newMask) {
259 SDL_SendKeyboardKey(SDL_RELEASED, scancode);
260 } else if (newMask && oldMask != newMask) {
261 SDL_SendKeyboardKey(SDL_PRESSED, scancode);
262 }
263 }
264
265 /* This is a helper function for HandleModifierSide.
266 * This function sets the actual SDL_PrivateKeyboard event.
267 */
268 static void
269 HandleModifierOneSide(unsigned int oldMods, unsigned int newMods,
270 SDL_Scancode scancode,
271 unsigned int sided_device_dependent_mask)
272 {
273 unsigned int old_dep_mask, new_dep_mask;
274
275 /* Isolate just the bits we care about in the depedent bits so we can
276 * figure out what changed
277 */
278 old_dep_mask = oldMods & sided_device_dependent_mask;
279 new_dep_mask = newMods & sided_device_dependent_mask;
280
281 /* We now know that this side bit flipped. But we don't know if
282 * it went pressed to released or released to pressed, so we must
283 * find out which it is.
284 */
285 if (new_dep_mask && old_dep_mask != new_dep_mask) {
286 SDL_SendKeyboardKey(SDL_PRESSED, scancode);
287 } else {
288 SDL_SendKeyboardKey(SDL_RELEASED, scancode);
289 }
290 }
291
292 /* This is a helper function for DoSidedModifiers.
293 * This function will figure out if the modifier key is the left or right side,
294 * e.g. left-shift vs right-shift.
295 */
296 static void
297 HandleModifierSide(int device_independent_mask,
298 unsigned int oldMods, unsigned int newMods,
299 SDL_Scancode left_scancode,
300 SDL_Scancode right_scancode,
301 unsigned int left_device_dependent_mask,
302 unsigned int right_device_dependent_mask)
303 {
304 unsigned int device_dependent_mask = (left_device_dependent_mask |
305 right_device_dependent_mask);
306 unsigned int diff_mod;
307
308 /* On the basis that the device independent mask is set, but there are
309 * no device dependent flags set, we'll assume that we can't detect this
310 * keyboard and revert to the unsided behavior.
311 */
312 if ((device_dependent_mask & newMods) == 0) {
313 /* Revert to the old behavior */
314 HandleNonDeviceModifier(device_independent_mask, oldMods, newMods, left_scancode);
315 return;
316 }
317
318 /* XOR the previous state against the new state to see if there's a change */
319 diff_mod = (device_dependent_mask & oldMods) ^
320 (device_dependent_mask & newMods);
321 if (diff_mod) {
322 /* A change in state was found. Isolate the left and right bits
323 * to handle them separately just in case the values can simulataneously
324 * change or if the bits don't both exist.
325 */
326 if (left_device_dependent_mask & diff_mod) {
327 HandleModifierOneSide(oldMods, newMods, left_scancode, left_device_dependent_mask);
328 }
329 if (right_device_dependent_mask & diff_mod) {
330 HandleModifierOneSide(oldMods, newMods, right_scancode, right_device_dependent_mask);
331 }
332 }
333 }
334
335 /* This is a helper function for DoSidedModifiers.
336 * This function will release a key press in the case that
337 * it is clear that the modifier has been released (i.e. one side
338 * can't still be down).
339 */
340 static void
341 ReleaseModifierSide(unsigned int device_independent_mask,
342 unsigned int oldMods, unsigned int newMods,
343 SDL_Scancode left_scancode,
344 SDL_Scancode right_scancode,
345 unsigned int left_device_dependent_mask,
346 unsigned int right_device_dependent_mask)
347 {
348 unsigned int device_dependent_mask = (left_device_dependent_mask |
349 right_device_dependent_mask);
350
351 /* On the basis that the device independent mask is set, but there are
352 * no device dependent flags set, we'll assume that we can't detect this
353 * keyboard and revert to the unsided behavior.
354 */
355 if ((device_dependent_mask & oldMods) == 0) {
356 /* In this case, we can't detect the keyboard, so use the left side
357 * to represent both, and release it.
358 */
359 SDL_SendKeyboardKey(SDL_RELEASED, left_scancode);
360 return;
361 }
362
363 /*
364 * This could have been done in an if-else case because at this point,
365 * we know that all keys have been released when calling this function.
366 * But I'm being paranoid so I want to handle each separately,
367 * so I hope this doesn't cause other problems.
368 */
369 if ( left_device_dependent_mask & oldMods ) {
370 SDL_SendKeyboardKey(SDL_RELEASED, left_scancode);
371 }
372 if ( right_device_dependent_mask & oldMods ) {
373 SDL_SendKeyboardKey(SDL_RELEASED, right_scancode);
374 }
375 }
376
377 /* This is a helper function for DoSidedModifiers.
378 * This function handles the CapsLock case.
379 */
380 static void
381 HandleCapsLock(unsigned short scancode,
382 unsigned int oldMods, unsigned int newMods)
383 {
384 unsigned int oldMask, newMask;
385
386 oldMask = oldMods & NSAlphaShiftKeyMask;
387 newMask = newMods & NSAlphaShiftKeyMask;
388
389 if (oldMask != newMask) {
390 SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_CAPSLOCK);
391 SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_CAPSLOCK);
392 }
393 }
394
395 /* This function will handle the modifier keys and also determine the
396 * correct side of the key.
397 */
398 static void
399 DoSidedModifiers(unsigned short scancode,
400 unsigned int oldMods, unsigned int newMods)
401 {
402 /* Set up arrays for the key syms for the left and right side. */
403 const SDL_Scancode left_mapping[] = {
404 SDL_SCANCODE_LSHIFT,
405 SDL_SCANCODE_LCTRL,
406 SDL_SCANCODE_LALT,
407 SDL_SCANCODE_LGUI
408 };
409 const SDL_Scancode right_mapping[] = {
410 SDL_SCANCODE_RSHIFT,
411 SDL_SCANCODE_RCTRL,
412 SDL_SCANCODE_RALT,
413 SDL_SCANCODE_RGUI
414 };
415 /* Set up arrays for the device dependent masks with indices that
416 * correspond to the _mapping arrays
417 */
418 const unsigned int left_device_mapping[] = { NX_DEVICELSHIFTKEYMASK, NX_DEVICELCTLKEYMASK, NX_DEVICELALTKEYMASK, NX_DEVICELCMDKEYMASK };
419 const unsigned int right_device_mapping[] = { NX_DEVICERSHIFTKEYMASK, NX_DEVICERCTLKEYMASK, NX_DEVICERALTKEYMASK, NX_DEVICERCMDKEYMASK };
420
421 unsigned int i, bit;
422
423 /* Handle CAPSLOCK separately because it doesn't have a left/right side */
424 HandleCapsLock(scancode, oldMods, newMods);
425
426 /* Iterate through the bits, testing each against the old modifiers */
427 for (i = 0, bit = NSShiftKeyMask; bit <= NSCommandKeyMask; bit <<= 1, ++i) {
428 unsigned int oldMask, newMask;
429
430 oldMask = oldMods & bit;
431 newMask = newMods & bit;
432
433 /* If the bit is set, we must always examine it because the left
434 * and right side keys may alternate or both may be pressed.
435 */
436 if (newMask) {
437 HandleModifierSide(bit, oldMods, newMods,
438 left_mapping[i], right_mapping[i],
439 left_device_mapping[i], right_device_mapping[i]);
440 }
441 /* If the state changed from pressed to unpressed, we must examine
442 * the device dependent bits to release the correct keys.
443 */
444 else if (oldMask && oldMask != newMask) {
445 ReleaseModifierSide(bit, oldMods, newMods,
446 left_mapping[i], right_mapping[i],
447 left_device_mapping[i], right_device_mapping[i]);
448 }
449 }
450 }
451
452 static void
453 HandleModifiers(_THIS, unsigned short scancode, unsigned int modifierFlags)
454 {
455 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
456
457 if (modifierFlags == data->modifierFlags) {
458 return;
459 }
460
461 /*
462 * Starting with Panther (10.3.0), the ability to distinguish between
463 * left side and right side modifiers is available.
464 */
465 if (data->osversion >= 0x1030) {
466 DoSidedModifiers(scancode, data->modifierFlags, modifierFlags);
467 } else {
468 DoUnsidedModifiers(scancode, data->modifierFlags, modifierFlags);
469 }
470 data->modifierFlags = modifierFlags;
471 }
472
473 static void
474 UpdateKeymap(SDL_VideoData *data)
475 {
476 TISInputSourceRef key_layout;
477 const void *chr_data;
478 int i;
479 SDL_Scancode scancode;
480 SDL_Keycode keymap[SDL_NUM_SCANCODES];
481
482 /* See if the keymap needs to be updated */
483 key_layout = TISCopyCurrentKeyboardLayoutInputSource();
484 if (key_layout == data->key_layout) {
485 return;
486 }
487 data->key_layout = key_layout;
488
489 SDL_GetDefaultKeymap(keymap);
490
491 /* Try Unicode data first */
492 CFDataRef uchrDataRef = TISGetInputSourceProperty(key_layout, kTISPropertyUnicodeKeyLayoutData);
493 if (uchrDataRef)
494 chr_data = CFDataGetBytePtr(uchrDataRef);
495 else
496 goto cleanup;
497
498 if (chr_data) {
499 UInt32 keyboard_type = LMGetKbdType();
500 OSStatus err;
501
502 for (i = 0; i < SDL_arraysize(darwin_scancode_table); i++) {
503 UniChar s[8];
504 UniCharCount len;
505 UInt32 dead_key_state;
506
507 /* Make sure this scancode is a valid character scancode */
508 scancode = darwin_scancode_table[i];
509 if (scancode == SDL_SCANCODE_UNKNOWN ||
510 (keymap[scancode] & SDLK_SCANCODE_MASK)) {
511 continue;
512 }
513
514 dead_key_state = 0;
515 err = UCKeyTranslate ((UCKeyboardLayout *) chr_data,
516 i, kUCKeyActionDown,
517 0, keyboard_type,
518 kUCKeyTranslateNoDeadKeysMask,
519 &dead_key_state, 8, &len, s);
520 if (err != noErr)
521 continue;
522
523 if (len > 0 && s[0] != 0x10) {
524 keymap[scancode] = s[0];
525 }
526 }
527 SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
528 return;
529 }
530
531 cleanup:
532 CFRelease(key_layout);
533 }
534
535 void
536 Cocoa_InitKeyboard(_THIS)
537 {
538 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
539
540 UpdateKeymap(data);
541
542 /* Set our own names for the platform-dependent but layout-independent keys */
543 /* This key is NumLock on the MacBook keyboard. :) */
544 /*SDL_SetScancodeName(SDL_SCANCODE_NUMLOCKCLEAR, "Clear");*/
545 SDL_SetScancodeName(SDL_SCANCODE_LALT, "Left Option");
546 SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Command");
547 SDL_SetScancodeName(SDL_SCANCODE_RALT, "Right Option");
548 SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command");
549 }
550
551 void
552 Cocoa_StartTextInput(_THIS)
553 {
554 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
555 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
556 NSView *parentView = [[NSApp keyWindow] contentView];
557
558 /* We only keep one field editor per process, since only the front most
559 * window can receive text input events, so it make no sense to keep more
560 * than one copy. When we switched to another window and requesting for
561 * text input, simply remove the field editor from its superview then add
562 * it to the front most window's content view */
563 if (!data->fieldEdit) {
564 data->fieldEdit =
565 [[SDLTranslatorResponder alloc] initWithFrame: NSMakeRect(0.0, 0.0, 0.0, 0.0)];
566 }
567
568 if (![[data->fieldEdit superview] isEqual: parentView])
569 {
570 /* DEBUG_IME(@"add fieldEdit to window contentView"); */
571 [data->fieldEdit removeFromSuperview];
572 [parentView addSubview: data->fieldEdit];
573 [[NSApp keyWindow] makeFirstResponder: data->fieldEdit];
574 }
575
576 [pool release];
577 }
578
579 void
580 Cocoa_StopTextInput(_THIS)
581 {
582 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
583
584 if (data && data->fieldEdit) {
585 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
586 [data->fieldEdit removeFromSuperview];
587 [data->fieldEdit release];
588 data->fieldEdit = nil;
589 [pool release];
590 }
591 }
592
593 void
594 Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect)
595 {
596 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
597
598 if (!rect) {
599 SDL_InvalidParamError("rect");
600 return;
601 }
602
603 [data->fieldEdit setInputRect: rect];
604 }
605
606 void
607 Cocoa_HandleKeyEvent(_THIS, NSEvent *event)
608 {
609 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
610 unsigned short scancode = [event keyCode];
611 SDL_Scancode code;
612 #if 0
613 const char *text;
614 #endif
615
616 if ((scancode == 10 || scancode == 50) && KBGetLayoutType(LMGetKbdType()) == kKeyboardISO) {
617 /* see comments in SDL_cocoakeys.h */
618 scancode = 60 - scancode;
619 }
620 if (scancode < SDL_arraysize(darwin_scancode_table)) {
621 code = darwin_scancode_table[scancode];
622 }
623 else {
624 /* Hmm, does this ever happen? If so, need to extend the keymap... */
625 code = SDL_SCANCODE_UNKNOWN;
626 }
627
628 switch ([event type]) {
629 case NSKeyDown:
630 if (![event isARepeat]) {
631 /* See if we need to rebuild the keyboard layout */
632 UpdateKeymap(data);
633 }
634
635 SDL_SendKeyboardKey(SDL_PRESSED, code);
636 #if 1
637 if (code == SDL_SCANCODE_UNKNOWN) {
638 fprintf(stderr, "The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL mailing list <sdl@libsdl.org> or to Christian Walther <cwalther@gmx.ch>. Mac virtual key code is %d.\n", scancode);
639 }
640 #endif
641 if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
642 /* FIXME CW 2007-08-16: only send those events to the field editor for which we actually want text events, not e.g. esc or function keys. Arrow keys in particular seem to produce crashes sometimes. */
643 [data->fieldEdit interpretKeyEvents:[NSArray arrayWithObject:event]];
644 #if 0
645 text = [[event characters] UTF8String];
646 if(text && *text) {
647 SDL_SendKeyboardText(text);
648 [data->fieldEdit setString:@""];
649 }
650 #endif
651 }
652 break;
653 case NSKeyUp:
654 SDL_SendKeyboardKey(SDL_RELEASED, code);
655 break;
656 case NSFlagsChanged:
657 /* FIXME CW 2007-08-14: check if this whole mess that takes up half of this file is really necessary */
658 HandleModifiers(_this, scancode, [event modifierFlags]);
659 break;
660 default: /* just to avoid compiler warnings */
661 break;
662 }
663 }
664
665 void
666 Cocoa_QuitKeyboard(_THIS)
667 {
668 }
669
670 #endif /* SDL_VIDEO_DRIVER_COCOA */
671
672 /* vi: set ts=4 sw=4 expandtab: */
SDL_GetDefaultKeymap
void SDL_GetDefaultKeymap(SDL_Keycode *keymap)
Definition: SDL_keyboard.c:579
Cocoa_SetTextInputRect
void Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect)
Cocoa_HandleKeyEvent
void Cocoa_HandleKeyEvent(_THIS, NSEvent *event)
s
GLdouble s
Definition: glew.h:1376
type
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
Definition: gl2ext.h:845
void
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1824
SDL_VideoData::fieldEdit
SDLTranslatorResponder * fieldEdit
Definition: SDL_cocoavideo.h:51
init
static void init(struct bs2b *bs2b)
Definition: bs2b.c:46
SDL_VideoDevice::driverdata
void * driverdata
Definition: SDL_sysvideo.h:314
SDLK_SCANCODE_MASK
#define SDLK_SCANCODE_MASK
Definition: SDL_keycode.h:44
SDL_EventState
DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state)
Definition: SDL_events.c:555
len
GLenum GLsizei len
Definition: glew.h:7035
SDL_InvalidParamError
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
if
if(!yyg->yy_init)
Definition: glslang_lex.cpp:1037
SDL_VideoData::modifierFlags
unsigned int modifierFlags
Definition: SDL_cocoavideo.h:49
Cocoa_StartTextInput
void Cocoa_StartTextInput(_THIS)
SDL_Keycode
Sint32 SDL_Keycode
The SDL virtual key representation.
Definition: SDL_keycode.h:42
SDL_SCANCODE_CAPSLOCK
Definition: SDL_scancode.h:151
SDL_config.h
SDL_SCANCODE_LALT
Definition: SDL_scancode.h:330
SDL_SendKeyboardKey
int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode)
Definition: SDL_keyboard.c:650
SDL_cocoavideo.h
Cocoa_QuitKeyboard
void Cocoa_QuitKeyboard(_THIS)
_this
static SDL_VideoDevice * _this
Definition: SDL_video.c:92
SDL_SetKeymap
void SDL_SetKeymap(int start, SDL_Keycode *keys, int length)
Definition: SDL_keyboard.c:585
darwin_scancode_table
static const SDL_Scancode darwin_scancode_table[]
Definition: scancodes_darwin.h:29
length
GLsizei GLsizei * length
Definition: gl2ext.h:792
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl2ext.h:848
_THIS
#define _THIS
Definition: SDL_alsa_audio.h:31
SDL_SendKeyboardText
int SDL_SendKeyboardText(const char *text)
Definition: SDL_keyboard.c:784
SDL_VideoData::osversion
SInt32 osversion
Definition: SDL_cocoavideo.h:48
SDL_VideoData::key_layout
void * key_layout
Definition: SDL_cocoavideo.h:50
SDL_SCANCODE_LCTRL
Definition: SDL_scancode.h:328
SDL_SetScancodeName
void SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
Definition: SDL_keyboard.c:597
SDL_SCANCODE_LSHIFT
Definition: SDL_scancode.h:329
cleanup
void cleanup(int exitcode)
Definition: chat.cpp:339
code
Definition: inftrees.h:24
SDL_arraysize
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:83
SDL_SCANCODE_UNKNOWN
Definition: SDL_scancode.h:45
SDL_TEXTINPUT
Definition: SDL_events.h:96
SDL_SCANCODE_LGUI
Definition: SDL_scancode.h:331
SDL_NUM_SCANCODES
Definition: SDL_scancode.h:395
Cocoa_InitKeyboard
void Cocoa_InitKeyboard(_THIS)
SDL_SCANCODE_RGUI
Definition: SDL_scancode.h:335
Cocoa_StopTextInput
void Cocoa_StopTextInput(_THIS)
SDL_VideoData
Definition: SDL_androidvideo.h:35
mapping
GLenum GLenum GLenum GLenum mapping
Definition: glew.h:12631
str
#define str(s)
SDL_PRESSED
#define SDL_PRESSED
Definition: SDL_events.h:50
SDL_QUERY
#define SDL_QUERY
Definition: SDL_events.h:685
i
int i
Definition: pngrutil.c:1377
SDL_RELEASED
#define SDL_RELEASED
Definition: SDL_events.h:49
SDL_Scancode
SDL_Scancode
The SDL keyboard scancode representation.
Definition: SDL_scancode.h:43
SDL_SCANCODE_RALT
Definition: SDL_scancode.h:334
SDL_SendEditingText
int SDL_SendEditingText(const char *text, int start, int length)
Definition: SDL_keyboard.c:807
SDL_Rect
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:63
SDL_SCANCODE_RSHIFT
Definition: SDL_scancode.h:333
event
cl_event event
Definition: glew.h:3556
SDL_SCANCODE_RCTRL
Definition: SDL_scancode.h:332
BOOL
typedef BOOL(WINAPI *PFNWGLSETSTEREOEMITTERSTATE3DLPROC)(HDC hDC