… | |
… | |
105 | if (cc->c2 == c2) return c1; |
105 | if (cc->c2 == c2) return c1; |
106 | cc = (*this)[cc->c1]; |
106 | cc = (*this)[cc->c1]; |
107 | } |
107 | } |
108 | |
108 | |
109 | // check to see whether this combination already exists otherwise |
109 | // check to see whether this combination already exists otherwise |
110 | for (cc = v.end (); cc-- > v.begin (); ) |
110 | for (cc = v.begin (); cc < v.end (); cc++) |
111 | if (cc->c1 == c1 && cc->c2 == c2) |
111 | if (cc->c1 == c1 && cc->c2 == c2) |
112 | return COMPOSE_LO + (cc - v.begin ()); |
112 | return COMPOSE_LO + (cc - v.begin ()); |
113 | |
113 | |
114 | // allocate a new combination |
114 | // allocate a new combination |
115 | if (v.size () == COMPOSE_HI - COMPOSE_LO + 1) |
115 | if (v.size () == COMPOSE_HI - COMPOSE_LO + 1) |
… | |
… | |
706 | if (recalc_y) |
706 | if (recalc_y) |
707 | szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth; |
707 | szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth; |
708 | |
708 | |
709 | ncol = width / fwidth; |
709 | ncol = width / fwidth; |
710 | nrow = height / fheight; |
710 | nrow = height / fheight; |
|
|
711 | |
|
|
712 | // When the size of the vt window is not a multiple of the cell |
|
|
713 | // size, i.e., when the wm does not honour our size hints, there are |
|
|
714 | // extra areas not covered by the terminal screen. Such gaps, when a |
|
|
715 | // bg pixmap is set, would have to be cleared manually to properly |
|
|
716 | // refresh the background. We take the simpler route and shrink the |
|
|
717 | // vt window so as to avoid creating gaps. |
|
|
718 | width = ncol * fwidth; |
|
|
719 | height = nrow * fheight; |
711 | } |
720 | } |
712 | |
721 | |
713 | /*----------------------------------------------------------------------*/ |
722 | /*----------------------------------------------------------------------*/ |
714 | /* |
723 | /* |
715 | * Tell the teletype handler what size the window is. |
724 | * Tell the teletype handler what size the window is. |
… | |
… | |
1078 | |
1087 | |
1079 | if (fix_screen || old_height == 0) |
1088 | if (fix_screen || old_height == 0) |
1080 | scr_reset (); |
1089 | scr_reset (); |
1081 | |
1090 | |
1082 | #ifdef USE_XIM |
1091 | #ifdef USE_XIM |
1083 | IMSetPosition (); |
1092 | im_set_position (); |
1084 | #endif |
1093 | #endif |
1085 | } |
1094 | } |
1086 | |
1095 | |
1087 | /* |
1096 | /* |
1088 | * Set the width/height of the vt window in characters. Units are pixels. |
1097 | * Set the width/height of the vt window in characters. Units are pixels. |
… | |
… | |
1149 | status_rect.height = fheight; |
1158 | status_rect.height = fheight; |
1150 | } |
1159 | } |
1151 | |
1160 | |
1152 | /* Checking whether input method is running. */ |
1161 | /* Checking whether input method is running. */ |
1153 | bool |
1162 | bool |
1154 | rxvt_term::IMisRunning () |
1163 | rxvt_term::im_is_running () |
1155 | { |
1164 | { |
1156 | Atom atom; |
1165 | Atom atom; |
1157 | Window win; |
1166 | Window win; |
1158 | char server[IMBUFSIZ]; |
1167 | char server[IMBUFSIZ]; |
1159 | |
1168 | |
… | |
… | |
1175 | |
1184 | |
1176 | return false; |
1185 | return false; |
1177 | } |
1186 | } |
1178 | |
1187 | |
1179 | void |
1188 | void |
1180 | rxvt_term::IMSendSpot () |
1189 | rxvt_term::im_send_spot () |
1181 | { |
1190 | { |
1182 | XPoint nspot; |
1191 | XPoint nspot; |
1183 | XVaNestedList preedit_attr; |
1192 | XVaNestedList preedit_attr; |
1184 | |
1193 | |
1185 | if (!Input_Context |
1194 | if (!Input_Context |
… | |
… | |
1291 | /* |
1300 | /* |
1292 | * Try to open a XIM with the current modifiers, then see if we can |
1301 | * Try to open a XIM with the current modifiers, then see if we can |
1293 | * open a suitable preedit type |
1302 | * open a suitable preedit type |
1294 | */ |
1303 | */ |
1295 | bool |
1304 | bool |
1296 | rxvt_term::IM_get_IC (const char *modifiers) |
1305 | rxvt_term::im_get_ic (const char *modifiers) |
1297 | { |
1306 | { |
1298 | int i, j, found; |
1307 | int i, j, found; |
1299 | XIM xim; |
1308 | XIM xim; |
1300 | XPoint spot; |
1309 | XPoint spot; |
1301 | XRectangle rect, status_rect, needed_rect; |
1310 | XRectangle rect, status_rect, needed_rect; |
1302 | unsigned long fg, bg; |
1311 | unsigned long fg, bg; |
1303 | const char *p; |
1312 | const char *p; |
1304 | char **s; |
1313 | char **s; |
1305 | XIMStyles *xim_styles; |
1314 | XIMStyles *xim_styles; |
1306 | #ifdef ENABLE_XIM_ONTHESPOT |
|
|
1307 | XIMCallback xcb[4]; |
|
|
1308 | #endif |
|
|
1309 | |
1315 | |
1310 | set_environ (envv); |
1316 | set_environ (envv); |
1311 | |
1317 | |
1312 | if (! ((p = XSetLocaleModifiers (modifiers)) && *p)) |
1318 | if (! ((p = XSetLocaleModifiers (modifiers)) && *p)) |
1313 | return false; |
1319 | return false; |
… | |
… | |
1453 | NULL); |
1459 | NULL); |
1454 | } |
1460 | } |
1455 | #if ENABLE_XIM_ONTHESPOT |
1461 | #if ENABLE_XIM_ONTHESPOT |
1456 | else if (input_style & XIMPreeditCallbacks) |
1462 | else if (input_style & XIMPreeditCallbacks) |
1457 | { |
1463 | { |
|
|
1464 | XIMCallback xcb[4]; |
|
|
1465 | |
1458 | im_set_position (spot); |
1466 | im_set_position (spot); |
1459 | |
1467 | |
1460 | xcb[0].client_data = (XPointer)this; xcb[0].callback = (XIMProc)xim_preedit_start; |
1468 | xcb[0].client_data = (XPointer)this; xcb[0].callback = (XIMProc)xim_preedit_start; |
1461 | xcb[1].client_data = (XPointer)this; xcb[1].callback = (XIMProc)xim_preedit_done; |
1469 | xcb[1].client_data = (XPointer)this; xcb[1].callback = (XIMProc)xim_preedit_done; |
1462 | xcb[2].client_data = (XPointer)this; xcb[2].callback = (XIMProc)xim_preedit_draw; |
1470 | xcb[2].client_data = (XPointer)this; xcb[2].callback = (XIMProc)xim_preedit_draw; |
… | |
… | |
1500 | // unfortunately, only the focus window is used by XIM, hard to fix |
1508 | // unfortunately, only the focus window is used by XIM, hard to fix |
1501 | if (!XGetICValues (Input_Context, XNFilterEvents, &vt_emask_xim, NULL)) |
1509 | if (!XGetICValues (Input_Context, XNFilterEvents, &vt_emask_xim, NULL)) |
1502 | vt_select_input (); |
1510 | vt_select_input (); |
1503 | #endif |
1511 | #endif |
1504 | |
1512 | |
1505 | IMSetPosition (); |
1513 | im_set_position (); |
1506 | |
1514 | |
1507 | return true; |
1515 | return true; |
1508 | } |
1516 | } |
1509 | |
1517 | |
1510 | void |
1518 | void |
… | |
… | |
1538 | { |
1546 | { |
1539 | if (*s[i]) |
1547 | if (*s[i]) |
1540 | { |
1548 | { |
1541 | strcpy (buf, "@im="); |
1549 | strcpy (buf, "@im="); |
1542 | strncat (buf, s[i], IMBUFSIZ - 5); |
1550 | strncat (buf, s[i], IMBUFSIZ - 5); |
1543 | if (IM_get_IC (buf)) |
1551 | if (im_get_ic (buf)) |
1544 | { |
1552 | { |
1545 | found = true; |
1553 | found = true; |
1546 | break; |
1554 | break; |
1547 | } |
1555 | } |
1548 | } |
1556 | } |
… | |
… | |
1553 | if (found) |
1561 | if (found) |
1554 | goto done; |
1562 | goto done; |
1555 | } |
1563 | } |
1556 | |
1564 | |
1557 | /* try with XMODIFIERS env. var. */ |
1565 | /* try with XMODIFIERS env. var. */ |
1558 | if (IM_get_IC ("")) |
1566 | if (im_get_ic ("")) |
1559 | goto done; |
1567 | goto done; |
1560 | |
1568 | |
1561 | /* try with no modifiers base IF the user didn't specify an IM */ |
1569 | /* try with no modifiers base IF the user didn't specify an IM */ |
1562 | if (IM_get_IC ("@im=none")) |
1570 | if (im_get_ic ("@im=none")) |
1563 | goto done; |
1571 | goto done; |
1564 | |
1572 | |
1565 | done: |
1573 | done: |
1566 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1574 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1567 | if (rs[Rs_imLocale]) |
1575 | if (rs[Rs_imLocale]) |
1568 | SET_LOCALE (locale); |
1576 | SET_LOCALE (locale); |
1569 | #endif |
1577 | #endif |
1570 | } |
1578 | } |
1571 | |
1579 | |
1572 | void |
1580 | void |
1573 | rxvt_term::IMSetPosition () |
1581 | rxvt_term::im_set_position () |
1574 | { |
1582 | { |
1575 | XRectangle preedit_rect, status_rect, *needed_rect; |
1583 | XRectangle preedit_rect, status_rect, *needed_rect; |
1576 | XVaNestedList preedit_attr, status_attr; |
1584 | XVaNestedList preedit_attr, status_attr; |
1577 | |
1585 | |
1578 | if (!Input_Context |
1586 | if (!Input_Context |
1579 | || !focus |
1587 | || !focus |
1580 | || !(input_style & (XIMPreeditArea | XIMPreeditPosition)) |
1588 | || !(input_style & (XIMPreeditArea | XIMPreeditPosition)) |
1581 | || !IMisRunning ()) |
1589 | || !im_is_running ()) |
1582 | return; |
1590 | return; |
1583 | |
1591 | |
1584 | if (input_style & XIMPreeditPosition) |
1592 | if (input_style & XIMPreeditPosition) |
1585 | { |
1593 | { |
1586 | im_set_size (preedit_rect); |
1594 | im_set_size (preedit_rect); |
… | |
… | |
1651 | if (update_background_ev.is_active ()) |
1659 | if (update_background_ev.is_active ()) |
1652 | return; |
1660 | return; |
1653 | |
1661 | |
1654 | bg_invalidate (); |
1662 | bg_invalidate (); |
1655 | |
1663 | |
|
|
1664 | if (!mapped) |
|
|
1665 | return; |
|
|
1666 | |
1656 | ev_tstamp to_wait = 0.5 - (ev::now () - bg_valid_since); |
1667 | ev_tstamp to_wait = 0.5 - (ev::now () - bg_valid_since); |
1657 | |
1668 | |
1658 | if (to_wait <= 0.) |
1669 | if (to_wait <= 0.) |
1659 | bg_render (); |
1670 | bg_render (); |
1660 | else |
1671 | else |