--- rxvt-unicode/src/main.C 2004/02/24 16:25:44 1.44 +++ rxvt-unicode/src/main.C 2004/03/15 00:08:11 1.54 @@ -58,6 +58,70 @@ } } +#if ENABLE_COMBINING +class rxvt_composite_vec rxvt_composite; + +text_t rxvt_composite_vec::compose (unicode_t c1, unicode_t c2) +{ + compose_char *cc; + + // break compose chains, as stupid readline really likes to duplicate + // composing characters for some reason near the end of a line. + cc = (*this)[c1]; + while (cc) + { + if (cc->c2 == c2) return c1; + cc = (*this)[cc->c1]; + } + + // check to see wether this combination already exists otherwise + for (cc = v.end (); cc-- > v.begin (); ) + { + if (cc->c1 == c1 && cc->c2 == c2) + return COMPOSE_LO + (cc - v.begin ()); + } + + // allocate a new combination + if (v.size () == COMPOSE_HI - COMPOSE_LO + 1) + { + static int seen; + + if (!seen++) + fprintf (stderr, "too many unrepresentable composite characters, try --enable-unicode3\n"); + + return REPLACEMENT_CHAR; + } + + v.push_back (compose_char (c1, c2)); + + return v.size () - 1 + COMPOSE_LO; +} + +int rxvt_composite_vec::expand (unicode_t c, wchar_t *r) +{ + compose_char *cc = (*this)[c]; + + if (!cc) + { + if (r) *r = c; + return 1; + } + + int len = expand (cc->c1, r); + + if (r) r += len; + + if (cc->c2 != NOCHAR) + { + len++; + if (r) *r++ = cc->c2; + } + + return len; + +} +#endif + void * rxvt_term::operator new (size_t s) { @@ -120,13 +184,15 @@ if (display) { - if (TermWin.parent[0]) - XDestroyWindow (display->display, TermWin.parent[0]); #if defined(MENUBAR) && (MENUBAR_MAX > 1) - if (menuBar.win) - XDestroyWindow (display->display, menuBar.win); delete menuBar.drawable; + //if (menuBar.win) + // XDestroyWindow (display->display, menuBar.win); #endif + delete TermWin.drawable; + // destroy all windows + if (TermWin.parent[0]) + XDestroyWindow (display->display, TermWin.parent[0]); } // TODO: free pixcolours, colours should become part of rxvt_display @@ -385,7 +451,7 @@ if (p) return p; - fprintf (stderr, APL_NAME ": memory allocation failure. Aborting"); + fprintf (stderr, RESNAME ": memory allocation failure. Aborting"); rxvt_clean_exit (); exit (EXIT_FAILURE); /* NOTREACHED */ @@ -401,7 +467,7 @@ if (p) return p; - fprintf (stderr, APL_NAME ": memory allocation failure. Aborting"); + fprintf (stderr, RESNAME ": memory allocation failure. Aborting"); rxvt_clean_exit (); exit (EXIT_FAILURE); /* NOTREACHED */ @@ -420,7 +486,7 @@ if (p) return p; - fprintf (stderr, APL_NAME ": memory allocation failure. Aborting"); + fprintf (stderr, RESNAME ": memory allocation failure. Aborting"); rxvt_clean_exit (); exit (EXIT_FAILURE); /* NOTREACHED */ @@ -622,6 +688,7 @@ } } } + /* TODO: BOUNDS */ TermWin.width = TermWin.ncol * TermWin.fwidth; TermWin.height = TermWin.nrow * TermWin.fheight; @@ -739,7 +806,7 @@ { rxvt_fontset *fs = new rxvt_fontset (this); - if (fs && fs->populate (fontname)) + if (fs && fs->populate (fontname ? fontname : "fixed")) { delete TermWin.fontset; TermWin.fontset = fs; @@ -747,8 +814,6 @@ TermWin.fheight = fs->base_font ()->height; TermWin.fbase = fs->base_font ()->ascent; - // TODO: screen needs to be told about new fonts - if (TermWin.parent[0]) { resize_all_windows (0, 0, 0); @@ -778,7 +843,7 @@ #ifndef SMART_WINDOW_TITLE XStoreName (display->display, TermWin.parent[0], str); #else - char *name; + char *name; if (XFetchName (display->display, TermWin.parent[0], &name) == 0) name = NULL; @@ -795,7 +860,7 @@ #ifndef SMART_WINDOW_TITLE XSetIconName (display->display, TermWin.parent[0], str); #else - char *name; + char *name; if (XGetIconName (display->display, TermWin.parent[0], &name)) name = NULL; @@ -810,8 +875,8 @@ void rxvt_term::set_window_color (int idx, const char *color) { - rxvt_color xcol; - int i; + rxvt_color xcol; + int i; if (color == NULL || *color == '\0') return; @@ -1038,7 +1103,7 @@ XMoveResizeWindow (display->display, TermWin.vt, window_vt_x, window_vt_y, TermWin_TotalWidth (), TermWin_TotalHeight ()); - scr_clear (); + scr_clear (height != old_height); #ifdef XPM_BACKGROUND resize_pixmap (); #endif