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.
This commit is contained in:
Po Lu
2022-01-09 20:29:39 +08:00
parent fea3bed792
commit 59ede5cce8
2 changed files with 9 additions and 30 deletions

View File

@@ -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);

View File

@@ -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: