天天看點

關于LINUX輸入法候選框光标跟随的代碼的一個網頁

吾搜尋後,發現真有牛人提供解決辦法: 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);      

根據參數類型,找一下已有代碼的對應内容,就可以實作了。

繼續閱讀