testime.c File Reference
`#include <stdlib.h>`
`#include <stdio.h>`
`#include <string.h>`
`#include "SDL.h"`
`#include "SDL_test_common.h"`
Include dependency graph for testime.c:

Go to the source code of this file.

## Macros

#define | DEFAULT_PTSIZE 30
#define | DEFAULT_FONT "/System/Library/Fonts/华文细黑.ttf"
#define | MAX_TEXT_LENGTH 256

## Functions

size_t | utf8_length (unsigned char c)
char * | utf8_next (char *p)
char * | utf8_advance (char *p, size_t distance)
void | usage ()
void | InitInput ()
void | CleanupVideo ()
void | _Redraw (SDL_Renderer *renderer)
void | Redraw ()
int | main (int argc, char *argv[])

## Variables

static SDLTest_CommonState * | state
static SDL_Rect | textRect
static SDL_Rect | markedRect
static SDL_Color | lineColor = {0,0,0,0}
static SDL_Color | backColor = {255,255,255,0}
static SDL_Color | textColor = {0,0,0,0}
static char | text [MAX_TEXT_LENGTH]
static char | markedText [SDL_TEXTEDITINGEVENT_TEXT_SIZE]
static int | cursor = 0

## Macro Definition Documentation

#define DEFAULT_FONT "/System/Library/Fonts/华文细黑.ttf"

Definition at line 26 of file testime.c.

Referenced by main().

#define DEFAULT_PTSIZE 30

Definition at line 25 of file testime.c.

Referenced by main().

#define MAX_TEXT_LENGTH 256

Definition at line 27 of file testime.c.

## Function Documentation

void _Redraw | ( | SDL_Renderer * | renderer | ) |

Definition at line 112 of file testime.c.

References cursor, SDL_Rect::h, SDL_Surface::h, markedRect, markedText, NULL, SDL_CreateTextureFromSurface, SDL_DestroyTexture, SDL_FreeSurface, SDL_RenderCopy, SDL_RenderFillRect, SDL_SetRenderDrawColor, SDL_SetTextInputRect, SDL_StartTextInput, SDL_StopTextInput, text, utf8_advance(), SDL_Rect::w, SDL_Surface::w, SDL_Rect::x, and SDL_Rect::y.

Referenced by Redraw().

