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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines