2

I'm trying to add Input Method supportto McCLIM so that it can input CJK in McCLIM, using input method client like fcitx.

To draw fcitx better, I want to get the cursor position of text editing area when it changed.

looks like this: enter image description here

I found something called cursor-position/stream-cursor-position, but I don't know how to get the cursor/stream currently focus on. I have tried *standard-output*, but it failed.

How could I do this?

C-Entropy
  • 303
  • 2
  • 9

1 Answers1

0

I know you're not using libx11, but I'd like just show you how libX11 do this.

Basically this is done by XIM_SET_IC_VALUES in the protocol. The values the spot location within a nested value of preedit attributes.

The spot is simply a X point (x, y). Despite of that, the point is a relative coordinates to the focus window. The focus window is also a part of ic vlaues, with property name XNFocusWindow.

If you don't set focus window, the client window that passed through XCreateIC will be used as the focus window.

    XVaNestedList preedit_attr;
    preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &nspot, NULL);
    XSetICValues(ic, XNPreeditAttributes, preedit_attr, NULL);
    XFree(preedit_attr);
csslayer
  • 317
  • 2
  • 9
  • You are right. But now my question is how to get the X point(x, y)? – C-Entropy Feb 27 '21 at 03:53
  • I don't know mcclim but briefly search this might be related to what you want: port-keyboard-input-focus https://github.com/McCLIM/McCLIM/blob/3c4957694a9bb4b372a3510c099f77dc0fed9fa9/Core/clim-basic/windowing/ports.lisp#L110 – csslayer Mar 02 '21 at 01:06