better Input Method Editor (IME) support (35f7db)

This commit is contained in:
bakkeby 2020-03-24 11:25:39 +01:00
parent 9f1a2db7c5
commit e7cfd5ae16
11 changed files with 56 additions and 93 deletions

View file

@ -1,49 +0,0 @@
void
ximopen(Display *dpy)
{
XIMCallback destroy = { .client_data = NULL, .callback = ximdestroy };
if ((xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL)) == NULL) {
XSetLocaleModifiers("@im=local");
if ((xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL)) == NULL) {
XSetLocaleModifiers("@im=");
if ((xw.xim = XOpenIM(xw.dpy,
NULL, NULL, NULL)) == NULL) {
die("XOpenIM failed. Could not open input"
" device.\n");
}
}
}
if (XSetIMValues(xw.xim, XNDestroyCallback, &destroy, NULL) != NULL)
die("XSetIMValues failed. Could not set input method value.\n");
xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
XNClientWindow, xw.win, XNFocusWindow, xw.win, NULL);
if (xw.xic == NULL)
die("XCreateIC failed. Could not obtain input method.\n");
}
void
ximinstantiate(Display *dpy, XPointer client, XPointer call)
{
ximopen(dpy);
XUnregisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL,
ximinstantiate, NULL);
}
void
ximdestroy(XIM xim, XPointer client, XPointer call)
{
xw.xim = NULL;
XRegisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL,
ximinstantiate, NULL);
}
void
xximspot(int x, int y)
{
XPoint spot = { borderpx + x * win.cw, borderpx + (y + 1) * win.ch };
XVaNestedList attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
XSetICValues(xw.xic, XNPreeditAttributes, attr, NULL);
XFree(attr);
}

View file

@ -1 +0,0 @@
void xximspot(int, int);

View file

@ -1,4 +0,0 @@
static void ximopen(Display *);
static void ximinstantiate(Display *, XPointer, XPointer);
static void ximdestroy(XIM, XPointer, XPointer);
void xximspot(int, int);

View file

@ -5,9 +5,6 @@
#if EXTERNALPIPE_PATCH
#include "externalpipe.h"
#endif
#if FIXIME_PATCH
#include "fixime_st.h"
#endif
#if ISO14755_PATCH
#include "iso14755.h"
#endif

View file

@ -5,9 +5,6 @@
#if OPENCOPIED_PATCH
#include "opencopied.c"
#endif
#if FIXIME_PATCH
#include "fixime.c"
#endif
#if FIXKEYBOARDINPUT_PATCH
#include "fixkeyboardinput.c"
#endif

View file

@ -5,9 +5,6 @@
#if OPENCOPIED_PATCH
#include "opencopied.h"
#endif
#if FIXIME_PATCH
#include "fixime_x.h"
#endif
#if FONT2_PATCH
#include "font2.h"
#endif