… | |
… | |
83 | if (n < MAXLEN_GEOM) |
83 | if (n < MAXLEN_GEOM) |
84 | { |
84 | { |
85 | strncpy (str, geom, n); |
85 | strncpy (str, geom, n); |
86 | str[n] = '\0'; |
86 | str[n] = '\0'; |
87 | |
87 | |
|
|
88 | if (strcmp(str, "auto") == 0) |
|
|
89 | { |
|
|
90 | if (!bgpixmap->auto_resize) |
|
|
91 | changed++; |
|
|
92 | bgpixmap->auto_resize = True ; |
|
|
93 | w = szHint.width ; |
|
|
94 | h = szHint.height ; |
|
|
95 | flags = WidthValue|HeightValue ; |
|
|
96 | } |
|
|
97 | else |
|
|
98 | { |
|
|
99 | bgpixmap->auto_resize = False ; |
88 | flags = XParseGeometry (str, &x, &y, &w, &h); |
100 | flags = XParseGeometry (str, &x, &y, &w, &h); |
|
|
101 | } |
89 | |
102 | |
90 | if (!flags) |
103 | if (!flags) |
91 | { |
104 | { |
92 | flags |= WidthValue; |
105 | flags |= WidthValue; |
93 | w = 0; |
106 | w = 0; |
… | |
… | |
169 | { |
182 | { |
170 | XGCValues gcvalue; |
183 | XGCValues gcvalue; |
171 | GC gc; |
184 | GC gc; |
172 | |
185 | |
173 | if (pixmap != None) |
186 | if (pixmap != None) |
|
|
187 | { |
174 | XFreePixmap (dpy, pixmap); |
188 | XFreePixmap (dpy, pixmap); |
|
|
189 | pixmap = None ; |
|
|
190 | } |
175 | |
191 | |
176 | if (bgPixmap.pixmap == None) |
192 | if (bgPixmap.pixmap == None) |
177 | { /* So be it: I'm not using pixmaps */ |
193 | { /* So be it: I'm not using pixmaps */ |
178 | pixmap = None; |
194 | pixmap = None; |
179 | |
195 | |
|
|
196 | #ifdef TRANSPARENT |
180 | if (!OPTION (Opt_transparent) || !am_transparent) |
197 | if (!option (Opt_transparent) || !am_transparent) |
|
|
198 | #endif |
181 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
199 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
182 | |
200 | |
183 | return; |
201 | return; |
184 | } |
202 | } |
185 | |
203 | |
… | |
… | |
191 | unsigned int w = bgPixmap.w, h = bgPixmap.h, |
209 | unsigned int w = bgPixmap.w, h = bgPixmap.h, |
192 | x = bgPixmap.x, y = bgPixmap.y; |
210 | x = bgPixmap.x, y = bgPixmap.y; |
193 | unsigned int xpmh = xpmAttr.height, |
211 | unsigned int xpmh = xpmAttr.height, |
194 | xpmw = xpmAttr.width; |
212 | xpmw = xpmAttr.width; |
195 | |
213 | |
|
|
214 | if (bgPixmap.auto_resize) |
|
|
215 | { |
|
|
216 | w = szHint.width ; |
|
|
217 | h = szHint.height ; |
|
|
218 | } |
196 | /* |
219 | /* |
197 | * don't zoom pixmap too much nor expand really small pixmaps |
220 | * don't zoom pixmap too much nor expand really small pixmaps |
198 | */ |
221 | */ |
199 | if (w > 32767 || h > 32767) |
222 | if (w > 32767 || h > 32767) |
200 | w = 1; |
223 | w = 1; |
… | |
… | |
211 | XCopyArea (dpy, bgPixmap.pixmap, pixmap, gc, x, 0, xpmw - x, y, 0, xpmh - y); |
234 | XCopyArea (dpy, bgPixmap.pixmap, pixmap, gc, x, 0, xpmw - x, y, 0, xpmh - y); |
212 | XCopyArea (dpy, bgPixmap.pixmap, pixmap, gc, 0, y, x, xpmh - y, xpmw - x, 0); |
235 | XCopyArea (dpy, bgPixmap.pixmap, pixmap, gc, 0, y, x, xpmh - y, xpmw - x, 0); |
213 | XCopyArea (dpy, bgPixmap.pixmap, pixmap, gc, 0, 0, x, y, xpmw - x, xpmh - y); |
236 | XCopyArea (dpy, bgPixmap.pixmap, pixmap, gc, 0, 0, x, y, xpmw - x, xpmh - y); |
214 | } |
237 | } |
215 | else |
238 | else |
|
|
239 | #ifdef HAVE_AFTERIMAGE |
|
|
240 | #ifdef TRANSPARENT |
|
|
241 | if (!option(Opt_transparent) || !am_transparent) |
|
|
242 | /* will do that in check_our_parents otherwise */ |
|
|
243 | #endif |
|
|
244 | { |
|
|
245 | ASImage *scaled_im = scale_asimage( display->asv, original_asim, w, h, ASA_XImage, 0, ASIMAGE_QUALITY_DEFAULT ); |
|
|
246 | if (scaled_im) |
|
|
247 | { |
|
|
248 | pixmap = asimage2pixmap( display->asv, display->root, scaled_im, gc, True ); |
|
|
249 | destroy_asimage( &scaled_im ); |
|
|
250 | } |
|
|
251 | } |
|
|
252 | #else /* HAVE_AFTERIMAGE */ |
216 | { |
253 | { |
217 | float incr, p; |
254 | float incr, p; |
218 | Pixmap tmp; |
255 | Pixmap tmp; |
219 | |
256 | |
220 | pixmap = XCreatePixmap (dpy, vt, width, height, depth); |
257 | pixmap = XCreatePixmap (dpy, vt, width, height, depth); |
… | |
… | |
255 | XCopyArea (dpy, tmp, pixmap, gc, 0, (int)p, width, 1, 0, (int)y); |
292 | XCopyArea (dpy, tmp, pixmap, gc, 0, (int)p, width, 1, 0, (int)y); |
256 | } |
293 | } |
257 | |
294 | |
258 | XFreePixmap (dpy, tmp); |
295 | XFreePixmap (dpy, tmp); |
259 | } |
296 | } |
|
|
297 | #endif /* HAVE_AFTERIMAGE */ |
260 | } |
298 | } |
261 | |
299 | |
262 | XSetWindowBackgroundPixmap (dpy, vt, pixmap); |
300 | XSetWindowBackgroundPixmap (dpy, vt, pixmap); |
263 | |
301 | |
264 | XFreeGC (dpy, gc); |
302 | XFreeGC (dpy, gc); |
|
|
303 | #ifdef TRANSPARENT |
265 | am_transparent = 0; |
304 | am_transparent = 0; |
|
|
305 | #endif |
266 | } |
306 | } |
267 | |
307 | |
268 | /* |
308 | /* |
269 | * Calculate tiling sizes and increments |
309 | * Calculate tiling sizes and increments |
270 | * At start, p == 0, incr == xpmwidthheight |
310 | * At start, p == 0, incr == xpmwidthheight |
… | |
… | |
363 | /* |
403 | /* |
364 | * we already have the required attributes |
404 | * we already have the required attributes |
365 | */ |
405 | */ |
366 | /* XGetWindowAttributes (dpy, vt, &attr); */ |
406 | /* XGetWindowAttributes (dpy, vt, &attr); */ |
367 | |
407 | |
|
|
408 | #ifdef HAVE_AFTERIMAGE |
|
|
409 | if (asimman == NULL) |
|
|
410 | asimman = create_generic_imageman(rs[Rs_path]); |
|
|
411 | if ((f = strchr (file, ';')) == NULL) |
|
|
412 | original_asim = get_asimage( asimman, file, 0xFFFFFFFF, 100 ); |
|
|
413 | else |
|
|
414 | { |
|
|
415 | f = strndup( file, f - file ); |
|
|
416 | original_asim = get_asimage( asimman, f, 0xFFFFFFFF, 100 ); |
|
|
417 | free( f ); |
|
|
418 | } |
|
|
419 | if (original_asim) |
|
|
420 | { |
|
|
421 | bgPixmap.pixmap = asimage2pixmap( display->asv, display->root, original_asim, NULL, True ); |
|
|
422 | xpmAttr.width = original_asim->width ; |
|
|
423 | xpmAttr.height = original_asim->height ; |
|
|
424 | } |
|
|
425 | #else /* HAVE_AFTERIMAGE */ |
368 | xpmAttr.closeness = 30000; |
426 | xpmAttr.closeness = 30000; |
369 | xpmAttr.colormap = cmap; |
427 | xpmAttr.colormap = cmap; |
370 | xpmAttr.visual = visual; |
428 | xpmAttr.visual = visual; |
371 | xpmAttr.depth = depth; |
429 | xpmAttr.depth = depth; |
372 | xpmAttr.valuemask = (XpmCloseness | XpmColormap | XpmVisual |
430 | xpmAttr.valuemask = (XpmCloseness | XpmColormap | XpmVisual |
… | |
… | |
385 | if ((p = strchr (file, ';')) == NULL) |
443 | if ((p = strchr (file, ';')) == NULL) |
386 | p = strchr (file, '\0'); |
444 | p = strchr (file, '\0'); |
387 | |
445 | |
388 | rxvt_warn ("couldn't load XPM file \"%.*s\", ignoring.\n", (p - file), file); |
446 | rxvt_warn ("couldn't load XPM file \"%.*s\", ignoring.\n", (p - file), file); |
389 | } |
447 | } |
390 | |
|
|
391 | free (f); |
448 | free (f); |
|
|
449 | #endif /* HAVE_AFTERIMAGE */ |
392 | } |
450 | } |
393 | |
451 | |
394 | resize_pixmap (); |
452 | resize_pixmap (); |
395 | return bgPixmap.pixmap; |
453 | return bgPixmap.pixmap; |
396 | } |
454 | } |