ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/main.C
(Generate patch)

Comparing rxvt-unicode/src/main.C (file contents):
Revision 1.356 by sf-exg, Fri Apr 29 10:10:20 2011 UTC vs.
Revision 1.358 by sf-exg, Sat Jul 9 13:40:13 2011 UTC

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. */
1153bool 1153bool
1154rxvt_term::IMisRunning () 1154rxvt_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
1179void 1179void
1180rxvt_term::IMSendSpot () 1180rxvt_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 */
1295bool 1295bool
1296rxvt_term::IM_get_IC (const char *modifiers) 1296rxvt_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;
1302 unsigned long fg, bg; 1302 unsigned long fg, bg;
1303 const char *p; 1303 const char *p;
1304 char **s; 1304 char **s;
1305 XIMStyles *xim_styles; 1305 XIMStyles *xim_styles;
1306#ifdef ENABLE_XIM_ONTHESPOT
1307 XIMCallback xcb[4];
1308#endif
1309 1306
1310 set_environ (envv); 1307 set_environ (envv);
1311 1308
1312 if (! ((p = XSetLocaleModifiers (modifiers)) && *p)) 1309 if (! ((p = XSetLocaleModifiers (modifiers)) && *p))
1313 return false; 1310 return false;
1453 NULL); 1450 NULL);
1454 } 1451 }
1455#if ENABLE_XIM_ONTHESPOT 1452#if ENABLE_XIM_ONTHESPOT
1456 else if (input_style & XIMPreeditCallbacks) 1453 else if (input_style & XIMPreeditCallbacks)
1457 { 1454 {
1455 XIMCallback xcb[4];
1456
1458 im_set_position (spot); 1457 im_set_position (spot);
1459 1458
1460 xcb[0].client_data = (XPointer)this; xcb[0].callback = (XIMProc)xim_preedit_start; 1459 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; 1460 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; 1461 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 1499 // unfortunately, only the focus window is used by XIM, hard to fix
1501 if (!XGetICValues (Input_Context, XNFilterEvents, &vt_emask_xim, NULL)) 1500 if (!XGetICValues (Input_Context, XNFilterEvents, &vt_emask_xim, NULL))
1502 vt_select_input (); 1501 vt_select_input ();
1503#endif 1502#endif
1504 1503
1505 IMSetPosition (); 1504 im_set_position ();
1506 1505
1507 return true; 1506 return true;
1508} 1507}
1509 1508
1510void 1509void
1538 { 1537 {
1539 if (*s[i]) 1538 if (*s[i])
1540 { 1539 {
1541 strcpy (buf, "@im="); 1540 strcpy (buf, "@im=");
1542 strncat (buf, s[i], IMBUFSIZ - 5); 1541 strncat (buf, s[i], IMBUFSIZ - 5);
1543 if (IM_get_IC (buf)) 1542 if (im_get_ic (buf))
1544 { 1543 {
1545 found = true; 1544 found = true;
1546 break; 1545 break;
1547 } 1546 }
1548 } 1547 }
1553 if (found) 1552 if (found)
1554 goto done; 1553 goto done;
1555 } 1554 }
1556 1555
1557 /* try with XMODIFIERS env. var. */ 1556 /* try with XMODIFIERS env. var. */
1558 if (IM_get_IC ("")) 1557 if (im_get_ic (""))
1559 goto done; 1558 goto done;
1560 1559
1561 /* 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 */
1562 if (IM_get_IC ("@im=none")) 1561 if (im_get_ic ("@im=none"))
1563 goto done; 1562 goto done;
1564 1563
1565done: 1564done:
1566#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) 1565#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
1567 if (rs[Rs_imLocale]) 1566 if (rs[Rs_imLocale])
1568 SET_LOCALE (locale); 1567 SET_LOCALE (locale);
1569#endif 1568#endif
1570} 1569}
1571 1570
1572void 1571void
1573rxvt_term::IMSetPosition () 1572rxvt_term::im_set_position ()
1574{ 1573{
1575 XRectangle preedit_rect, status_rect, *needed_rect; 1574 XRectangle preedit_rect, status_rect, *needed_rect;
1576 XVaNestedList preedit_attr, status_attr; 1575 XVaNestedList preedit_attr, status_attr;
1577 1576
1578 if (!Input_Context 1577 if (!Input_Context
1579 || !focus 1578 || !focus
1580 || !(input_style & (XIMPreeditArea | XIMPreeditPosition)) 1579 || !(input_style & (XIMPreeditArea | XIMPreeditPosition))
1581 || !IMisRunning ()) 1580 || !im_is_running ())
1582 return; 1581 return;
1583 1582
1584 if (input_style & XIMPreeditPosition) 1583 if (input_style & XIMPreeditPosition)
1585 { 1584 {
1586 im_set_size (preedit_rect); 1585 im_set_size (preedit_rect);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines