--- rxvt-unicode/src/main.C 2004/02/22 08:28:36 1.41 +++ rxvt-unicode/src/main.C 2004/03/06 00:05:01 1.51 @@ -58,6 +58,69 @@ } } +class rxvt_composite_vec rxvt_composite; + +text_t rxvt_composite_vec::compose (uint32_t c1, uint32_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 (uint32_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; + +} + +extern struct rxvt_composite_vec rxvt_composite; void * rxvt_term::operator new (size_t s) { @@ -82,7 +145,7 @@ scrollbar_ev (this, &rxvt_term::x_cb), #endif #ifdef MENUBAR - menubar_ev (this, &rxvt_term::x_cb), fixme + menubar_ev (this, &rxvt_term::x_cb), #endif #ifdef CURSOR_BLINK cursor_blink_ev (this, &rxvt_term::cursor_blink_cb), @@ -119,8 +182,17 @@ delete TermWin.fontset; if (display) - if (TermWin.parent[0]) - XDestroyWindow (display->display, TermWin.parent[0]); + { +#if defined(MENUBAR) && (MENUBAR_MAX > 1) + 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 @@ -251,7 +323,7 @@ set_locale (""); -#if (MENUBAR_MAX) +#if MENUBAR_MAX menubar_read (rs[Rs_menu]); #endif #ifdef HAVE_SCROLLBARS @@ -274,7 +346,7 @@ resize_scrollbar (); /* create and map scrollbar */ #endif #if (MENUBAR_MAX) - if (menubar_visible (r)) + if (menubar_visible ()) XMapWindow (display->display, menuBar.win); #endif #ifdef TRANSPARENT @@ -378,7 +450,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 */ @@ -394,7 +466,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 */ @@ -413,7 +485,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 */ @@ -732,7 +804,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; @@ -740,8 +812,13 @@ 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); + scr_remap_chars (); + scr_touch (true); + } + return true; } } @@ -764,7 +841,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; @@ -781,7 +858,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; @@ -796,8 +873,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; @@ -1024,7 +1101,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