fixed a memleak in the font panel in WINGs
[wmaker-crm.git] / WINGs / winputmethod.c
blobc0ed4ef8bbfbb090cd700502f68e4b057473832b
3 #include <X11/Xlib.h>
5 #include "WINGsP.h"
9 typedef struct W_IMContext {
10 XIM xim;
12 struct W_ICContext *icList;
13 } WMIMContext;
16 typedef struct W_ICContext {
17 struct W_ICContext *next;
18 struct W_ICContext *prev;
20 XIC xic;
21 } WMICContext;
25 Bool W_InitIMStuff(WMScreen *scr)
27 WMIMContext *ctx;
29 ctx = scr->imctx = wmalloc(sizeof(WMIMContext));
31 ctx->xim = XOpenIM(scr->display, NULL, NULL, NULL);
32 if (ctx->xim == NULL) {
33 wwarning("could not open IM");
34 return False;
37 // XGetIMValues(scr->display,
41 void W_CloseIMStuff(WMScreen *scr)
43 if (!scr->imctx)
44 return;
46 if (scr->imctx->xim)
47 XCloseIM(scr->imctx->xim);
48 wfree(scr->imctx);
49 scr->imctx = NULL;
54 WMICContext *W_CreateIC(WMView *view)
56 WMScreen *scr = W_VIEW_SCREEN(view);
57 WMICContext *ctx;
59 ctx->prev = NULL;
60 ctx->next = scr->imctx->icList;
61 if (scr->imctx->icList)
62 scr->imctx->icList->prev = ctx;
63 scr->imctx = ctx;
67 void W_DestroyIC(WMICContext *ctx)
69 XDestroyIC(ctx->xic);
75 int W_LookupString(WMView *view, XKeyEvent *event,
76 char buffer, int bufsize, KeySym ksym)