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.40 by pcg, Sun Feb 22 08:09:38 2004 UTC vs.
Revision 1.51 by pcg, Sat Mar 6 00:05:01 2004 UTC

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
61class rxvt_composite_vec rxvt_composite;
62
63text_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
99int 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
123extern struct rxvt_composite_vec rxvt_composite;
61void * 124void *
62rxvt_term::operator new (size_t s) 125rxvt_term::operator new (size_t s)
63{ 126{
64 void *p = malloc (s); 127 void *p = malloc (s);
65 128
80 vt_ev (this, &rxvt_term::x_cb), 143 vt_ev (this, &rxvt_term::x_cb),
81#ifdef HAVE_SCROLLBARS 144#ifdef HAVE_SCROLLBARS
82 scrollbar_ev (this, &rxvt_term::x_cb), 145 scrollbar_ev (this, &rxvt_term::x_cb),
83#endif 146#endif
84#ifdef MENUBAR 147#ifdef MENUBAR
85 menubar_ev (this, &rxvt_term::x_cb), fixme 148 menubar_ev (this, &rxvt_term::x_cb),
86#endif 149#endif
87#ifdef CURSOR_BLINK 150#ifdef CURSOR_BLINK
88 cursor_blink_ev (this, &rxvt_term::cursor_blink_cb), 151 cursor_blink_ev (this, &rxvt_term::cursor_blink_cb),
89#endif 152#endif
90#ifdef TEXT_BLINK 153#ifdef TEXT_BLINK
117#endif 180#endif
118 181
119 delete TermWin.fontset; 182 delete TermWin.fontset;
120 183
121 if (display) 184 if (display)
185 {
186#if defined(MENUBAR) && (MENUBAR_MAX > 1)
187 delete menuBar.drawable;
188 //if (menuBar.win)
189 // XDestroyWindow (display->display, menuBar.win);
190#endif
191 delete TermWin.drawable;
192 // destroy all windows
122 if (TermWin.parent[0]) 193 if (TermWin.parent[0])
123 XDestroyWindow (display->display, TermWin.parent[0]); 194 XDestroyWindow (display->display, TermWin.parent[0]);
195 }
124 196
125 // TODO: free pixcolours, colours should become part of rxvt_display 197 // TODO: free pixcolours, colours should become part of rxvt_display
126 198
127 delete PixColors; 199 delete PixColors;
128 200
249 321
250 const char **cmd_argv = init_resources (argc, argv); 322 const char **cmd_argv = init_resources (argc, argv);
251 323
252 set_locale (""); 324 set_locale ("");
253 325
254#if (MENUBAR_MAX) 326#if MENUBAR_MAX
255 menubar_read (rs[Rs_menu]); 327 menubar_read (rs[Rs_menu]);
256#endif 328#endif
257#ifdef HAVE_SCROLLBARS 329#ifdef HAVE_SCROLLBARS
258 if (Options & Opt_scrollBar) 330 if (Options & Opt_scrollBar)
259 scrollBar.setIdle (); /* set existence for size calculations */ 331 scrollBar.setIdle (); /* set existence for size calculations */
272#ifdef HAVE_SCROLLBARS 344#ifdef HAVE_SCROLLBARS
273 if (Options & Opt_scrollBar) 345 if (Options & Opt_scrollBar)
274 resize_scrollbar (); /* create and map scrollbar */ 346 resize_scrollbar (); /* create and map scrollbar */
275#endif 347#endif
276#if (MENUBAR_MAX) 348#if (MENUBAR_MAX)
277 if (menubar_visible (r)) 349 if (menubar_visible ())
278 XMapWindow (display->display, menuBar.win); 350 XMapWindow (display->display, menuBar.win);
279#endif 351#endif
280#ifdef TRANSPARENT 352#ifdef TRANSPARENT
281 if (Options & Opt_transparent) 353 if (Options & Opt_transparent)
282 { 354 {
376 448
377 p = malloc (size); 449 p = malloc (size);
378 if (p) 450 if (p)
379 return p; 451 return p;
380 452
381 fprintf (stderr, APL_NAME ": memory allocation failure. Aborting"); 453 fprintf (stderr, RESNAME ": memory allocation failure. Aborting");
382 rxvt_clean_exit (); 454 rxvt_clean_exit ();
383 exit (EXIT_FAILURE); 455 exit (EXIT_FAILURE);
384 /* NOTREACHED */ 456 /* NOTREACHED */
385} 457}
386 458
392 464
393 p = calloc (number, size); 465 p = calloc (number, size);
394 if (p) 466 if (p)
395 return p; 467 return p;
396 468
397 fprintf (stderr, APL_NAME ": memory allocation failure. Aborting"); 469 fprintf (stderr, RESNAME ": memory allocation failure. Aborting");
398 rxvt_clean_exit (); 470 rxvt_clean_exit ();
399 exit (EXIT_FAILURE); 471 exit (EXIT_FAILURE);
400 /* NOTREACHED */ 472 /* NOTREACHED */
401} 473}
402 474
411 else 483 else
412 p = malloc (size); 484 p = malloc (size);
413 if (p) 485 if (p)
414 return p; 486 return p;
415 487
416 fprintf (stderr, APL_NAME ": memory allocation failure. Aborting"); 488 fprintf (stderr, RESNAME ": memory allocation failure. Aborting");
417 rxvt_clean_exit (); 489 rxvt_clean_exit ();
418 exit (EXIT_FAILURE); 490 exit (EXIT_FAILURE);
419 /* NOTREACHED */ 491 /* NOTREACHED */
420} 492}
421 493
715 * init = 1 - initialize 787 * init = 1 - initialize
716 * 788 *
717 * fontname == FONT_UP - switch to bigger font 789 * fontname == FONT_UP - switch to bigger font
718 * fontname == FONT_DN - switch to smaller font 790 * fontname == FONT_DN - switch to smaller font
719 */ 791 */
720void 792bool
721rxvt_term::change_font (int init, const char *fontname) 793rxvt_term::change_font (const char *fontname)
722{} 794{
795 if (fontname == FONT_UP)
796 {
797 // TODO
798 }
799 else if (fontname == FONT_DN)
800 {
801 // TODO
802 }
803 else
804 {
805 rxvt_fontset *fs = new rxvt_fontset (this);
723 806
724void 807 if (fs && fs->populate (fontname ? fontname : "fixed"))
808 {
809 delete TermWin.fontset;
810 TermWin.fontset = fs;
811 TermWin.fwidth = fs->base_font ()->width;
812 TermWin.fheight = fs->base_font ()->height;
813 TermWin.fbase = fs->base_font ()->ascent;
814
815 if (TermWin.parent[0])
816 {
817 resize_all_windows (0, 0, 0);
818 scr_remap_chars ();
819 scr_touch (true);
820 }
821
822 return true;
823 }
824 }
825
826 return false;
827}
828
829bool
725rxvt_term::font_up_down (int n, int direction) 830rxvt_term::font_up_down (int n, int direction)
726{} 831{
832 return false;
833}
727 834
728/*----------------------------------------------------------------------*/ 835/*----------------------------------------------------------------------*/
729/*----------------------------------------------------------------------*/ 836/*----------------------------------------------------------------------*/
730/* xterm sequences - title, iconName, color (exptl) */ 837/* xterm sequences - title, iconName, color (exptl) */
731void 838void
732rxvt_term::set_title (const char *str) 839rxvt_term::set_title (const char *str)
733{ 840{
734#ifndef SMART_WINDOW_TITLE 841#ifndef SMART_WINDOW_TITLE
735 XStoreName (display->display, TermWin.parent[0], str); 842 XStoreName (display->display, TermWin.parent[0], str);
736#else 843#else
737 char *name; 844 char *name;
738 845
739 if (XFetchName (display->display, TermWin.parent[0], &name) == 0) 846 if (XFetchName (display->display, TermWin.parent[0], &name) == 0)
740 name = NULL; 847 name = NULL;
741 if (name == NULL || STRCMP (name, str)) 848 if (name == NULL || STRCMP (name, str))
742 XStoreName (display->display, TermWin.parent[0], str); 849 XStoreName (display->display, TermWin.parent[0], str);
749rxvt_term::set_iconName (const char *str) 856rxvt_term::set_iconName (const char *str)
750{ 857{
751#ifndef SMART_WINDOW_TITLE 858#ifndef SMART_WINDOW_TITLE
752 XSetIconName (display->display, TermWin.parent[0], str); 859 XSetIconName (display->display, TermWin.parent[0], str);
753#else 860#else
754 char *name; 861 char *name;
755 862
756 if (XGetIconName (display->display, TermWin.parent[0], &name)) 863 if (XGetIconName (display->display, TermWin.parent[0], &name))
757 name = NULL; 864 name = NULL;
758 if (name == NULL || STRCMP (name, str)) 865 if (name == NULL || STRCMP (name, str))
759 XSetIconName (display->display, TermWin.parent[0], str); 866 XSetIconName (display->display, TermWin.parent[0], str);
764 871
765#ifdef XTERM_COLOR_CHANGE 872#ifdef XTERM_COLOR_CHANGE
766void 873void
767rxvt_term::set_window_color (int idx, const char *color) 874rxvt_term::set_window_color (int idx, const char *color)
768{ 875{
769 rxvt_color xcol; 876 rxvt_color xcol;
770 int i; 877 int i;
771 878
772 if (color == NULL || *color == '\0') 879 if (color == NULL || *color == '\0')
773 return; 880 return;
774 881
775 /* handle color aliases */ 882 /* handle color aliases */
992 0, TermWin_TotalWidth (), menuBar_TotalHeight ()); 1099 0, TermWin_TotalWidth (), menuBar_TotalHeight ());
993 1100
994 XMoveResizeWindow (display->display, TermWin.vt, window_vt_x, 1101 XMoveResizeWindow (display->display, TermWin.vt, window_vt_x,
995 window_vt_y, TermWin_TotalWidth (), 1102 window_vt_y, TermWin_TotalWidth (),
996 TermWin_TotalHeight ()); 1103 TermWin_TotalHeight ());
997 scr_clear (); 1104 scr_clear (height != old_height);
998#ifdef XPM_BACKGROUND 1105#ifdef XPM_BACKGROUND
999 resize_pixmap (); 1106 resize_pixmap ();
1000#endif 1107#endif
1001 1108
1002 } 1109 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines