src/video/uikit/SDL_uikitview.m
author Jim Grandpre <jim.tla@gmail.com>
Mon, 12 Jul 2010 22:03:25 -0400
changeset 4660 b15e7017409b
parent 3685 64ce267332c6
child 4661 03dcb795c583
permissions -rw-r--r--
Added Iphone support (untested)
slouken@2765
     1
/*
slouken@2765
     2
 SDL - Simple DirectMedia Layer
slouken@2859
     3
 Copyright (C) 1997-2009 Sam Lantinga
slouken@2765
     4
 
slouken@2765
     5
 This library is free software; you can redistribute it and/or
slouken@2765
     6
 modify it under the terms of the GNU Lesser General Public
slouken@2765
     7
 License as published by the Free Software Foundation; either
slouken@2765
     8
 version 2.1 of the License, or (at your option) any later version.
slouken@2765
     9
 
slouken@2765
    10
 This library is distributed in the hope that it will be useful,
slouken@2765
    11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@2765
    12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@2765
    13
 Lesser General Public License for more details.
slouken@2765
    14
 
slouken@2765
    15
 You should have received a copy of the GNU Lesser General Public
slouken@2765
    16
 License along with this library; if not, write to the Free Software
slouken@2765
    17
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@2765
    18
 
slouken@2765
    19
 Sam Lantinga
slouken@2765
    20
 slouken@libsdl.org
slouken@2765
    21
 */
slouken@2765
    22
slouken@2765
    23
#import "SDL_uikitview.h"
slouken@2765
    24
jim@4660
    25
#include "../../events/SDL_keyboard_c.h"
jim@4660
    26
#include "../../events/SDL_mouse_c.h"
jim@4660
    27
slouken@2765
    28
#if SDL_IPHONE_KEYBOARD
slouken@2765
    29
#import "keyinfotable.h"
slouken@2765
    30
#import "SDL_uikitappdelegate.h"
slouken@2765
    31
#import "SDL_uikitwindow.h"
slouken@2765
    32
#endif
slouken@2765
    33
slouken@2765
    34
@implementation SDL_uikitview
slouken@2765
    35
slouken@2765
    36
- (void)dealloc {
slouken@2765
    37
#if SDL_IPHONE_KEYBOARD
slouken@2765
    38
	[textField release];
slouken@2765
    39
#endif
slouken@2765
    40
	[super dealloc];
slouken@2765
    41
}
slouken@2765
    42
slouken@2765
    43
- (id)initWithFrame:(CGRect)frame {
slouken@2765
    44
slouken@2765
    45
	self = [super initWithFrame: frame];
slouken@2765
    46
	
slouken@2765
    47
#if SDL_IPHONE_KEYBOARD
slouken@2765
    48
	[self initializeKeyboard];
slouken@2765
    49
#endif	
slouken@2765
    50
jim@4660
    51
#if FIXME_MULTITOUCH
slouken@2765
    52
	int i;
slouken@2765
    53
	for (i=0; i<MAX_SIMULTANEOUS_TOUCHES; i++) {
slouken@2940
    54
        mice[i].id = i;
slouken@2765
    55
		mice[i].driverdata = NULL;
slouken@2940
    56
		SDL_AddMouse(&mice[i], "Mouse", 0, 0, 1);
slouken@2765
    57
	}
slouken@2765
    58
	self.multipleTouchEnabled = YES;
jim@4660
    59
#endif
jim@4660
    60
#if FIXED_MULTITOUCH
jim@4660
    61
	SDL_Touch touch;
jim@4660
    62
	touch.id = 0; //TODO: Should be -1?
jim@4660
    63
jim@4660
    64
	//touch.driverdata = SDL_malloc(sizeof(EventTouchData));
jim@4660
    65
	//EventTouchData* data = (EventTouchData*)(touch.driverdata);
jim@4660
    66
	
jim@4660
    67
	touch.x_min = 0;
jim@4660
    68
	touch.x_max = frame.size.width;
jim@4660
    69
	touch.xres = touch.x_max - touch.x_min;
jim@4660
    70
	touch.y_min = 0;
jim@4660
    71
	touch.y_max = frame.size.height;
jim@4660
    72
	touch.yres = touch.y_max - touch.y_min;
jim@4660
    73
	touch.pressure_min = 0;
jim@4660
    74
	touch.pressure_max = 1;
jim@4660
    75
	touch.pressureres = touch.pressure_max - touch.pressure_min;
jim@4660
    76
jim@4660
    77
jim@4660
    78
	touchId = SDL_AddTouch(&touch, "IPHONE SCREEN");
jim@4660
    79
#endif
slouken@2765
    80
			
slouken@2765
    81
	return self;
slouken@2765
    82
slouken@2765
    83
}
slouken@2765
    84
