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.30 by root, Wed Jan 25 21:09:22 2006 UTC vs.
Revision 1.31 by root, Thu Feb 2 18:04:46 2006 UTC

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) 263 if (pixmap != None)
264 { 264 {
265 XFreePixmap (xdisp, pixmap); 265 XFreePixmap (dpy, pixmap);
266 pixmap = None; 266 pixmap = None;
267 } 267 }
268 268
269 XFreeGC (xdisp, gc); 269 XFreeGC (dpy, gc);
270 am_transparent = 0; 270 am_transparent = 0;
271} 271}
272 272
273/* 273/*
274 * Calculate tiling sizes and increments 274 * Calculate tiling sizes and increments
353 353
354 assert (file != NULL); 354 assert (file != NULL);
355 355
356 if (bgPixmap.pixmap != None) 356 if (bgPixmap.pixmap != None)
357 { 357 {
358 XFreePixmap (xdisp, bgPixmap.pixmap); 358 XFreePixmap (dpy, bgPixmap.pixmap);
359 bgPixmap.pixmap = None; 359 bgPixmap.pixmap = None;
360 } 360 }
361 361
362 XSetWindowBackground (xdisp, vt, pix_colors[Color_bg]); 362 XSetWindowBackground (dpy, vt, pix_colors[Color_bg]);
363 363
364 if (*file != '\0') 364 if (*file != '\0')
365 { 365 {
366 /* XWindowAttributes attr; */ 366 /* XWindowAttributes attr; */
367 367
368 /* 368 /*
369 * we already have the required attributes 369 * we already have the required attributes
370 */ 370 */
371 /* XGetWindowAttributes (xdisp, vt, &attr); */ 371 /* XGetWindowAttributes (dpy, vt, &attr); */
372 372
373 xpmAttr.closeness = 30000; 373 xpmAttr.closeness = 30000;
374 xpmAttr.colormap = cmap; 374 xpmAttr.colormap = cmap;
375 xpmAttr.visual = visual; 375 xpmAttr.visual = visual;
376 xpmAttr.depth = depth; 376 xpmAttr.depth = depth;
378 | XpmDepth | XpmSize | XpmReturnPixels); 378 | XpmDepth | XpmSize | XpmReturnPixels);
379 379
380 /* search environment variables here too */ 380 /* search environment variables here too */
381 f = (char *)rxvt_File_find (file, ".xpm", rs[Rs_path]); 381 f = (char *)rxvt_File_find (file, ".xpm", rs[Rs_path]);
382 if (f == NULL 382 if (f == NULL
383 || XpmReadFileToPixmap (xdisp, display->root, f, 383 || XpmReadFileToPixmap (dpy, display->root, f,
384 &bgPixmap.pixmap, NULL, 384 &bgPixmap.pixmap, NULL,
385 &xpmAttr)) 385 &xpmAttr))
386 { 386 {
387 char *p; 387 char *p;
388 388

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines