]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix specification of caret position
authorPo Lu <luangruo@yahoo.com>
Sun, 9 Jan 2022 12:29:39 +0000 (20:29 +0800)
committerPo Lu <luangruo@yahoo.com>
Sun, 9 Jan 2022 12:30:58 +0000 (20:30 +0800)
* 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.

src/xfns.c
src/xterm.c

index 0254b3d0b16a8e97af4c033b432d99a175c2f191..293a1b586a4a990868a0e012944f2de965029630 100644 (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);
index 1c4907f7eaad0aaa3fff59997878dc0331459a8a..36b245ddc35d1372529d19a43192e8b0a5dfef8a 100644 (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: