… | |
… | |
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 | ~bgPixmap_t(); |
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, windowScale = 100, defaultScale = windowScale, |
|
|
60 | centerAlign = 50, defaultAlign = centerAlign, |
|
|
61 | rootAlign = -10000 }; |
51 | |
62 | |
52 | unsigned int h_scale, v_scale;/* percents of the window size */ |
63 | unsigned int h_scale, v_scale;/* percents of the window size */ |
53 | int h_align, v_align; /* percents of the window size: |
64 | int h_align, v_align; /* percents of the window size: |
54 | 0 - left align, 50 - center, 100 - right */ |
65 | 0 - left align, 50 - center, 100 - right */ |
55 | void unset_geometry () { flags = flags & ~geometryFlags; }; |
66 | void unset_geometry () { flags = flags & ~geometryFlags; }; |
… | |
… | |
60 | h_align = v_align = defaultAlign; |
71 | h_align = v_align = defaultAlign; |
61 | flags |= geometrySet; |
72 | flags |= geometrySet; |
62 | }; |
73 | }; |
63 | |
74 | |
64 | bool set_file (const char *file); |
75 | bool set_file (const char *file); |
65 | # endif /* XPM_BACKGROUND */ |
76 | # endif /* BG_IMAGE_FROM_FILE */ |
66 | |
77 | |
67 | rxvt_term *target; |
78 | rxvt_term *target; |
68 | bool set_target (rxvt_term *new_target); |
79 | bool set_target (rxvt_term *new_target); |
69 | |
80 | |
70 | # ifdef ENABLE_TRANSPARENCY |
81 | # ifdef ENABLE_TRANSPARENCY |
… | |
… | |
88 | Pixmap pixmap; |
99 | Pixmap pixmap; |
89 | unsigned int pmap_width, pmap_height; |
100 | unsigned int pmap_width, pmap_height; |
90 | unsigned int pmap_depth; |
101 | unsigned int pmap_depth; |
91 | |
102 | |
92 | bool window_size_sensitive (); |
103 | bool window_size_sensitive (); |
93 | bool window_position_sensitive () { |
104 | bool window_position_sensitive (); |
94 | return (flags & isTransparent); |
|
|
95 | }; |
|
|
96 | |
105 | |
97 | bool is_parentOrigin () { |
106 | bool is_parentOrigin () { |
98 | return !(flags & isVtOrigin); |
107 | return !(flags & isVtOrigin); |
99 | }; |
108 | }; |
100 | |
109 | |
101 | bool need_client_side_rendering (); |
110 | bool need_client_side_rendering (); |
102 | void apply (); |
111 | void apply (); |
103 | bool render (); |
112 | bool render (); |
104 | void invalidate () { |
113 | void invalidate () { |
105 | if (!(flags & isInvalid)) |
114 | if (!(flags & isInvalid)) |
106 | { |
115 | { |
107 | flags |= isInvalid; |
116 | flags |= isInvalid; |
108 | invalid_since = NOW; |
117 | invalid_since = ev::now (); |
109 | } |
118 | } |
110 | }; |
119 | }; |
111 | }; |
120 | }; |
112 | #else |
121 | #else |
113 | # undef HAVE_BG_PIXMAP |
122 | # undef HAVE_BG_PIXMAP |
114 | #endif |
123 | #endif |
115 | |
124 | |
116 | |
125 | |
117 | |
126 | |
118 | #endif /* _BACKGROUND_H_ */ |
127 | #endif /* _BACKGROUND_H_ */ |