SDL_ime.c File Reference
`#include "SDL_ime.h"`
`#include "SDL_ibus.h"`
`#include "SDL_fcitx.h"`
Include dependency graph for SDL_ime.c:

Go to the source code of this file.

## Typedefs

typedef SDL_bool(* | _SDL_IME_Init) ()
typedef void(* | _SDL_IME_Quit) ()
typedef void(* | _SDL_IME_SetFocus) (SDL_bool)
typedef void(* | _SDL_IME_Reset) ()
typedef SDL_bool(* | _SDL_IME_ProcessKeyEvent) (Uint32, Uint32)
typedef void(* | _SDL_IME_UpdateTextRect) (SDL_Rect *)
typedef void(* | _SDL_IME_PumpEvents) ()

## Functions

static void | InitIME ()
SDL_bool | SDL_IME_Init (void)
void | SDL_IME_Quit (void)
void | SDL_IME_SetFocus (SDL_bool focused)
void | SDL_IME_Reset (void)
SDL_bool | SDL_IME_ProcessKeyEvent (Uint32 keysym, Uint32 keycode)
void | SDL_IME_UpdateTextRect (SDL_Rect *rect)
void | SDL_IME_PumpEvents ()

## Variables

static _SDL_IME_Init | SDL_IME_Init_Real = NULL
static _SDL_IME_Quit | SDL_IME_Quit_Real = NULL
static _SDL_IME_SetFocus | SDL_IME_SetFocus_Real = NULL
static _SDL_IME_Reset | SDL_IME_Reset_Real = NULL
static _SDL_IME_ProcessKeyEvent | SDL_IME_ProcessKeyEvent_Real = NULL
static _SDL_IME_UpdateTextRect | SDL_IME_UpdateTextRect_Real = NULL
static _SDL_IME_PumpEvents | SDL_IME_PumpEvents_Real = NULL

## Typedef Documentation

## _SDL_IME_Init

typedef SDL_bool(* _SDL_IME_Init) ()

Definition at line 26 of file SDL_ime.c.

## _SDL_IME_ProcessKeyEvent

typedef SDL_bool(* _SDL_IME_ProcessKeyEvent) (Uint32, Uint32)

Definition at line 30 of file SDL_ime.c.

## _SDL_IME_PumpEvents

typedef void(* _SDL_IME_PumpEvents) ()

Definition at line 32 of file SDL_ime.c.

## _SDL_IME_Quit

typedef void(* _SDL_IME_Quit) ()

Definition at line 27 of file SDL_ime.c.

## _SDL_IME_Reset

typedef void(* _SDL_IME_Reset) ()

Definition at line 29 of file SDL_ime.c.

## _SDL_IME_SetFocus

typedef void(* _SDL_IME_SetFocus) (SDL_bool)

Definition at line 28 of file SDL_ime.c.

## _SDL_IME_UpdateTextRect

typedef void(* _SDL_IME_UpdateTextRect) (SDL_Rect *)

Definition at line 31 of file SDL_ime.c.

## Function Documentation

## InitIME()

static void InitIME | ( |  | ) |

static

Definition at line 43 of file SDL_ime.c.

{
static SDL_bool inited = SDL_FALSE;
#ifdef HAVE_FCITX_FRONTEND_H
const char *im_module = SDL_getenv("SDL_IM_MODULE");
const char *xmodifiers = SDL_getenv("XMODIFIERS");
#endif
if (inited == SDL_TRUE)
return;
inited = SDL_TRUE;
/* See if fcitx IME support is being requested */
#ifdef HAVE_FCITX_FRONTEND_H
if (!SDL_IME_Init_Real &&
((im_module && SDL_strcmp(im_module, "fcitx") == 0) ||
(!im_module && xmodifiers && SDL_strstr(xmodifiers, "@im=fcitx") != NULL))) {
SDL_IME_Init_Real = SDL_Fcitx_Init;
SDL_IME_Quit_Real = SDL_Fcitx_Quit;
SDL_IME_SetFocus_Real = SDL_Fcitx_SetFocus;
SDL_IME_Reset_Real = SDL_Fcitx_Reset;
SDL_IME_ProcessKeyEvent_Real = SDL_Fcitx_ProcessKeyEvent;
SDL_IME_UpdateTextRect_Real = SDL_Fcitx_UpdateTextRect;
SDL_IME_PumpEvents_Real = SDL_Fcitx_PumpEvents;
}
#endif /* HAVE_FCITX_FRONTEND_H */
/* default to IBus */
#ifdef HAVE_IBUS_IBUS_H
if (!SDL_IME_Init_Real) {
SDL_IME_Init_Real = SDL_IBus_Init;
SDL_IME_Quit_Real = SDL_IBus_Quit;
SDL_IME_SetFocus_Real = SDL_IBus_SetFocus;
SDL_IME_Reset_Real = SDL_IBus_Reset;
SDL_IME_ProcessKeyEvent_Real = SDL_IBus_ProcessKeyEvent;
SDL_IME_UpdateTextRect_Real = SDL_IBus_UpdateTextRect;
SDL_IME_PumpEvents_Real = SDL_IBus_PumpEvents;
}
#endif /* HAVE_IBUS_IBUS_H */
}

