From: Po Lu Date: Sun, 9 Jan 2022 12:29:39 +0000 (+0800) Subject: Fix specification of caret position X-Git-Tag: emacs-29.0.90~3176 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=59ede5cce8e58eabc479ecca88c0ce67bc4bb928;p=emacs.git Fix specification of caret position * src/xfns.c (xic_preedit_caret_callback): (xic_preedit_draw_callback): Use `cursor' property correctly. * src/xterm.c (handle_one_xevent): Stop filtering XI release events. This caused more problems than it fixed. --- diff --git a/src/xfns.c b/src/xfns.c index 0254b3d0b16..293a1b586a4 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -2973,11 +2973,10 @@ xic_preedit_caret_callback (XIC xic, XPointer client_data, ie.arg = make_string_from_utf8 (output->preedit_chars, output->preedit_size); - Fput_text_property (make_fixnum (0), - make_fixnum (SCHARS (ie.arg)), - Qcursor, - make_fixnum (output->preedit_caret), - ie.arg); + Fput_text_property (make_fixnum (max (0, output->preedit_caret)), + make_fixnum (max (SCHARS (ie.arg), + max (0, output->preedit_caret) + 1)), + Qcursor, Qt, ie.arg); XSETINT (ie.x, 0); XSETINT (ie.y, 0); @@ -3196,11 +3195,10 @@ xic_preedit_draw_callback (XIC xic, XPointer client_data, ie.arg = make_string_from_utf8 (output->preedit_chars, output->preedit_size); - Fput_text_property (make_fixnum (0), - make_fixnum (SCHARS (ie.arg)), - Qcursor, - make_fixnum (output->preedit_caret), - ie.arg); + Fput_text_property (make_fixnum (max (0, output->preedit_caret)), + make_fixnum (min (SCHARS (ie.arg), + max (0, output->preedit_caret) + 1)), + Qcursor, Qt, ie.arg); XSETINT (ie.x, 0); XSETINT (ie.y, 0); diff --git a/src/xterm.c b/src/xterm.c index 1c4907f7eaa..36b245ddc35 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -11068,27 +11068,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, } case XI_KeyRelease: x_display_set_last_user_time (dpyinfo, xev->time); -#ifdef HAVE_X_I18N - XKeyPressedEvent xkey; - - memset (&xkey, 0, sizeof xkey); - - xkey.type = KeyRelease; - xkey.serial = xev->serial; - xkey.send_event = xev->send_event; - xkey.display = xev->display; - xkey.window = xev->event; - xkey.root = xev->root; - xkey.subwindow = xev->child; - xkey.time = xev->time; - xkey.state = ((xev->mods.effective & ~(1 << 13 | 1 << 14)) - | (xev->group.effective << 13)); - xkey.keycode = xev->detail; - xkey.same_screen = True; - - x_filter_event (dpyinfo, (XEvent *) &xkey); -#endif goto XI_OTHER; + case XI_PropertyEvent: case XI_HierarchyChanged: case XI_DeviceChanged: