… | |
… | |
168 | { |
168 | { |
169 | XGCValues gcvalue; |
169 | XGCValues gcvalue; |
170 | GC gc; |
170 | GC gc; |
171 | |
171 | |
172 | if (pixmap != None) |
172 | if (pixmap != None) |
173 | XFreePixmap (xdisp, pixmap); |
173 | XFreePixmap (dpy, pixmap); |
174 | |
174 | |
175 | if (bgPixmap.pixmap == None) |
175 | if (bgPixmap.pixmap == None) |
176 | { /* So be it: I'm not using pixmaps */ |
176 | { /* So be it: I'm not using pixmaps */ |
177 | pixmap = None; |
177 | pixmap = None; |
178 | |
178 | |
179 | if (!OPTION (Opt_transparent) || !am_transparent) |
179 | if (!OPTION (Opt_transparent) || !am_transparent) |
180 | XSetWindowBackground (xdisp, vt, pix_colors[Color_bg]); |
180 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
181 | |
181 | |
182 | return; |
182 | return; |
183 | } |
183 | } |
184 | |
184 | |
185 | gcvalue.foreground = pix_colors[Color_bg]; |
185 | gcvalue.foreground = pix_colors[Color_bg]; |
186 | gc = XCreateGC (xdisp, vt, GCForeground, &gcvalue); |
186 | gc = XCreateGC (dpy, vt, GCForeground, &gcvalue); |
187 | |
187 | |
188 | if (bgPixmap.pixmap != None) |
188 | if (bgPixmap.pixmap != None) |
189 | { /* we have a specified pixmap */ |
189 | { /* we have a specified pixmap */ |
190 | unsigned int w = bgPixmap.w, h = bgPixmap.h, |
190 | unsigned int w = bgPixmap.w, h = bgPixmap.h, |
191 | x = bgPixmap.x, y = bgPixmap.y; |
191 | x = bgPixmap.x, y = bgPixmap.y; |
… | |
… | |
202 | w = 0; /* tile */ |
202 | w = 0; /* tile */ |
203 | |
203 | |
204 | if (!w) |
204 | if (!w) |
205 | { |
205 | { |
206 | /* basic X tiling - let the X server do it */ |
206 | /* basic X tiling - let the X server do it */ |
207 | pixmap = XCreatePixmap (xdisp, vt, xpmw, xpmh, depth); |
207 | pixmap = XCreatePixmap (dpy, vt, xpmw, xpmh, depth); |
208 | |
208 | |
209 | XCopyArea (xdisp, bgPixmap.pixmap, pixmap, gc, x, y, xpmw - x, xpmh - y, 0, 0); |
209 | XCopyArea (dpy, bgPixmap.pixmap, pixmap, gc, x, y, xpmw - x, xpmh - y, 0, 0); |
210 | XCopyArea (xdisp, bgPixmap.pixmap, pixmap, gc, x, 0, xpmw - x, y, 0, xpmh - y); |
210 | XCopyArea (dpy, bgPixmap.pixmap, pixmap, gc, x, 0, xpmw - x, y, 0, xpmh - y); |
211 | XCopyArea (xdisp, bgPixmap.pixmap, pixmap, gc, 0, y, x, xpmh - y, xpmw - x, 0); |
211 | XCopyArea (dpy, bgPixmap.pixmap, pixmap, gc, 0, y, x, xpmh - y, xpmw - x, 0); |
212 | XCopyArea (xdisp, bgPixmap.pixmap, pixmap, gc, 0, 0, x, y, xpmw - x, xpmh - y); |
212 | XCopyArea (dpy, bgPixmap.pixmap, pixmap, gc, 0, 0, x, y, xpmw - x, xpmh - y); |
213 | } |
213 | } |
214 | else |
214 | else |
215 | { |
215 | { |
216 | float incr, p; |
216 | float incr, p; |
217 | Pixmap tmp; |
217 | Pixmap tmp; |
218 | |
218 | |
219 | pixmap = XCreatePixmap (xdisp, vt, width, height, depth); |
219 | pixmap = XCreatePixmap (dpy, vt, width, height, depth); |
220 | /* |
220 | /* |
221 | * horizontal scaling |
221 | * horizontal scaling |
222 | */ |
222 | */ |
223 | rxvt_pixmap_incr (&w, &x, &incr, &p, width, xpmw); |
223 | rxvt_pixmap_incr (&w, &x, &incr, &p, width, xpmw); |
224 | |
224 | |
225 | tmp = XCreatePixmap (xdisp, vt, width, xpmh, depth); |
225 | tmp = XCreatePixmap (dpy, vt, width, xpmh, depth); |
226 | XFillRectangle (xdisp, tmp, gc, 0, 0, width, xpmh); |
226 | XFillRectangle (dpy, tmp, gc, 0, 0, width, xpmh); |
227 | |
227 | |
228 | for ( /*nil */ ; x < w; x++, p += incr) |
228 | for ( /*nil */ ; x < w; x++, p += incr) |
229 | { |
229 | { |
230 | if (p >= xpmw) |
230 | if (p >= xpmw) |
231 | p = 0; |
231 | p = 0; |
232 | |
232 | |
233 | /* copy one column from the original pixmap to the tmp pixmap */ |
233 | /* copy one column from the original pixmap to the tmp pixmap */ |
234 | XCopyArea (xdisp, bgPixmap.pixmap, tmp, gc, (int)p, 0, 1, xpmh, (int)x, 0); |
234 | XCopyArea (dpy, bgPixmap.pixmap, tmp, gc, (int)p, 0, 1, xpmh, (int)x, 0); |
235 | } |
235 | } |
236 | |
236 | |
237 | /* |
237 | /* |
238 | * vertical scaling |
238 | * vertical scaling |
239 | */ |
239 | */ |
240 | rxvt_pixmap_incr (&h, &y, &incr, &p, height, xpmh); |
240 | rxvt_pixmap_incr (&h, &y, &incr, &p, height, xpmh); |
241 | |
241 | |
242 | if (y > 0) |
242 | if (y > 0) |
243 | XFillRectangle (xdisp, pixmap, gc, 0, 0, width, y); |
243 | XFillRectangle (dpy, pixmap, gc, 0, 0, width, y); |
244 | |
244 | |
245 | if (h < height) |
245 | if (h < height) |
246 | XFillRectangle (xdisp, pixmap, gc, 0, (int)h, width, height - h + 1); |
246 | XFillRectangle (dpy, pixmap, gc, 0, (int)h, width, height - h + 1); |
247 | |
247 | |
248 | for ( /*nil */ ; y < h; y++, p += incr) |
248 | for ( /*nil */ ; y < h; y++, p += incr) |
249 | { |
249 | { |
250 | if (p >= xpmh) |
250 | if (p >= xpmh) |
251 | p = 0; |
251 | p = 0; |
252 | |
252 | |
253 | /* copy one row from the tmp pixmap to the main pixmap */ |
253 | /* copy one row from the tmp pixmap to the main pixmap */ |
254 | XCopyArea (xdisp, tmp, pixmap, gc, 0, (int)p, width, 1, 0, (int)y); |
254 | XCopyArea (dpy, tmp, pixmap, gc, 0, (int)p, width, 1, 0, (int)y); |
255 | } |
255 | } |
256 | |
256 | |
257 | XFreePixmap (xdisp, tmp); |
257 | XFreePixmap (dpy, tmp); |
258 | } |
258 | } |
259 | } |
259 | } |
260 | |
260 | |
261 | XSetWindowBackgroundPixmap (xdisp, vt, pixmap); |
261 | XSetWindowBackgroundPixmap (dpy, vt, pixmap); |
262 | |
262 | |
263 | if (pixmap != None) |
|
|
264 | { |
|
|
265 | XFreePixmap (xdisp, pixmap); |
|
|
266 | pixmap = None; |
|
|
267 | } |
|
|
268 | |
|
|
269 | XFreeGC (xdisp, gc); |
263 | XFreeGC (dpy, gc); |
270 | am_transparent = 0; |
264 | am_transparent = 0; |
271 | } |
265 | } |
272 | |
266 | |
273 | /* |
267 | /* |
274 | * Calculate tiling sizes and increments |
268 | * Calculate tiling sizes and increments |
… | |
… | |
353 | |
347 | |
354 | assert (file != NULL); |
348 | assert (file != NULL); |
355 | |
349 | |
356 | if (bgPixmap.pixmap != None) |
350 | if (bgPixmap.pixmap != None) |
357 | { |
351 | { |
358 | XFreePixmap (display->display, bgPixmap.pixmap); |
352 | XFreePixmap (dpy, bgPixmap.pixmap); |
359 | bgPixmap.pixmap = None; |
353 | bgPixmap.pixmap = None; |
360 | } |
354 | } |
361 | |
355 | |
362 | XSetWindowBackground (display->display, vt, pix_colors[Color_bg]); |
356 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
363 | |
357 | |
364 | if (*file != '\0') |
358 | if (*file != '\0') |
365 | { |
359 | { |
366 | /* XWindowAttributes attr; */ |
360 | /* XWindowAttributes attr; */ |
367 | |
361 | |
368 | /* |
362 | /* |
369 | * we already have the required attributes |
363 | * we already have the required attributes |
370 | */ |
364 | */ |
371 | /* XGetWindowAttributes (display->display, vt, &attr); */ |
365 | /* XGetWindowAttributes (dpy, vt, &attr); */ |
372 | |
366 | |
373 | xpmAttr.closeness = 30000; |
367 | xpmAttr.closeness = 30000; |
374 | xpmAttr.colormap = cmap; |
368 | xpmAttr.colormap = cmap; |
375 | xpmAttr.visual = visual; |
369 | xpmAttr.visual = visual; |
376 | xpmAttr.depth = depth; |
370 | xpmAttr.depth = depth; |
… | |
… | |
378 | | XpmDepth | XpmSize | XpmReturnPixels); |
372 | | XpmDepth | XpmSize | XpmReturnPixels); |
379 | |
373 | |
380 | /* search environment variables here too */ |
374 | /* search environment variables here too */ |
381 | f = (char *)rxvt_File_find (file, ".xpm", rs[Rs_path]); |
375 | f = (char *)rxvt_File_find (file, ".xpm", rs[Rs_path]); |
382 | if (f == NULL |
376 | if (f == NULL |
383 | || XpmReadFileToPixmap (display->display, display->root, f, |
377 | || XpmReadFileToPixmap (dpy, display->root, f, |
384 | &bgPixmap.pixmap, NULL, |
378 | &bgPixmap.pixmap, NULL, |
385 | &xpmAttr)) |
379 | &xpmAttr)) |
386 | { |
380 | { |
387 | char *p; |
381 | char *p; |
388 | |
382 | |