slouken@2765
    85
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
slouken@2765
    86
slouken@2765
    87
	NSEnumerator *enumerator = [touches objectEnumerator];
jim@4660
    88
	UITouch *touch = (UITouch*)[enumerator nextObject];
slouken@2765
    89
	
jim@4660
    90
#if FIXME_MULTITOUCH
slouken@2765
    91
	/* associate touches with mice, so long as we have slots */
slouken@2765
    92
	int i;
slouken@2765
    93
	int found = 0;
slouken@2765
    94
	for(i=0; touch && i < MAX_SIMULTANEOUS_TOUCHES; i++) {
slouken@2765
    95
	
slouken@2765
    96
		/* check if this mouse is already tracking a touch */
slouken@2765
    97
		if (mice[i].driverdata != NULL) {
slouken@2765
    98
			continue;
slouken@2765
    99
		}
slouken@2765
   100
		/*	
slouken@2765
   101
			mouse not associated with anything right now,
slouken@2765
   102
			associate the touch with this mouse
slouken@2765
   103
		*/
slouken@2765
   104
		found = 1;
slouken@2765
   105
		
slouken@2765
   106
		/* save old mouse so we can switch back */
slouken@2765
   107
		int oldMouse = SDL_SelectMouse(-1);
slouken@2765
   108
		
slouken@2765
   109
		/* select this slot's mouse */
slouken@2765
   110
		SDL_SelectMouse(i);
slouken@2765
   111
		CGPoint locationInView = [touch locationInView: self];
slouken@2765
   112
		
slouken@2765
   113
		/* set driver data to touch object, we'll use touch object later */
slouken@2765
   114
		mice[i].driverdata = [touch retain];
slouken@2765
   115
		
slouken@2765
   116
		/* send moved event */
slouken@2765
   117
		SDL_SendMouseMotion(i, 0, locationInView.x, locationInView.y, 0);
slouken@2765
   118
		
slouken@2765
   119
		/* send mouse down event */
slouken@2765
   120
		SDL_SendMouseButton(i, SDL_PRESSED, SDL_BUTTON_LEFT);
slouken@2765
   121
		
slouken@2765
   122
		/* re-calibrate relative mouse motion */
slouken@2765
   123
		SDL_GetRelativeMouseState(i, NULL, NULL);
slouken@2765
   124
		
slouken@2765
   125
		/* switch back to our old mouse */
slouken@2765
   126
		SDL_SelectMouse(oldMouse);
slouken@2765
   127
		
jim@4660
   128
		/* grab next touch */
jim@4660
   129
		touch = (UITouch*)[enumerator nextObject]; 
jim@4660
   130
	}
jim@4660
   131
#else
jim@4660
   132
	if (touch) {
jim@4660
   133
		CGPoint locationInView = [touch locationInView: self];
jim@4660
   134
			
jim@4660
   135
		/* send moved event */
jim@4660
   136
		SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y);
jim@4660
   137
jim@4660
   138
		/* send mouse down event */
jim@4660
   139
		SDL_SendMouseButton(NULL, SDL_PRESSED, SDL_BUTTON_LEFT);
jim@4660
   140
	}
jim@4660
   141
#endif
jim@4660
   142
jim@4660
   143
#if FIXED_MULTITOUCH
jim@4660
   144
	while(touch) {
jim@4660
   145
	  CGPoint locationInView = [touch locationInView: self];
jim@4660
   146
	  SDL_SendFingerDown(touchId,(int)touch,
jim@4660
   147
			     SDL_TRUE,locationInView.x,locationInView.y,
jim@4660
   148
			     1);
jim@4660
   149
jim@4660
   150
	  touch = (UITouch*)[enumerator nextObject]; 
jim@4660
   151
	}
