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.241 by sf-exg, Mon Jun 11 14:45:53 2012 UTC vs.
Revision 1.249 by sf-exg, Sun Dec 30 11:52:15 2012 UTC

1/*----------------------------------------------------------------------* 1/*----------------------------------------------------------------------*
2 * File: background.C - former xpm.C 2 * File: background.C
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * 4 *
5 * All portions of code are copyright by their respective author/s. 5 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 2005-2008 Marc Lehmann <schmorp@schmorp.de> 6 * Copyright (c) 2005-2008 Marc Lehmann <schmorp@schmorp.de>
7 * Copyright (c) 2007 Sasha Vasko <sasha@aftercode.net> 7 * Copyright (c) 2007 Sasha Vasko <sasha@aftercode.net>
28#ifdef HAVE_BG_PIXMAP 28#ifdef HAVE_BG_PIXMAP
29 29
30void 30void
31rxvt_term::bg_destroy () 31rxvt_term::bg_destroy ()
32{ 32{
33# if ENABLE_TRANSPARENCY 33# if BG_IMAGE_FROM_ROOT
34 delete root_img; 34 delete root_img;
35 root_img = 0; 35 root_img = 0;
36# endif 36# endif
37 37
38# if BG_IMAGE_FROM_FILE 38# if BG_IMAGE_FROM_FILE
39 fimage.destroy (); 39 fimage.destroy ();
40# endif 40# endif
41
42 delete bg_img;
43 bg_img = 0;
44} 41}
45 42
46bool 43bool
47rxvt_term::bg_window_size_sensitive () 44rxvt_term::bg_window_size_sensitive ()
48{ 45{
49# if ENABLE_TRANSPARENCY 46# if BG_IMAGE_FROM_ROOT
50 if (bg_flags & BG_IS_TRANSPARENT) 47 if (option (Opt_transparent))
51 return true; 48 return true;
52# endif 49# endif
53 50
54# if BG_IMAGE_FROM_FILE 51# if BG_IMAGE_FROM_FILE
55 if (fimage.img) 52 if (fimage.img)
65} 62}
66 63
67bool 64bool
68rxvt_term::bg_window_position_sensitive () 65rxvt_term::bg_window_position_sensitive ()
69{ 66{
70# if ENABLE_TRANSPARENCY 67# if BG_IMAGE_FROM_ROOT
71 if (bg_flags & BG_IS_TRANSPARENT) 68 if (option (Opt_transparent))
72 return true; 69 return true;
73# endif 70# endif
74 71
75# if BG_IMAGE_FROM_FILE 72# if BG_IMAGE_FROM_FILE
76 if (fimage.img) 73 if (fimage.img)
319 else 316 else
320 img->repeat_mode (RepeatNone); 317 img->repeat_mode (RepeatNone);
321 img->sub_rect (-x, -y, parent_width, parent_height)->replace (img); 318 img->sub_rect (-x, -y, parent_width, parent_height)->replace (img);
322 319
323 if (bg_flags & BG_IS_VALID) 320 if (bg_flags & BG_IS_VALID)
324 { 321 img->draw (bg_img, PictOpOver, image.alpha * 1. / 0xffff);
325 double factor = image.alpha * 1. / 0xffff;
326 bg_img->blend (img, factor)->replace (img);
327 }
328 322
329 XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual); 323 XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual);
330 img->convert_format (format, pix_colors [Color_bg])->replace (img); 324 img->convert_format (format, pix_colors [Color_bg])->replace (img);
331 325
332 delete bg_img; 326 delete bg_img;
440 } 434 }
441 435
442 return false; 436 return false;
443} 437}
444 438
445# if ENABLE_TRANSPARENCY 439# if BG_IMAGE_FROM_ROOT
446/* 440/*
447 * Builds a pixmap of the same size as the terminal window that contains 441 * Builds a pixmap of the same size as the terminal window that contains
448 * the tiled portion of the root pixmap that is supposed to be covered by 442 * the tiled portion of the root pixmap that is supposed to be covered by
449 * our window. 443 * our window.
450 */ 444 */
496rxvt_term::bg_set_root_pixmap () 490rxvt_term::bg_set_root_pixmap ()
497{ 491{
498 delete root_img; 492 delete root_img;
499 root_img = rxvt_img::new_from_root (this); 493 root_img = rxvt_img::new_from_root (this);
500} 494}
501# endif /* ENABLE_TRANSPARENCY */ 495# endif /* BG_IMAGE_FROM_ROOT */
502 496
503void 497void
504rxvt_term::bg_render () 498rxvt_term::bg_render ()
505{ 499{
506 if (bg_flags & BG_INHIBIT_RENDER) 500 if (bg_flags & BG_INHIBIT_RENDER)
507 return; 501 return;
508 502
509 bg_invalidate (); 503 bg_flags &= BG_INHIBIT_RENDER;
510# if ENABLE_TRANSPARENCY 504
511 if (bg_flags & BG_IS_TRANSPARENT) 505# if BG_IMAGE_FROM_ROOT
506 if (option (Opt_transparent))
512 { 507 {
513 /* we need to re-generate transparency pixmap in that case ! */ 508 /* we need to re-generate transparency pixmap in that case ! */
514 if (render_root_image ()) 509 if (render_root_image ())
515 bg_flags |= BG_IS_VALID; 510 bg_flags |= BG_IS_VALID | BG_IS_TRANSPARENT;
516 } 511 }
517# endif 512# endif
518 513
519# if BG_IMAGE_FROM_FILE 514# if BG_IMAGE_FROM_FILE
520 if (fimage.img) 515 if (fimage.img)
537} 532}
538 533
539void 534void
540rxvt_term::bg_init () 535rxvt_term::bg_init ()
541{ 536{
537#if BG_IMAGE_FROM_ROOT
538 if (option (Opt_transparent))
539 {
540 if (rs [Rs_blurradius])
541 root_effects.set_blur (rs [Rs_blurradius]);
542
543 if (ISSET_PIXCOLOR (Color_tint))
544 root_effects.set_tint (pix_colors_focused [Color_tint]);
545
546 if (rs [Rs_shade])
547 root_effects.set_shade (rs [Rs_shade]);
548
549 bg_set_root_pixmap ();
550 XSelectInput (dpy, display->root, PropertyChangeMask);
551 rootwin_ev.start (display, display->root);
552 }
553#endif
554
542#if BG_IMAGE_FROM_FILE 555#if BG_IMAGE_FROM_FILE
543 if (rs[Rs_backgroundPixmap]) 556 if (rs[Rs_backgroundPixmap])
544 { 557 {
545 fimage.set_file_geometry (this, rs[Rs_backgroundPixmap]); 558 fimage.set_file_geometry (this, rs[Rs_backgroundPixmap]);
546 if (!bg_window_position_sensitive ()) 559 if (!bg_window_position_sensitive ())

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines