[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master f591835838 1/2: Don't set callbacks on XIC when adjusting spot if
From: |
Po Lu |
Subject: |
master f591835838 1/2: Don't set callbacks on XIC when adjusting spot if callbacks are off |
Date: |
Mon, 10 Jan 2022 01:40:09 -0500 (EST) |
branch: master
commit f591835838be92bfe3f02754268cd7fff43fe681
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
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 9cf6f52819..cd48419fbd 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);
}