jim@4660
   152
#endif
slouken@2765
   153
}
slouken@2765
   154
slouken@2765
   155
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
slouken@2765
   156
	
slouken@2765
   157
	NSEnumerator *enumerator = [touches objectEnumerator];
jim@4660
   158
	UITouch *touch = (UITouch*)[enumerator nextObject];
slouken@2765
   159
	
jim@4660
   160
#if FIXME_MULTITOUCH
jim@4660
   161
	while(touch) {
slouken@2765
   162
		/* search for the mouse slot associated with this touch */
slouken@2765
   163
		int i, found = NO;
slouken@2765
   164
		for (i=0; i<MAX_SIMULTANEOUS_TOUCHES && !found; i++) {
slouken@2765
   165
			if (mice[i].driverdata == touch) {
slouken@2765
   166
				/* found the mouse associate with the touch */
slouken@2765
   167
				[(UITouch*)(mice[i].driverdata) release];
slouken@2765
   168
				mice[i].driverdata = NULL;
slouken@2765
   169
				/* send mouse up */
slouken@2765
   170
				SDL_SendMouseButton(i, SDL_RELEASED, SDL_BUTTON_LEFT);
slouken@2765
   171
				/* discontinue search for this touch */
slouken@2765
   172
				found = YES;
slouken@2765
   173
			}
slouken@2765
   174
		}
jim@4660
   175
		
jim@4660
   176
		/* grab next touch */
jim@4660
   177
		touch = (UITouch*)[enumerator nextObject]; 
slouken@2765
   178
	}
jim@4660
   179
#else
jim@4660
   180
	if (touch) {
jim@4660
   181
		/* send mouse up */
jim@4660
   182
		SDL_SendMouseButton(NULL, SDL_RELEASED, SDL_BUTTON_LEFT);
jim@4660
   183
	}
jim@4660
   184
#endif
jim@4660
   185
#if FIXED_MULTITOUCH
jim@4660
   186
	while(touch) {
jim@4660
   187
	  CGPoint locationInView = [touch locationInView: self];
jim@4660
   188
	  SDL_SendFingerDown(touchId,(int)touch,
jim@4660
   189
			     SDL_FALSE,locationInView.x,locationInView.y,
jim@4660
   190
			     1);
jim@4660
   191
jim@4660
   192
	  touch = (UITouch*)[enumerator nextObject]; 
jim@4660
   193
	}
jim@4660
   194
#endif
slouken@2765
   195
}
slouken@2765
   196
slouken@2765
   197
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
slouken@2765
   198
	/*
slouken@2765
   199
		this can happen if the user puts more than 5 touches on the screen
slouken@2765
   200
		at once, or perhaps in other circumstances.  Usually (it seems)
slouken@2765
   201
		all active touches are canceled.
slouken@2765
   202
	*/
slouken@2765
   203
	[self touchesEnded: touches withEvent: event];
slouken@2765
   204
}
slouken@2765
   205
slouken@2765
   206
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
slouken@2765
   207
	
slouken@2765
   208
	NSEnumerator *enumerator = [touches objectEnumerator];
jim@4660
   209
	UITouch *touch = (UITouch*)[enumerator nextObject];
slouken@2765
   210
	
jim@4660
   211
#if FIXME_MULTITOUCH
jim@4660
   212
	while(touch) {
slouken@2765
   213
		/* try to find the mouse associated with this touch */
slouken@2765
   214
		int i, found = NO;
slouken@2765
   215
		for (i=0; i<MAX_SIMULTANEOUS_TOUCHES && !found; i++) {
slouken@2765
   216
			if (mice[i].driverdata == touch) {
slouken@2765
   217
				/* found proper mouse */
slouken@2765
   218
				CGPoint locationInView = [touch locationInView: self];
slouken@2765
   219
				/* send moved event */
slouken@2765
   220
				SDL_SendMouseMotion(i, 0, locationInView.x, locationInView.y, 0);
slouken@2765
   221
				/* discontinue search */
slouken@2765
   222
				found = YES;
slouken@2765
   223
			}
slouken@2765
   224
		}
jim@4660
   225
		
jim@4660
   226
		/* grab next touch */
jim@4660
   227
		touch = (UITouch*)[enumerator nextObject]; 
slouken@2765
   228
	}