{
int w = 0, h = textRect.h;
SDL_Rect cursorRect, underlineRect;
SDL_SetRenderDrawColor(renderer, 255,255,255,255);
SDL_RenderFillRect(renderer,&textRect);
#ifdef HAVE_SDL_TTF
if (*text)
{
SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, text, textColor);
SDL_Rect dest = {textRect.x, textRect.y, textSur->w, textSur->h };
SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer,textSur);
SDL_FreeSurface(textSur);
SDL_RenderCopy(renderer,texture,NULL,&dest);
SDL_DestroyTexture(texture);
TTF_SizeUTF8(font, text, &w, &h);
}
#endif
markedRect.x = textRect.x + w;
markedRect.w = textRect.w - w;
if (markedRect.w < 0)
{
/* Stop text input because we cannot hold any more characters */
SDL_StopTextInput();
return;
}
else
{
SDL_StartTextInput();
}
cursorRect = markedRect;
cursorRect.w = 2;
cursorRect.h = h;
SDL_SetRenderDrawColor(renderer, 255,255,255,255);
SDL_RenderFillRect(renderer,&markedRect);
if (markedText[0])
{
#ifdef HAVE_SDL_TTF
if (cursor)
{
char *p = utf8_advance(markedText, cursor);
char c = 0;
if (!p)
p = &markedText[strlen(markedText)];
c = *p;
*p = 0;
TTF_SizeUTF8(font, markedText, &w, 0);
cursorRect.x += w;
*p = c;
}
SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, markedText, textColor);
SDL_Rect dest = {markedRect.x, markedRect.y, textSur->w, textSur->h };
TTF_SizeUTF8(font, markedText, &w, &h);
SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer,textSur);
SDL_FreeSurface(textSur);
SDL_RenderCopy(renderer,texture,NULL,&dest);
SDL_DestroyTexture(texture);
#endif
underlineRect = markedRect;
underlineRect.y += (h - 2);
underlineRect.h = 2;
underlineRect.w = w;
SDL_SetRenderDrawColor(renderer, 0,0,0,0);
SDL_RenderFillRect(renderer,&markedRect);
}
SDL_SetRenderDrawColor(renderer, 0,0,0,0);
SDL_RenderFillRect(renderer,&cursorRect);
SDL_SetTextInputRect(&markedRect);
}
SDL_Surface::h
int h
Definition: SDL_surface.h:73
SDL_RenderFillRect
#define SDL_RenderFillRect
Definition: SDL_dynapi_overrides.h:347
texture
GLenum GLenum GLuint texture
Definition: SDL_opengl_glext.h:1178
p
GLfloat GLfloat p
Definition: SDL_opengl_glext.h:11090
SDL_Surface
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
SDL_Surface::w
int w
Definition: SDL_surface.h:73
SDL_Texture
Definition: SDL_sysrender.h:49
cursor
static int cursor
Definition: testime.c:35
SDL_RenderCopy
#define SDL_RenderCopy
Definition: SDL_dynapi_overrides.h:349
utf8_advance
char * utf8_advance(char *p, size_t distance)
Definition: testime.c:71
SDL_StopTextInput
#define SDL_StopTextInput
Definition: SDL_dynapi_overrides.h:234
SDL_CreateTextureFromSurface
#define SDL_CreateTextureFromSurface
Definition: SDL_dynapi_overrides.h:313
SDL_FreeSurface
#define SDL_FreeSurface
Definition: SDL_dynapi_overrides.h:450
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
SDL_Rect::x
int x
Definition: SDL_rect.h:66
SDL_Rect::w
int w
Definition: SDL_rect.h:67
SDL_StartTextInput
#define SDL_StartTextInput
Definition: SDL_dynapi_overrides.h:232
NULL
#define NULL
Definition: begin_code.h:143
text
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:34
SDL_SetTextInputRect
#define SDL_SetTextInputRect
Definition: SDL_dynapi_overrides.h:235
markedText
static char markedText[SDL_TEXTEDITINGEVENT_TEXT_SIZE]
Definition: testime.c:34
SDL_DestroyTexture
#define SDL_DestroyTexture
Definition: SDL_dynapi_overrides.h:353
SDL_Rect::h
int h
Definition: SDL_rect.h:67
textRect
static SDL_Rect textRect
Definition: testime.c:30
SDL_SetRenderDrawColor
#define SDL_SetRenderDrawColor
Definition: SDL_dynapi_overrides.h:336
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:731
SDL_Rect::y
int y
Definition: SDL_rect.h:66
markedRect
static SDL_Rect markedRect
Definition: testime.c:30
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1946
textColor
static SDL_Color textColor
Definition: testime.c:33
SDL_Rect
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64

void CleanupVideo | ( |  | ) |

Definition at line 102 of file testime.c.

References SDL_StopTextInput.

Referenced by main().

{
SDL_StopTextInput();
#ifdef HAVE_SDL_TTF
TTF_CloseFont(font);
TTF_Quit();
#endif
}
SDL_StopTextInput
#define SDL_StopTextInput
Definition: SDL_dynapi_overrides.h:234

void InitInput | ( |  | ) |

Definition at line 87 of file testime.c.

References DEFAULT_WINDOW_WIDTH, SDL_Rect::h, markedText, SDL_StartTextInput, text, textRect, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

Referenced by main().

