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> |
7 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
7 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
8 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
8 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
|
|
9 | * Copyright (c) 2005-2006 Marc Lehmann <pcg@goof.com> |
9 | * |
10 | * |
10 | * This program is free software; you can redistribute it and/or modify |
11 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by |
12 | * it under the terms of the GNU General Public License as published by |
12 | * the Free Software Foundation; either version 2 of the License, or |
13 | * the Free Software Foundation; either version 2 of the License, or |
13 | * (at your option) any later version. |
14 | * (at your option) any later version. |
… | |
… | |
55 | int flags, changed = 0; |
56 | int flags, changed = 0; |
56 | int x = 0, y = 0; |
57 | int x = 0, y = 0; |
57 | unsigned int w = 0, h = 0; |
58 | unsigned int w = 0, h = 0; |
58 | unsigned int n; |
59 | unsigned int n; |
59 | char *p; |
60 | char *p; |
60 | bgPixmap_t *bgpixmap = & (bgPixmap); |
61 | bgPixmap_t *bgpixmap = &bgPixmap; |
61 | |
62 | |
62 | #define MAXLEN_GEOM sizeof("[10000x10000+10000+10000]") |
63 | #define MAXLEN_GEOM sizeof("[10000x10000+10000+10000]") |
63 | |
64 | |
64 | if (geom == NULL) |
65 | if (geom == NULL) |
65 | return 0; |
66 | return 0; |
… | |
… | |
77 | |
78 | |
78 | if ((p = strchr (geom, ';')) == NULL) |
79 | if ((p = strchr (geom, ';')) == NULL) |
79 | p = strchr (geom, '\0'); |
80 | p = strchr (geom, '\0'); |
80 | |
81 | |
81 | n = (p - geom); |
82 | n = (p - geom); |
82 | if (n <= MAXLEN_GEOM) |
83 | if (n < MAXLEN_GEOM) |
83 | { |
84 | { |
84 | strncpy (str, geom, n); |
85 | strncpy (str, geom, n); |
85 | str[n] = '\0'; |
86 | str[n] = '\0'; |
86 | |
87 | |
87 | flags = XParseGeometry (str, &x, &y, &w, &h); |
88 | flags = XParseGeometry (str, &x, &y, &w, &h); |
… | |
… | |
174 | |
175 | |
175 | if (bgPixmap.pixmap == None) |
176 | if (bgPixmap.pixmap == None) |
176 | { /* So be it: I'm not using pixmaps */ |
177 | { /* So be it: I'm not using pixmaps */ |
177 | pixmap = None; |
178 | pixmap = None; |
178 | |
179 | |
|
|
180 | #ifdef TRANSPARENT |
179 | if (!OPTION (Opt_transparent) || !am_transparent) |
181 | if (!OPTION (Opt_transparent) || !am_transparent) |
|
|
182 | #endif |
180 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
183 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
181 | |
184 | |
182 | return; |
185 | return; |
183 | } |
186 | } |
184 | |
187 | |
… | |
… | |
259 | } |
262 | } |
260 | |
263 | |
261 | XSetWindowBackgroundPixmap (dpy, vt, pixmap); |
264 | XSetWindowBackgroundPixmap (dpy, vt, pixmap); |
262 | |
265 | |
263 | XFreeGC (dpy, gc); |
266 | XFreeGC (dpy, gc); |
|
|
267 | #ifdef TRANSPARENT |
264 | am_transparent = 0; |
268 | am_transparent = 0; |
|
|
269 | #endif |
265 | } |
270 | } |
266 | |
271 | |
267 | /* |
272 | /* |
268 | * Calculate tiling sizes and increments |
273 | * Calculate tiling sizes and increments |
269 | * At start, p == 0, incr == xpmwidthheight |
274 | * At start, p == 0, incr == xpmwidthheight |