1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*--------------------------------*-C-*---------------------------------* |
2 | * File: xpm.c |
2 | * File: xpm.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * $Id: xpm.C,v 1.10 2004/03/17 03:47:14 pcg Exp $ |
|
|
5 | * |
4 | * |
6 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
7 | * Copyright (c) 1997 Carsten Haitzler <raster@zip.com.au> |
6 | * Copyright (c) 1997 Carsten Haitzler <raster@zip.com.au> |
8 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
7 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
9 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
8 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
… | |
… | |
67 | if (!STRCMP (geom, "?")) |
66 | if (!STRCMP (geom, "?")) |
68 | { |
67 | { |
69 | sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ |
68 | sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ |
70 | min (bgpixmap->w, 9999), min (bgpixmap->h, 9999), |
69 | min (bgpixmap->w, 9999), min (bgpixmap->h, 9999), |
71 | min (bgpixmap->x, 9999), min (bgpixmap->y, 9999)); |
70 | min (bgpixmap->x, 9999), min (bgpixmap->y, 9999)); |
72 | xterm_seq (XTerm_title, str, CHAR_ST); |
71 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
73 | free (str); |
72 | free (str); |
74 | return 0; |
73 | return 0; |
75 | } |
74 | } |
76 | |
75 | |
77 | if ((p = STRCHR (geom, ';')) == NULL) |
76 | if ((p = STRCHR (geom, ';')) == NULL) |
… | |
… | |
199 | if (w == 0) |
198 | if (w == 0) |
200 | { |
199 | { |
201 | /* basic X tiling - let the X server do it */ |
200 | /* basic X tiling - let the X server do it */ |
202 | TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, |
201 | TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, |
203 | xpmw, xpmh, |
202 | xpmw, xpmh, |
204 | (unsigned int)XDEPTH); |
203 | (unsigned int)display->depth); |
205 | XCopyArea (display->display, bgPixmap.pixmap, TermWin.pixmap, gc, |
204 | XCopyArea (display->display, bgPixmap.pixmap, TermWin.pixmap, gc, |
206 | 0, 0, xpmw, xpmh, 0, 0); |
205 | 0, 0, xpmw, xpmh, 0, 0); |
207 | } |
206 | } |
208 | else |
207 | else |
209 | { |
208 | { |
210 | float incr, p; |
209 | float incr, p; |
211 | Pixmap tmp; |
210 | Pixmap tmp; |
212 | |
211 | |
213 | TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, |
212 | TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, |
214 | width, height, |
213 | width, height, |
215 | (unsigned int)XDEPTH); |
214 | (unsigned int)display->depth); |
216 | /* |
215 | /* |
217 | * horizontal scaling |
216 | * horizontal scaling |
218 | */ |
217 | */ |
219 | rxvt_pixmap_incr (&w, &x, &incr, &p, width, xpmw); |
218 | rxvt_pixmap_incr (&w, &x, &incr, &p, width, xpmw); |
220 | |
219 | |
221 | tmp = XCreatePixmap (display->display, TermWin.vt, |
220 | tmp = XCreatePixmap (display->display, TermWin.vt, |
222 | width, xpmh, (unsigned int)XDEPTH); |
221 | width, xpmh, (unsigned int)display->depth); |
223 | XFillRectangle (display->display, tmp, gc, 0, 0, width, |
222 | XFillRectangle (display->display, tmp, gc, 0, 0, width, |
224 | xpmh); |
223 | xpmh); |
225 | |
224 | |
226 | for ( /*nil */ ; x < w; x++, p += incr) |
225 | for ( /*nil */ ; x < w; x++, p += incr) |
227 | { |
226 | { |
… | |
… | |
252 | 0, (int)p, width, 1, 0, (int)y); |
251 | 0, (int)p, width, 1, 0, (int)y); |
253 | } |
252 | } |
254 | XFreePixmap (display->display, tmp); |
253 | XFreePixmap (display->display, tmp); |
255 | } |
254 | } |
256 | } |
255 | } |
|
|
256 | |
257 | XSetWindowBackgroundPixmap (display->display, TermWin.vt, TermWin.pixmap); |
257 | XSetWindowBackgroundPixmap (display->display, TermWin.vt, TermWin.pixmap); |
258 | XFreeGC (display->display, gc); |
258 | XFreeGC (display->display, gc); |
259 | am_transparent = 0; |
259 | am_transparent = 0; |
260 | |
260 | |
261 | XClearWindow (display->display, TermWin.vt); |
261 | XClearWindow (display->display, TermWin.vt); |
… | |
… | |
362 | * we already have the required attributes |
362 | * we already have the required attributes |
363 | */ |
363 | */ |
364 | /* XGetWindowAttributes (display->display, TermWin.vt, &attr); */ |
364 | /* XGetWindowAttributes (display->display, TermWin.vt, &attr); */ |
365 | |
365 | |
366 | xpmAttr.closeness = 30000; |
366 | xpmAttr.closeness = 30000; |
367 | xpmAttr.colormap = XCMAP; |
367 | xpmAttr.colormap = display->cmap; |
368 | xpmAttr.visual = XVISUAL; |
368 | xpmAttr.visual = display->visual; |
369 | xpmAttr.depth = XDEPTH; |
369 | xpmAttr.depth = display->depth; |
370 | xpmAttr.valuemask = (XpmCloseness | XpmColormap | XpmVisual | |
370 | xpmAttr.valuemask = (XpmCloseness | XpmColormap | XpmVisual | |
371 | XpmDepth | XpmSize | XpmReturnPixels); |
371 | XpmDepth | XpmSize | XpmReturnPixels); |
372 | |
372 | |
373 | /* search environment variables here too */ |
373 | /* search environment variables here too */ |
374 | f = (char *)rxvt_File_find (file, ".xpm", rs[Rs_path]); |
374 | f = (char *)rxvt_File_find (file, ".xpm", rs[Rs_path]); |