--- rxvt-unicode/src/background.C 2008/11/04 13:20:40 1.31 +++ rxvt-unicode/src/background.C 2010/08/21 16:07:15 1.41 @@ -29,17 +29,21 @@ #if DO_TIMING_TEST # include #define TIMING_TEST_START(id) \ - struct timeval timing_test_##id##_stv;\ + struct timeval timing_test_##id##_stv; \ gettimeofday (&timing_test_##id##_stv, NULL); #define TIMING_TEST_PRINT_RESULT(id) \ - do{ struct timeval tv;gettimeofday (&tv, NULL); tv.tv_sec -= (timing_test_##id##_stv).tv_sec;\ - fprintf (stderr, "%s: %s: %d: elapsed %ld usec\n", #id, __FILE__, __LINE__,\ - tv.tv_sec * 1000000 + tv.tv_usec - (timing_test_##id##_stv).tv_usec);}while (0) + do { \ + struct timeval tv; \ + gettimeofday (&tv, NULL); \ + tv.tv_sec -= (timing_test_##id##_stv).tv_sec; \ + fprintf (stderr, "%s: %s: %d: elapsed %ld usec\n", #id, __FILE__, __LINE__, \ + tv.tv_sec * 1000000 + tv.tv_usec - (timing_test_##id##_stv).tv_usec); \ + } while (0) #else -#define TIMING_TEST_START(id) do{}while (0) -#define TIMING_TEST_PRINT_RESULT(id) do{}while (0) +#define TIMING_TEST_START(id) do {} while (0) +#define TIMING_TEST_PRINT_RESULT(id) do {} while (0) #endif /* @@ -48,7 +52,7 @@ * adjustment and may optionally be followed by a colon and one or more * colon-delimited pixmap operations. * The following table shows the valid geometry strings and their - * affects on the background image : + * effects on the background image : * * WxH+X+Y Set scaling to W% by H%, and position to X% by Y%. * W and H are percentages of the terminal window size. @@ -138,8 +142,8 @@ return false; } -bool -bgPixmap_t::window_position_sensitive () +bool +bgPixmap_t::window_position_sensitive () { # ifdef ENABLE_TRANSPARENCY if (flags & isTransparent) @@ -261,7 +265,7 @@ unsigned int w = 0, h = 0; unsigned int n; unsigned long new_flags = (flags & (~geometryFlags)); - char *p; + const char *p; # define MAXLEN_GEOM 256 /* could be longer than regular geometry string */ if (geom == NULL) @@ -497,7 +501,7 @@ if (background_tint != TINT_LEAVE_SAME) { - ASImage* tmp = tile_asimage (target->asv, background, 0, 0, + ASImage *tmp = tile_asimage (target->asv, background, 0, 0, target_width, target_height, background_tint, ASA_XImage, 100, ASIMAGE_QUALITY_DEFAULT); if (tmp) @@ -535,7 +539,7 @@ ASImage *tmp = tile_asimage (target->asv, result, (h_scale > 0) ? 0 : (int)result->width - x, (v_scale > 0) ? 0 : (int)result->height - y, - new_pmap_width, + new_pmap_width, new_pmap_height, TINT_LEAVE_SAME, ASA_XImage, 100, ASIMAGE_QUALITY_DEFAULT); @@ -677,10 +681,10 @@ if (!target->asimman) target->asimman = create_generic_imageman (target->rs[Rs_path]); - if (char *f = strchr (file, ';')) + if (const char *p = strchr (file, ';')) { - size_t len = f - file; - f = (char *)malloc (len + 1); + size_t len = p - file; + char *f = (char *)malloc (len + 1); memcpy (f, file, len); f[len] = '\0'; original_asim = get_asimage (target->asimman, f, 0xFFFFFFFF, 100); @@ -850,7 +854,7 @@ if (target == NULL) return 0; - /* root dimentions may change from call to call - but Display structure should + /* root dimensions may change from call to call - but Display structure should * be always up-to-date, so let's use it : */ Window root = target->display->root; @@ -949,7 +953,7 @@ } else { - /* strightforward pixmap copy */ + /* straightforward pixmap copy */ gcv.tile = root_pixmap; gcv.fill_style = FillTiled; @@ -1110,7 +1114,7 @@ # endif /* ENABLE_TRANSPARENCY */ # ifndef HAVE_AFTERIMAGE -static void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm); +static void ShadeXImage(rxvt_term *term, XImage *srcImage, int shade, int rm, int gm, int bm); # endif bool @@ -1121,8 +1125,6 @@ if (target == NULL) return false; - target->init_asv (); - TIMING_TEST_START (tp); invalidate (); @@ -1144,6 +1146,8 @@ if (original_asim || (background_flags & transpTransformations) != (flags & transpTransformations)) { + target->init_asv (); + ASImage *background = NULL; ARGB32 as_tint = TINT_LEAVE_SAME; if (background_flags) @@ -1167,7 +1171,7 @@ if (!(background_flags & transpPmapBlured) && (flags & blurNeeded) && background != NULL) { - ASImage* tmp = blur_asimage_gauss (target->asv, background, h_blurRadius, v_blurRadius, 0xFFFFFFFF, + ASImage *tmp = blur_asimage_gauss (target->asv, background, h_blurRadius, v_blurRadius, 0xFFFFFFFF, (original_asim == NULL || tint == TINT_LEAVE_SAME)?ASA_XImage:ASA_ASImage, 100, ASIMAGE_QUALITY_DEFAULT); if (tmp) @@ -1188,7 +1192,7 @@ # elif !XFT /* our own client-side tinting */ - /* ATTENTION: We ASSUME that XFT will let us do all the tinting neccessary server-side. + /* ATTENTION: We ASSUME that XFT will let us do all the tinting necessary server-side. This may need to be changed in need_client_side_rendering() logic is altered !!! */ if (background_flags && (flags & isInvalid)) @@ -1329,7 +1333,7 @@ scr_touch or we get a great deal of flicker otherwise: */ XClearWindow (target->dpy, target->parent[0]); - if (target->scrollBar.win) + if (target->scrollBar.state && target->scrollBar.win) { target->scrollBar.state = STATE_IDLE; target->scrollBar.show (0); @@ -1348,7 +1352,7 @@ typedef uint32_t RUINT32T; static void -ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm) +ShadeXImage(rxvt_term *term, XImage *srcImage, int shade, int rm, int gm, int bm) { int sh_r, sh_g, sh_b; RUINT32T mask_r, mask_g, mask_b;