吾搜索后,发现真有牛人提供解决办法:
https://stackoverflow.com/questions/66290102/how-to-get-cursor-position-of-mcclim
有用内容如下:
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);
根据参数类型,找一下已有代码的对应内容,就可以实现了。