From: Po Lu Date: Sun, 13 Mar 2022 10:58:42 +0000 (+0800) Subject: Fix setting IM spot after key press events X-Git-Tag: emacs-29.0.90~1931^2~1156 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=676dffff4b063cf4f7667bd0ca6ded3a03704d2c;p=emacs.git Fix setting IM spot after key press events * src/xterm.c (handle_one_xevent): Check f is not NULL before trying to set its status area and set preedit spot location after KeyPress events. --- diff --git a/src/xterm.c b/src/xterm.c index 18a8d5b431a..397b5bfc7a8 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -11038,6 +11038,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, } done_keysym: #ifdef HAVE_X_I18N + if (f) + { + struct window *w = XWINDOW (f->selected_window); + xic_set_preeditarea (w, w->cursor.x, w->cursor.y); + + if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMStatusArea)) + xic_set_statusarea (f); + } + /* Don't dispatch this event since XtDispatchEvent calls XFilterEvent, and two calls in a row may freeze the client. */ @@ -11507,11 +11516,11 @@ handle_one_xevent (struct x_display_info *dpyinfo, #ifdef HAVE_X_I18N - if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMStatusArea)) - xic_set_statusarea (f); - if (f) { + if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMStatusArea)) + xic_set_statusarea (f); + struct window *w = XWINDOW (f->selected_window); xic_set_preeditarea (w, w->cursor.x, w->cursor.y); } @@ -13598,8 +13607,14 @@ handle_one_xevent (struct x_display_info *dpyinfo, xi_done_keysym: #ifdef HAVE_X_I18N - if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMStatusArea)) - xic_set_statusarea (f); + if (f) + { + struct window *w = XWINDOW (f->selected_window); + xic_set_preeditarea (w, w->cursor.x, w->cursor.y); + + if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMStatusArea)) + xic_set_statusarea (f); + } #endif if (must_free_data) XFreeEventData (dpyinfo->display, &event->xcookie);