--- rxvt-unicode/src/main.C 2010/12/07 19:53:20 1.339 +++ rxvt-unicode/src/main.C 2011/02/11 01:24:46 1.352 @@ -98,7 +98,7 @@ compose_char *cc; // break compose chains, as stupid readline really likes to duplicate - // composing characters for some reason near the end of a line. + // composing characters for some reason, near the end of a line. cc = (*this)[c1]; while (cc) { @@ -108,10 +108,8 @@ // check to see whether 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 ()); - } + 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) @@ -119,7 +117,7 @@ static int seen; if (!seen++) - fprintf (stderr, "too many unrepresentable composite characters, try --enable-unicode3\n"); + rxvt_warn ("too many unrepresentable composite characters, try --enable-unicode3\n"); return REPLACEMENT_CHAR; } @@ -191,7 +189,6 @@ flush_ev.set (this); destroy_ev.set (this); pty_ev.set (this); - incr_ev.set (this); termwin_ev.set (this); vt_ev.set (this); @@ -230,13 +227,7 @@ delete fontset[0]; #ifdef HAVE_BG_PIXMAP - bgPixmap.destroy (); -#endif -#ifdef HAVE_AFTERIMAGE - if (asv) - destroy_asvisual (asv, 0); - if (asimman) - destroy_image_manager (asimman, 0); + bg_destroy (); #endif if (display) @@ -283,7 +274,6 @@ free (env_term); free (locale); free (v_buffer); - free (incr_buf); delete envv; delete argv; @@ -329,7 +319,6 @@ #if ENABLE_TRANSPARENCY || ENABLE_PERL rootwin_ev.stop (display); #endif - incr_ev.stop (); termwin_ev.stop (display); vt_ev.stop (display); } @@ -396,7 +385,7 @@ char buffer[BUFSIZ]; char mesg[BUFSIZ]; char number[32]; - char *mtype = "XlibMessage"; + const char mtype[] = "XlibMessage"; XGetErrorText(dpy, event->error_code, buffer, BUFSIZ); XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ); rxvt_warn ("An X Error occurred, trying to continue after report.\n"); @@ -960,21 +949,20 @@ { unsigned int i; const char *xpmb = ""; - char fstr[sizeof ("default") + 1], bstr[sizeof ("default") + 1]; + char fstr[] = "default"; + char bstr[] = "default"; - strcpy (fstr, "default"); - strcpy (bstr, "default"); for (i = Color_Black; i <= Color_White; i++) if (pix_colors[Color_fg] == pix_colors[i]) { - sprintf (fstr, "%d", (i - Color_Black)); + sprintf (fstr, "%d", i - Color_Black); break; } for (i = Color_Black; i <= Color_White; i++) if (pix_colors[Color_bg] == pix_colors[i]) { - sprintf (bstr, "%d", (i - Color_Black)); + sprintf (bstr, "%d", i - Color_Black); #ifdef BG_IMAGE_FROM_FILE xpmb = "default;"; #endif @@ -1087,7 +1075,7 @@ width, height); #ifdef HAVE_BG_PIXMAP - if (bgPixmap.window_size_sensitive ()) + if (bg_window_size_sensitive ()) update_background (); #endif } @@ -1095,12 +1083,6 @@ if (fix_screen || old_height == 0) scr_reset (); -#ifdef HAVE_BG_PIXMAP -// TODO: this don't seem to have any effect - do we still need it ? If so - in which case exactly ? -// if (bgPixmap.pixmap) -// scr_touch (false); -#endif - #ifdef USE_XIM IMSetPosition (); #endif @@ -1192,10 +1174,10 @@ win = XGetSelectionOwner (dpy, atom); if (win != None) - return True; + return true; } - return False; + return false; } void @@ -1358,7 +1340,7 @@ if (!p) continue; - s = rxvt_splitcommastring (p); + s = rxvt_strsplit (',', p); for (i = found = 0; !found && s[i]; i++) { @@ -1380,7 +1362,7 @@ for (j = 0; j < xim_styles->count_styles; j++) if (input_style == xim_styles->supported_styles[j]) { - rxvt_freecommastring (s); + rxvt_free_strsplit (s); found = 1; goto foundpet; @@ -1388,7 +1370,7 @@ } - rxvt_freecommastring (s); + rxvt_free_strsplit (s); } foundpet: @@ -1554,7 +1536,7 @@ { bool found = false; - s = rxvt_splitcommastring (p); + s = rxvt_strsplit (',', p); for (i = 0; s[i]; i++) { @@ -1570,7 +1552,7 @@ } } - rxvt_freecommastring (s); + rxvt_free_strsplit (s); if (found) goto done; @@ -1644,23 +1626,25 @@ } Pixmap -rxvt_term::get_pixmap_property (int prop_id) +rxvt_term::get_pixmap_property (Atom property) { - if (prop_id > 0 && prop_id < NUM_XA) - if (xa[prop_id]) - { - int aformat; - unsigned long nitems, bytes_after; - Atom atype; - unsigned char *prop = NULL; - int result = XGetWindowProperty (dpy, display->root, xa[prop_id], - 0L, 1L, False, XA_PIXMAP, &atype, &aformat, - &nitems, &bytes_after, &prop); - if (result == Success && prop && atype == XA_PIXMAP) - return *(Pixmap *)prop; - } + Pixmap pixmap = None; + + int aformat; + unsigned long nitems, bytes_after; + Atom atype; + unsigned char *prop; + int result = XGetWindowProperty (dpy, display->root, property, + 0L, 1L, False, XA_PIXMAP, &atype, &aformat, + &nitems, &bytes_after, &prop); + if (result == Success) + { + if (atype == XA_PIXMAP) + pixmap = *(Pixmap *)prop; + XFree (prop); + } - return None; + return pixmap; } #ifdef HAVE_BG_PIXMAP @@ -1671,12 +1655,12 @@ if (update_background_ev.is_active ()) return; - bgPixmap.invalidate (); + bg_invalidate (); - ev_tstamp to_wait = 0.5 - (ev::now () - bgPixmap.valid_since); + ev_tstamp to_wait = 0.5 - (ev::now () - bg_valid_since); if (to_wait <= 0.) - bgPixmap.render (); + bg_render (); else update_background_ev.start (to_wait); } @@ -1687,7 +1671,7 @@ make_current (); update_background_ev.stop (); - bgPixmap.render (); + bg_render (); refresh_check (); }