jim@4660
   229
#else
jim@4660
   230
	if (touch) {
jim@4660
   231
		CGPoint locationInView = [touch locationInView: self];
jim@4660
   232
jim@4660
   233
		/* send moved event */
jim@4660
   234
		SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y);
jim@4660
   235
	}
jim@4660
   236
#endif
jim@4660
   237
jim@4660
   238
#if FIXED_MULTITOUCH
jim@4660
   239
	while(touch) {
jim@4660
   240
	  CGPoint locationInView = [touch locationInView: self];
jim@4660
   241
	  SDL_SendTouchMotion(touchId,(int)touch,
jim@4660
   242
			     SDL_FALSE,locationInView.x,locationInView.y,
jim@4660
   243
			     1);
jim@4660
   244
jim@4660
   245
	  touch = (UITouch*)[enumerator nextObject]; 
jim@4660
   246
	}
jim@4660
   247
#endif
slouken@2765
   248
}
slouken@2765
   249
slouken@2765
   250
/*
slouken@2765
   251
	---- Keyboard related functionality below this line ----
slouken@2765
   252
*/
slouken@2765
   253
#if SDL_IPHONE_KEYBOARD
slouken@2765
   254
slouken@2765
   255
/* Is the iPhone virtual keyboard visible onscreen? */
slouken@2765
   256
- (BOOL)keyboardVisible {
slouken@2765
   257
	return keyboardVisible;
slouken@2765
   258
}
slouken@2765
   259
slouken@2765
   260
/* Set ourselves up as a UITextFieldDelegate */
slouken@2765
   261
- (void)initializeKeyboard {
slouken@2765
   262
		
slouken@2765
   263
	textField = [[[UITextField alloc] initWithFrame: CGRectZero] autorelease];
slouken@2765
   264
	textField.delegate = self;
slouken@2765
   265
	/* placeholder so there is something to delete! */
slouken@2765
   266
	textField.text = @" ";	
slouken@2765
   267
	
slouken@2765
   268
	/* set UITextInputTrait properties, mostly to defaults */
slouken@2765
   269
	textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
slouken@2765
   270
	textField.autocorrectionType = UITextAutocorrectionTypeNo;
slouken@2765
   271
	textField.enablesReturnKeyAutomatically = NO;
slouken@2765
   272
	textField.keyboardAppearance = UIKeyboardAppearanceDefault;
slouken@2765
   273
	textField.keyboardType = UIKeyboardTypeDefault;
slouken@2765
   274
	textField.returnKeyType = UIReturnKeyDefault;
slouken@2765
   275
	textField.secureTextEntry = NO;	
slouken@2765
   276
	
slouken@2765
   277
	textField.hidden = YES;
slouken@2765
   278
	keyboardVisible = NO;
slouken@2765
   279
	/* add the UITextField (hidden) to our view */
slouken@2765
   280
	[self addSubview: textField];
slouken@2765
   281
}
slouken@2765
   282
slouken@2765
   283
/* reveal onscreen virtual keyboard */
slouken@2765
   284
- (void)showKeyboard {
slouken@2765
   285
	keyboardVisible = YES;
slouken@2765
   286
	[textField becomeFirstResponder];
slouken@2765
   287
}
slouken@2765
   288
slouken@2765
   289
/* hide onscreen virtual keyboard */
slouken@2765
   290
- (void)hideKeyboard {
slouken@2765
   291
	keyboardVisible = NO;
slouken@2765
   292
	[textField resignFirstResponder];
slouken@2765
   293
}
slouken@2765
   294
slouken@2765
   295
/* UITextFieldDelegate method.  Invoked when user types something. */
slouken@2765
   296
- (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
slouken@2765
   297
	
slouken@2765
   298
	if ([string length] == 0) {
slouken@2765
   299
		/* it wants to replace text with nothing, ie a delete */
jim@4660
   300
		SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_DELETE);
jim@4660
   301
		SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_DELETE);
slouken@2765
   302
	}
