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.25 by sf-exg, Tue Oct 5 20:22:25 2010 UTC vs.
Revision 1.42 by sf-exg, Sat Jan 15 17:41:43 2011 UTC

10# undef min 10# undef min
11# undef max 11# undef max
12#endif 12#endif
13 13
14#ifdef HAVE_PIXBUF 14#ifdef HAVE_PIXBUF
15#include <gdk-pixbuf-xlib/gdk-pixbuf-xlib.h> 15#include <gdk-pixbuf/gdk-pixbuf.h>
16#endif 16#endif
17 17
18#if defined(BG_IMAGE_FROM_FILE) || defined(ENABLE_TRANSPARENCY) 18#if defined(BG_IMAGE_FROM_FILE) || defined(ENABLE_TRANSPARENCY)
19# define HAVE_BG_PIXMAP 1 /* to simplify further usage */ 19# define HAVE_BG_PIXMAP 1 /* to simplify further usage */
20struct bgPixmap_t 20struct bgPixmap_t
21{ 21{
22 bgPixmap_t (); 22 bgPixmap_t ();
23 void destroy (); 23 void destroy ();
24 24
25 enum { 25 enum {
26 geometrySet = 1 << 0,
27 propScale = 1 << 1, 26 propScale = 1 << 1,
28 rootAlign = 1 << 2, 27 rootAlign = 1 << 2,
29 geometryFlags = geometrySet | propScale | rootAlign, 28 geometryFlags = propScale | rootAlign,
30 29
31 tintSet = 1 << 8, 30 tintSet = 1 << 8,
32 tintNeeded = 1 << 9, 31 tintNeeded = 1 << 9,
33 tintWholesome = 1 << 10, 32 tintWholesome = 1 << 10,
34 tintServerSide = 1 << 11,
35 tintFlags = tintSet | tintServerSide | tintNeeded | tintWholesome, 33 tintFlags = tintSet | tintNeeded | tintWholesome,
36 34
37 blurNeeded = 1 << 12, 35 blurNeeded = 1 << 11,
38 blurServerSide = 1 << 13, /* this doesn't work yet */ 36
37 HAS_RENDER = 1 << 12,
38 HAS_RENDER_CONV = 1 << 13,
39 CLIENT_RENDER = 1 << 14,
39 40
40 isTransparent = 1 << 16, 41 isTransparent = 1 << 16,
41 isInvalid = 1 << 17, 42 isInvalid = 1 << 17,
42 isVtOrigin = 1 << 18, /* if set pixmap has origin at corner of
43 vt window instead of parent[0]! */
44 hasChanged = 1 << 19, 43 hasChanged = 1 << 19,
45 sizeSensitive = 1 << 20, 44 sizeSensitive = 1 << 20,
46 }; 45 };
47 46
48 unsigned int flags; 47 unsigned int flags;
49 48
50 enum { 49 enum {
51 transpPmapTiled = 1 << 0, 50 transpPmapTiled = 1 << 0,
52 transpPmapTinted = tintNeeded, 51 transpPmapTinted = tintNeeded,
53 transpPmapBlured = blurNeeded, 52 transpPmapBlurred = blurNeeded,
54 transpTransformations = tintNeeded | blurNeeded, 53 transpTransformations = tintNeeded | blurNeeded,
55 }; /* these flags are returned by make_transparency_pixmap if called */ 54 }; /* these flags are returned by make_transparency_pixmap if called */
56
57 bool check_clearChanged ()
58 {
59 bool r = flags & hasChanged;
60 flags &= ~hasChanged;
61 return r;
62 };
63 55
64# ifdef BG_IMAGE_FROM_FILE 56# ifdef BG_IMAGE_FROM_FILE
65# ifdef HAVE_AFTERIMAGE 57# ifdef HAVE_AFTERIMAGE
66 ASImage *original_asim; 58 ASImage *original_asim;
67# endif 59# endif
68 60
69# ifdef HAVE_PIXBUF 61# ifdef HAVE_PIXBUF
70 GdkPixbuf *pixbuf; 62 GdkPixbuf *pixbuf;
63 bool pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc,
64 int src_x, int src_y, int dst_x, int dst_y,
65 unsigned int width, unsigned int height);
71# endif 66# endif
72 67
73 void get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y); 68 void get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y);
74 bool render_image (unsigned long background_flags); 69 bool render_image (unsigned long background_flags);
75 bool have_image; 70 bool have_image;
83 }; 78 };
84 79
85 unsigned int h_scale, v_scale;/* percents of the window size */ 80 unsigned int h_scale, v_scale;/* percents of the window size */
86 int h_align, v_align; /* percents of the window size: 81 int h_align, v_align; /* percents of the window size:
87 0 - left align, 50 - center, 100 - right */ 82 0 - left align, 50 - center, 100 - right */
88 void unset_geometry ()
89 {
90 flags = flags & ~geometryFlags;
91 };
92 bool set_geometry (const char *geom); 83 bool set_geometry (const char *geom, bool update = false);
93 void set_defaultGeometry () 84 void set_defaultGeometry ()
94 { 85 {
95 h_scale = v_scale = defaultScale; 86 h_scale = v_scale = defaultScale;
96 h_align = v_align = defaultAlign; 87 h_align = v_align = defaultAlign;
97 flags |= geometrySet;
98 }; 88 }
99 89
100 bool set_file (const char *file); 90 bool set_file (const char *file);
101# endif /* BG_IMAGE_FROM_FILE */ 91# endif /* BG_IMAGE_FROM_FILE */
102 92
103 rxvt_term *target; 93 rxvt_term *target;
104 bool set_target (rxvt_term *new_target); 94 void set_target (rxvt_term *new_target);
105 95
106# ifdef ENABLE_TRANSPARENCY 96# ifdef ENABLE_TRANSPARENCY
107 int root_depth; /* obtained when target is set */
108 Pixmap root_pixmap; /* current root pixmap set */ 97 Pixmap root_pixmap; /* current root pixmap set */
109 rxvt_color tint; 98 rxvt_color tint;
110 int shade; 99 int shade;
111 int h_blurRadius, v_blurRadius; 100 int h_blurRadius, v_blurRadius;
112 101
113 bool set_transparent (); 102 bool set_transparent ();
114 bool set_blur_radius (const char *geom); 103 bool set_blur_radius (const char *geom);
115 bool set_tint (rxvt_color &new_tint); 104 bool set_tint (rxvt_color &new_tint);
116 bool unset_tint ();
117 bool set_shade (const char *shade_str); 105 bool set_shade (const char *shade_str);
106 bool blur_pixmap (Pixmap pixmap, Visual *visual, int width, int height);
118 bool tint_pixmap (Pixmap pixmap, Window root, int width, int height); 107 bool tint_pixmap (Pixmap pixmap, Visual *visual, int width, int height);
119 bool set_root_pixmap (); 108 void set_root_pixmap ();
120 109
121 unsigned long make_transparency_pixmap ();/* returns combination of the transpTransformations flags */ 110 unsigned long make_transparency_pixmap ();/* returns combination of the transpTransformations flags */
122# endif 111# endif
123 double invalid_since, valid_since; 112 double valid_since;
124 113
125 Pixmap pixmap; 114 Pixmap pixmap;
126 unsigned int pmap_width, pmap_height; 115 unsigned int pmap_width, pmap_height;
127 unsigned int pmap_depth;
128 116
117 int target_x;
118 int target_y;
119 bool set_position (int x, int y);
129 bool window_size_sensitive (); 120 bool window_size_sensitive ();
130 bool window_position_sensitive (); 121 bool window_position_sensitive ();
131 122
132 bool is_parentOrigin ()
133 {
134 return !(flags & isVtOrigin);
135 };
136
137 bool need_client_side_rendering ();
138 void apply (); 123 void apply ();
139 bool render (); 124 bool render ();
140 void invalidate () 125 void invalidate ()
141 { 126 {
142 if (!(flags & isInvalid))
143 {
144 flags |= isInvalid; 127 flags |= isInvalid;
145 invalid_since = ev::now ();
146 }
147 }; 128 }
148}; 129};
149#else 130#else
150# undef HAVE_BG_PIXMAP 131# undef HAVE_BG_PIXMAP
151#endif 132#endif
152 133

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines