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.254 by sf-exg, Sun Dec 30 20:28:31 2012 UTC vs.
Revision 1.255 by sf-exg, Mon Dec 31 12:05:34 2012 UTC

251 flags &= ~IM_IS_SIZE_SENSITIVE; 251 flags &= ~IM_IS_SIZE_SENSITIVE;
252 252
253 return changed; 253 return changed;
254} 254}
255 255
256void 256bool
257rxvt_term::get_image_geometry (rxvt_image &image, int &w, int &h, int &x, int &y) 257rxvt_term::render_image (rxvt_image &image)
258{ 258{
259 int image_width = image.img->w; 259 int image_width = image.img->w;
260 int image_height = image.img->h; 260 int image_height = image.img->h;
261 int parent_width = szHint.width; 261 int parent_width = szHint.width;
262 int parent_height = szHint.height; 262 int parent_height = szHint.height;
263 int h_scale = min (image.h_scale, 32767 * 100 / parent_width); 263 int h_scale = min (image.h_scale, 32767 * 100 / parent_width);
264 int v_scale = min (image.v_scale, 32767 * 100 / parent_height); 264 int v_scale = min (image.v_scale, 32767 * 100 / parent_height);
265 265
266 int w;
267 int h;
268 int x;
269 int y;
270
266 w = h_scale * parent_width / 100; 271 w = h_scale * parent_width / 100;
267 h = v_scale * parent_height / 100; 272 h = v_scale * parent_height / 100;
268 273
269 if (image.flags & IM_KEEP_ASPECT) 274 if (image.flags & IM_KEEP_ASPECT)
270 { 275 {
285 else 290 else
286 { 291 {
287 x = make_align_position (image.h_align, parent_width, w); 292 x = make_align_position (image.h_align, parent_width, w);
288 y = make_align_position (image.v_align, parent_height, h); 293 y = make_align_position (image.v_align, parent_height, h);
289 } 294 }
290}
291
292bool
293rxvt_term::render_image (rxvt_image &image)
294{
295 int parent_width = szHint.width;
296 int parent_height = szHint.height;
297
298 int x = 0;
299 int y = 0;
300 int w = 0;
301 int h = 0;
302
303 get_image_geometry (image, w, h, x, y);
304 295
305 if (!(image.flags & IM_ROOT_ALIGN) 296 if (!(image.flags & IM_ROOT_ALIGN)
306 && (x >= parent_width 297 && (x >= parent_width
307 || y >= parent_height 298 || y >= parent_height
308 || x + w <= 0 299 || x + w <= 0
480 delete bg_img; 471 delete bg_img;
481 bg_img = img; 472 bg_img = img;
482 473
483 return true; 474 return true;
484} 475}
485
486void
487rxvt_term::bg_set_root_pixmap ()
488{
489 delete root_img;
490 root_img = rxvt_img::new_from_root (this);
491}
492# endif /* BG_IMAGE_FROM_ROOT */ 476# endif /* BG_IMAGE_FROM_ROOT */
493 477
494void 478void
495rxvt_term::bg_render () 479rxvt_term::bg_render ()
496{ 480{
534 root_effects.set_tint (pix_colors_focused [Color_tint]); 518 root_effects.set_tint (pix_colors_focused [Color_tint]);
535 519
536 if (rs [Rs_shade]) 520 if (rs [Rs_shade])
537 root_effects.set_shade (rs [Rs_shade]); 521 root_effects.set_shade (rs [Rs_shade]);
538 522
539 bg_set_root_pixmap (); 523 rxvt_img::new_from_root (this)->replace (root_img);
540 XSelectInput (dpy, display->root, PropertyChangeMask); 524 XSelectInput (dpy, display->root, PropertyChangeMask);
541 rootwin_ev.start (display, display->root); 525 rootwin_ev.start (display, display->root);
542 } 526 }
543#endif 527#endif
544 528

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines