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