{
/* Prepare a rect for text input */
textRect.x = textRect.y = 100;
textRect.w = DEFAULT_WINDOW_WIDTH - 2 * textRect.x;
textRect.h = 50;
text[0] = 0;
markedRect = textRect;
markedText[0] = 0;
SDL_StartTextInput();
}
SDL_Rect::x
int x
Definition: SDL_rect.h:66
SDL_Rect::w
int w
Definition: SDL_rect.h:67
SDL_StartTextInput
#define SDL_StartTextInput
Definition: SDL_dynapi_overrides.h:232
text
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:34
markedText
static char markedText[SDL_TEXTEDITINGEVENT_TEXT_SIZE]
Definition: testime.c:34
SDL_Rect::h
int h
Definition: SDL_rect.h:67
textRect
static SDL_Rect textRect
Definition: testime.c:30
DEFAULT_WINDOW_WIDTH
#define DEFAULT_WINDOW_WIDTH
Definition: SDL_test_common.h:41
SDL_Rect::y
int y
Definition: SDL_rect.h:66
markedRect
static SDL_Rect markedRect
Definition: testime.c:30

int main | ( | int | argc,
|  | char * | argv[]
| ) |  |

Definition at line 210 of file testime.c.

References CleanupVideo(), cursor, DEFAULT_FONT, DEFAULT_PTSIZE, done, SDL_Event::edit, i, InitInput(), SDL_Event::key, SDL_KeyboardEvent::keysym, SDL_TextEditingEvent::length, markedText, SDLTest_CommonState::num_windows, Redraw(), renderer, SDLTest_CommonState::renderers, SDL_Keysym::scancode, SDL_BLENDMODE_NONE, SDL_GetKeyName, SDL_GetScancodeName, SDL_INIT_VIDEO, SDL_KEYDOWN, SDL_Log, SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, SDL_LogError, SDL_LogSetPriority, SDL_PollEvent, SDL_Quit, SDL_RenderClear, SDL_SetRenderDrawBlendMode, SDL_SetRenderDrawColor, SDL_strlcat, SDL_strlen, SDL_TEXTEDITING, SDL_TEXTINPUT, SDLK_BACKSPACE, SDLK_RETURN, SDLTest_CommonArg(), SDLTest_CommonCreateState(), SDLTest_CommonEvent(), SDLTest_CommonInit(), SDLTest_CommonQuit(), SDL_TextEditingEvent::start, SDL_Keysym::sym, text, SDL_TextEditingEvent::text, SDL_TextInputEvent::text, SDL_Event::text, SDL_Event::type, usage(), and SDL_Rect::w.

