… | |
… | |
164 | GC gc; |
164 | GC gc; |
165 | unsigned int width = TermWin_TotalWidth (); |
165 | unsigned int width = TermWin_TotalWidth (); |
166 | unsigned int height = TermWin_TotalHeight (); |
166 | unsigned int height = TermWin_TotalHeight (); |
167 | dDisp; |
167 | dDisp; |
168 | |
168 | |
169 | if (TermWin.pixmap != None) |
169 | if (pixmap != None) |
170 | XFreePixmap (disp, TermWin.pixmap); |
170 | XFreePixmap (disp, pixmap); |
171 | |
171 | |
172 | if (bgPixmap.pixmap == None) |
172 | if (bgPixmap.pixmap == None) |
173 | { /* So be it: I'm not using pixmaps */ |
173 | { /* So be it: I'm not using pixmaps */ |
174 | TermWin.pixmap = None; |
174 | pixmap = None; |
175 | |
175 | |
176 | if (!(options & Opt_transparent) || !am_transparent) |
176 | if (!(options & Opt_transparent) || !am_transparent) |
177 | XSetWindowBackground (disp, TermWin.vt, |
177 | XSetWindowBackground (disp, vt, |
178 | pix_colors[Color_bg]); |
178 | pix_colors[Color_bg]); |
179 | |
179 | |
180 | return; |
180 | return; |
181 | } |
181 | } |
182 | |
182 | |
183 | gcvalue.foreground = pix_colors[Color_bg]; |
183 | gcvalue.foreground = pix_colors[Color_bg]; |
184 | gc = XCreateGC (disp, TermWin.vt, GCForeground, &gcvalue); |
184 | gc = XCreateGC (disp, vt, GCForeground, &gcvalue); |
185 | |
185 | |
186 | if (bgPixmap.pixmap != None) |
186 | if (bgPixmap.pixmap != None) |
187 | { /* we have a specified pixmap */ |
187 | { /* we have a specified pixmap */ |
188 | unsigned int w = bgPixmap.w, h = bgPixmap.h, |
188 | unsigned int w = bgPixmap.w, h = bgPixmap.h, |
189 | x = bgPixmap.x, y = bgPixmap.y; |
189 | x = bgPixmap.x, y = bgPixmap.y; |
… | |
… | |
200 | w = 0; /* tile */ |
200 | w = 0; /* tile */ |
201 | |
201 | |
202 | if (w == 0) |
202 | if (w == 0) |
203 | { |
203 | { |
204 | /* basic X tiling - let the X server do it */ |
204 | /* basic X tiling - let the X server do it */ |
205 | TermWin.pixmap = XCreatePixmap (disp, TermWin.vt, |
205 | pixmap = XCreatePixmap (disp, vt, |
206 | xpmw, xpmh, |
206 | xpmw, xpmh, |
207 | (unsigned int)display->depth); |
207 | (unsigned int)display->depth); |
208 | XCopyArea (disp, bgPixmap.pixmap, TermWin.pixmap, gc, |
208 | XCopyArea (disp, bgPixmap.pixmap, pixmap, gc, |
209 | 0, 0, xpmw, xpmh, 0, 0); |
209 | 0, 0, xpmw, xpmh, 0, 0); |
210 | } |
210 | } |
211 | else |
211 | else |
212 | { |
212 | { |
213 | float incr, p; |
213 | float incr, p; |
214 | Pixmap tmp; |
214 | Pixmap tmp; |
215 | |
215 | |
216 | TermWin.pixmap = XCreatePixmap (disp, TermWin.vt, |
216 | pixmap = XCreatePixmap (disp, vt, |
217 | width, height, |
217 | width, height, |
218 | (unsigned int)display->depth); |
218 | (unsigned int)display->depth); |
219 | /* |
219 | /* |
220 | * horizontal scaling |
220 | * horizontal scaling |
221 | */ |
221 | */ |
222 | rxvt_pixmap_incr (&w, &x, &incr, &p, width, xpmw); |
222 | rxvt_pixmap_incr (&w, &x, &incr, &p, width, xpmw); |
223 | |
223 | |
224 | tmp = XCreatePixmap (disp, TermWin.vt, |
224 | tmp = XCreatePixmap (disp, vt, |
225 | width, xpmh, (unsigned int)display->depth); |
225 | width, xpmh, (unsigned int)display->depth); |
226 | XFillRectangle (disp, tmp, gc, 0, 0, width, |
226 | XFillRectangle (disp, tmp, gc, 0, 0, width, |
227 | xpmh); |
227 | xpmh); |
228 | |
228 | |
229 | for ( /*nil */ ; x < w; x++, p += incr) |
229 | for ( /*nil */ ; x < w; x++, p += incr) |
… | |
… | |
239 | * vertical scaling |
239 | * vertical scaling |
240 | */ |
240 | */ |
241 | rxvt_pixmap_incr (&h, &y, &incr, &p, height, xpmh); |
241 | rxvt_pixmap_incr (&h, &y, &incr, &p, height, xpmh); |
242 | |
242 | |
243 | if (y > 0) |
243 | if (y > 0) |
244 | XFillRectangle (disp, TermWin.pixmap, gc, 0, 0, width, y); |
244 | XFillRectangle (disp, pixmap, gc, 0, 0, width, y); |
245 | |
245 | |
246 | if (h < height) |
246 | if (h < height) |
247 | XFillRectangle (disp, TermWin.pixmap, gc, 0, (int)h, width, height - h + 1); |
247 | XFillRectangle (disp, pixmap, gc, 0, (int)h, width, height - h + 1); |
248 | |
248 | |
249 | for ( /*nil */ ; y < h; y++, p += incr) |
249 | for ( /*nil */ ; y < h; y++, p += incr) |
250 | { |
250 | { |
251 | if (p >= xpmh) |
251 | if (p >= xpmh) |
252 | p = 0; |
252 | p = 0; |
253 | |
253 | |
254 | /* copy one row from the tmp pixmap to the main pixmap */ |
254 | /* copy one row from the tmp pixmap to the main pixmap */ |
255 | XCopyArea (disp, tmp, TermWin.pixmap, gc, |
255 | XCopyArea (disp, tmp, pixmap, gc, |
256 | 0, (int)p, width, 1, 0, (int)y); |
256 | 0, (int)p, width, 1, 0, (int)y); |
257 | } |
257 | } |
258 | |
258 | |
259 | XFreePixmap (disp, tmp); |
259 | XFreePixmap (disp, tmp); |
260 | } |
260 | } |
261 | } |
261 | } |
262 | |
262 | |
263 | XSetWindowBackgroundPixmap (disp, TermWin.vt, TermWin.pixmap); |
263 | XSetWindowBackgroundPixmap (disp, vt, pixmap); |
264 | XFreeGC (disp, gc); |
264 | XFreeGC (disp, gc); |
265 | am_transparent = 0; |
265 | am_transparent = 0; |
266 | } |
266 | } |
267 | |
267 | |
268 | /* |
268 | /* |
… | |
… | |
352 | { |
352 | { |
353 | XFreePixmap (display->display, bgPixmap.pixmap); |
353 | XFreePixmap (display->display, bgPixmap.pixmap); |
354 | bgPixmap.pixmap = None; |
354 | bgPixmap.pixmap = None; |
355 | } |
355 | } |
356 | |
356 | |
357 | XSetWindowBackground (display->display, TermWin.vt, pix_colors[Color_bg]); |
357 | XSetWindowBackground (display->display, vt, pix_colors[Color_bg]); |
358 | |
358 | |
359 | if (*file != '\0') |
359 | if (*file != '\0') |
360 | { |
360 | { |
361 | /* XWindowAttributes attr; */ |
361 | /* XWindowAttributes attr; */ |
362 | |
362 | |
363 | /* |
363 | /* |
364 | * we already have the required attributes |
364 | * we already have the required attributes |
365 | */ |
365 | */ |
366 | /* XGetWindowAttributes (display->display, TermWin.vt, &attr); */ |
366 | /* XGetWindowAttributes (display->display, vt, &attr); */ |
367 | |
367 | |
368 | xpmAttr.closeness = 30000; |
368 | xpmAttr.closeness = 30000; |
369 | xpmAttr.colormap = display->cmap; |
369 | xpmAttr.colormap = display->cmap; |
370 | xpmAttr.visual = display->visual; |
370 | xpmAttr.visual = display->visual; |
371 | xpmAttr.depth = display->depth; |
371 | xpmAttr.depth = display->depth; |