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