… | |
… | |
831 | } |
831 | } |
832 | |
832 | |
833 | return true; |
833 | return true; |
834 | } |
834 | } |
835 | |
835 | |
|
|
836 | void rxvt_term::set_string_property (Atom prop, const char *str, int len) |
|
|
837 | { |
|
|
838 | // TODO: SMART_WINDOW_TITLE |
|
|
839 | XChangeProperty (display->display, TermWin.parent[0], |
|
|
840 | prop, XA_STRING, 8, PropModeReplace, |
|
|
841 | (const unsigned char *)str, len >= 0 ? len : strlen (str)); |
|
|
842 | } |
|
|
843 | |
|
|
844 | void rxvt_term::set_utf8_property (Atom prop, const char *str, int len) |
|
|
845 | { |
|
|
846 | // TODO: SMART_WINDOW_TITLE |
|
|
847 | wchar_t *ws = rxvt_mbstowcs (str, len); |
|
|
848 | char *s = rxvt_wcstoutf8 (ws); |
|
|
849 | |
|
|
850 | XChangeProperty (display->display, TermWin.parent[0], |
|
|
851 | prop, xa[XA_UTF8_STRING], 8, PropModeReplace, |
|
|
852 | (const unsigned char *)s, strlen (s)); |
|
|
853 | |
|
|
854 | free (s); |
|
|
855 | free (ws); |
|
|
856 | } |
|
|
857 | |
836 | /*----------------------------------------------------------------------*/ |
858 | /*----------------------------------------------------------------------*/ |
837 | /*----------------------------------------------------------------------*/ |
859 | /*----------------------------------------------------------------------*/ |
838 | /* xterm sequences - title, iconName, color (exptl) */ |
860 | /* xterm sequences - title, iconName, color (exptl) */ |
839 | void |
861 | void |
840 | rxvt_term::set_title (const char *str) |
862 | rxvt_term::set_title (const char *str) |
841 | { |
863 | { |
842 | #ifdef SMART_WINDOW_TITLE |
864 | set_string_property (XA_WM_NAME, str); |
843 | char *name; |
865 | #if ENABLE_FRILLS |
844 | |
866 | set_utf8_property (display->atom ("_NET_WM_NAME"), str); |
845 | if (!XFetchName (display->display, TermWin.parent[0], &name)) |
|
|
846 | name = NULL; |
|
|
847 | |
|
|
848 | if (name == NULL || strcmp (name, str)) |
|
|
849 | #endif |
|
|
850 | XStoreName (display->display, TermWin.parent[0], str); |
|
|
851 | |
|
|
852 | #ifdef SMART_WINDOW_TITLE |
|
|
853 | if (name) |
|
|
854 | XFree (name); |
|
|
855 | #endif |
867 | #endif |
856 | } |
868 | } |
857 | |
869 | |
858 | void |
870 | void |
859 | rxvt_term::set_icon_name (const char *str) |
871 | rxvt_term::set_icon_name (const char *str) |
860 | { |
872 | { |
861 | #ifdef SMART_WINDOW_TITLE |
873 | set_string_property (XA_WM_ICON_NAME, str); |
862 | char *name; |
874 | #if ENABLE_FRILLS |
863 | |
875 | set_utf8_property (display->atom ("_NET_WM_ICON_NAME"), str); |
864 | if (!XGetIconName (display->display, TermWin.parent[0], &name)) |
|
|
865 | name = NULL; |
|
|
866 | |
|
|
867 | if (name == NULL || strcmp (name, str)) |
|
|
868 | #endif |
|
|
869 | XSetIconName (display->display, TermWin.parent[0], str); |
|
|
870 | |
|
|
871 | #ifdef SMART_WINDOW_TITLE |
|
|
872 | if (name) |
|
|
873 | XFree (name); |
|
|
874 | #endif |
876 | #endif |
875 | } |
877 | } |
876 | |
878 | |
877 | #ifdef XTERM_COLOR_CHANGE |
879 | #ifdef XTERM_COLOR_CHANGE |
878 | void |
880 | void |
… | |
… | |
1299 | { |
1301 | { |
1300 | im_destroy (); |
1302 | im_destroy (); |
1301 | return false; |
1303 | return false; |
1302 | } |
1304 | } |
1303 | |
1305 | |
1304 | p = rs[Rs_preeditType] ? rs[Rs_preeditType] : "OverTheSpot,OffTheSpot,Root,None"; |
1306 | const char *pet[] = { rs[Rs_preeditType], "OverTheSpot,OffTheSpot,Root,None" }; |
|
|
1307 | |
|
|
1308 | for (int pi = 0; pi < 2; pi++) |
|
|
1309 | { |
|
|
1310 | p = pet[pi]; |
|
|
1311 | |
|
|
1312 | if (!p) |
|
|
1313 | continue; |
|
|
1314 | |
1305 | s = rxvt_splitcommastring (p); |
1315 | s = rxvt_splitcommastring (p); |
1306 | |
1316 | |
1307 | for (i = found = 0; !found && s[i]; i++) |
1317 | for (i = found = 0; !found && s[i]; i++) |
1308 | { |
1318 | { |
1309 | if (!strcmp (s[i], "OverTheSpot")) |
1319 | if (!strcmp (s[i], "OverTheSpot")) |
1310 | input_style = (XIMPreeditPosition | XIMStatusNothing); |
1320 | input_style = (XIMPreeditPosition | XIMStatusNothing); |
1311 | else if (!strcmp (s[i], "OffTheSpot")) |
1321 | else if (!strcmp (s[i], "OffTheSpot")) |
1312 | input_style = (XIMPreeditArea | XIMStatusArea); |
1322 | input_style = (XIMPreeditArea | XIMStatusArea); |
1313 | else if (!strcmp (s[i], "Root")) |
1323 | else if (!strcmp (s[i], "Root")) |
1314 | input_style = (XIMPreeditNothing | XIMStatusNothing); |
1324 | input_style = (XIMPreeditNothing | XIMStatusNothing); |
1315 | else if (!strcmp (s[i], "None")) |
1325 | else if (!strcmp (s[i], "None")) |
1316 | input_style = (XIMPreeditNone | XIMStatusNone); |
1326 | input_style = (XIMPreeditNone | XIMStatusNone); |
1317 | |
1327 | |
1318 | for (j = 0; j < xim_styles->count_styles; j++) |
1328 | for (j = 0; j < xim_styles->count_styles; j++) |
1319 | if (input_style == xim_styles->supported_styles[j]) |
1329 | if (input_style == xim_styles->supported_styles[j]) |
1320 | { |
1330 | { |
|
|
1331 | rxvt_freecommastring (s); |
|
|
1332 | |
1321 | found = 1; |
1333 | found = 1; |
1322 | break; |
1334 | goto foundpet; |
|
|
1335 | } |
|
|
1336 | |
1323 | } |
1337 | } |
1324 | } |
|
|
1325 | |
1338 | |
1326 | for (i = 0; s[i]; i++) |
1339 | rxvt_freecommastring (s); |
1327 | free (s[i]); |
1340 | } |
1328 | |
1341 | |
1329 | free (s); |
1342 | foundpet: |
|
|
1343 | |
1330 | XFree (xim_styles); |
1344 | XFree (xim_styles); |
1331 | |
1345 | |
1332 | if (!found) |
1346 | if (!found) |
1333 | { |
1347 | { |
1334 | im_destroy (); |
1348 | im_destroy (); |
… | |
… | |
1459 | if (p && *p) |
1473 | if (p && *p) |
1460 | { |
1474 | { |
1461 | bool found = false; |
1475 | bool found = false; |
1462 | |
1476 | |
1463 | s = rxvt_splitcommastring (p); |
1477 | s = rxvt_splitcommastring (p); |
|
|
1478 | |
1464 | for (i = 0; s[i]; i++) |
1479 | for (i = 0; s[i]; i++) |
1465 | { |
1480 | { |
1466 | if (*s[i]) |
1481 | if (*s[i]) |
1467 | { |
1482 | { |
1468 | strcpy (buf, "@im="); |
1483 | strcpy (buf, "@im="); |
… | |
… | |
1472 | found = true; |
1487 | found = true; |
1473 | break; |
1488 | break; |
1474 | } |
1489 | } |
1475 | } |
1490 | } |
1476 | } |
1491 | } |
1477 | for (i = 0; s[i]; i++) |
1492 | |
1478 | free (s[i]); |
1493 | rxvt_freecommastring (s); |
1479 | free (s); |
|
|
1480 | |
1494 | |
1481 | if (found) |
1495 | if (found) |
1482 | goto done; |
1496 | goto done; |
1483 | } |
1497 | } |
1484 | |
1498 | |