{
int i, done;
SDL_Event event;
const char *fontname = DEFAULT_FONT;
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
if (!state) {
return 1;
}
for (i = 1; i < argc;i++) {
SDLTest_CommonArg(state, i);
}
for (argc--, argv++; argc > 0; argc--, argv++)
{
if (strcmp(argv[0], "--help") == 0) {
usage();
return 0;
}
else if (strcmp(argv[0], "--font") == 0)
{
argc--;
argv++;
if (argc > 0)
fontname = argv[0];
else {
usage();
return 0;
}
}
}
if (!SDLTest_CommonInit(state)) {
return 2;
}
#ifdef HAVE_SDL_TTF
/* Initialize fonts */
TTF_Init();
font = TTF_OpenFont(fontname, DEFAULT_PTSIZE);
if (! font)
{
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to find font: %s\n", TTF_GetError());
exit(-1);
}
#endif
SDL_Log("Using font: %s\n", fontname);
atexit(SDL_Quit);
InitInput();
/* Create the windows and initialize the renderers */
for (i = 0; i < state->num_windows; ++i) {
SDL_Renderer *renderer = state->renderers[i];
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE);
SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF);
SDL_RenderClear(renderer);
}
Redraw();
/* Main render loop */
done = 0;
while (!done) {
/* Check for events */
while (SDL_PollEvent(&event)) {
SDLTest_CommonEvent(state, &event, &done);
switch(event.type) {
case SDL_KEYDOWN: {
switch (event.key.keysym.sym)
{
case SDLK_RETURN:
text[0]=0x00;
Redraw();
break;
case SDLK_BACKSPACE:
{
size_t textlen = SDL_strlen(text);
do {
if (textlen==0)
{
break;
}
if ((text[textlen-1] & 0x80) == 0x00)
{
/* One byte */
text[textlen-1]=0x00;
break;
}
if ((text[textlen-1] & 0xC0) == 0x80)
{
/* Byte from the multibyte sequence */
text[textlen-1]=0x00;
textlen--;
}
if ((text[textlen-1] & 0xC0) == 0xC0)
{
/* First byte of multibyte sequence */
text[textlen-1]=0x00;
break;
}
} while(1);
Redraw();
}
break;
}
if (done)
{
break;
}
SDL_Log("Keyboard: scancode 0x%08X = %s, keycode 0x%08X = %s\n",
event.key.keysym.scancode,
SDL_GetScancodeName(event.key.keysym.scancode),
event.key.keysym.sym, SDL_GetKeyName(event.key.keysym.sym));
break;
case SDL_TEXTINPUT:
if (event.text.text[0] == '\0' || event.text.text[0] == '\n' ||
markedRect.w < 0)
break;
SDL_Log("Keyboard: text input \"%s\"\n", event.text.text);
if (SDL_strlen(text) + SDL_strlen(event.text.text) < sizeof(text))
SDL_strlcat(text, event.text.text, sizeof(text));
SDL_Log("text inputed: %s\n", text);
/* After text inputed, we can clear up markedText because it */
/* is committed */
markedText[0] = 0;
Redraw();
break;
case SDL_TEXTEDITING:
SDL_Log("text editing \"%s\", selected range (%d, %d)\n",
event.edit.text, event.edit.start, event.edit.length);
strcpy(markedText, event.edit.text);
cursor = event.edit.start;
Redraw();
break;
}
break;
}
}
}
CleanupVideo();
SDLTest_CommonQuit(state);
return 0;
}
CleanupVideo
void CleanupVideo()
Definition: testime.c:102
SDL_TextEditingEvent::start
Sint32 start
Definition: SDL_events.h:209
SDL_PollEvent
#define SDL_PollEvent
Definition: SDL_dynapi_overrides.h:128
SDL_KEYDOWN
Definition: SDL_events.h:93
SDLK_BACKSPACE
Definition: SDL_keycode.h:53
SDL_strlcat
#define SDL_strlcat
Definition: SDL_dynapi_overrides.h:402
SDL_BLENDMODE_NONE
Definition: SDL_blendmode.h:42
SDLTest_CommonCreateState
SDLTest_CommonState * SDLTest_CommonCreateState(char **argv, Uint32 flags)
Parse command line parameters and create common state.
Definition: SDL_test_common.c:36
SDLTest_CommonArg
int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
Process one common argument.
Definition: SDL_test_common.c:83
SDL_SetRenderDrawBlendMode
#define SDL_SetRenderDrawBlendMode
Definition: SDL_dynapi_overrides.h:338
SDL_Renderer
Definition: SDL_sysrender.h:76
SDL_Keysym::scancode
SDL_Scancode scancode
Definition: SDL_keyboard.h:49
SDLTest_CommonInit
SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
Open test window.
Definition: SDL_test_common.c:645
SDL_TextEditingEvent::length
Sint32 length
Definition: SDL_events.h:210
SDLK_RETURN
Definition: SDL_keycode.h:51
cursor
static int cursor
Definition: testime.c:35
SDL_LogError
#define SDL_LogError
Definition: SDL_dynapi_overrides.h:42
SDLTest_CommonState::num_windows
int num_windows
Definition: SDL_test_common.h:77
renderer
SDL_Renderer * renderer
Definition: testautomation_render.c:27
SDL_Log
#define SDL_Log
Definition: SDL_dynapi_overrides.h:37
SDL_Event::text
SDL_TextInputEvent text
Definition: SDL_events.h:528
SDL_TextInputEvent::text
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]
Definition: SDL_events.h:223
SDLTest_CommonEvent
void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done)
Common event handler for test windows.
Definition: SDL_test_common.c:1295
InitInput
void InitInput()
Definition: testime.c:87
event
struct _cl_event * event
Definition: SDL_opengl_glext.h:2649
SDL_Quit
#define SDL_Quit
Definition: SDL_dynapi_overrides.h:64
done
int done
Definition: checkkeys.c:28
SDL_TextEditingEvent::text
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]
Definition: SDL_events.h:208
Redraw
void Redraw()
Definition: testime.c:195
SDL_LOG_PRIORITY_INFO
Definition: SDL_log.h:106
state
static SDLTest_CommonState * state
Definition: testime.c:29
SDL_KeyboardEvent::keysym
SDL_Keysym keysym
Definition: SDL_events.h:196
SDL_Rect::w
int w
Definition: SDL_rect.h:67
SDLTest_CommonState::renderers
SDL_Renderer ** renderers
Definition: SDL_test_common.h:84
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
SDL_LogSetPriority
#define SDL_LogSetPriority
Definition: SDL_dynapi_overrides.h:242
SDL_Event::edit
SDL_TextEditingEvent edit
Definition: SDL_events.h:527
text
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:34
SDL_RenderClear
#define SDL_RenderClear
Definition: SDL_dynapi_overrides.h:340
SDL_GetScancodeName
#define SDL_GetScancodeName
Definition: SDL_dynapi_overrides.h:228
SDL_TEXTINPUT
Definition: SDL_events.h:96
markedText
static char markedText[SDL_TEXTEDITINGEVENT_TEXT_SIZE]
Definition: testime.c:34
SDL_Event::key
SDL_KeyboardEvent key
Definition: SDL_events.h:526
SDL_strlen
#define SDL_strlen
Definition: SDL_dynapi_overrides.h:399
SDL_GetKeyName
#define SDL_GetKeyName
Definition: SDL_dynapi_overrides.h:230
SDL_Keysym::sym
SDL_Keycode sym
Definition: SDL_keyboard.h:50
DEFAULT_FONT
#define DEFAULT_FONT
Definition: testime.c:26
SDL_Event
General event structure.
Definition: SDL_events.h:521
SDL_SetRenderDrawColor
#define SDL_SetRenderDrawColor
Definition: SDL_dynapi_overrides.h:336
usage
void usage()
Definition: testime.c:81
DEFAULT_PTSIZE
#define DEFAULT_PTSIZE
Definition: testime.c:25
SDL_LOG_CATEGORY_APPLICATION
Definition: SDL_log.h:66
markedRect
static SDL_Rect markedRect
Definition: testime.c:30
SDLTest_CommonQuit
void SDLTest_CommonQuit(SDLTest_CommonState *state)
Close test window.
Definition: SDL_test_common.c:1560
SDL_TEXTEDITING
Definition: SDL_events.h:95
SDL_INIT_VIDEO
#define SDL_INIT_VIDEO
Definition: SDL.h:77
SDL_Event::type
Uint32 type
Definition: SDL_events.h:523

void Redraw | ( |  | ) |

Definition at line 195 of file testime.c.

References _Redraw(), i, NULL, SDLTest_CommonState::num_windows, renderer, SDLTest_CommonState::renderers, SDL_RenderClear, SDL_RenderPresent, SDL_SetRenderDrawColor, and SDLTest_CommonState::windows.

Referenced by main().

{
int i;
for (i = 0; i < state->num_windows; ++i) {
SDL_Renderer *renderer = state->renderers[i];
if (state->windows[i] == NULL)
continue;
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
SDL_RenderClear(renderer);
_Redraw(renderer);
SDL_RenderPresent(renderer);
}
}
SDL_Renderer
Definition: SDL_sysrender.h:76
SDLTest_CommonState::windows
SDL_Window ** windows
Definition: SDL_test_common.h:78
SDLTest_CommonState::num_windows
int num_windows
Definition: SDL_test_common.h:77
renderer
SDL_Renderer * renderer
Definition: testautomation_render.c:27
state
static SDLTest_CommonState * state
Definition: testime.c:29
SDLTest_CommonState::renderers
SDL_Renderer ** renderers
Definition: SDL_test_common.h:84
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
NULL
#define NULL
Definition: begin_code.h:143
SDL_RenderClear
#define SDL_RenderClear
Definition: SDL_dynapi_overrides.h:340
SDL_SetRenderDrawColor
#define SDL_SetRenderDrawColor
Definition: SDL_dynapi_overrides.h:336
_Redraw
void _Redraw(SDL_Renderer *renderer)
Definition: testime.c:112
SDL_RenderPresent
#define SDL_RenderPresent
Definition: SDL_dynapi_overrides.h:352

