Commit 95c839f4 authored by Sam Lantinga's avatar Sam Lantinga

Fixed bug 1163 (SDL_TEXTINPUT not being received on iPhoneOS)

parent 608ec7da
...@@ -17,6 +17,15 @@ ...@@ -17,6 +17,15 @@
046CEF8113254F23007AD51D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; }; 046CEF8113254F23007AD51D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; };
046CEF8213254F23007AD51D /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; }; 046CEF8213254F23007AD51D /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; };
046CEF8A13254F63007AD51D /* testgesture.c in Sources */ = {isa = PBXBuildFile; fileRef = 046CEF8913254F63007AD51D /* testgesture.c */; }; 046CEF8A13254F63007AD51D /* testgesture.c in Sources */ = {isa = PBXBuildFile; fileRef = 046CEF8913254F63007AD51D /* testgesture.c */; };
047A63E213285C3200CD7973 /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
047A63E313285C3200CD7973 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; };
047A63E413285C3200CD7973 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; };
047A63E513285C3200CD7973 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; };
047A63E613285C3200CD7973 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89B0E2D111A00EA573E /* CoreGraphics.framework */; };
047A63E713285C3200CD7973 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89C0E2D111A00EA573E /* UIKit.framework */; };
047A63E813285C3200CD7973 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; };
047A63E913285C3200CD7973 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; };
047A63F113285CD100CD7973 /* checkkeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 047A63F013285CD100CD7973 /* checkkeys.c */; };
56ED04FE118A8FE400A56AA6 /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDA8AAD90E2D33B000EA573E /* icon.bmp */; }; 56ED04FE118A8FE400A56AA6 /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDA8AAD90E2D33B000EA573E /* icon.bmp */; };
56ED0502118A8FE400A56AA6 /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; }; 56ED0502118A8FE400A56AA6 /* libSDL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL.a */; };
56ED0503118A8FE400A56AA6 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; }; 56ED0503118A8FE400A56AA6 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; };
...@@ -306,6 +315,8 @@ ...@@ -306,6 +315,8 @@
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
046CEF8613254F23007AD51D /* testgesture.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testgesture.app; sourceTree = BUILT_PRODUCTS_DIR; }; 046CEF8613254F23007AD51D /* testgesture.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testgesture.app; sourceTree = BUILT_PRODUCTS_DIR; };
046CEF8913254F63007AD51D /* testgesture.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testgesture.c; path = ../../test/testgesture.c; sourceTree = SOURCE_ROOT; }; 046CEF8913254F63007AD51D /* testgesture.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testgesture.c; path = ../../test/testgesture.c; sourceTree = SOURCE_ROOT; };
047A63ED13285C3200CD7973 /* checkkeys.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = checkkeys.app; sourceTree = BUILT_PRODUCTS_DIR; };
047A63F013285CD100CD7973 /* checkkeys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = checkkeys.c; path = ../../test/checkkeys.c; sourceTree = SOURCE_ROOT; };
1D6058910D05DD3D006BFB54 /* testwm2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testwm2.app; sourceTree = BUILT_PRODUCTS_DIR; }; 1D6058910D05DD3D006BFB54 /* testwm2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testwm2.app; sourceTree = BUILT_PRODUCTS_DIR; };
56ED050D118A8FE400A56AA6 /* testpower.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testpower.app; sourceTree = BUILT_PRODUCTS_DIR; }; 56ED050D118A8FE400A56AA6 /* testpower.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testpower.app; sourceTree = BUILT_PRODUCTS_DIR; };
56ED0510118A904200A56AA6 /* testpower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testpower.c; path = ../../test/testpower.c; sourceTree = SOURCE_ROOT; }; 56ED0510118A904200A56AA6 /* testpower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testpower.c; path = ../../test/testpower.c; sourceTree = SOURCE_ROOT; };
...@@ -342,7 +353,6 @@ ...@@ -342,7 +353,6 @@
FDA8A7840E2D0F1F00EA573E /* common.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = common.c; path = ../../test/common.c; sourceTree = SOURCE_ROOT; }; FDA8A7840E2D0F1F00EA573E /* common.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = common.c; path = ../../test/common.c; sourceTree = SOURCE_ROOT; };
FDA8A7850E2D0F1F00EA573E /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = common.h; path = ../../test/common.h; sourceTree = SOURCE_ROOT; }; FDA8A7850E2D0F1F00EA573E /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = common.h; path = ../../test/common.h; sourceTree = SOURCE_ROOT; };
FDA8A7870E2D0F2700EA573E /* graywin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = graywin.c; path = ../../test/graywin.c; sourceTree = SOURCE_ROOT; }; FDA8A7870E2D0F2700EA573E /* graywin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = graywin.c; path = ../../test/graywin.c; sourceTree = SOURCE_ROOT; };
FDA8A7890E2D0F2E00EA573E /* checkkeys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = checkkeys.c; path = ../../test/checkkeys.c; sourceTree = SOURCE_ROOT; };
FDA8A78B0E2D0F3D00EA573E /* loopwave.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loopwave.c; path = ../../test/loopwave.c; sourceTree = SOURCE_ROOT; }; FDA8A78B0E2D0F3D00EA573E /* loopwave.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = loopwave.c; path = ../../test/loopwave.c; sourceTree = SOURCE_ROOT; };
FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
FDA8A8990E2D111A00EA573E /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; FDA8A8990E2D111A00EA573E /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
...@@ -404,6 +414,21 @@ ...@@ -404,6 +414,21 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
047A63E113285C3200CD7973 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
047A63E213285C3200CD7973 /* libSDL.a in Frameworks */,
047A63E313285C3200CD7973 /* AudioToolbox.framework in Frameworks */,
047A63E413285C3200CD7973 /* QuartzCore.framework in Frameworks */,
047A63E513285C3200CD7973 /* OpenGLES.framework in Frameworks */,
047A63E613285C3200CD7973 /* CoreGraphics.framework in Frameworks */,
047A63E713285C3200CD7973 /* UIKit.framework in Frameworks */,
047A63E813285C3200CD7973 /* Foundation.framework in Frameworks */,
047A63E913285C3200CD7973 /* CoreAudio.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
1D60588F0D05DD3D006BFB54 /* Frameworks */ = { 1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
...@@ -858,6 +883,7 @@ ...@@ -858,6 +883,7 @@
FDC430000F0D866D009C87E1 /* torturethread.app */, FDC430000F0D866D009C87E1 /* torturethread.app */,
56ED050D118A8FE400A56AA6 /* testpower.app */, 56ED050D118A8FE400A56AA6 /* testpower.app */,
046CEF8613254F23007AD51D /* testgesture.app */, 046CEF8613254F23007AD51D /* testgesture.app */,
047A63ED13285C3200CD7973 /* checkkeys.app */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -888,9 +914,9 @@ ...@@ -888,9 +914,9 @@
children = ( children = (
FDA8A7840E2D0F1F00EA573E /* common.c */, FDA8A7840E2D0F1F00EA573E /* common.c */,
FDA8A7850E2D0F1F00EA573E /* common.h */, FDA8A7850E2D0F1F00EA573E /* common.h */,
047A63F013285CD100CD7973 /* checkkeys.c */,
FDA8A7870E2D0F2700EA573E /* graywin.c */, FDA8A7870E2D0F2700EA573E /* graywin.c */,
FDA8A78B0E2D0F3D00EA573E /* loopwave.c */, FDA8A78B0E2D0F3D00EA573E /* loopwave.c */,
FDA8A7890E2D0F2E00EA573E /* checkkeys.c */,
FDA8A7400E2D0F1600EA573E /* testalpha.c */, FDA8A7400E2D0F1600EA573E /* testalpha.c */,
FDA8A7410E2D0F1600EA573E /* testaudioinfo.c */, FDA8A7410E2D0F1600EA573E /* testaudioinfo.c */,
FDA8A7420E2D0F1600EA573E /* testbitmap.c */, FDA8A7420E2D0F1600EA573E /* testbitmap.c */,
...@@ -976,6 +1002,23 @@ ...@@ -976,6 +1002,23 @@
productReference = 046CEF8613254F23007AD51D /* testgesture.app */; productReference = 046CEF8613254F23007AD51D /* testgesture.app */;
productType = "com.apple.product-type.application"; productType = "com.apple.product-type.application";
}; };
047A63DD13285C3200CD7973 /* checkkeys */ = {
isa = PBXNativeTarget;
buildConfigurationList = 047A63EA13285C3200CD7973 /* Build configuration list for PBXNativeTarget "checkkeys" */;
buildPhases = (
047A63DE13285C3200CD7973 /* Resources */,
047A63DF13285C3200CD7973 /* Sources */,
047A63E113285C3200CD7973 /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = checkkeys;
productName = TestiPhoneOS;
productReference = 047A63ED13285C3200CD7973 /* checkkeys.app */;
productType = "com.apple.product-type.application";
};
1D6058900D05DD3D006BFB54 /* testwm2 */ = { 1D6058900D05DD3D006BFB54 /* testwm2 */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "testwm2" */; buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "testwm2" */;
...@@ -1477,6 +1520,7 @@ ...@@ -1477,6 +1520,7 @@
); );
projectRoot = ""; projectRoot = "";
targets = ( targets = (
047A63DD13285C3200CD7973 /* checkkeys */,
FDA8A91D0E2D1C0B00EA573E /* graywin */, FDA8A91D0E2D1C0B00EA573E /* graywin */,
FDAAC4300E2D4961001DB1D8 /* testbitmap */, FDAAC4300E2D4961001DB1D8 /* testbitmap */,
FDAAC5040E2D4FEB001DB1D8 /* testdyngles */, FDAAC5040E2D4FEB001DB1D8 /* testdyngles */,
...@@ -1536,6 +1580,13 @@ ...@@ -1536,6 +1580,13 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
047A63DE13285C3200CD7973 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
1D60588D0D05DD3D006BFB54 /* Resources */ = { 1D60588D0D05DD3D006BFB54 /* Resources */ = {
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
...@@ -1755,6 +1806,14 @@ ...@@ -1755,6 +1806,14 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
047A63DF13285C3200CD7973 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
047A63F113285CD100CD7973 /* checkkeys.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
1D60588E0D05DD3D006BFB54 /* Sources */ = { 1D60588E0D05DD3D006BFB54 /* Sources */ = {
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
...@@ -2012,6 +2071,32 @@ ...@@ -2012,6 +2071,32 @@
}; };
name = Release; name = Release;
}; };
047A63EB13285C3200CD7973 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "";
INFOPLIST_FILE = Info.plist;
PRODUCT_NAME = checkkeys;
};
name = Debug;
};
047A63EC13285C3200CD7973 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "";
INFOPLIST_FILE = Info.plist;
PRODUCT_NAME = checkkeys;
};
name = Release;
};
1D6058940D05DD3E006BFB54 /* Debug */ = { 1D6058940D05DD3E006BFB54 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
...@@ -2787,6 +2872,15 @@ ...@@ -2787,6 +2872,15 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
047A63EA13285C3200CD7973 /* Build configuration list for PBXNativeTarget "checkkeys" */ = {
isa = XCConfigurationList;
buildConfigurations = (
047A63EB13285C3200CD7973 /* Debug */,
047A63EC13285C3200CD7973 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "testwm2" */ = { 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "testwm2" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
......
...@@ -290,6 +290,7 @@ ...@@ -290,6 +290,7 @@
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT); SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT);
} }
} }
SDL_SendKeyboardText([string UTF8String]);
} }
return NO; /* don't allow the edit! (keep placeholder text there) */ return NO; /* don't allow the edit! (keep placeholder text there) */
} }
......
...@@ -19,92 +19,124 @@ quit(int rc) ...@@ -19,92 +19,124 @@ quit(int rc)
} }
static void static void
print_modifiers(void) print_string(char **text, size_t *maxlen, const char *fmt, ...)
{
int len;
va_list ap;
va_start(ap, fmt);
len = SDL_vsnprintf(*text, *maxlen, fmt, ap);
if (len > 0) {
*text += len;
if (len < *maxlen) {
*maxlen -= len;
} else {
*maxlen = 0;
}
}
va_end(ap);
}
static void
print_modifiers(char **text, size_t *maxlen)
{ {
int mod; int mod;
printf(" modifiers:"); print_string(text, maxlen, " modifiers:");
mod = SDL_GetModState(); mod = SDL_GetModState();
if (!mod) { if (!mod) {
printf(" (none)"); print_string(text, maxlen, " (none)");
return; return;
} }
if (mod & KMOD_LSHIFT) if (mod & KMOD_LSHIFT)
printf(" LSHIFT"); print_string(text, maxlen, " LSHIFT");
if (mod & KMOD_RSHIFT) if (mod & KMOD_RSHIFT)
printf(" RSHIFT"); print_string(text, maxlen, " RSHIFT");
if (mod & KMOD_LCTRL) if (mod & KMOD_LCTRL)
printf(" LCTRL"); print_string(text, maxlen, " LCTRL");
if (mod & KMOD_RCTRL) if (mod & KMOD_RCTRL)
printf(" RCTRL"); print_string(text, maxlen, " RCTRL");
if (mod & KMOD_LALT) if (mod & KMOD_LALT)
printf(" LALT"); print_string(text, maxlen, " LALT");
if (mod & KMOD_RALT) if (mod & KMOD_RALT)
printf(" RALT"); print_string(text, maxlen, " RALT");
if (mod & KMOD_LGUI) if (mod & KMOD_LGUI)
printf(" LGUI"); print_string(text, maxlen, " LGUI");
if (mod & KMOD_RGUI) if (mod & KMOD_RGUI)
printf(" RGUI"); print_string(text, maxlen, " RGUI");
if (mod & KMOD_NUM) if (mod & KMOD_NUM)
printf(" NUM"); print_string(text, maxlen, " NUM");
if (mod & KMOD_CAPS) if (mod & KMOD_CAPS)
printf(" CAPS"); print_string(text, maxlen, " CAPS");
if (mod & KMOD_MODE) if (mod & KMOD_MODE)
printf(" MODE"); print_string(text, maxlen, " MODE");
} }
static void static void
PrintKey(SDL_Keysym * sym, SDL_bool pressed, SDL_bool repeat) PrintKey(SDL_Keysym * sym, SDL_bool pressed, SDL_bool repeat)
{ {
char message[512];
char *spot;
size_t left;
spot = message;
left = sizeof(message);
/* Print the keycode, name and state */ /* Print the keycode, name and state */
if (sym->sym) { if (sym->sym) {
printf("Key %s: scancode %d = %s, keycode 0x%08X = %s ", print_string(&spot, &left,
pressed ? "pressed " : "released", "Key %s: scancode %d = %s, keycode 0x%08X = %s ",
sym->scancode, pressed ? "pressed " : "released",
SDL_GetScancodeName(sym->scancode), sym->scancode,
sym->sym, SDL_GetKeyName(sym->sym)); SDL_GetScancodeName(sym->scancode),
sym->sym, SDL_GetKeyName(sym->sym));
} else { } else {
printf("Unknown Key (scancode %d = %s) %s ", print_string(&spot, &left,
sym->scancode, "Unknown Key (scancode %d = %s) %s ",
SDL_GetScancodeName(sym->scancode), sym->scancode,
pressed ? "pressed" : "released"); SDL_GetScancodeName(sym->scancode),
pressed ? "pressed" : "released");
} }
/* Print the translated character, if one exists */ /* Print the translated character, if one exists */
if (sym->unicode) { if (sym->unicode) {
/* Is it a control-character? */ /* Is it a control-character? */
if (sym->unicode < ' ') { if (sym->unicode < ' ') {
printf(" (^%c)", sym->unicode + '@'); print_string(&spot, &left, " (^%c)", sym->unicode + '@');
} else { } else {
#ifdef UNICODE #ifdef UNICODE
printf(" (%c)", sym->unicode); print_string(&spot, &left, " (%c)", sym->unicode);
#else #else
/* This is a Latin-1 program, so only show 8-bits */ /* This is a Latin-1 program, so only show 8-bits */
if (!(sym->unicode & 0xFF00)) if (!(sym->unicode & 0xFF00))
printf(" (%c)", sym->unicode); print_string(&spot, &left, " (%c)", sym->unicode);
else else
printf(" (0x%X)", sym->unicode); print_string(&spot, &left, " (0x%X)", sym->unicode);
#endif #endif
} }
} }
print_modifiers(); print_modifiers(&spot, &left);
if (repeat) { if (repeat) {
printf(" (repeat)"); print_string(&spot, &left, " (repeat)");
} }
printf("\n"); SDL_Log("%s", message);
} }
static void static void
PrintText(char *text) PrintText(char *text)
{ {
printf("Text: %s\n", text); SDL_Log("Text: %s", text);
} }
#if __IPHONEOS__
extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardShow(SDL_Window * window);
#endif
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
SDL_Window *window;
SDL_Event event; SDL_Event event;
int done; int done;
Uint32 videoflags;
/* Initialize SDL */ /* Initialize SDL */
if (SDL_Init(SDL_INIT_VIDEO) < 0) { if (SDL_Init(SDL_INIT_VIDEO) < 0) {
...@@ -112,24 +144,23 @@ main(int argc, char *argv[]) ...@@ -112,24 +144,23 @@ main(int argc, char *argv[])
return (1); return (1);
} }
videoflags = SDL_SWSURFACE;
while (argc > 1) {
--argc;
if (argv[argc] && !strcmp(argv[argc], "-fullscreen")) {
videoflags |= SDL_FULLSCREEN;
} else {
fprintf(stderr, "Usage: %s [-fullscreen]\n", argv[0]);
quit(1);
}
}
/* Set 640x480 video mode */ /* Set 640x480 video mode */
if (SDL_SetVideoMode(640, 480, 0, videoflags) == NULL) { window = SDL_CreateWindow("CheckKeys Test",
fprintf(stderr, "Couldn't set 640x480 video mode: %s\n", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
640, 480, 0);
if (!window) {
fprintf(stderr, "Couldn't create 640x480 window: %s\n",
SDL_GetError()); SDL_GetError());
quit(2); quit(2);
} }
#if __IPHONEOS__
/* Creating the context creates the view, which we need to show keyboard */
SDL_GL_CreateContext(window);
SDL_iPhoneKeyboardShow(window);
#endif
/* Watch keystrokes */ /* Watch keystrokes */
done = 0; done = 0;
while (!done) { while (!done) {
...@@ -156,3 +187,5 @@ main(int argc, char *argv[]) ...@@ -156,3 +187,5 @@ main(int argc, char *argv[])
SDL_Quit(); SDL_Quit();
return (0); return (0);
} }
/* vi: set ts=4 sw=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment