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