ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/background.C
(Generate patch)

Comparing rxvt-unicode/src/background.C (file contents):
Revision 1.132 by sf-exg, Mon Jan 10 20:46:20 2011 UTC vs.
Revision 1.133 by sf-exg, Tue Jan 11 09:21:14 2011 UTC

253 int x = 0, y = 0; 253 int x = 0, y = 0;
254 unsigned int w = 0, h = 0; 254 unsigned int w = 0, h = 0;
255 unsigned int n; 255 unsigned int n;
256 unsigned long new_flags = (flags & (~geometryFlags)); 256 unsigned long new_flags = (flags & (~geometryFlags));
257 const char *ops; 257 const char *ops;
258# define MAXLEN_GEOM 256 /* could be longer than regular geometry string */
259 258
260 if (geom == NULL) 259 if (geom == NULL)
261 return false; 260 return false;
262 261
263 char str[MAXLEN_GEOM]; 262 char str[256];
264 263
265 ops = strchr (geom, ':'); 264 ops = strchr (geom, ':');
266 if (ops == NULL) 265 if (ops == NULL)
267 n = strlen (geom); 266 n = strlen (geom);
268 else 267 else
269 n = ops - geom; 268 n = ops - geom;
270 269
271 if (n >= MAXLEN_GEOM) 270 if (n >= sizeof (str))
272 return false; 271 return false;
273 272
274 memcpy (str, geom, n); 273 memcpy (str, geom, n);
275 str[n] = '\0'; 274 str[n] = '\0';
276 rxvt_strtrim (str); 275 rxvt_strtrim (str);
302 { 301 {
303 char **arr = rxvt_strsplit (':', ops + 1); 302 char **arr = rxvt_strsplit (':', ops + 1);
304 303
305 for (int i = 0; arr[i]; i++) 304 for (int i = 0; arr[i]; i++)
306 { 305 {
307# define CHECK_GEOM_OPS(op_str) (strcasecmp (arr[i], (op_str)) == 0) 306 if (!strcasecmp (arr[i], "tile"))
308 if (CHECK_GEOM_OPS ("tile"))
309 { 307 {
310 w = h = noScale; 308 w = h = noScale;
311 geom_flags |= WidthValue|HeightValue; 309 geom_flags |= WidthValue|HeightValue;
312 } 310 }
313 else if (CHECK_GEOM_OPS ("propscale")) 311 else if (!strcasecmp (arr[i], "propscale"))
314 { 312 {
315 new_flags |= propScale; 313 new_flags |= propScale;
316 } 314 }
317 else if (CHECK_GEOM_OPS ("hscale")) 315 else if (!strcasecmp (arr[i], "hscale"))
318 { 316 {
319 if (w == 0) w = windowScale; 317 if (w == 0) w = windowScale;
320 318
321 h = noScale; 319 h = noScale;
322 geom_flags |= WidthValue|HeightValue; 320 geom_flags |= WidthValue|HeightValue;
323 } 321 }
324 else if (CHECK_GEOM_OPS ("vscale")) 322 else if (!strcasecmp (arr[i], "vscale"))
325 { 323 {
326 if (h == 0) h = windowScale; 324 if (h == 0) h = windowScale;
327 325
328 w = noScale; 326 w = noScale;
329 geom_flags |= WidthValue|HeightValue; 327 geom_flags |= WidthValue|HeightValue;
330 } 328 }
331 else if (CHECK_GEOM_OPS ("scale")) 329 else if (!strcasecmp (arr[i], "scale"))
332 { 330 {
333 if (h == 0) h = windowScale; 331 if (h == 0) h = windowScale;
334 if (w == 0) w = windowScale; 332 if (w == 0) w = windowScale;
335 333
336 geom_flags |= WidthValue|HeightValue; 334 geom_flags |= WidthValue|HeightValue;
337 } 335 }
338 else if (CHECK_GEOM_OPS ("auto")) 336 else if (!strcasecmp (arr[i], "auto"))
339 { 337 {
340 w = h = windowScale; 338 w = h = windowScale;
341 x = y = centerAlign; 339 x = y = centerAlign;
342 geom_flags |= WidthValue|HeightValue|XValue|YValue; 340 geom_flags |= WidthValue|HeightValue|XValue|YValue;
343 } 341 }
344 else if (CHECK_GEOM_OPS ("root")) 342 else if (!strcasecmp (arr[i], "root"))
345 { 343 {
346 new_flags |= rootAlign; 344 new_flags |= rootAlign;
347 w = h = noScale; 345 w = h = noScale;
348 geom_flags |= WidthValue|HeightValue; 346 geom_flags |= WidthValue|HeightValue;
349 } 347 }
350# undef CHECK_GEOM_OPS
351 } /* done parsing ops */ 348 } /* done parsing ops */
352 349
353 rxvt_free_strsplit (arr); 350 rxvt_free_strsplit (arr);
354 } 351 }
355 352
1013 bool has_shade = shade != 100; 1010 bool has_shade = shade != 100;
1014 1011
1015 if (tint) 1012 if (tint)
1016 { 1013 {
1017 tint->get (c); 1014 tint->get (c);
1018# define IS_COMPONENT_WHOLESOME(cmp) ((cmp) <= 0x00ff || (cmp) >= 0xff00)
1019 if (!has_shade 1015 if (!has_shade
1020 && IS_COMPONENT_WHOLESOME (c.r) 1016 && (c.r <= 0x00ff || c.r >= 0xff00)
1021 && IS_COMPONENT_WHOLESOME (c.g) 1017 && (c.g <= 0x00ff || c.g >= 0xff00)
1022 && IS_COMPONENT_WHOLESOME (c.b)) 1018 && (c.b <= 0x00ff || c.b >= 0xff00))
1023 flags |= bgPixmap_t::tintWholesome; 1019 flags |= bgPixmap_t::tintWholesome;
1024# undef IS_COMPONENT_WHOLESOME
1025 } 1020 }
1026 1021
1027 if (has_shade || tint) 1022 if (has_shade || tint)
1028 flags |= bgPixmap_t::tintNeeded; 1023 flags |= bgPixmap_t::tintNeeded;
1029 1024

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines