… | |
… | |
61 | #define MAXLEN_GEOM sizeof("[1000x1000+1000+1000]") |
61 | #define MAXLEN_GEOM sizeof("[1000x1000+1000+1000]") |
62 | |
62 | |
63 | if (geom == NULL) |
63 | if (geom == NULL) |
64 | return 0; |
64 | return 0; |
65 | str = (char *)rxvt_malloc (MAXLEN_GEOM + 1); |
65 | str = (char *)rxvt_malloc (MAXLEN_GEOM + 1); |
66 | if (!STRCMP (geom, "?")) |
66 | if (!strcmp (geom, "?")) |
67 | { |
67 | { |
68 | sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ |
68 | sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ |
69 | min (bgpixmap->w, 9999), min (bgpixmap->h, 9999), |
69 | min (bgpixmap->w, 9999), min (bgpixmap->h, 9999), |
70 | min (bgpixmap->x, 9999), min (bgpixmap->y, 9999)); |
70 | min (bgpixmap->x, 9999), min (bgpixmap->y, 9999)); |
71 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
71 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
72 | free (str); |
72 | free (str); |
73 | return 0; |
73 | return 0; |
74 | } |
74 | } |
75 | |
75 | |
76 | if ((p = STRCHR (geom, ';')) == NULL) |
76 | if ((p = strchr (geom, ';')) == NULL) |
77 | p = STRCHR (geom, '\0'); |
77 | p = strchr (geom, '\0'); |
78 | n = (p - geom); |
78 | n = (p - geom); |
79 | if (n <= MAXLEN_GEOM) |
79 | if (n <= MAXLEN_GEOM) |
80 | { |
80 | { |
81 | STRNCPY (str, geom, n); |
81 | strncpy (str, geom, n); |
82 | str[n] = '\0'; |
82 | str[n] = '\0'; |
83 | |
83 | |
84 | flags = XParseGeometry (str, &x, &y, &w, &h); |
84 | flags = XParseGeometry (str, &x, &y, &w, &h); |
85 | if (!flags) |
85 | if (!flags) |
86 | { |
86 | { |
… | |
… | |
168 | XFreePixmap (display->display, TermWin.pixmap); |
168 | XFreePixmap (display->display, TermWin.pixmap); |
169 | |
169 | |
170 | if (bgPixmap.pixmap == None) |
170 | if (bgPixmap.pixmap == None) |
171 | { /* So be it: I'm not using pixmaps */ |
171 | { /* So be it: I'm not using pixmaps */ |
172 | TermWin.pixmap = None; |
172 | TermWin.pixmap = None; |
173 | if (! (Options & Opt_transparent) || am_transparent == 0) |
173 | if (! (options & Opt_transparent) || am_transparent == 0) |
174 | XSetWindowBackground (display->display, TermWin.vt, |
174 | XSetWindowBackground (display->display, TermWin.vt, |
175 | PixColors[Color_bg]); |
175 | pix_colors[Color_bg]); |
176 | return; |
176 | return; |
177 | } |
177 | } |
178 | |
178 | |
179 | gcvalue.foreground = PixColors[Color_bg]; |
179 | gcvalue.foreground = pix_colors[Color_bg]; |
180 | gc = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
180 | gc = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
181 | |
181 | |
182 | if (bgPixmap.pixmap != None) |
182 | if (bgPixmap.pixmap != None) |
183 | { /* we have a specified pixmap */ |
183 | { /* we have a specified pixmap */ |
184 | unsigned int w = bgPixmap.w, h = bgPixmap.h, |
184 | unsigned int w = bgPixmap.w, h = bgPixmap.h, |
… | |
… | |
198 | if (w == 0) |
198 | if (w == 0) |
199 | { |
199 | { |
200 | /* basic X tiling - let the X server do it */ |
200 | /* basic X tiling - let the X server do it */ |
201 | TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, |
201 | TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, |
202 | xpmw, xpmh, |
202 | xpmw, xpmh, |
203 | (unsigned int)XDEPTH); |
203 | (unsigned int)display->depth); |
204 | XCopyArea (display->display, bgPixmap.pixmap, TermWin.pixmap, gc, |
204 | XCopyArea (display->display, bgPixmap.pixmap, TermWin.pixmap, gc, |
205 | 0, 0, xpmw, xpmh, 0, 0); |
205 | 0, 0, xpmw, xpmh, 0, 0); |
206 | } |
206 | } |
207 | else |
207 | else |
208 | { |
208 | { |
209 | float incr, p; |
209 | float incr, p; |
210 | Pixmap tmp; |
210 | Pixmap tmp; |
211 | |
211 | |
212 | TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, |
212 | TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, |
213 | width, height, |
213 | width, height, |
214 | (unsigned int)XDEPTH); |
214 | (unsigned int)display->depth); |
215 | /* |
215 | /* |
216 | * horizontal scaling |
216 | * horizontal scaling |
217 | */ |
217 | */ |
218 | rxvt_pixmap_incr (&w, &x, &incr, &p, width, xpmw); |
218 | rxvt_pixmap_incr (&w, &x, &incr, &p, width, xpmw); |
219 | |
219 | |
220 | tmp = XCreatePixmap (display->display, TermWin.vt, |
220 | tmp = XCreatePixmap (display->display, TermWin.vt, |
221 | width, xpmh, (unsigned int)XDEPTH); |
221 | width, xpmh, (unsigned int)display->depth); |
222 | XFillRectangle (display->display, tmp, gc, 0, 0, width, |
222 | XFillRectangle (display->display, tmp, gc, 0, 0, width, |
223 | xpmh); |
223 | xpmh); |
224 | |
224 | |
225 | for ( /*nil */ ; x < w; x++, p += incr) |
225 | for ( /*nil */ ; x < w; x++, p += incr) |
226 | { |
226 | { |
… | |
… | |
251 | 0, (int)p, width, 1, 0, (int)y); |
251 | 0, (int)p, width, 1, 0, (int)y); |
252 | } |
252 | } |
253 | XFreePixmap (display->display, tmp); |
253 | XFreePixmap (display->display, tmp); |
254 | } |
254 | } |
255 | } |
255 | } |
|
|
256 | |
256 | XSetWindowBackgroundPixmap (display->display, TermWin.vt, TermWin.pixmap); |
257 | XSetWindowBackgroundPixmap (display->display, TermWin.vt, TermWin.pixmap); |
257 | XFreeGC (display->display, gc); |
258 | XFreeGC (display->display, gc); |
258 | am_transparent = 0; |
259 | am_transparent = 0; |
259 | |
260 | |
260 | XClearWindow (display->display, TermWin.vt); |
261 | XClearWindow (display->display, TermWin.vt); |
… | |
… | |
349 | if (bgPixmap.pixmap != None) |
350 | if (bgPixmap.pixmap != None) |
350 | { |
351 | { |
351 | XFreePixmap (display->display, bgPixmap.pixmap); |
352 | XFreePixmap (display->display, bgPixmap.pixmap); |
352 | bgPixmap.pixmap = None; |
353 | bgPixmap.pixmap = None; |
353 | } |
354 | } |
|
|
355 | |
354 | XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]); |
356 | XSetWindowBackground (display->display, TermWin.vt, pix_colors[Color_bg]); |
355 | |
357 | |
356 | if (*file != '\0') |
358 | if (*file != '\0') |
357 | { |
359 | { |
358 | /* XWindowAttributes attr; */ |
360 | /* XWindowAttributes attr; */ |
359 | |
361 | |
… | |
… | |
361 | * we already have the required attributes |
363 | * we already have the required attributes |
362 | */ |
364 | */ |
363 | /* XGetWindowAttributes (display->display, TermWin.vt, &attr); */ |
365 | /* XGetWindowAttributes (display->display, TermWin.vt, &attr); */ |
364 | |
366 | |
365 | xpmAttr.closeness = 30000; |
367 | xpmAttr.closeness = 30000; |
366 | xpmAttr.colormap = XCMAP; |
368 | xpmAttr.colormap = display->cmap; |
367 | xpmAttr.visual = XVISUAL; |
369 | xpmAttr.visual = display->visual; |
368 | xpmAttr.depth = XDEPTH; |
370 | xpmAttr.depth = display->depth; |
369 | xpmAttr.valuemask = (XpmCloseness | XpmColormap | XpmVisual | |
371 | xpmAttr.valuemask = (XpmCloseness | XpmColormap | XpmVisual | |
370 | XpmDepth | XpmSize | XpmReturnPixels); |
372 | XpmDepth | XpmSize | XpmReturnPixels); |
371 | |
373 | |
372 | /* search environment variables here too */ |
374 | /* search environment variables here too */ |
373 | f = (char *)rxvt_File_find (file, ".xpm", rs[Rs_path]); |
375 | f = (char *)rxvt_File_find (file, ".xpm", rs[Rs_path]); |
… | |
… | |
377 | &xpmAttr)) |
379 | &xpmAttr)) |
378 | { |
380 | { |
379 | char *p; |
381 | char *p; |
380 | |
382 | |
381 | /* semi-colon delimited */ |
383 | /* semi-colon delimited */ |
382 | if ((p = STRCHR (file, ';')) == NULL) |
384 | if ((p = strchr (file, ';')) == NULL) |
383 | p = STRCHR (file, '\0'); |
385 | p = strchr (file, '\0'); |
384 | |
386 | |
385 | rxvt_warn ("couldn't load XPM file \"%.*s\", ignoring.", (p - file), file); |
387 | rxvt_warn ("couldn't load XPM file \"%.*s\", ignoring.\n", (p - file), file); |
386 | } |
388 | } |
387 | |
389 | |
388 | free (f); |
390 | free (f); |
389 | } |
391 | } |
390 | |
392 | |