ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/xpm.C
(Generate patch)

Comparing rxvt-unicode/src/xpm.C (file contents):
Revision 1.28 by root, Wed Jan 18 17:49:47 2006 UTC vs.
Revision 1.29 by root, Wed Jan 25 21:03:04 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines