@@ -303,18 +303,28 @@ class XIMInputContext final : public InputContext {
303303
304304 void updateCursorLocation () {
305305 // kinds of like notification for position moving
306- bool hasSpotLocation =
307- xcb_im_input_context_get_preedit_attr_mask (xic_) &
308- XCB_XIM_XNSpotLocation_MASK;
309- auto p = xcb_im_input_context_get_preedit_attr (xic_)->spot_location ;
306+ auto mask = xcb_im_input_context_get_preedit_attr_mask (xic_);
310307 auto w = xcb_im_input_context_get_focus_window (xic_);
311308 if (!w) {
312309 w = xcb_im_input_context_get_client_window (xic_);
313310 }
314311 if (!w) {
315312 return ;
316313 }
317- if (hasSpotLocation) {
314+ if (mask & XCB_XIM_XNArea_MASK) {
315+ auto a = xcb_im_input_context_get_preedit_attr (xic_)->area ;
316+ auto trans_cookie = xcb_translate_coordinates (
317+ server_->conn (), w, server_->root (), a.x , a.y );
318+ auto reply = makeUniqueCPtr (xcb_translate_coordinates_reply (
319+ server_->conn (), trans_cookie, nullptr ));
320+ if (!reply) {
321+ return ;
322+ }
323+ setCursorRect (Rect ()
324+ .setPosition (reply->dst_x , reply->dst_y )
325+ .setSize (a.width , a.height ));
326+ } else if (mask & XCB_XIM_XNSpotLocation_MASK) {
327+ auto p = xcb_im_input_context_get_preedit_attr (xic_)->spot_location ;
318328 auto trans_cookie = xcb_translate_coordinates (
319329 server_->conn (), w, server_->root (), p.x , p.y );
320330 auto reply = makeUniqueCPtr (xcb_translate_coordinates_reply (
0 commit comments