aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-01-09 20:29:39 +0800
committerPo Lu2022-01-09 20:30:58 +0800
commit59ede5cce8e58eabc479ecca88c0ce67bc4bb928 (patch)
tree1d4a0fe5c1cc101c504775f88aea886a9b4a45fe /src
parentfea3bed79228824946b5d6574ec301191e8ae028 (diff)
downloademacs-59ede5cce8e58eabc479ecca88c0ce67bc4bb928.tar.gz
emacs-59ede5cce8e58eabc479ecca88c0ce67bc4bb928.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/xfns.c18
-rw-r--r--src/xterm.c21
2 files changed, 9 insertions, 30 deletions
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,
2973 ie.arg = make_string_from_utf8 (output->preedit_chars, 2973 ie.arg = make_string_from_utf8 (output->preedit_chars,
2974 output->preedit_size); 2974 output->preedit_size);
2975 2975
2976 Fput_text_property (make_fixnum (0), 2976 Fput_text_property (make_fixnum (max (0, output->preedit_caret)),
2977 make_fixnum (SCHARS (ie.arg)), 2977 make_fixnum (max (SCHARS (ie.arg),
2978 Qcursor, 2978 max (0, output->preedit_caret) + 1)),
2979 make_fixnum (output->preedit_caret), 2979 Qcursor, Qt, ie.arg);
2980 ie.arg);
2981 2980
2982 XSETINT (ie.x, 0); 2981 XSETINT (ie.x, 0);
2983 XSETINT (ie.y, 0); 2982 XSETINT (ie.y, 0);
@@ -3196,11 +3195,10 @@ xic_preedit_draw_callback (XIC xic, XPointer client_data,
3196 ie.arg = make_string_from_utf8 (output->preedit_chars, 3195 ie.arg = make_string_from_utf8 (output->preedit_chars,
3197 output->preedit_size); 3196 output->preedit_size);
3198 3197
3199 Fput_text_property (make_fixnum (0), 3198 Fput_text_property (make_fixnum (max (0, output->preedit_caret)),
3200 make_fixnum (SCHARS (ie.arg)), 3199 make_fixnum (min (SCHARS (ie.arg),
3201 Qcursor, 3200 max (0, output->preedit_caret) + 1)),
3202 make_fixnum (output->preedit_caret), 3201 Qcursor, Qt, ie.arg);
3203 ie.arg);
3204 3202
3205 XSETINT (ie.x, 0); 3203 XSETINT (ie.x, 0);
3206 XSETINT (ie.y, 0); 3204 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,
11068 } 11068 }
11069 case XI_KeyRelease: 11069 case XI_KeyRelease:
11070 x_display_set_last_user_time (dpyinfo, xev->time); 11070 x_display_set_last_user_time (dpyinfo, xev->time);
11071#ifdef HAVE_X_I18N
11072 XKeyPressedEvent xkey;
11073
11074 memset (&xkey, 0, sizeof xkey);
11075
11076 xkey.type = KeyRelease;
11077 xkey.serial = xev->serial;
11078 xkey.send_event = xev->send_event;
11079 xkey.display = xev->display;
11080 xkey.window = xev->event;
11081 xkey.root = xev->root;
11082 xkey.subwindow = xev->child;
11083 xkey.time = xev->time;
11084 xkey.state = ((xev->mods.effective & ~(1 << 13 | 1 << 14))
11085 | (xev->group.effective << 13));
11086 xkey.keycode = xev->detail;
11087 xkey.same_screen = True;
11088
11089 x_filter_event (dpyinfo, (XEvent *) &xkey);
11090#endif
11091 goto XI_OTHER; 11071 goto XI_OTHER;
11072
11092 case XI_PropertyEvent: 11073 case XI_PropertyEvent:
11093 case XI_HierarchyChanged: 11074 case XI_HierarchyChanged:
11094 case XI_DeviceChanged: 11075 case XI_DeviceChanged: