… | |
… | |
275 | if (ops == NULL) |
275 | if (ops == NULL) |
276 | n = strlen (geom); |
276 | n = strlen (geom); |
277 | else |
277 | else |
278 | n = ops - geom; |
278 | n = ops - geom; |
279 | |
279 | |
280 | if (n < MAXLEN_GEOM) |
280 | if (n >= MAXLEN_GEOM) |
281 | { |
281 | return false; |
|
|
282 | |
282 | memcpy (str, geom, n); |
283 | memcpy (str, geom, n); |
283 | str[n] = '\0'; |
284 | str[n] = '\0'; |
284 | rxvt_strtrim (str); |
285 | rxvt_strtrim (str); |
285 | |
286 | |
286 | if (str[0]) |
287 | if (str[0]) |
287 | { |
288 | { |
288 | /* we have geometry string - let's handle it prior to applying ops */ |
289 | /* we have geometry string - let's handle it prior to applying ops */ |
289 | geom_flags = XParseGeometry (str, &x, &y, &w, &h); |
290 | geom_flags = XParseGeometry (str, &x, &y, &w, &h); |
290 | } /* done parsing geometry string */ |
291 | } /* done parsing geometry string */ |
291 | |
292 | |
292 | if (!update) |
293 | if (!update) |
293 | { |
294 | { |
294 | if (!(geom_flags & XValue)) |
295 | if (!(geom_flags & XValue)) |
295 | x = y = defaultAlign; |
296 | x = y = defaultAlign; |
296 | else if (!(geom_flags & YValue)) |
297 | else if (!(geom_flags & YValue)) |
297 | y = x; |
298 | y = x; |
298 | |
299 | |
299 | if (!(geom_flags & (WidthValue|HeightValue))) |
300 | if (!(geom_flags & (WidthValue|HeightValue))) |
300 | w = h = defaultScale; |
301 | w = h = defaultScale; |
301 | else if (!(geom_flags & HeightValue)) |
302 | else if (!(geom_flags & HeightValue)) |
302 | h = w; |
303 | h = w; |
303 | else if (!(geom_flags & WidthValue)) |
304 | else if (!(geom_flags & WidthValue)) |
304 | w = h; |
305 | w = h; |
305 | |
306 | |
306 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
307 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
307 | } |
308 | } |
308 | |
309 | |
309 | if (ops) |
310 | if (ops) |
310 | { |
311 | { |
311 | while (*ops) |
312 | while (*ops) |
312 | { |
313 | { |
313 | while (*ops == ':' || isspace(*ops)) ++ops; |
314 | while (*ops == ':' || isspace(*ops)) ++ops; |
314 | |
315 | |
315 | # define CHECK_GEOM_OPS(op_str) (strncasecmp (ops, (op_str), sizeof (op_str) - 1) == 0) |
316 | # define CHECK_GEOM_OPS(op_str) (strncasecmp (ops, (op_str), sizeof (op_str) - 1) == 0) |
316 | if (CHECK_GEOM_OPS ("tile")) |
317 | if (CHECK_GEOM_OPS ("tile")) |
317 | { |
318 | { |
318 | w = h = noScale; |
319 | w = h = noScale; |
319 | geom_flags |= WidthValue|HeightValue; |
320 | geom_flags |= WidthValue|HeightValue; |
320 | } |
321 | } |
321 | else if (CHECK_GEOM_OPS ("propscale")) |
322 | else if (CHECK_GEOM_OPS ("propscale")) |
322 | { |
323 | { |
323 | new_flags |= propScale; |
324 | new_flags |= propScale; |
324 | } |
325 | } |
325 | else if (CHECK_GEOM_OPS ("hscale")) |
326 | else if (CHECK_GEOM_OPS ("hscale")) |
326 | { |
327 | { |
327 | if (w == 0) w = windowScale; |
328 | if (w == 0) w = windowScale; |
328 | |
329 | |
329 | h = noScale; |
330 | h = noScale; |
330 | geom_flags |= WidthValue|HeightValue; |
331 | geom_flags |= WidthValue|HeightValue; |
331 | } |
332 | } |
332 | else if (CHECK_GEOM_OPS ("vscale")) |
333 | else if (CHECK_GEOM_OPS ("vscale")) |
333 | { |
334 | { |
334 | if (h == 0) h = windowScale; |
335 | if (h == 0) h = windowScale; |
335 | |
336 | |
336 | w = noScale; |
337 | w = noScale; |
337 | geom_flags |= WidthValue|HeightValue; |
338 | geom_flags |= WidthValue|HeightValue; |
338 | } |
339 | } |
339 | else if (CHECK_GEOM_OPS ("scale")) |
340 | else if (CHECK_GEOM_OPS ("scale")) |
340 | { |
341 | { |
341 | if (h == 0) h = windowScale; |
342 | if (h == 0) h = windowScale; |
342 | if (w == 0) w = windowScale; |
343 | if (w == 0) w = windowScale; |
343 | |
344 | |
344 | geom_flags |= WidthValue|HeightValue; |
345 | geom_flags |= WidthValue|HeightValue; |
345 | } |
346 | } |
346 | else if (CHECK_GEOM_OPS ("auto")) |
347 | else if (CHECK_GEOM_OPS ("auto")) |
347 | { |
348 | { |
348 | w = h = windowScale; |
349 | w = h = windowScale; |
349 | x = y = centerAlign; |
350 | x = y = centerAlign; |
350 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
351 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
351 | } |
352 | } |
352 | else if (CHECK_GEOM_OPS ("root")) |
353 | else if (CHECK_GEOM_OPS ("root")) |
353 | { |
354 | { |
354 | new_flags |= rootAlign; |
355 | new_flags |= rootAlign; |
355 | w = h = noScale; |
356 | w = h = noScale; |
356 | geom_flags |= WidthValue|HeightValue; |
357 | geom_flags |= WidthValue|HeightValue; |
357 | } |
358 | } |
358 | # undef CHECK_GEOM_OPS |
359 | # undef CHECK_GEOM_OPS |
359 | |
360 | |
360 | while (*ops != ':' && *ops != '\0') ++ops; |
361 | while (*ops != ':' && *ops != '\0') ++ops; |
361 | } /* done parsing ops */ |
362 | } /* done parsing ops */ |
362 | } |
363 | } |
363 | |
364 | |
364 | if (check_set_scale_value (geom_flags, WidthValue, h_scale, w)) changed = true; |
365 | if (check_set_scale_value (geom_flags, WidthValue, h_scale, w)) changed = true; |
365 | if (check_set_scale_value (geom_flags, HeightValue, v_scale, h)) changed = true; |
366 | if (check_set_scale_value (geom_flags, HeightValue, v_scale, h)) changed = true; |
366 | if (check_set_align_value (geom_flags, XValue, h_align, x)) changed = true; |
367 | if (check_set_align_value (geom_flags, XValue, h_align, x)) changed = true; |
367 | if (check_set_align_value (geom_flags, YValue, v_align, y)) changed = true; |
368 | if (check_set_align_value (geom_flags, YValue, v_align, y)) changed = true; |
368 | } |
|
|
369 | |
369 | |
370 | if (new_flags != flags) |
370 | if (new_flags != flags) |
371 | { |
371 | { |
372 | flags = new_flags; |
372 | flags = new_flags; |
373 | changed = true; |
373 | changed = true; |
… | |
… | |
941 | |
941 | |
942 | if (tint) |
942 | if (tint) |
943 | { |
943 | { |
944 | tint->get (c); |
944 | tint->get (c); |
945 | # define IS_COMPONENT_WHOLESOME(cmp) ((cmp) <= 0x000700 || (cmp) >= 0x00f700) |
945 | # define IS_COMPONENT_WHOLESOME(cmp) ((cmp) <= 0x000700 || (cmp) >= 0x00f700) |
|
|
946 | if (!has_shade |
946 | if (!has_shade && IS_COMPONENT_WHOLESOME (c.r) |
947 | && IS_COMPONENT_WHOLESOME (c.r) |
947 | && IS_COMPONENT_WHOLESOME (c.g) |
948 | && IS_COMPONENT_WHOLESOME (c.g) |
948 | && IS_COMPONENT_WHOLESOME (c.b)) |
949 | && IS_COMPONENT_WHOLESOME (c.b)) |
949 | flags |= bgPixmap_t::tintWholesome; |
950 | flags |= bgPixmap_t::tintWholesome; |
950 | # undef IS_COMPONENT_WHOLESOME |
951 | # undef IS_COMPONENT_WHOLESOME |
951 | } |
952 | } |
… | |
… | |
1278 | |
1279 | |
1279 | if (tiled_root_pmap == None) /* something really bad happened - abort */ |
1280 | if (tiled_root_pmap == None) /* something really bad happened - abort */ |
1280 | return 0; |
1281 | return 0; |
1281 | |
1282 | |
1282 | /* straightforward pixmap copy */ |
1283 | /* straightforward pixmap copy */ |
|
|
1284 | while (sx < 0) sx += (int)root_width; |
|
|
1285 | while (sy < 0) sy += (int)root_height; |
|
|
1286 | |
1283 | gcv.tile = recoded_root_pmap; |
1287 | gcv.tile = recoded_root_pmap; |
1284 | gcv.fill_style = FillTiled; |
1288 | gcv.fill_style = FillTiled; |
1285 | |
|
|
1286 | while (sx < 0) sx += (int)root_width; |
|
|
1287 | while (sy < 0) sy += (int)root_height; |
|
|
1288 | |
|
|
1289 | gcv.ts_x_origin = -sx; |
1289 | gcv.ts_x_origin = -sx; |
1290 | gcv.ts_y_origin = -sy; |
1290 | gcv.ts_y_origin = -sy; |
1291 | gc = XCreateGC (dpy, target->vt, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
1291 | gc = XCreateGC (dpy, target->vt, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
1292 | |
1292 | |
1293 | if (gc) |
1293 | if (gc) |
… | |
… | |
1359 | /* we need to re-generate transparency pixmap in that case ! */ |
1359 | /* we need to re-generate transparency pixmap in that case ! */ |
1360 | background_flags = make_transparency_pixmap (); |
1360 | background_flags = make_transparency_pixmap (); |
1361 | if (background_flags == 0) |
1361 | if (background_flags == 0) |
1362 | return false; |
1362 | return false; |
1363 | else if ((background_flags & transpTransformations) == (flags & transpTransformations)) |
1363 | else if ((background_flags & transpTransformations) == (flags & transpTransformations)) |
1364 | flags = flags & ~isInvalid; |
1364 | flags &= ~isInvalid; |
1365 | } |
1365 | } |
1366 | # endif |
1366 | # endif |
1367 | |
1367 | |
1368 | # ifdef BG_IMAGE_FROM_FILE |
1368 | # ifdef BG_IMAGE_FROM_FILE |
1369 | if (have_image |
1369 | if (have_image |
1370 | || (background_flags & transpTransformations) != (flags & transpTransformations)) |
1370 | || (background_flags & transpTransformations) != (flags & transpTransformations)) |
1371 | { |
1371 | { |
1372 | if (render_image (background_flags)) |
1372 | if (render_image (background_flags)) |
1373 | flags = flags & ~isInvalid; |
1373 | flags &= ~isInvalid; |
1374 | } |
1374 | } |
1375 | # endif |
1375 | # endif |
1376 | |
1376 | |
1377 | # if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
1377 | # if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
1378 | XImage *result = NULL; |
1378 | XImage *result = NULL; |
… | |
… | |
1398 | if (gc) |
1398 | if (gc) |
1399 | { |
1399 | { |
1400 | XPutImage (target->dpy, pixmap, gc, result, 0, 0, 0, 0, result->width, result->height); |
1400 | XPutImage (target->dpy, pixmap, gc, result, 0, 0, 0, 0, result->width, result->height); |
1401 | |
1401 | |
1402 | XFreeGC (target->dpy, gc); |
1402 | XFreeGC (target->dpy, gc); |
1403 | flags = flags & ~isInvalid; |
1403 | flags &= ~isInvalid; |
1404 | } |
1404 | } |
1405 | |
1405 | |
1406 | XDestroyImage (result); |
1406 | XDestroyImage (result); |
1407 | } |
1407 | } |
1408 | # endif |
1408 | # endif |