… | |
… | |
56 | STRNCPY (curlocale, locale, 128); |
56 | STRNCPY (curlocale, locale, 128); |
57 | setlocale (LC_CTYPE, curlocale); |
57 | setlocale (LC_CTYPE, curlocale); |
58 | } |
58 | } |
59 | } |
59 | } |
60 | |
60 | |
|
|
61 | class rxvt_composite_vec rxvt_composite; |
|
|
62 | |
|
|
63 | text_t rxvt_composite_vec::compose (uint32_t c1, uint32_t c2) |
|
|
64 | { |
|
|
65 | compose_char *cc; |
|
|
66 | |
|
|
67 | // break compose chains, as stupid readline really likes to duplicate |
|
|
68 | // composing characters for some reason near the end of a line. |
|
|
69 | cc = (*this)[c1]; |
|
|
70 | while (cc) |
|
|
71 | { |
|
|
72 | if (cc->c2 == c2) return c1; |
|
|
73 | cc = (*this)[cc->c1]; |
|
|
74 | } |
|
|
75 | |
|
|
76 | // check to see wether this combination already exists otherwise |
|
|
77 | for (cc = v.end (); cc-- > v.begin (); ) |
|
|
78 | { |
|
|
79 | if (cc->c1 == c1 && cc->c2 == c2) |
|
|
80 | return COMPOSE_LO + (cc - v.begin ()); |
|
|
81 | } |
|
|
82 | |
|
|
83 | // allocate a new combination |
|
|
84 | if (v.size () == COMPOSE_HI - COMPOSE_LO + 1) |
|
|
85 | { |
|
|
86 | static int seen; |
|
|
87 | |
|
|
88 | if (!seen++) |
|
|
89 | fprintf (stderr, "too many unrepresentable composite characters, try --enable-unicode3\n"); |
|
|
90 | |
|
|
91 | return REPLACEMENT_CHAR; |
|
|
92 | } |
|
|
93 | |
|
|
94 | v.push_back (compose_char (c1, c2)); |
|
|
95 | |
|
|
96 | return v.size () - 1 + COMPOSE_LO; |
|
|
97 | } |
|
|
98 | |
|
|
99 | int rxvt_composite_vec::expand (uint32_t c, wchar_t *r) |
|
|
100 | { |
|
|
101 | compose_char *cc = (*this)[c]; |
|
|
102 | |
|
|
103 | if (!cc) |
|
|
104 | { |
|
|
105 | if (r) *r = c; |
|
|
106 | return 1; |
|
|
107 | } |
|
|
108 | |
|
|
109 | int len = expand (cc->c1, r); |
|
|
110 | |
|
|
111 | if (r) r += len; |
|
|
112 | |
|
|
113 | if (cc->c2 != NOCHAR) |
|
|
114 | { |
|
|
115 | len++; |
|
|
116 | if (r) *r++ = cc->c2; |
|
|
117 | } |
|
|
118 | |
|
|
119 | return len; |
|
|
120 | |
|
|
121 | } |
|
|
122 | |
|
|
123 | extern struct rxvt_composite_vec rxvt_composite; |
61 | void * |
124 | void * |
62 | rxvt_term::operator new (size_t s) |
125 | rxvt_term::operator new (size_t s) |
63 | { |
126 | { |
64 | void *p = malloc (s); |
127 | void *p = malloc (s); |
65 | |
128 | |
… | |
… | |
385 | |
448 | |
386 | p = malloc (size); |
449 | p = malloc (size); |
387 | if (p) |
450 | if (p) |
388 | return p; |
451 | return p; |
389 | |
452 | |
390 | fprintf (stderr, APL_NAME ": memory allocation failure. Aborting"); |
453 | fprintf (stderr, RESNAME ": memory allocation failure. Aborting"); |
391 | rxvt_clean_exit (); |
454 | rxvt_clean_exit (); |
392 | exit (EXIT_FAILURE); |
455 | exit (EXIT_FAILURE); |
393 | /* NOTREACHED */ |
456 | /* NOTREACHED */ |
394 | } |
457 | } |
395 | |
458 | |
… | |
… | |
401 | |
464 | |
402 | p = calloc (number, size); |
465 | p = calloc (number, size); |
403 | if (p) |
466 | if (p) |
404 | return p; |
467 | return p; |
405 | |
468 | |
406 | fprintf (stderr, APL_NAME ": memory allocation failure. Aborting"); |
469 | fprintf (stderr, RESNAME ": memory allocation failure. Aborting"); |
407 | rxvt_clean_exit (); |
470 | rxvt_clean_exit (); |
408 | exit (EXIT_FAILURE); |
471 | exit (EXIT_FAILURE); |
409 | /* NOTREACHED */ |
472 | /* NOTREACHED */ |
410 | } |
473 | } |
411 | |
474 | |
… | |
… | |
420 | else |
483 | else |
421 | p = malloc (size); |
484 | p = malloc (size); |
422 | if (p) |
485 | if (p) |
423 | return p; |
486 | return p; |
424 | |
487 | |
425 | fprintf (stderr, APL_NAME ": memory allocation failure. Aborting"); |
488 | fprintf (stderr, RESNAME ": memory allocation failure. Aborting"); |
426 | rxvt_clean_exit (); |
489 | rxvt_clean_exit (); |
427 | exit (EXIT_FAILURE); |
490 | exit (EXIT_FAILURE); |
428 | /* NOTREACHED */ |
491 | /* NOTREACHED */ |
429 | } |
492 | } |
430 | |
493 | |
… | |
… | |
739 | } |
802 | } |
740 | else |
803 | else |
741 | { |
804 | { |
742 | rxvt_fontset *fs = new rxvt_fontset (this); |
805 | rxvt_fontset *fs = new rxvt_fontset (this); |
743 | |
806 | |
744 | if (fs && fs->populate (fontname)) |
807 | if (fs && fs->populate (fontname ? fontname : "fixed")) |
745 | { |
808 | { |
746 | delete TermWin.fontset; |
809 | delete TermWin.fontset; |
747 | TermWin.fontset = fs; |
810 | TermWin.fontset = fs; |
748 | TermWin.fwidth = fs->base_font ()->width; |
811 | TermWin.fwidth = fs->base_font ()->width; |
749 | TermWin.fheight = fs->base_font ()->height; |
812 | TermWin.fheight = fs->base_font ()->height; |
750 | TermWin.fbase = fs->base_font ()->ascent; |
813 | TermWin.fbase = fs->base_font ()->ascent; |
751 | |
814 | |
752 | // TODO: screen needs to be told about new fonts |
|
|
753 | |
|
|
754 | if (TermWin.parent[0]) |
815 | if (TermWin.parent[0]) |
755 | { |
816 | { |
756 | resize_all_windows (0, 0, 0); |
817 | resize_all_windows (0, 0, 0); |
757 | scr_remap_chars (); |
818 | scr_remap_chars (); |
758 | scr_touch (true); |
819 | scr_touch (true); |
… | |
… | |
778 | rxvt_term::set_title (const char *str) |
839 | rxvt_term::set_title (const char *str) |
779 | { |
840 | { |
780 | #ifndef SMART_WINDOW_TITLE |
841 | #ifndef SMART_WINDOW_TITLE |
781 | XStoreName (display->display, TermWin.parent[0], str); |
842 | XStoreName (display->display, TermWin.parent[0], str); |
782 | #else |
843 | #else |
783 | char *name; |
844 | char *name; |
784 | |
845 | |
785 | if (XFetchName (display->display, TermWin.parent[0], &name) == 0) |
846 | if (XFetchName (display->display, TermWin.parent[0], &name) == 0) |
786 | name = NULL; |
847 | name = NULL; |
787 | if (name == NULL || STRCMP (name, str)) |
848 | if (name == NULL || STRCMP (name, str)) |
788 | XStoreName (display->display, TermWin.parent[0], str); |
849 | XStoreName (display->display, TermWin.parent[0], str); |
… | |
… | |
795 | rxvt_term::set_iconName (const char *str) |
856 | rxvt_term::set_iconName (const char *str) |
796 | { |
857 | { |
797 | #ifndef SMART_WINDOW_TITLE |
858 | #ifndef SMART_WINDOW_TITLE |
798 | XSetIconName (display->display, TermWin.parent[0], str); |
859 | XSetIconName (display->display, TermWin.parent[0], str); |
799 | #else |
860 | #else |
800 | char *name; |
861 | char *name; |
801 | |
862 | |
802 | if (XGetIconName (display->display, TermWin.parent[0], &name)) |
863 | if (XGetIconName (display->display, TermWin.parent[0], &name)) |
803 | name = NULL; |
864 | name = NULL; |
804 | if (name == NULL || STRCMP (name, str)) |
865 | if (name == NULL || STRCMP (name, str)) |
805 | XSetIconName (display->display, TermWin.parent[0], str); |
866 | XSetIconName (display->display, TermWin.parent[0], str); |
… | |
… | |
810 | |
871 | |
811 | #ifdef XTERM_COLOR_CHANGE |
872 | #ifdef XTERM_COLOR_CHANGE |
812 | void |
873 | void |
813 | rxvt_term::set_window_color (int idx, const char *color) |
874 | rxvt_term::set_window_color (int idx, const char *color) |
814 | { |
875 | { |
815 | rxvt_color xcol; |
876 | rxvt_color xcol; |
816 | int i; |
877 | int i; |
817 | |
878 | |
818 | if (color == NULL || *color == '\0') |
879 | if (color == NULL || *color == '\0') |
819 | return; |
880 | return; |
820 | |
881 | |
821 | /* handle color aliases */ |
882 | /* handle color aliases */ |
… | |
… | |
1038 | 0, TermWin_TotalWidth (), menuBar_TotalHeight ()); |
1099 | 0, TermWin_TotalWidth (), menuBar_TotalHeight ()); |
1039 | |
1100 | |
1040 | XMoveResizeWindow (display->display, TermWin.vt, window_vt_x, |
1101 | XMoveResizeWindow (display->display, TermWin.vt, window_vt_x, |
1041 | window_vt_y, TermWin_TotalWidth (), |
1102 | window_vt_y, TermWin_TotalWidth (), |
1042 | TermWin_TotalHeight ()); |
1103 | TermWin_TotalHeight ()); |
1043 | scr_clear (); |
1104 | scr_clear (height != old_height); |
1044 | #ifdef XPM_BACKGROUND |
1105 | #ifdef XPM_BACKGROUND |
1045 | resize_pixmap (); |
1106 | resize_pixmap (); |
1046 | #endif |
1107 | #endif |
1047 | |
1108 | |
1048 | } |
1109 | } |