Skip to content

Commit

Permalink
* ui_xic.c: Add 'spot' to ui_xic_t to decrease the number of informing
Browse files Browse the repository at this point in the history
  the cursor position for XIM preedit by XSetICValues().
  • Loading branch information
arakiken committed Jan 3, 2024
1 parent a2caa10 commit b8750c1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
2024-01-03 Araki Ken <arakiken@users.sf.net>

* ui_xic.c: Add 'spot' to ui_xic_t to decrease the number of informing
the cursor position for XIM preedit by XSetICValues().

* etc/termcap: Change the default value of "xterm" entry from "ut" to "kb=^H:ut".

2024-01-02 Araki Ken <arakiken@users.sf.net>
Expand Down
1 change: 1 addition & 0 deletions uitoolkit/ui_xic.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ typedef struct ui_xic {
#elif defined(USE_XLIB)
XFontSet fontset;
XIMStyle style;
XPoint spot;
#endif

} ui_xic_t;
Expand Down
11 changes: 11 additions & 0 deletions uitoolkit/xlib/ui_xic.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ static int create_xic(ui_window_t *win) {
win->xic->ic = xic;
win->xic->fontset = fontset;
win->xic->style = selected_style;
win->xic->spot = spot;

xim_ev_mask = 0;

Expand Down Expand Up @@ -352,6 +353,10 @@ int ui_xic_resized(ui_window_t *win) {
spot.y = 0;
}

if (spot.x == win->xic->spot.x && spot.y == win->xic->spot.y) {
return 0;
}

if ((preedit_attr = XVaCreateNestedList(0,
#ifdef SET_XNAREA_ATTR
XNArea, &rect,
Expand All @@ -365,6 +370,7 @@ int ui_xic_resized(ui_window_t *win) {
}

XSetICValues(win->xic->ic, XNPreeditAttributes, preedit_attr, NULL);
win->xic->spot = spot;

XFree(preedit_attr);

Expand All @@ -385,6 +391,10 @@ int ui_xic_set_spot(ui_window_t *win) {
return 0;
}

if (spot.x == win->xic->spot.x && spot.y == win->xic->spot.y) {
return 0;
}

if ((preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL)) == NULL) {
#ifdef DEBUG
bl_warn_printf(BL_DEBUG_TAG " XvaCreateNestedList failed.\n");
Expand All @@ -394,6 +404,7 @@ int ui_xic_set_spot(ui_window_t *win) {
}

XSetICValues(win->xic->ic, XNPreeditAttributes, preedit_attr, NULL);
win->xic->spot = spot;

XFree(preedit_attr);

Expand Down

0 comments on commit b8750c1

Please sign in to comment.