… | |
… | |
100 | #endif |
100 | #endif |
101 | flags = 0; |
101 | flags = 0; |
102 | pixmap = None; |
102 | pixmap = None; |
103 | } |
103 | } |
104 | |
104 | |
|
|
105 | bgPixmap_t::~bgPixmap_t() |
|
|
106 | { |
|
|
107 | #ifdef HAVE_AFTERIMAGE |
|
|
108 | if (original_asim) |
|
|
109 | safe_asimage_destroy (original_asim); |
|
|
110 | #endif |
|
|
111 | if (pixmap && target) |
|
|
112 | XFreePixmap (target->dpy, pixmap); |
|
|
113 | } |
105 | |
114 | |
106 | bool |
115 | bool |
107 | bgPixmap_t::window_size_sensitive () |
116 | bgPixmap_t::window_size_sensitive () |
108 | { |
117 | { |
|
|
118 | # ifdef ENABLE_TRANSPARENCY |
|
|
119 | if (flags & isTransparent) |
|
|
120 | return true; |
|
|
121 | # endif |
|
|
122 | |
109 | # ifdef BG_IMAGE_FROM_FILE |
123 | # ifdef BG_IMAGE_FROM_FILE |
110 | # ifdef HAVE_AFTERIMAGE |
124 | # ifdef HAVE_AFTERIMAGE |
111 | if (original_asim != NULL) |
125 | if (original_asim != NULL) |
112 | # endif |
126 | # endif |
113 | { |
127 | { |
114 | if (h_scale != 0 || v_scale != 0 |
128 | if (h_scale != 0 || v_scale != 0 |
115 | || h_align != 0 || v_align != 0) |
129 | || h_align != 0 || v_align != 0) |
116 | return true; |
130 | return true; |
117 | } |
131 | } |
118 | # endif |
132 | # endif |
|
|
133 | |
|
|
134 | return false; |
|
|
135 | } |
|
|
136 | |
|
|
137 | bool |
|
|
138 | bgPixmap_t::window_position_sensitive () |
|
|
139 | { |
119 | # ifdef ENABLE_TRANSPARENCY |
140 | # ifdef ENABLE_TRANSPARENCY |
120 | if (flags & isTransparent) |
141 | if (flags & isTransparent) |
121 | return true; |
142 | return true; |
122 | # endif |
143 | # endif |
|
|
144 | |
|
|
145 | # ifdef BG_IMAGE_FROM_FILE |
|
|
146 | # ifdef HAVE_AFTERIMAGE |
|
|
147 | if (original_asim != NULL) |
|
|
148 | # endif |
|
|
149 | { |
|
|
150 | if (h_align == rootAlign || v_align == rootAlign) |
|
|
151 | return true; |
|
|
152 | } |
|
|
153 | # endif |
|
|
154 | |
123 | return false; |
155 | return false; |
124 | } |
156 | }; |
125 | |
157 | |
126 | bool bgPixmap_t::need_client_side_rendering () |
158 | bool bgPixmap_t::need_client_side_rendering () |
127 | { |
159 | { |
128 | # ifdef HAVE_AFTERIMAGE |
160 | # ifdef HAVE_AFTERIMAGE |
129 | if (original_asim != NULL) |
161 | if (original_asim != NULL) |
… | |
… | |
163 | static inline bool |
195 | static inline bool |
164 | check_set_align_value (int geom_flags, int flag, int &align, int new_value) |
196 | check_set_align_value (int geom_flags, int flag, int &align, int new_value) |
165 | { |
197 | { |
166 | if (geom_flags & flag) |
198 | if (geom_flags & flag) |
167 | { |
199 | { |
|
|
200 | if (new_value != bgPixmap_t::rootAlign) |
|
|
201 | { |
168 | if (new_value < -100) |
202 | if (new_value < -100) |
169 | new_value = -100; |
203 | new_value = -100; |
170 | else if (new_value > 200) |
204 | else if (new_value > 200) |
171 | new_value = 200; |
205 | new_value = 200; |
|
|
206 | } |
172 | if (new_value != align) |
207 | if (new_value != align) |
173 | { |
208 | { |
174 | align = new_value; |
209 | align = new_value; |
175 | return true; |
210 | return true; |
176 | } |
211 | } |
… | |
… | |
330 | { |
365 | { |
331 | while (*ops == ':' || isspace(*ops)) ++ops; |
366 | while (*ops == ':' || isspace(*ops)) ++ops; |
332 | # define CHECK_GEOM_OPS(op_str) (strncasecmp (ops, (op_str), sizeof(op_str)-1) == 0) |
367 | # define CHECK_GEOM_OPS(op_str) (strncasecmp (ops, (op_str), sizeof(op_str)-1) == 0) |
333 | if (CHECK_GEOM_OPS("tile")) |
368 | if (CHECK_GEOM_OPS("tile")) |
334 | { |
369 | { |
335 | w = h = 0; |
370 | w = h = noScale; |
336 | geom_flags |= WidthValue|HeightValue; |
371 | geom_flags |= WidthValue|HeightValue; |
337 | } |
372 | } |
338 | else if (CHECK_GEOM_OPS("propscale")) |
373 | else if (CHECK_GEOM_OPS("propscale")) |
339 | { |
374 | { |
340 | if (w == 0 && h == 0) |
375 | if (w == 0 && h == 0) |
341 | { |
376 | { |
342 | w = 100; |
377 | w = windowScale; |
343 | geom_flags |= WidthValue; |
378 | geom_flags |= WidthValue; |
344 | } |
379 | } |
345 | new_flags |= propScale; |
380 | new_flags |= propScale; |
346 | } |
381 | } |
347 | else if (CHECK_GEOM_OPS("hscale")) |
382 | else if (CHECK_GEOM_OPS("hscale")) |
348 | { |
383 | { |
349 | if (w == 0) |
384 | if (w == 0) |
350 | w = 100; |
385 | w = windowScale; |
351 | h = 0; |
386 | h = noScale; |
352 | geom_flags |= WidthValue|HeightValue; |
387 | geom_flags |= WidthValue|HeightValue; |
353 | } |
388 | } |
354 | else if (CHECK_GEOM_OPS("vscale")) |
389 | else if (CHECK_GEOM_OPS("vscale")) |
355 | { |
390 | { |
356 | if (h == 0) |
391 | if (h == 0) |
357 | h = 100; |
392 | h = windowScale; |
358 | w = 0; |
393 | w = noScale; |
359 | geom_flags |= WidthValue|HeightValue; |
394 | geom_flags |= WidthValue|HeightValue; |
360 | } |
395 | } |
361 | else if (CHECK_GEOM_OPS("scale")) |
396 | else if (CHECK_GEOM_OPS("scale")) |
362 | { |
397 | { |
363 | if (h == 0) |
398 | if (h == 0) |
364 | h = 100; |
399 | h = windowScale; |
365 | if (w == 0) |
400 | if (w == 0) |
366 | w = 100; |
401 | w = windowScale; |
367 | geom_flags |= WidthValue|HeightValue; |
402 | geom_flags |= WidthValue|HeightValue; |
368 | } |
403 | } |
369 | else if (CHECK_GEOM_OPS("auto")) |
404 | else if (CHECK_GEOM_OPS("auto")) |
370 | { |
405 | { |
|
|
406 | w = h = windowScale; |
|
|
407 | x = y = centerAlign; |
|
|
408 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
|
|
409 | } |
|
|
410 | else if (CHECK_GEOM_OPS("root")) |
|
|
411 | { |
371 | w = h = 100; |
412 | w = h = noScale; |
372 | x = y = 50; |
413 | x = y = rootAlign; |
373 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
414 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
374 | } |
415 | } |
375 | # undef CHECK_GEOM_OPS |
416 | # undef CHECK_GEOM_OPS |
376 | while (*ops != ':' && *ops != '\0') ++ops; |
417 | while (*ops != ':' && *ops != '\0') ++ops; |
377 | } /* done parsing ops */ |
418 | } /* done parsing ops */ |
… | |
… | |
416 | |
457 | |
417 | TIMING_TEST_START (asim); |
458 | TIMING_TEST_START (asim); |
418 | |
459 | |
419 | if (original_asim) |
460 | if (original_asim) |
420 | { |
461 | { |
|
|
462 | if (h_align == rootAlign || v_align == rootAlign) |
|
|
463 | { |
|
|
464 | target->get_window_origin(x, y); |
|
|
465 | x = -x; |
|
|
466 | y = -y; |
|
|
467 | } |
|
|
468 | if (h_align != rootAlign) |
421 | x = make_align_position (h_align, target_width, w > 0 ? w : (int)original_asim->width); |
469 | x = make_align_position (h_align, target_width, w > 0 ? w : (int)original_asim->width); |
|
|
470 | if (v_align != rootAlign) |
422 | y = make_align_position (v_align, target_height, h > 0 ? h : (int)original_asim->height); |
471 | y = make_align_position (v_align, target_height, h > 0 ? h : (int)original_asim->height); |
423 | } |
472 | } |
424 | |
473 | |
425 | if (original_asim == NULL |
474 | if (original_asim == NULL |
426 | || x >= target_width |
475 | || x >= target_width |
427 | || y >= target_height |
476 | || y >= target_height |
… | |
… | |
456 | h > 0 ? h : original_asim->height, |
505 | h > 0 ? h : original_asim->height, |
457 | background ? ASA_ASImage : ASA_XImage, |
506 | background ? ASA_ASImage : ASA_XImage, |
458 | 100, ASIMAGE_QUALITY_DEFAULT); |
507 | 100, ASIMAGE_QUALITY_DEFAULT); |
459 | } |
508 | } |
460 | if (background == NULL) |
509 | if (background == NULL) |
461 | {/* if tiling - pixmap has to be sized exactly as the image */ |
510 | {/* if tiling - pixmap has to be sized exactly as the image, |
|
|
511 | but there is no need to make it bigger then the window! */ |
462 | if (h_scale == 0) |
512 | if (h_scale == 0) |
463 | new_pmap_width = result->width; |
513 | new_pmap_width = min (result->width, target_width); |
464 | if (v_scale == 0) |
514 | if (v_scale == 0) |
465 | new_pmap_height = result->height; |
515 | new_pmap_height = min (result->height, target_height); |
466 | /* we also need to tile our image in one or both directions */ |
516 | /* we also need to tile our image in one or both directions */ |
467 | if (h_scale == 0 || v_scale == 0) |
517 | if (h_scale == 0 || v_scale == 0) |
468 | { |
518 | { |
469 | ASImage *tmp = tile_asimage (target->asv, result, |
519 | ASImage *tmp = tile_asimage (target->asv, result, |
470 | (h_scale > 0) ? 0 : (int)result->width - x, |
520 | (h_scale > 0) ? 0 : (int)result->width - x, |
471 | (v_scale > 0) ? 0 : (int)result->height - y, |
521 | (v_scale > 0) ? 0 : (int)result->height - y, |
|
|
522 | new_pmap_width, |
472 | result->width, result->height, |
523 | new_pmap_height, |
473 | TINT_LEAVE_SAME, ASA_XImage, |
524 | TINT_LEAVE_SAME, ASA_XImage, |
474 | 100, ASIMAGE_QUALITY_DEFAULT); |
525 | 100, ASIMAGE_QUALITY_DEFAULT); |
475 | if (tmp) |
526 | if (tmp) |
476 | { |
527 | { |
477 | if (result != original_asim) |
528 | if (result != original_asim) |
… | |
… | |
619 | # endif |
670 | # endif |
620 | } |
671 | } |
621 | return false; |
672 | return false; |
622 | } |
673 | } |
623 | |
674 | |
624 | # endif /* BG_IMAGE_FROM_FILE */ |
675 | # endif /* BG_IMAGE_FROM_FILE */ |
625 | |
676 | |
626 | # ifdef ENABLE_TRANSPARENCY |
677 | # ifdef ENABLE_TRANSPARENCY |
627 | bool |
678 | bool |
628 | bgPixmap_t::set_transparent () |
679 | bgPixmap_t::set_transparent () |
629 | { |
680 | { |
… | |
… | |
1244 | target->want_refresh = 1; |
1295 | target->want_refresh = 1; |
1245 | flags |= hasChanged; |
1296 | flags |= hasChanged; |
1246 | } |
1297 | } |
1247 | } |
1298 | } |
1248 | |
1299 | |
1249 | #endif /* HAVE_BG_PIXMAP */ |
1300 | #endif /* HAVE_BG_PIXMAP */ |
1250 | |
1301 | |
1251 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) && !XFT |
1302 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) && !XFT |
1252 | /* taken from aterm-0.4.2 */ |
1303 | /* taken from aterm-0.4.2 */ |
1253 | |
1304 | |
1254 | typedef uint32_t RUINT32T; |
1305 | typedef uint32_t RUINT32T; |