slouken@2765
   303
	else {
slouken@2765
   304
		/* go through all the characters in the string we've been sent
slouken@2765
   305
		   and convert them to key presses */
slouken@2765
   306
		int i;
slouken@2765
   307
		for (i=0; i<[string length]; i++) {
slouken@2765
   308
			
slouken@2765
   309
			unichar c = [string characterAtIndex: i];
slouken@2765
   310
			
slouken@2765
   311
			Uint16 mod = 0;
slouken@2765
   312
			SDL_scancode code;
slouken@2765
   313
			
slouken@2765
   314
			if (c < 127) {
slouken@2765
   315
				/* figure out the SDL_scancode and SDL_keymod for this unichar */
slouken@2765
   316
				code = unicharToUIKeyInfoTable[c].code;
slouken@2765
   317
				mod  = unicharToUIKeyInfoTable[c].mod;
slouken@2765
   318
			}
slouken@2765
   319
			else {
slouken@2765
   320
				/* we only deal with ASCII right now */
slouken@2765
   321
				code = SDL_SCANCODE_UNKNOWN;
slouken@2765
   322
				mod = 0;
slouken@2765
   323
			}
slouken@2765
   324
			
slouken@2765
   325
			if (mod & KMOD_SHIFT) {
slouken@2765
   326
				/* If character uses shift, press shift down */
jim@4660
   327
				SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT);
slouken@2765
   328
			}
slouken@2765
   329
			/* send a keydown and keyup even for the character */
jim@4660
   330
			SDL_SendKeyboardKey(SDL_PRESSED, code);
jim@4660
   331
			SDL_SendKeyboardKey(SDL_RELEASED, code);
slouken@2765
   332
			if (mod & KMOD_SHIFT) {
slouken@2765
   333
				/* If character uses shift, press shift back up */
jim@4660
   334
				SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT);
slouken@2765
   335
			}			
slouken@2765
   336
		}
slouken@2765
   337
	}
slouken@2765
   338
	return NO; /* don't allow the edit! (keep placeholder text there) */
slouken@2765
   339
}
slouken@2765
   340
slouken@2765
   341
/* Terminates the editing session */
slouken@2765
   342
- (BOOL)textFieldShouldReturn:(UITextField*)_textField {
slouken@2765
   343
	[self hideKeyboard];
slouken@2765
   344
	return YES;
slouken@2765
   345
}
slouken@2765
   346
slouken@2765
   347
#endif
slouken@2765
   348
slouken@2765
   349
@end
slouken@2765
   350
slouken@2765
   351
/* iPhone keyboard addition functions */
slouken@2765
   352
#if SDL_IPHONE_KEYBOARD
slouken@2765
   353
slouken@3685
   354
int SDL_iPhoneKeyboardShow(SDL_Window * window) {
slouken@2765
   355
	
slouken@2765
   356
	SDL_WindowData *data;
slouken@2765
   357
	SDL_uikitview *view;
slouken@2765
   358
	
slouken@2765
   359
	if (NULL == window) {
slouken@2765
   360
		SDL_SetError("Window does not exist");
slouken@2765
   361
		return -1;
slouken@2765
   362
	}
slouken@2765
   363
	
slouken@2765
   364
	data = (SDL_WindowData *)window->driverdata;
slouken@2765
   365
	view = data->view;
slouken@2765
   366
	
slouken@2765
   367
	if (nil == view) {
slouken@2765
   368
		SDL_SetError("Window has no view");
slouken@2765
   369
		return -1;
slouken@2765
   370
	}
slouken@2765
   371
	else {
slouken@2765
   372
		[view showKeyboard];
slouken@2765
   373
		return 0;
slouken@2765
   374
	}
slouken@2765
   375
}
slouken@2765
   376
slouken@3685
   377
