From f591835838be92bfe3f02754268cd7fff43fe681 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Mon, 10 Jan 2022 14:36:21 +0800 Subject: [PATCH] Don't set callbacks on XIC when adjusting spot if callbacks are off * src/xfns.c (xic_set_preeditarea): Don't set callbacks if the XIC style is not XIMPreeditCallbacks. (bug#53146) --- src/xfns.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/xfns.c b/src/xfns.c index 9cf6f528198..cd48419fbd3 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -2816,20 +2816,24 @@ free_frame_xic (struct frame *f) void xic_set_preeditarea (struct window *w, int x, int y) { - struct frame *f = XFRAME (w->frame); + struct frame *f = WINDOW_XFRAME (w); XVaNestedList attr; XPoint spot; - if (FRAME_XIC (WINDOW_XFRAME (w))) + if (FRAME_XIC (f)) { spot.x = WINDOW_TO_FRAME_PIXEL_X (w, x) + WINDOW_LEFT_FRINGE_WIDTH (w) + WINDOW_LEFT_MARGIN_WIDTH(w); spot.y = WINDOW_TO_FRAME_PIXEL_Y (w, y) + FONT_BASE (FRAME_FONT (f)); - attr = XVaCreateNestedList (0, XNSpotLocation, &spot, - XNPreeditStartCallback, &Xxic_preedit_start_callback, - XNPreeditDoneCallback, &Xxic_preedit_done_callback, - XNPreeditDrawCallback, &Xxic_preedit_draw_callback, - XNPreeditCaretCallback, &Xxic_preedit_caret_callback, - NULL); + + if (FRAME_XIC_STYLE (f) & XIMPreeditCallbacks) + attr = XVaCreateNestedList (0, XNSpotLocation, &spot, + XNPreeditStartCallback, &Xxic_preedit_start_callback, + XNPreeditDoneCallback, &Xxic_preedit_done_callback, + XNPreeditDrawCallback, &Xxic_preedit_draw_callback, + XNPreeditCaretCallback, &Xxic_preedit_caret_callback, + NULL); + else + attr = XVaCreateNestedList (0, XNSpotLocation, &spot, NULL); XSetICValues (FRAME_XIC (f), XNPreeditAttributes, attr, NULL); XFree (attr); } -- 2.39.2