… | |
… | |
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 (uint32_t c1, uint32_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 (uint32_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 | |
… | |
… | |
80 | vt_ev (this, &rxvt_term::x_cb), |
144 | vt_ev (this, &rxvt_term::x_cb), |
81 | #ifdef HAVE_SCROLLBARS |
145 | #ifdef HAVE_SCROLLBARS |
82 | scrollbar_ev (this, &rxvt_term::x_cb), |
146 | scrollbar_ev (this, &rxvt_term::x_cb), |
83 | #endif |
147 | #endif |
84 | #ifdef MENUBAR |
148 | #ifdef MENUBAR |
85 | menubar_ev (this, &rxvt_term::x_cb), fixme |
149 | menubar_ev (this, &rxvt_term::x_cb), |
86 | #endif |
150 | #endif |
87 | #ifdef CURSOR_BLINK |
151 | #ifdef CURSOR_BLINK |
88 | cursor_blink_ev (this, &rxvt_term::cursor_blink_cb), |
152 | cursor_blink_ev (this, &rxvt_term::cursor_blink_cb), |
89 | #endif |
153 | #endif |
90 | #ifdef TEXT_BLINK |
154 | #ifdef TEXT_BLINK |
… | |
… | |
117 | #endif |
181 | #endif |
118 | |
182 | |
119 | delete TermWin.fontset; |
183 | delete TermWin.fontset; |
120 | |
184 | |
121 | if (display) |
185 | if (display) |
|
|
186 | { |
|
|
187 | #if defined(MENUBAR) && (MENUBAR_MAX > 1) |
|
|
188 | delete menuBar.drawable; |
|
|
189 | //if (menuBar.win) |
|
|
190 | // XDestroyWindow (display->display, menuBar.win); |
|
|
191 | #endif |
|
|
192 | delete TermWin.drawable; |
|
|
193 | // destroy all windows |
122 | if (TermWin.parent[0]) |
194 | if (TermWin.parent[0]) |
123 | XDestroyWindow (display->display, TermWin.parent[0]); |
195 | XDestroyWindow (display->display, TermWin.parent[0]); |
|
|
196 | } |
124 | |
197 | |
125 | // TODO: free pixcolours, colours should become part of rxvt_display |
198 | // TODO: free pixcolours, colours should become part of rxvt_display |
126 | |
199 | |
127 | delete PixColors; |
200 | delete PixColors; |
128 | |
201 | |
… | |
… | |
249 | |
322 | |
250 | const char **cmd_argv = init_resources (argc, argv); |
323 | const char **cmd_argv = init_resources (argc, argv); |
251 | |
324 | |
252 | set_locale (""); |
325 | set_locale (""); |
253 | |
326 | |
254 | #if (MENUBAR_MAX) |
327 | #if MENUBAR_MAX |
255 | menubar_read (rs[Rs_menu]); |
328 | menubar_read (rs[Rs_menu]); |
256 | #endif |
329 | #endif |
257 | #ifdef HAVE_SCROLLBARS |
330 | #ifdef HAVE_SCROLLBARS |
258 | if (Options & Opt_scrollBar) |
331 | if (Options & Opt_scrollBar) |
259 | scrollBar.setIdle (); /* set existence for size calculations */ |
332 | scrollBar.setIdle (); /* set existence for size calculations */ |
… | |
… | |
262 | create_windows (argc, argv); |
335 | create_windows (argc, argv); |
263 | |
336 | |
264 | init_xlocale (); |
337 | init_xlocale (); |
265 | |
338 | |
266 | scr_reset (); /* initialize screen */ |
339 | scr_reset (); /* initialize screen */ |
267 | #ifdef RXVT_GRAPHICS |
|
|
268 | Gr_reset (); /* reset graphics */ |
|
|
269 | #endif |
|
|
270 | |
340 | |
271 | #if 0 |
341 | #if 0 |
272 | XSynchronize (display->display, True); |
342 | XSynchronize (display->display, True); |
273 | #endif |
343 | #endif |
274 | |
344 | |
275 | #ifdef HAVE_SCROLLBARS |
345 | #ifdef HAVE_SCROLLBARS |
276 | if (Options & Opt_scrollBar) |
346 | if (Options & Opt_scrollBar) |
277 | resize_scrollbar (); /* create and map scrollbar */ |
347 | resize_scrollbar (); /* create and map scrollbar */ |
278 | #endif |
348 | #endif |
279 | #if (MENUBAR_MAX) |
349 | #if (MENUBAR_MAX) |
280 | if (menubar_visible (r)) |
350 | if (menubar_visible ()) |
281 | XMapWindow (display->display, menuBar.win); |
351 | XMapWindow (display->display, menuBar.win); |
282 | #endif |
352 | #endif |
283 | #ifdef TRANSPARENT |
353 | #ifdef TRANSPARENT |
284 | if (Options & Opt_transparent) |
354 | if (Options & Opt_transparent) |
285 | { |
355 | { |
… | |
… | |
379 | |
449 | |
380 | p = malloc (size); |
450 | p = malloc (size); |
381 | if (p) |
451 | if (p) |
382 | return p; |
452 | return p; |
383 | |
453 | |
384 | fprintf (stderr, APL_NAME ": memory allocation failure. Aborting"); |
454 | fprintf (stderr, RESNAME ": memory allocation failure. Aborting"); |
385 | rxvt_clean_exit (); |
455 | rxvt_clean_exit (); |
386 | exit (EXIT_FAILURE); |
456 | exit (EXIT_FAILURE); |
387 | /* NOTREACHED */ |
457 | /* NOTREACHED */ |
388 | } |
458 | } |
389 | |
459 | |
… | |
… | |
395 | |
465 | |
396 | p = calloc (number, size); |
466 | p = calloc (number, size); |
397 | if (p) |
467 | if (p) |
398 | return p; |
468 | return p; |
399 | |
469 | |
400 | fprintf (stderr, APL_NAME ": memory allocation failure. Aborting"); |
470 | fprintf (stderr, RESNAME ": memory allocation failure. Aborting"); |
401 | rxvt_clean_exit (); |
471 | rxvt_clean_exit (); |
402 | exit (EXIT_FAILURE); |
472 | exit (EXIT_FAILURE); |
403 | /* NOTREACHED */ |
473 | /* NOTREACHED */ |
404 | } |
474 | } |
405 | |
475 | |
… | |
… | |
414 | else |
484 | else |
415 | p = malloc (size); |
485 | p = malloc (size); |
416 | if (p) |
486 | if (p) |
417 | return p; |
487 | return p; |
418 | |
488 | |
419 | fprintf (stderr, APL_NAME ": memory allocation failure. Aborting"); |
489 | fprintf (stderr, RESNAME ": memory allocation failure. Aborting"); |
420 | rxvt_clean_exit (); |
490 | rxvt_clean_exit (); |
421 | exit (EXIT_FAILURE); |
491 | exit (EXIT_FAILURE); |
422 | /* NOTREACHED */ |
492 | /* NOTREACHED */ |
423 | } |
493 | } |
424 | |
494 | |
… | |
… | |
616 | else |
686 | else |
617 | szHint.win_gravity = SouthWestGravity; |
687 | szHint.win_gravity = SouthWestGravity; |
618 | } |
688 | } |
619 | } |
689 | } |
620 | } |
690 | } |
|
|
691 | |
621 | /* TODO: BOUNDS */ |
692 | /* TODO: BOUNDS */ |
622 | TermWin.width = TermWin.ncol * TermWin.fwidth; |
693 | TermWin.width = TermWin.ncol * TermWin.fwidth; |
623 | TermWin.height = TermWin.nrow * TermWin.fheight; |
694 | TermWin.height = TermWin.nrow * TermWin.fheight; |
624 | max_width = MAX_COLS * TermWin.fwidth; |
695 | max_width = MAX_COLS * TermWin.fwidth; |
625 | max_height = MAX_ROWS * TermWin.fheight; |
696 | max_height = MAX_ROWS * TermWin.fheight; |
… | |
… | |
718 | * init = 1 - initialize |
789 | * init = 1 - initialize |
719 | * |
790 | * |
720 | * fontname == FONT_UP - switch to bigger font |
791 | * fontname == FONT_UP - switch to bigger font |
721 | * fontname == FONT_DN - switch to smaller font |
792 | * fontname == FONT_DN - switch to smaller font |
722 | */ |
793 | */ |
723 | void |
794 | bool |
724 | rxvt_term::change_font (int init, const char *fontname) |
795 | rxvt_term::change_font (const char *fontname) |
725 | {} |
796 | { |
|
|
797 | if (fontname == FONT_UP) |
|
|
798 | { |
|
|
799 | // TODO |
|
|
800 | } |
|
|
801 | else if (fontname == FONT_DN) |
|
|
802 | { |
|
|
803 | // TODO |
|
|
804 | } |
|
|
805 | else |
|
|
806 | { |
|
|
807 | rxvt_fontset *fs = new rxvt_fontset (this); |
726 | |
808 | |
727 | void |
809 | if (fs && fs->populate (fontname ? fontname : "fixed")) |
|
|
810 | { |
|
|
811 | delete TermWin.fontset; |
|
|
812 | TermWin.fontset = fs; |
|
|
813 | TermWin.fwidth = fs->base_font ()->width; |
|
|
814 | TermWin.fheight = fs->base_font ()->height; |
|
|
815 | TermWin.fbase = fs->base_font ()->ascent; |
|
|
816 | |
|
|
817 | if (TermWin.parent[0]) |
|
|
818 | { |
|
|
819 | resize_all_windows (0, 0, 0); |
|
|
820 | scr_remap_chars (); |
|
|
821 | scr_touch (true); |
|
|
822 | } |
|
|
823 | |
|
|
824 | return true; |
|
|
825 | } |
|
|
826 | } |
|
|
827 | |
|
|
828 | return false; |
|
|
829 | } |
|
|
830 | |
|
|
831 | bool |
728 | rxvt_term::font_up_down (int n, int direction) |
832 | rxvt_term::font_up_down (int n, int direction) |
729 | {} |
833 | { |
|
|
834 | return false; |
|
|
835 | } |
730 | |
836 | |
731 | /*----------------------------------------------------------------------*/ |
837 | /*----------------------------------------------------------------------*/ |
732 | /*----------------------------------------------------------------------*/ |
838 | /*----------------------------------------------------------------------*/ |
733 | /* xterm sequences - title, iconName, color (exptl) */ |
839 | /* xterm sequences - title, iconName, color (exptl) */ |
734 | void |
840 | void |
735 | rxvt_term::set_title (const char *str) |
841 | rxvt_term::set_title (const char *str) |
736 | { |
842 | { |
737 | #ifndef SMART_WINDOW_TITLE |
843 | #ifndef SMART_WINDOW_TITLE |
738 | XStoreName (display->display, TermWin.parent[0], str); |
844 | XStoreName (display->display, TermWin.parent[0], str); |
739 | #else |
845 | #else |
740 | char *name; |
846 | char *name; |
741 | |
847 | |
742 | if (XFetchName (display->display, TermWin.parent[0], &name) == 0) |
848 | if (XFetchName (display->display, TermWin.parent[0], &name) == 0) |
743 | name = NULL; |
849 | name = NULL; |
744 | if (name == NULL || STRCMP (name, str)) |
850 | if (name == NULL || STRCMP (name, str)) |
745 | XStoreName (display->display, TermWin.parent[0], str); |
851 | XStoreName (display->display, TermWin.parent[0], str); |
… | |
… | |
752 | rxvt_term::set_iconName (const char *str) |
858 | rxvt_term::set_iconName (const char *str) |
753 | { |
859 | { |
754 | #ifndef SMART_WINDOW_TITLE |
860 | #ifndef SMART_WINDOW_TITLE |
755 | XSetIconName (display->display, TermWin.parent[0], str); |
861 | XSetIconName (display->display, TermWin.parent[0], str); |
756 | #else |
862 | #else |
757 | char *name; |
863 | char *name; |
758 | |
864 | |
759 | if (XGetIconName (display->display, TermWin.parent[0], &name)) |
865 | if (XGetIconName (display->display, TermWin.parent[0], &name)) |
760 | name = NULL; |
866 | name = NULL; |
761 | if (name == NULL || STRCMP (name, str)) |
867 | if (name == NULL || STRCMP (name, str)) |
762 | XSetIconName (display->display, TermWin.parent[0], str); |
868 | XSetIconName (display->display, TermWin.parent[0], str); |
… | |
… | |
767 | |
873 | |
768 | #ifdef XTERM_COLOR_CHANGE |
874 | #ifdef XTERM_COLOR_CHANGE |
769 | void |
875 | void |
770 | rxvt_term::set_window_color (int idx, const char *color) |
876 | rxvt_term::set_window_color (int idx, const char *color) |
771 | { |
877 | { |
772 | rxvt_color xcol; |
878 | rxvt_color xcol; |
773 | int i; |
879 | int i; |
774 | |
880 | |
775 | if (color == NULL || *color == '\0') |
881 | if (color == NULL || *color == '\0') |
776 | return; |
882 | return; |
777 | |
883 | |
778 | /* handle color aliases */ |
884 | /* handle color aliases */ |
… | |
… | |
995 | 0, TermWin_TotalWidth (), menuBar_TotalHeight ()); |
1101 | 0, TermWin_TotalWidth (), menuBar_TotalHeight ()); |
996 | |
1102 | |
997 | XMoveResizeWindow (display->display, TermWin.vt, window_vt_x, |
1103 | XMoveResizeWindow (display->display, TermWin.vt, window_vt_x, |
998 | window_vt_y, TermWin_TotalWidth (), |
1104 | window_vt_y, TermWin_TotalWidth (), |
999 | TermWin_TotalHeight ()); |
1105 | TermWin_TotalHeight ()); |
1000 | #ifdef RXVT_GRAPHICS |
1106 | scr_clear (height != old_height); |
1001 | if (old_height) |
|
|
1002 | Gr_Resize (old_width - szHint.base_width, |
|
|
1003 | old_height - szHint.base_height); |
|
|
1004 | #endif |
|
|
1005 | scr_clear (); |
|
|
1006 | #ifdef XPM_BACKGROUND |
1107 | #ifdef XPM_BACKGROUND |
1007 | resize_pixmap (); |
1108 | resize_pixmap (); |
1008 | #endif |
1109 | #endif |
1009 | |
1110 | |
1010 | } |
1111 | } |