… | |
… | |
4 | |
4 | |
5 | #ifndef BACKGROUND_H_ |
5 | #ifndef BACKGROUND_H_ |
6 | #define BACKGROUND_H_ |
6 | #define BACKGROUND_H_ |
7 | |
7 | |
8 | #ifdef HAVE_AFTERIMAGE |
8 | #ifdef HAVE_AFTERIMAGE |
9 | # include <afterimage.h> |
9 | # include <afterimage.h> |
|
|
10 | # undef min |
|
|
11 | # undef max |
10 | #endif |
12 | #endif |
11 | |
13 | |
12 | #if defined(XPM_BACKGROUND) || defined(ENABLE_TRANSPARENCY) |
14 | #if defined(BG_IMAGE_FROM_FILE) || defined(ENABLE_TRANSPARENCY) |
13 | # define HAVE_BG_PIXMAP 1/* to simplify further usage */ |
15 | # define HAVE_BG_PIXMAP 1/* to simplify further usage */ |
14 | struct bgPixmap_t { |
16 | struct bgPixmap_t |
|
|
17 | { |
|
|
18 | bgPixmap_t (); |
|
|
19 | void destroy (); |
15 | |
20 | |
16 | enum { |
21 | enum { |
17 | geometrySet = (1UL<<0), |
22 | geometrySet = (1UL<<0), |
18 | propScale = (1UL<<1), |
23 | propScale = (1UL<<1), |
19 | geometryFlags = (geometrySet|propScale), |
24 | geometryFlags = (geometrySet|propScale), |
… | |
… | |
26 | blurNeeded = (1UL<<12), |
31 | blurNeeded = (1UL<<12), |
27 | blurServerSide = (1UL<<13), /* this don't work yet */ |
32 | blurServerSide = (1UL<<13), /* this don't work yet */ |
28 | |
33 | |
29 | isTransparent = (1UL<<16), |
34 | isTransparent = (1UL<<16), |
30 | isInvalid = (1UL<<17), |
35 | isInvalid = (1UL<<17), |
31 | isVtOrigin = (1UL<<18) /* if set pixmap has origin at corner of |
36 | isVtOrigin = (1UL<<18), /* if set pixmap has origin at corner of |
32 | vt window instead of parent[0]! */ |
37 | vt window instead of parent[0]! */ |
|
|
38 | hasChanged = (1UL<<19) |
33 | }; |
39 | }; |
34 | |
40 | |
35 | unsigned long flags; |
41 | unsigned long flags; |
36 | |
42 | |
37 | enum { |
43 | enum { |
… | |
… | |
39 | transpPmapTinted = tintNeeded, |
45 | transpPmapTinted = tintNeeded, |
40 | transpPmapBlured = blurNeeded, |
46 | transpPmapBlured = blurNeeded, |
41 | transpTransformations = (tintNeeded|blurNeeded) |
47 | transpTransformations = (tintNeeded|blurNeeded) |
42 | }; /* this flags are returned by make_transparency_pixmap if called */ |
48 | }; /* this flags are returned by make_transparency_pixmap if called */ |
43 | |
49 | |
44 | # ifdef XPM_BACKGROUND |
50 | bool check_clearChanged () { bool r = flags & hasChanged; flags &= ~hasChanged; return r; }; |
|
|
51 | |
|
|
52 | # ifdef BG_IMAGE_FROM_FILE |
45 | # ifdef HAVE_AFTERIMAGE |
53 | # ifdef HAVE_AFTERIMAGE |
46 | ASImage *original_asim; |
54 | ASImage *original_asim; |
47 | bool render_asim (ASImage *background, ARGB32 background_tint); |
55 | bool render_asim (ASImage *background, ARGB32 background_tint); |
48 | # endif |
56 | # endif |
49 | |
57 | |
50 | enum { defaultScale = 100, defaultAlign = 50 }; |
58 | enum { |
|
|
59 | noScale = 0, |
|
|
60 | windowScale = 100, |
|
|
61 | defaultScale = windowScale, |
|
|
62 | centerAlign = 50, |
|
|
63 | defaultAlign = centerAlign, |
|
|
64 | rootAlign = -10000 |
|
|
65 | }; |
51 | |
66 | |
52 | unsigned int h_scale, v_scale;/* percents of the window size */ |
67 | unsigned int h_scale, v_scale;/* percents of the window size */ |
53 | int h_align, v_align; /* percents of the window size: |
68 | int h_align, v_align; /* percents of the window size: |
54 | 0 - left align, 50 - center, 100 - right */ |
69 | 0 - left align, 50 - center, 100 - right */ |
55 | void unset_geometry () { flags = flags & ~geometryFlags; }; |
70 | void unset_geometry () { flags = flags & ~geometryFlags; }; |
… | |
… | |
60 | h_align = v_align = defaultAlign; |
75 | h_align = v_align = defaultAlign; |
61 | flags |= geometrySet; |
76 | flags |= geometrySet; |
62 | }; |
77 | }; |
63 | |
78 | |
64 | bool set_file (const char *file); |
79 | bool set_file (const char *file); |
65 | # endif /* XPM_BACKGROUND */ |
80 | # endif /* BG_IMAGE_FROM_FILE */ |
66 | |
81 | |
67 | rxvt_term *target; |
82 | rxvt_term *target; |
68 | bool set_target (rxvt_term *new_target); |
83 | bool set_target (rxvt_term *new_target); |
69 | |
84 | |
70 | # ifdef ENABLE_TRANSPARENCY |
85 | # ifdef ENABLE_TRANSPARENCY |
… | |
… | |
81 | bool set_shade (const char *shade_str); |
96 | bool set_shade (const char *shade_str); |
82 | bool set_root_pixmap (); |
97 | bool set_root_pixmap (); |
83 | |
98 | |
84 | unsigned long make_transparency_pixmap ();/* returns combination of the transpTransformations flags */ |
99 | unsigned long make_transparency_pixmap ();/* returns combination of the transpTransformations flags */ |
85 | # endif |
100 | # endif |
86 | double invalid_since; |
101 | double invalid_since, valid_since; |
87 | |
102 | |
88 | Pixmap pixmap; |
103 | Pixmap pixmap; |
89 | unsigned int pmap_width, pmap_height; |
104 | unsigned int pmap_width, pmap_height; |
90 | unsigned int pmap_depth; |
105 | unsigned int pmap_depth; |
91 | |
106 | |
92 | bool window_size_sensitive (); |
107 | bool window_size_sensitive (); |
93 | bool window_position_sensitive () { |
108 | bool window_position_sensitive (); |
94 | return (flags & isTransparent); |
|
|
95 | }; |
|
|
96 | |
109 | |
97 | bool is_parentOrigin () { |
110 | bool is_parentOrigin () |
|
|
111 | { |
98 | return !(flags & isVtOrigin); |
112 | return !(flags & isVtOrigin); |
99 | }; |
113 | }; |
100 | |
114 | |
101 | bool need_client_side_rendering (); |
115 | bool need_client_side_rendering (); |
102 | void apply (); |
116 | void apply (); |
103 | bool render (); |
117 | bool render (); |
104 | void invalidate () { |
118 | void invalidate () |
|
|
119 | { |
105 | if (!(flags & isInvalid)) |
120 | if (!(flags & isInvalid)) |
106 | { |
121 | { |
107 | flags |= isInvalid; |
122 | flags |= isInvalid; |
108 | invalid_since = NOW; |
123 | invalid_since = ev::now (); |
109 | } |
124 | } |
110 | }; |
125 | }; |
111 | }; |
126 | }; |
112 | #else |
127 | #else |
113 | # undef HAVE_BG_PIXMAP |
128 | # undef HAVE_BG_PIXMAP |
114 | #endif |
129 | #endif |
115 | |
130 | |
116 | |
131 | |
117 | |
132 | |
118 | #endif /* _BACKGROUND_H_ */ |
133 | #endif /* _BACKGROUND_H_ */ |