void usage | ( |  | ) |

Definition at line 81 of file testime.c.

References SDL_Log.

Referenced by main().

{
SDL_Log("usage: testime [--font fontfile]\n");
exit(0);
}
SDL_Log
#define SDL_Log
Definition: SDL_dynapi_overrides.h:37

char* utf8_advance | ( | char * | p,
|  | size_t | distance
| ) |  |

Definition at line 71 of file testime.c.

References i, and utf8_next().

Referenced by _Redraw().

{
size_t i = 0;
for (; i < distance && p; ++i)
{
p = utf8_next(p);
}
return p;
}
p
GLfloat GLfloat p
Definition: SDL_opengl_glext.h:11090
utf8_next
char * utf8_next(char *p)
Definition: testime.c:55
distance
GLsizei GLsizei GLfloat distance
Definition: SDL_opengl_glext.h:9200
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42

size_t utf8_length | ( | unsigned char | c | ) |

Definition at line 40 of file testime.c.

Referenced by utf8_next().

{
c = (unsigned char)(0xff & c);
if (c < 0x80)
return 1;
else if ((c >> 5) ==0x6)
return 2;
else if ((c >> 4) == 0xe)
return 3;
else if ((c >> 3) == 0x1e)
return 4;
else
return 0;
}
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093

char* utf8_next | ( | char * | p | ) |

Definition at line 55 of file testime.c.

References i, and utf8_length().

Referenced by utf8_advance().

{
size_t len = utf8_length(*p);
size_t i = 0;
if (!len)
return 0;
for (; i < len; ++i)
{
++p;
if (!*p)
return 0;
}
return p;
}
p
GLfloat GLfloat p
Definition: SDL_opengl_glext.h:11090
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
utf8_length
size_t utf8_length(unsigned char c)
Definition: testime.c:40

## Variable Documentation

SDL_Color backColor = {255,255,255,0}

static

Definition at line 32 of file testime.c.

int cursor = 0

static

Definition at line 35 of file testime.c.

Referenced by _Redraw(), and main().

SDL_Color lineColor = {0,0,0,0}

static

Definition at line 31 of file testime.c.

SDL_Rect markedRect

static

Definition at line 30 of file testime.c.

Referenced by _Redraw().

char markedText[SDL_TEXTEDITINGEVENT_TEXT_SIZE]

static

Definition at line 34 of file testime.c.

Referenced by _Redraw(), InitInput(), and main().

SDLTest_CommonState* state

static

Definition at line 29 of file testime.c.

char text[MAX_TEXT_LENGTH]

static

Definition at line 34 of file testime.c.

Referenced by _Redraw(), clipboard_testClipboardTextFunctions(), clipboard_testSetClipboardText(), InitInput(), main(), SDL_GetClipboardText(), SDL_LogOutput(), SDL_memset4(), SDL_PrintFloat(), SDL_ScanFloat(), SDL_ScanLong(), SDL_ScanLongLong(), SDL_ScanUintPtrT(), SDL_ScanUnsignedLong(), SDL_ScanUnsignedLongLong(), SDL_sscanf(), SDL_vsnprintf(), SDL_vsscanf(), SDLTest_CommonEvent(), stdlib_getsetenv(), stdlib_snprintf(), and stdlib_strlcpy().

SDL_Color textColor = {0,0,0,0}

static

Definition at line 33 of file testime.c.

SDL_Rect textRect

static

Definition at line 30 of file testime.c.

Referenced by InitInput().