emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 59ede5cce8: Fix specification of caret position


From: Po Lu
Subject: master 59ede5cce8: Fix specification of caret position
Date: Sun, 9 Jan 2022 07:31:13 -0500 (EST)

branch: master
commit 59ede5cce8e58eabc479ecca88c0ce67bc4bb928
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 src/xfns.c  | 18 ++++++++----------
 src/xterm.c | 21 +--------------------
 2 files changed, 9 insertions(+), 30 deletions(-)

diff --git a/src/xfns.c b/src/xfns.c
index 0254b3d0b1..293a1b586a 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 1c4907f7ea..36b245ddc3 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:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]