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.114 by root, Tue Sep 7 06:19:45 2004 UTC vs.
Revision 1.121 by root, Wed Dec 15 00:12:58 2004 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines