--- rxvt-unicode/src/background.C 2010/09/08 22:17:06 1.59 +++ rxvt-unicode/src/background.C 2010/10/03 21:44:13 1.62 @@ -140,8 +140,7 @@ # ifdef BG_IMAGE_FROM_FILE if (have_image) { - if (h_scale != 0 || v_scale != 0 - || h_align != 0 || v_align != 0) + if (flags & sizeSensitive) return true; } # endif @@ -249,7 +248,7 @@ int src_pos = 0; dst_pos = 0; dst_size = size; - if (pos < 0 && size > target_size) + if (pos < 0) { src_pos = -pos; dst_size += pos; @@ -390,11 +389,6 @@ } else if (CHECK_GEOM_OPS ("propscale")) { - if (w == 0 && h == 0) - { - w = windowScale; - geom_flags |= WidthValue; - } new_flags |= propScale; } else if (CHECK_GEOM_OPS ("hscale")) @@ -459,8 +453,18 @@ int target_width = target->szHint.width; int target_height = target->szHint.height; - w = h_scale * target_width / 100; - h = v_scale * target_height / 100; + if (flags & propScale) + { + float scale = (float)target_width / image_width; + min_it (scale, (float)target_height / image_height); + w = image_width * scale + 0.5; + h = image_height * scale + 0.5; + } + else + { + w = h_scale * target_width / 100; + h = v_scale * target_height / 100; + } if (h_align == rootAlign || v_align == rootAlign) { @@ -474,6 +478,12 @@ if (v_align != rootAlign) y = make_align_position (v_align, target_height, h > 0 ? h : image_height); + + flags &= ~sizeSensitive; + if (h_scale != 0 || v_scale != 0 + || h_align != 0 || v_align != 0 + || image_width > target_width || image_height > target_height) + flags |= sizeSensitive; } # ifdef HAVE_AFTERIMAGE