1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*----------------------------------------------------------------------* |
2 | * File: xpm.C |
2 | * File: xpm.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
6 | * Copyright (c) 1997 Carsten Haitzler <raster@zip.com.au> |
6 | * Copyright (c) 1997 Carsten Haitzler <raster@zip.com.au> |
… | |
… | |
56 | int flags, changed = 0; |
56 | int flags, changed = 0; |
57 | int x = 0, y = 0; |
57 | int x = 0, y = 0; |
58 | unsigned int w = 0, h = 0; |
58 | unsigned int w = 0, h = 0; |
59 | unsigned int n; |
59 | unsigned int n; |
60 | char *p; |
60 | char *p; |
61 | bgPixmap_t *bgpixmap = & (bgPixmap); |
61 | bgPixmap_t *bgpixmap = &bgPixmap; |
62 | |
62 | |
63 | #define MAXLEN_GEOM sizeof("[10000x10000+10000+10000]") |
63 | #define MAXLEN_GEOM sizeof("[10000x10000+10000+10000]") |
64 | |
64 | |
65 | if (geom == NULL) |
65 | if (geom == NULL) |
66 | return 0; |
66 | return 0; |
… | |
… | |
78 | |
78 | |
79 | if ((p = strchr (geom, ';')) == NULL) |
79 | if ((p = strchr (geom, ';')) == NULL) |
80 | p = strchr (geom, '\0'); |
80 | p = strchr (geom, '\0'); |
81 | |
81 | |
82 | n = (p - geom); |
82 | n = (p - geom); |
83 | if (n <= MAXLEN_GEOM) |
83 | if (n < MAXLEN_GEOM) |
84 | { |
84 | { |
85 | strncpy (str, geom, n); |
85 | strncpy (str, geom, n); |
86 | str[n] = '\0'; |
86 | str[n] = '\0'; |
87 | |
87 | |
88 | flags = XParseGeometry (str, &x, &y, &w, &h); |
88 | flags = XParseGeometry (str, &x, &y, &w, &h); |
… | |
… | |
175 | |
175 | |
176 | if (bgPixmap.pixmap == None) |
176 | if (bgPixmap.pixmap == None) |
177 | { /* So be it: I'm not using pixmaps */ |
177 | { /* So be it: I'm not using pixmaps */ |
178 | pixmap = None; |
178 | pixmap = None; |
179 | |
179 | |
|
|
180 | #ifdef TRANSPARENT |
180 | if (!OPTION (Opt_transparent) || !am_transparent) |
181 | if (!OPTION (Opt_transparent) || !am_transparent) |
|
|
182 | #endif |
181 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
183 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
182 | |
184 | |
183 | return; |
185 | return; |
184 | } |
186 | } |
185 | |
187 | |
… | |
… | |
260 | } |
262 | } |
261 | |
263 | |
262 | XSetWindowBackgroundPixmap (dpy, vt, pixmap); |
264 | XSetWindowBackgroundPixmap (dpy, vt, pixmap); |
263 | |
265 | |
264 | XFreeGC (dpy, gc); |
266 | XFreeGC (dpy, gc); |
|
|
267 | #ifdef TRANSPARENT |
265 | am_transparent = 0; |
268 | am_transparent = 0; |
|
|
269 | #endif |
266 | } |
270 | } |
267 | |
271 | |
268 | /* |
272 | /* |
269 | * Calculate tiling sizes and increments |
273 | * Calculate tiling sizes and increments |
270 | * At start, p == 0, incr == xpmwidthheight |
274 | * At start, p == 0, incr == xpmwidthheight |