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

Comparing rxvt-unicode/src/background.C (file contents):
Revision 1.218 by sf-exg, Mon May 21 12:29:22 2012 UTC vs.
Revision 1.219 by sf-exg, Thu May 24 16:17:33 2012 UTC

145 145
146 min_it (dst_size, target_size - dst_pos); 146 min_it (dst_size, target_size - dst_pos);
147 return src_pos; 147 return src_pos;
148} 148}
149 149
150static void
151parse_style (const char *style, int &x, int &y, unsigned int &w, unsigned int &h, uint8_t &flags)
152{
153 if (!strcasecmp (style, "tiled"))
154 {
155 flags = IM_TILE;
156 w = h = noScale;
157 x = y = 0;
158 }
159 else if (!strcasecmp (style, "aspect-stretched"))
160 {
161 flags = IM_KEEP_ASPECT;
162 w = h = windowScale;
163 x = y = centerAlign;
164 }
165 else if (!strcasecmp (style, "stretched"))
166 {
167 flags = 0;
168 w = h = windowScale;
169 x = y = centerAlign;
170 }
171 else if (!strcasecmp (style, "centered"))
172 {
173 flags = 0;
174 w = h = noScale;
175 x = y = centerAlign;
176 }
177 else if (!strcasecmp (style, "root-tiled"))
178 {
179 flags = IM_TILE|IM_ROOT_ALIGN;
180 w = h = noScale;
181 x = y = 0;
182 }
183}
184
150bool 185bool
151rxvt_image::set_geometry (const char *geom, bool update) 186rxvt_image::set_geometry (const char *geom, bool update)
152{ 187{
153 bool changed = false; 188 bool changed = false;
154 int geom_flags = 0; 189 int geom_flags = 0;
155 int x = h_align; 190 int x = h_align;
156 int y = v_align; 191 int y = v_align;
157 unsigned int w = h_scale; 192 unsigned int w = h_scale;
158 unsigned int h = v_scale; 193 unsigned int h = v_scale;
159 unsigned long new_flags = 0; 194 uint8_t new_flags = 0;
160 195
161 if (geom == NULL) 196 if (geom == NULL)
162 return false; 197 return false;
163 198
164 if (geom[0]) 199 if (geom[0])
165 { 200 {
166 char **arr = rxvt_strsplit (':', geom); 201 char **arr = rxvt_strsplit (':', geom);
167 202
168 for (int i = 0; arr[i]; i++) 203 for (int i = 0; arr[i]; i++)
169 { 204 {
170 if (!strcasecmp (arr[i], "style=tiled")) 205 if (!strncasecmp (arr[i], "style=", 6))
171 { 206 {
172 new_flags = IM_TILE; 207 parse_style (arr[i] + 6, x, y, w, h, new_flags);
173 w = h = noScale;
174 x = y = 0;
175 geom_flags = WidthValue|HeightValue|XValue|YValue; 208 geom_flags = WidthValue|HeightValue|XValue|YValue;
176 }
177 else if (!strcasecmp (arr[i], "style=aspect-stretched"))
178 {
179 new_flags = IM_KEEP_ASPECT;
180 w = h = windowScale;
181 x = y = centerAlign;
182 geom_flags = WidthValue|HeightValue|XValue|YValue;
183 }
184 else if (!strcasecmp (arr[i], "style=stretched"))
185 {
186 new_flags = 0;
187 w = h = windowScale;
188 geom_flags = WidthValue|HeightValue;
189 }
190 else if (!strcasecmp (arr[i], "style=centered"))
191 {
192 new_flags = 0;
193 w = h = noScale;
194 x = y = centerAlign;
195 geom_flags = WidthValue|HeightValue|XValue|YValue;
196 }
197 else if (!strcasecmp (arr[i], "style=root-tiled"))
198 {
199 new_flags = IM_TILE|IM_ROOT_ALIGN;
200 w = h = noScale;
201 geom_flags = WidthValue|HeightValue;
202 } 209 }
203 else if (!strcasecmp (arr[i], "op=tile")) 210 else if (!strcasecmp (arr[i], "op=tile"))
204 new_flags |= IM_TILE; 211 new_flags |= IM_TILE;
205 else if (!strcasecmp (arr[i], "op=keep-aspect")) 212 else if (!strcasecmp (arr[i], "op=keep-aspect"))
206 new_flags |= IM_KEEP_ASPECT; 213 new_flags |= IM_KEEP_ASPECT;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines