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.324 by sf-exg, Wed Mar 31 13:14:50 2010 UTC vs.
Revision 1.328 by sf-exg, Mon Jul 19 16:43:21 2010 UTC

35#include "keyboard.h" 35#include "keyboard.h"
36#include "rxvtperl.h" 36#include "rxvtperl.h"
37 37
38#include <limits> 38#include <limits>
39 39
40#include <cassert>
40#include <csignal> 41#include <csignal>
41#include <cstring> 42#include <cstring>
42 43
43#include <termios.h> 44#include <termios.h>
44 45
390 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->request_code); 391 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->request_code);
391 sprintf(number, "%d", event->request_code); 392 sprintf(number, "%d", event->request_code);
392 XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); 393 XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ);
393 rxvt_warn ("(which is %s)\n", buffer); 394 rxvt_warn ("(which is %s)\n", buffer);
394 if (event->request_code >= 128) { 395 if (event->request_code >= 128) {
395 XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", 396 XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d",
396 mesg, BUFSIZ); 397 mesg, BUFSIZ);
397 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->minor_code); 398 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->minor_code);
398 } 399 }
399 if ((event->error_code == BadWindow) || 400 if ((event->error_code == BadWindow) ||
400 (event->error_code == BadPixmap) || 401 (event->error_code == BadPixmap) ||
401 (event->error_code == BadCursor) || 402 (event->error_code == BadCursor) ||
402 (event->error_code == BadFont) || 403 (event->error_code == BadFont) ||
403 (event->error_code == BadDrawable) || 404 (event->error_code == BadDrawable) ||
404 (event->error_code == BadColor) || 405 (event->error_code == BadColor) ||
405 (event->error_code == BadGC) || 406 (event->error_code == BadGC) ||
406 (event->error_code == BadIDChoice) || 407 (event->error_code == BadIDChoice) ||
407 (event->error_code == BadValue) || 408 (event->error_code == BadValue) ||
408 (event->error_code == BadAtom)) { 409 (event->error_code == BadAtom)) {
409 if (event->error_code == BadValue) 410 if (event->error_code == BadValue)
410 XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", 411 XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x",
411 mesg, BUFSIZ); 412 mesg, BUFSIZ);
412 else if (event->error_code == BadAtom) 413 else if (event->error_code == BadAtom)
413 XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", 414 XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x",
414 mesg, BUFSIZ); 415 mesg, BUFSIZ);
415 else 416 else
416 XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", 417 XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x",
417 mesg, BUFSIZ); 418 mesg, BUFSIZ);
418 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->resourceid); 419 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->resourceid);
419 } 420 }
420 XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", 421 XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d",
421 mesg, BUFSIZ); 422 mesg, BUFSIZ);
422 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->serial); 423 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->serial);
423} 424}
424#endif 425#endif
425 426
426int 427int
478char **rxvt_environ; // startup environment 479char **rxvt_environ; // startup environment
479 480
480void 481void
481rxvt_init () 482rxvt_init ()
482{ 483{
484 assert (("fontMask must not overlap other RS masks",
485 0 == (RS_fontMask & (RS_Sel | RS_baseattrMask | RS_customMask | RS_bgMask | RS_fgMask))));
486
483 ptytty::init (); 487 ptytty::init ();
484 488
485 if (!ev_default_loop (0)) 489 if (!ev_default_loop (0))
486 rxvt_fatal ("cannot initialise libev (bad value for LIBEV_METHODS?)\n"); 490 rxvt_fatal ("cannot initialise libev (bad value for LIBEV_METHODS?)\n");
487 491
688#endif 692#endif
689 693
690 delete fontset[0]; 694 delete fontset[0];
691 fontset[0] = fs; 695 fontset[0] = fs;
692 696
693 prop = (*fs)[1]->properties (); 697 prop = (*fs)[rxvt_fontset::firstFont]->properties ();
694 prop.height += lineSpace; 698 prop.height += lineSpace;
695 prop.width += letterSpace; 699 prop.width += letterSpace;
696 700
697 fs->set_prop (prop, false); 701 fs->set_prop (prop, false);
698 702
750 prop, XA_STRING, 8, PropModeReplace, 754 prop, XA_STRING, 8, PropModeReplace,
751 (const unsigned char *)str, len >= 0 ? len : strlen (str)); 755 (const unsigned char *)str, len >= 0 ? len : strlen (str));
752} 756}
753 757
754void 758void
759rxvt_term::set_mbstring_property (Atom prop, const char *str, int len)
760{
761 XTextProperty ct;
762
763 if (XmbTextListToTextProperty (dpy, (char **)&str, 1, XStdICCTextStyle, &ct) >= 0)
764 {
765 XSetTextProperty (dpy, parent[0], &ct, prop);
766 XFree (ct.value);
767 }
768}
769
770void
755rxvt_term::set_utf8_property (Atom prop, const char *str, int len) 771rxvt_term::set_utf8_property (Atom prop, const char *str, int len)
756{ 772{
757 wchar_t *ws = rxvt_mbstowcs (str, len); 773 wchar_t *ws = rxvt_mbstowcs (str, len);
758 char *s = rxvt_wcstoutf8 (ws); 774 char *s = rxvt_wcstoutf8 (ws);
759 775
769/*----------------------------------------------------------------------*/ 785/*----------------------------------------------------------------------*/
770/* xterm sequences - title, iconName, color (exptl) */ 786/* xterm sequences - title, iconName, color (exptl) */
771void 787void
772rxvt_term::set_title (const char *str) 788rxvt_term::set_title (const char *str)
773{ 789{
774 set_string_property (XA_WM_NAME, str); 790 set_mbstring_property (XA_WM_NAME, str);
775#if ENABLE_EWMH 791#if ENABLE_EWMH
776 set_utf8_property (xa[XA_NET_WM_NAME], str); 792 set_utf8_property (xa[XA_NET_WM_NAME], str);
777#endif 793#endif
778} 794}
779 795
780void 796void
781rxvt_term::set_icon_name (const char *str) 797rxvt_term::set_icon_name (const char *str)
782{ 798{
783 set_string_property (XA_WM_ICON_NAME, str); 799 set_mbstring_property (XA_WM_ICON_NAME, str);
784#if ENABLE_EWMH 800#if ENABLE_EWMH
785 set_utf8_property (xa[XA_NET_WM_ICON_NAME], str); 801 set_utf8_property (xa[XA_NET_WM_ICON_NAME], str);
786#endif 802#endif
787} 803}
788 804

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines