ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/background.h
(Generate patch)

Comparing rxvt-unicode/src/background.h (file contents):
Revision 1.1 by sasha, Wed Sep 12 20:29:24 2007 UTC vs.
Revision 1.16 by root, Tue Nov 4 13:20:40 2008 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines