--- rxvt-unicode/src/background.C 2010/12/19 00:49:32 1.128 +++ rxvt-unicode/src/background.C 2011/01/11 11:04:39 1.134 @@ -177,15 +177,6 @@ return false; } -bool bgPixmap_t::need_client_side_rendering () -{ -# ifdef HAVE_AFTERIMAGE - if (original_asim) - return true; -# endif - return false; -} - # ifdef BG_IMAGE_FROM_FILE static inline bool check_set_scale_value (int geom_flags, int flag, unsigned int &scale, unsigned int new_value) @@ -264,12 +255,11 @@ unsigned int n; unsigned long new_flags = (flags & (~geometryFlags)); const char *ops; -# define MAXLEN_GEOM 256 /* could be longer than regular geometry string */ if (geom == NULL) return false; - char str[MAXLEN_GEOM]; + char str[256]; ops = strchr (geom, ':'); if (ops == NULL) @@ -277,7 +267,7 @@ else n = ops - geom; - if (n >= MAXLEN_GEOM) + if (n >= sizeof (str)) return false; memcpy (str, geom, n); @@ -309,57 +299,55 @@ if (ops) { - while (*ops) - { - while (*ops == ':' || isspace(*ops)) ++ops; + char **arr = rxvt_strsplit (':', ops + 1); -# define CHECK_GEOM_OPS(op_str) (strncasecmp (ops, (op_str), sizeof (op_str) - 1) == 0) - if (CHECK_GEOM_OPS ("tile")) + for (int i = 0; arr[i]; i++) + { + if (!strcasecmp (arr[i], "tile")) { w = h = noScale; geom_flags |= WidthValue|HeightValue; } - else if (CHECK_GEOM_OPS ("propscale")) + else if (!strcasecmp (arr[i], "propscale")) { new_flags |= propScale; } - else if (CHECK_GEOM_OPS ("hscale")) + else if (!strcasecmp (arr[i], "hscale")) { if (w == 0) w = windowScale; h = noScale; geom_flags |= WidthValue|HeightValue; } - else if (CHECK_GEOM_OPS ("vscale")) + else if (!strcasecmp (arr[i], "vscale")) { if (h == 0) h = windowScale; w = noScale; geom_flags |= WidthValue|HeightValue; } - else if (CHECK_GEOM_OPS ("scale")) + else if (!strcasecmp (arr[i], "scale")) { if (h == 0) h = windowScale; if (w == 0) w = windowScale; geom_flags |= WidthValue|HeightValue; } - else if (CHECK_GEOM_OPS ("auto")) + else if (!strcasecmp (arr[i], "auto")) { w = h = windowScale; x = y = centerAlign; geom_flags |= WidthValue|HeightValue|XValue|YValue; } - else if (CHECK_GEOM_OPS ("root")) + else if (!strcasecmp (arr[i], "root")) { new_flags |= rootAlign; w = h = noScale; geom_flags |= WidthValue|HeightValue; } -# undef CHECK_GEOM_OPS - - while (*ops != ':' && *ops != '\0') ++ops; } /* done parsing ops */ + + rxvt_free_strsplit (arr); } if (check_set_scale_value (geom_flags, WidthValue, h_scale, w)) changed = true; @@ -608,15 +596,13 @@ /* create Pixmap */ if (pixmap == None || pmap_width != new_pmap_width - || pmap_height != new_pmap_height - || pmap_depth != target->depth) + || pmap_height != new_pmap_height) { if (pixmap) XFreePixmap (target->dpy, pixmap); pixmap = XCreatePixmap (target->dpy, target->vt, new_pmap_width, new_pmap_height, target->depth); pmap_width = new_pmap_width; pmap_height = new_pmap_height; - pmap_depth = target->depth; } /* fill with background color (if result's not completely overlapping it) */ gcv.foreground = target->pix_colors[Color_bg]; @@ -710,7 +696,7 @@ return false; } - ximage->byte_order = byteorder.big_endian () ? MSBFirst : LSBFirst; + ximage->byte_order = byteorder::big_endian () ? MSBFirst : LSBFirst; rowstride = gdk_pixbuf_get_rowstride (pixbuf); channels = gdk_pixbuf_get_n_channels (pixbuf); @@ -817,15 +803,13 @@ if (pixmap == None || pmap_width != new_pmap_width - || pmap_height != new_pmap_height - || pmap_depth != target->depth) + || pmap_height != new_pmap_height) { if (pixmap) XFreePixmap (target->dpy, pixmap); pixmap = XCreatePixmap (target->dpy, target->vt, new_pmap_width, new_pmap_height, target->depth); pmap_width = new_pmap_width; pmap_height = new_pmap_height; - pmap_depth = target->depth; } gcv.foreground = target->pix_colors[Color_bg]; @@ -942,6 +926,7 @@ if (original_asim) safe_asimage_destroy (original_asim); original_asim = image; + flags |= CLIENT_RENDER; have_image = true; return true; } @@ -1023,13 +1008,11 @@ if (tint) { tint->get (c); -# define IS_COMPONENT_WHOLESOME(cmp) ((cmp) <= 0x00ff || (cmp) >= 0xff00) if (!has_shade - && IS_COMPONENT_WHOLESOME (c.r) - && IS_COMPONENT_WHOLESOME (c.g) - && IS_COMPONENT_WHOLESOME (c.b)) + && (c.r <= 0x00ff || c.r >= 0xff00) + && (c.g <= 0x00ff || c.g >= 0xff00) + && (c.b <= 0x00ff || c.b >= 0xff00)) flags |= bgPixmap_t::tintWholesome; -# undef IS_COMPONENT_WHOLESOME } if (has_shade || tint) @@ -1053,20 +1036,6 @@ } bool -bgPixmap_t::unset_tint () -{ - unsigned long new_flags = compute_tint_shade_flags (NULL, shade); - - if (new_flags != (flags & tintFlags)) - { - flags = (flags & ~tintFlags) | new_flags; - return true; - } - - return false; -} - -bool bgPixmap_t::set_shade (const char *shade_str) { int new_shade = (shade_str) ? atoi (shade_str) : 100; @@ -1379,7 +1348,7 @@ result |= transpPmapTiled; XFreeGC (dpy, gc); - if (!need_client_side_rendering ()) + if (!(flags & CLIENT_RENDER)) { if ((flags & blurNeeded) && (flags & HAS_RENDER_CONV)) @@ -1401,7 +1370,6 @@ pixmap = tiled_root_pmap; pmap_width = window_width; pmap_height = window_height; - pmap_depth = target->depth; } else XFreePixmap (dpy, tiled_root_pmap); @@ -1596,7 +1564,7 @@ rgba low; rgba high; int i; - int host_byte_order = byteorder.big_endian () ? MSBFirst : LSBFirst; + int host_byte_order = byteorder::big_endian () ? MSBFirst : LSBFirst; if (visual->c_class != TrueColor || ximage->format != ZPixmap) return;