References NULL, SDL_FALSE, SDL_Fcitx_Init(), SDL_Fcitx_ProcessKeyEvent(), SDL_Fcitx_PumpEvents(), SDL_Fcitx_Quit(), SDL_Fcitx_Reset(), SDL_Fcitx_SetFocus(), SDL_Fcitx_UpdateTextRect(), SDL_getenv, SDL_IME_Init_Real, SDL_IME_ProcessKeyEvent_Real, SDL_IME_PumpEvents_Real, SDL_IME_Quit_Real, SDL_IME_Reset_Real, SDL_IME_SetFocus_Real, SDL_IME_UpdateTextRect_Real, SDL_strcmp, SDL_strstr, and SDL_TRUE.

Referenced by SDL_IME_Init().

## SDL_IME_Init()

SDL_bool SDL_IME_Init | ( | void |  | ) |

Definition at line 86 of file SDL_ime.c.

{
InitIME();
if (SDL_IME_Init_Real) {
if (SDL_IME_Init_Real()) {
return SDL_TRUE;
}
/* uhoh, the IME implementation's init failed! Disable IME support. */
SDL_IME_Init_Real = NULL;
SDL_IME_Quit_Real = NULL;
SDL_IME_SetFocus_Real = NULL;
SDL_IME_Reset_Real = NULL;
SDL_IME_ProcessKeyEvent_Real = NULL;
SDL_IME_UpdateTextRect_Real = NULL;
SDL_IME_PumpEvents_Real = NULL;
}
return SDL_FALSE;
}

References InitIME(), NULL, SDL_FALSE, SDL_IME_Init_Real, SDL_IME_ProcessKeyEvent_Real, SDL_IME_PumpEvents_Real, SDL_IME_Quit_Real, SDL_IME_Reset_Real, SDL_IME_SetFocus_Real, SDL_IME_UpdateTextRect_Real, and SDL_TRUE.

## SDL_IME_ProcessKeyEvent()

SDL_bool SDL_IME_ProcessKeyEvent | ( | Uint32 | keysym,
|  | Uint32 | keycode
| ) |  |

Definition at line 130 of file SDL_ime.c.

{
if (SDL_IME_ProcessKeyEvent_Real)
return SDL_IME_ProcessKeyEvent_Real(keysym, keycode);
return SDL_FALSE;
}

References SDL_FALSE, and SDL_IME_ProcessKeyEvent_Real.

## SDL_IME_PumpEvents()

void SDL_IME_PumpEvents | ( |  | ) |

Definition at line 146 of file SDL_ime.c.

{
if (SDL_IME_PumpEvents_Real)
SDL_IME_PumpEvents_Real();
}

References SDL_IME_PumpEvents_Real.

## SDL_IME_Quit()

void SDL_IME_Quit | ( | void |  | ) |

Definition at line 109 of file SDL_ime.c.

{
if (SDL_IME_Quit_Real)
SDL_IME_Quit_Real();
}

References SDL_IME_Quit_Real.

## SDL_IME_Reset()

void SDL_IME_Reset | ( | void |  | ) |

Definition at line 123 of file SDL_ime.c.

{
if (SDL_IME_Reset_Real)
SDL_IME_Reset_Real();
}

References SDL_IME_Reset_Real.

## SDL_IME_SetFocus()

void SDL_IME_SetFocus | ( | SDL_bool | focused | ) |

Definition at line 116 of file SDL_ime.c.

{
if (SDL_IME_SetFocus_Real)
SDL_IME_SetFocus_Real(focused);
}

References SDL_IME_SetFocus_Real.

## SDL_IME_UpdateTextRect()

void SDL_IME_UpdateTextRect | ( | SDL_Rect * | rect | ) |

Definition at line 139 of file SDL_ime.c.

