Files
wmaker/WINGs/winputmethod.c
T

88 lines
1.1 KiB
C
Raw Normal View History

2001-08-23 22:40:46 +00:00
#include <X11/Xlib.h>
#include "WINGsP.h"
typedef struct W_IMContext {
XIM xim;
2004-10-12 21:28:27 +00:00
2001-08-23 22:40:46 +00:00
struct W_ICContext *icList;
} WMIMContext;
typedef struct W_ICContext {
struct W_ICContext *next;
struct W_ICContext *prev;
2004-10-12 21:28:27 +00:00
XIC xic;
2001-08-23 22:40:46 +00:00
} WMICContext;
Bool
W_InitIMStuff(WMScreen *scr)
2001-08-23 22:40:46 +00:00
{
WMIMContext *ctx;
2004-10-12 21:28:27 +00:00
2001-08-23 22:40:46 +00:00
ctx = scr->imctx = wmalloc(sizeof(WMIMContext));
2004-10-12 21:28:27 +00:00
2001-08-23 22:40:46 +00:00
ctx->xim = XOpenIM(scr->display, NULL, NULL, NULL);
if (ctx->xim == NULL) {
2004-10-12 21:28:27 +00:00
wwarning("could not open IM");
return False;
2001-08-23 22:40:46 +00:00
}
2004-10-12 21:28:27 +00:00
2001-08-23 22:40:46 +00:00
}
void
W_CloseIMStuff(WMScreen *scr)
2001-08-23 22:40:46 +00:00
{
2004-10-12 21:28:27 +00:00
if (!scr->imctx)
return;
2001-08-23 22:40:46 +00:00
if (scr->imctx->xim)
2004-10-12 21:28:27 +00:00
XCloseIM(scr->imctx->xim);
2001-08-23 22:40:46 +00:00
wfree(scr->imctx);
scr->imctx = NULL;
}
WMICContext*
W_CreateIC(WMView *view)
2001-08-23 22:40:46 +00:00
{
WMScreen *scr = W_VIEW_SCREEN(view);
WMICContext *ctx;
2004-10-12 21:28:27 +00:00
2001-08-23 22:40:46 +00:00
ctx->prev = NULL;
ctx->next = scr->imctx->icList;
if (scr->imctx->icList)
2004-10-12 21:28:27 +00:00
scr->imctx->icList->prev = ctx;
2004-10-22 23:39:11 +00:00
2001-08-23 22:40:46 +00:00
}
void
W_DestroyIC(WMICContext *ctx)
2001-08-23 22:40:46 +00:00
{
XDestroyIC(ctx->xic);
2004-10-12 21:28:27 +00:00
2001-08-23 22:40:46 +00:00
}
int
W_LookupString(WMView *view, XKeyEvent *event,
char buffer, int bufsize, KeySym ksym)
2001-08-23 22:40:46 +00:00
{
2004-10-12 21:28:27 +00:00
2001-08-23 22:40:46 +00:00
}