int SDL_iPhoneKeyboardHide(SDL_Window * window) {
slouken@2765
   378
	
slouken@2765
   379
	SDL_WindowData *data;
slouken@2765
   380
	SDL_uikitview *view;
slouken@2765
   381
	
slouken@2765
   382
	if (NULL == window) {
slouken@2765
   383
		SDL_SetError("Window does not exist");
slouken@2765
   384
		return -1;
slouken@2765
   385
	}	
slouken@2765
   386
	
slouken@2765
   387
	data = (SDL_WindowData *)window->driverdata;
slouken@2765
   388
	view = data->view;
slouken@2765
   389
	
slouken@2765
   390
	if (NULL == view) {
slouken@2765
   391
		SDL_SetError("Window has no view");
slouken@2765
   392
		return -1;
slouken@2765
   393
	}
slouken@2765
   394
	else {
slouken@2765
   395
		[view hideKeyboard];
slouken@2765
   396
		return 0;
slouken@2765
   397
	}
slouken@2765
   398
}
slouken@2765
   399
slouken@3685
   400
SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window) {
slouken@2765
   401
	
slouken@2765
   402
	SDL_WindowData *data;
slouken@2765
   403
	SDL_uikitview *view;
slouken@2765
   404
	
slouken@2765
   405
	if (NULL == window) {
slouken@2765
   406
		SDL_SetError("Window does not exist");
slouken@2765
   407
		return -1;
slouken@2765
   408
	}	
slouken@2765
   409
	
slouken@2765
   410
	data = (SDL_WindowData *)window->driverdata;
slouken@2765
   411
	view = data->view;
slouken@2765
   412
	
slouken@2765
   413
	if (NULL == view) {
slouken@2765
   414
		SDL_SetError("Window has no view");
slouken@2765
   415
		return 0;
slouken@2765
   416
	}
slouken@2765
   417
	else {
slouken@2765
   418
		return view.keyboardVisible;
slouken@2765
   419
	}
slouken@2765
   420
}
slouken@2765
   421
slouken@3685
   422
int SDL_iPhoneKeyboardToggle(SDL_Window * window) {
slouken@2765
   423
	
slouken@2765
   424
	SDL_WindowData *data;
slouken@2765
   425
	SDL_uikitview *view;
slouken@2765
   426
	
slouken@2765
   427
	if (NULL == window) {
slouken@2765
   428
		SDL_SetError("Window does not exist");
slouken@2765
   429
		return -1;
slouken@2765
   430
	}	
slouken@2765
   431
	
slouken@2765
   432
	data = (SDL_WindowData *)window->driverdata;
slouken@2765
   433
	view = data->view;
slouken@2765
   434
	
slouken@2765
   435
	if (NULL == view) {
slouken@2765
   436
		SDL_SetError("Window has no view");
slouken@2765
   437
		return -1;
slouken@2765
   438
	}
slouken@2765
   439
	else {
slouken@3685
   440
		if (SDL_iPhoneKeyboardIsShown(window)) {
slouken@3685
   441
			SDL_iPhoneKeyboardHide(window);
slouken@2765
   442
		}
slouken@2765
   443
		else {
slouken@3685
   444
			SDL_iPhoneKeyboardShow(window);
slouken@2765
   445
		}
slouken@2765
   446
		return 0;
slouken@2765
   447
	}
slouken@2765
   448
}
slouken@2765
   449
slouken@2765
   450
#else
slouken@2765
   451
slouken@2765
   452
/* stubs, used if compiled without keyboard support */
slouken@2765
   453
slouken@3685
   454
int SDL_iPhoneKeyboardShow(SDL_Window * window) {
slouken@2765
   455
	SDL_SetError("Not compiled with keyboard support");
slouken@2765
   456
	return -1;
slouken@2765
   457
}
slouken@2765
   458
slouken@3685
   459
int SDL_iPhoneKeyboardHide(SDL_Window * window) {
slouken@2765
   460
	SDL_SetError("Not compiled with keyboard support");
slouken@2765
   461
	return -1;
slouken@2765
   462
}
slouken@2765
   463
slouken@3685
   464
SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window) {
slouken@2765
   465
	return 0;
slouken@2765
   466
}
slouken@2765
   467
slouken@3685
   468
int SDL_iPhoneKeyboardToggle(SDL_Window * window) {
slouken@2765
   469
	SDL_SetError("Not compiled with keyboard support");
slouken@2765
   470
	return -1;
slouken@2765
   471
}
slouken@2765
   472
slouken@2765
   473
slouken@2859
   474
#endif /* SDL_IPHONE_KEYBOARD */