{
if (SDL_IME_UpdateTextRect_Real)
SDL_IME_UpdateTextRect_Real(rect);
}

References rect, and SDL_IME_UpdateTextRect_Real.

## Variable Documentation

## SDL_IME_Init_Real

_SDL_IME_Init SDL_IME_Init_Real = NULL

static

Definition at line 34 of file SDL_ime.c.

Referenced by InitIME(), and SDL_IME_Init().

## SDL_IME_ProcessKeyEvent_Real

_SDL_IME_ProcessKeyEvent SDL_IME_ProcessKeyEvent_Real = NULL

static

Definition at line 38 of file SDL_ime.c.

Referenced by InitIME(), SDL_IME_Init(), and SDL_IME_ProcessKeyEvent().

## SDL_IME_PumpEvents_Real

_SDL_IME_PumpEvents SDL_IME_PumpEvents_Real = NULL

static

Definition at line 40 of file SDL_ime.c.

Referenced by InitIME(), SDL_IME_Init(), and SDL_IME_PumpEvents().

## SDL_IME_Quit_Real

_SDL_IME_Quit SDL_IME_Quit_Real = NULL

static

Definition at line 35 of file SDL_ime.c.

Referenced by InitIME(), SDL_IME_Init(), and SDL_IME_Quit().

## SDL_IME_Reset_Real

_SDL_IME_Reset SDL_IME_Reset_Real = NULL

static

Definition at line 37 of file SDL_ime.c.

Referenced by InitIME(), SDL_IME_Init(), and SDL_IME_Reset().

## SDL_IME_SetFocus_Real

_SDL_IME_SetFocus SDL_IME_SetFocus_Real = NULL

static

Definition at line 36 of file SDL_ime.c.

Referenced by InitIME(), SDL_IME_Init(), and SDL_IME_SetFocus().

## SDL_IME_UpdateTextRect_Real

_SDL_IME_UpdateTextRect SDL_IME_UpdateTextRect_Real = NULL

static

Definition at line 39 of file SDL_ime.c.

Referenced by InitIME(), SDL_IME_Init(), and SDL_IME_UpdateTextRect().

SDL_IME_UpdateTextRect_Real
static _SDL_IME_UpdateTextRect SDL_IME_UpdateTextRect_Real
Definition: SDL_ime.c:39
NULL
#define NULL
Definition: begin_code.h:167
SDL_Fcitx_UpdateTextRect
void SDL_Fcitx_UpdateTextRect(SDL_Rect *rect)
InitIME
static void InitIME()
Definition: SDL_ime.c:43
SDL_IME_SetFocus_Real
static _SDL_IME_SetFocus SDL_IME_SetFocus_Real
Definition: SDL_ime.c:36
SDL_IME_Reset_Real
static _SDL_IME_Reset SDL_IME_Reset_Real
Definition: SDL_ime.c:37
SDL_Fcitx_Init
SDL_bool SDL_Fcitx_Init(void)
SDL_FALSE
@ SDL_FALSE
Definition: SDL_stdinc.h:163
rect
SDL_Rect rect
Definition: testrelative.c:27
SDL_Fcitx_Reset
void SDL_Fcitx_Reset(void)
SDL_Fcitx_PumpEvents
void SDL_Fcitx_PumpEvents(void)
SDL_IME_PumpEvents_Real
static _SDL_IME_PumpEvents SDL_IME_PumpEvents_Real
Definition: SDL_ime.c:40
SDL_Fcitx_Quit
void SDL_Fcitx_Quit(void)
SDL_IME_Quit_Real
static _SDL_IME_Quit SDL_IME_Quit_Real
Definition: SDL_ime.c:35
SDL_getenv
#define SDL_getenv
Definition: SDL_dynapi_overrides.h:378
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
SDL_Fcitx_SetFocus
void SDL_Fcitx_SetFocus(SDL_bool focused)
SDL_IME_ProcessKeyEvent_Real
static _SDL_IME_ProcessKeyEvent SDL_IME_ProcessKeyEvent_Real
Definition: SDL_ime.c:38
SDL_Fcitx_ProcessKeyEvent
SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode)
SDL_IME_Init_Real
static _SDL_IME_Init SDL_IME_Init_Real
Definition: SDL_ime.c:34
SDL_strcmp
#define SDL_strcmp
Definition: SDL_dynapi_overrides.h:417
SDL_strstr
#define SDL_strstr
Definition: SDL_dynapi_overrides.h:403
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:161