… | |
… | |
1078 | |
1078 | |
1079 | if (fix_screen || old_height == 0) |
1079 | if (fix_screen || old_height == 0) |
1080 | scr_reset (); |
1080 | scr_reset (); |
1081 | |
1081 | |
1082 | #ifdef USE_XIM |
1082 | #ifdef USE_XIM |
1083 | IMSetPosition (); |
1083 | im_set_position (); |
1084 | #endif |
1084 | #endif |
1085 | } |
1085 | } |
1086 | |
1086 | |
1087 | /* |
1087 | /* |
1088 | * Set the width/height of the vt window in characters. Units are pixels. |
1088 | * Set the width/height of the vt window in characters. Units are pixels. |
… | |
… | |
1149 | status_rect.height = fheight; |
1149 | status_rect.height = fheight; |
1150 | } |
1150 | } |
1151 | |
1151 | |
1152 | /* Checking whether input method is running. */ |
1152 | /* Checking whether input method is running. */ |
1153 | bool |
1153 | bool |
1154 | rxvt_term::IMisRunning () |
1154 | rxvt_term::im_is_running () |
1155 | { |
1155 | { |
1156 | Atom atom; |
1156 | Atom atom; |
1157 | Window win; |
1157 | Window win; |
1158 | char server[IMBUFSIZ]; |
1158 | char server[IMBUFSIZ]; |
1159 | |
1159 | |
… | |
… | |
1175 | |
1175 | |
1176 | return false; |
1176 | return false; |
1177 | } |
1177 | } |
1178 | |
1178 | |
1179 | void |
1179 | void |
1180 | rxvt_term::IMSendSpot () |
1180 | rxvt_term::im_send_spot () |
1181 | { |
1181 | { |
1182 | XPoint nspot; |
1182 | XPoint nspot; |
1183 | XVaNestedList preedit_attr; |
1183 | XVaNestedList preedit_attr; |
1184 | |
1184 | |
1185 | if (!Input_Context |
1185 | if (!Input_Context |
… | |
… | |
1291 | /* |
1291 | /* |
1292 | * Try to open a XIM with the current modifiers, then see if we can |
1292 | * Try to open a XIM with the current modifiers, then see if we can |
1293 | * open a suitable preedit type |
1293 | * open a suitable preedit type |
1294 | */ |
1294 | */ |
1295 | bool |
1295 | bool |
1296 | rxvt_term::IM_get_IC (const char *modifiers) |
1296 | rxvt_term::im_get_ic (const char *modifiers) |
1297 | { |
1297 | { |
1298 | int i, j, found; |
1298 | int i, j, found; |
1299 | XIM xim; |
1299 | XIM xim; |
1300 | XPoint spot; |
1300 | XPoint spot; |
1301 | XRectangle rect, status_rect, needed_rect; |
1301 | XRectangle rect, status_rect, needed_rect; |
… | |
… | |
1499 | // unfortunately, only the focus window is used by XIM, hard to fix |
1499 | // unfortunately, only the focus window is used by XIM, hard to fix |
1500 | if (!XGetICValues (Input_Context, XNFilterEvents, &vt_emask_xim, NULL)) |
1500 | if (!XGetICValues (Input_Context, XNFilterEvents, &vt_emask_xim, NULL)) |
1501 | vt_select_input (); |
1501 | vt_select_input (); |
1502 | #endif |
1502 | #endif |
1503 | |
1503 | |
1504 | IMSetPosition (); |
1504 | im_set_position (); |
1505 | |
1505 | |
1506 | return true; |
1506 | return true; |
1507 | } |
1507 | } |
1508 | |
1508 | |
1509 | void |
1509 | void |
… | |
… | |
1537 | { |
1537 | { |
1538 | if (*s[i]) |
1538 | if (*s[i]) |
1539 | { |
1539 | { |
1540 | strcpy (buf, "@im="); |
1540 | strcpy (buf, "@im="); |
1541 | strncat (buf, s[i], IMBUFSIZ - 5); |
1541 | strncat (buf, s[i], IMBUFSIZ - 5); |
1542 | if (IM_get_IC (buf)) |
1542 | if (im_get_ic (buf)) |
1543 | { |
1543 | { |
1544 | found = true; |
1544 | found = true; |
1545 | break; |
1545 | break; |
1546 | } |
1546 | } |
1547 | } |
1547 | } |
… | |
… | |
1552 | if (found) |
1552 | if (found) |
1553 | goto done; |
1553 | goto done; |
1554 | } |
1554 | } |
1555 | |
1555 | |
1556 | /* try with XMODIFIERS env. var. */ |
1556 | /* try with XMODIFIERS env. var. */ |
1557 | if (IM_get_IC ("")) |
1557 | if (im_get_ic ("")) |
1558 | goto done; |
1558 | goto done; |
1559 | |
1559 | |
1560 | /* try with no modifiers base IF the user didn't specify an IM */ |
1560 | /* try with no modifiers base IF the user didn't specify an IM */ |
1561 | if (IM_get_IC ("@im=none")) |
1561 | if (im_get_ic ("@im=none")) |
1562 | goto done; |
1562 | goto done; |
1563 | |
1563 | |
1564 | done: |
1564 | done: |
1565 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1565 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1566 | if (rs[Rs_imLocale]) |
1566 | if (rs[Rs_imLocale]) |
1567 | SET_LOCALE (locale); |
1567 | SET_LOCALE (locale); |
1568 | #endif |
1568 | #endif |
1569 | } |
1569 | } |
1570 | |
1570 | |
1571 | void |
1571 | void |
1572 | rxvt_term::IMSetPosition () |
1572 | rxvt_term::im_set_position () |
1573 | { |
1573 | { |
1574 | XRectangle preedit_rect, status_rect, *needed_rect; |
1574 | XRectangle preedit_rect, status_rect, *needed_rect; |
1575 | XVaNestedList preedit_attr, status_attr; |
1575 | XVaNestedList preedit_attr, status_attr; |
1576 | |
1576 | |
1577 | if (!Input_Context |
1577 | if (!Input_Context |
1578 | || !focus |
1578 | || !focus |
1579 | || !(input_style & (XIMPreeditArea | XIMPreeditPosition)) |
1579 | || !(input_style & (XIMPreeditArea | XIMPreeditPosition)) |
1580 | || !IMisRunning ()) |
1580 | || !im_is_running ()) |
1581 | return; |
1581 | return; |
1582 | |
1582 | |
1583 | if (input_style & XIMPreeditPosition) |
1583 | if (input_style & XIMPreeditPosition) |
1584 | { |
1584 | { |
1585 | im_set_size (preedit_rect); |
1585 | im_set_size (preedit_rect); |