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.104 by sf-exg, Sun Oct 31 17:44:39 2010 UTC vs.
Revision 1.107 by sf-exg, Mon Nov 1 14:29:33 2010 UTC

909# endif /* HAVE_PIXBUF */ 909# endif /* HAVE_PIXBUF */
910 910
911bool 911bool
912bgPixmap_t::set_file (const char *file) 912bgPixmap_t::set_file (const char *file)
913{ 913{
914 assert (file); 914 if (!file || !*file)
915 return false;
915 916
916 if (*file)
917 {
918 if (const char *p = strchr (file, ';')) 917 if (const char *p = strchr (file, ';'))
919 { 918 {
920 size_t len = p - file; 919 size_t len = p - file;
921 char *f = rxvt_temp_buf<char> (len + 1); 920 char *f = rxvt_temp_buf<char> (len + 1);
922 memcpy (f, file, len); 921 memcpy (f, file, len);
923 f[len] = '\0'; 922 f[len] = '\0';
924 file = f; 923 file = f;
925 } 924 }
926 925
927# ifdef HAVE_AFTERIMAGE 926# ifdef HAVE_AFTERIMAGE
928 if (!target->asimman) 927 if (!target->asimman)
929 target->asimman = create_generic_imageman (target->rs[Rs_path]); 928 target->asimman = create_generic_imageman (target->rs[Rs_path]);
930 ASImage *image = get_asimage (target->asimman, file, 0xFFFFFFFF, 100); 929 ASImage *image = get_asimage (target->asimman, file, 0xFFFFFFFF, 100);
931 if (image) 930 if (image)
932 { 931 {
933 if (original_asim) 932 if (original_asim)
934 safe_asimage_destroy (original_asim); 933 safe_asimage_destroy (original_asim);
935 original_asim = image; 934 original_asim = image;
936 have_image = true; 935 have_image = true;
937 return true; 936 return true;
938 } 937 }
939# endif 938# endif
940 939
941# ifdef HAVE_PIXBUF 940# ifdef HAVE_PIXBUF
942 GdkPixbuf *image = gdk_pixbuf_new_from_file (file, NULL); 941 GdkPixbuf *image = gdk_pixbuf_new_from_file (file, NULL);
943 if (image) 942 if (image)
944 { 943 {
945 if (pixbuf) 944 if (pixbuf)
946 g_object_unref (pixbuf); 945 g_object_unref (pixbuf);
947 pixbuf = image; 946 pixbuf = image;
948 have_image = true; 947 have_image = true;
949 return true; 948 return true;
950 } 949 }
951# endif 950# endif
952 }
953 951
954 return false; 952 return false;
955} 953}
956 954
957# endif /* BG_IMAGE_FROM_FILE */ 955# endif /* BG_IMAGE_FROM_FILE */
1392 1390
1393 if (tiled_root_pmap != None) 1391 if (tiled_root_pmap != None)
1394 { 1392 {
1395 if (!need_client_side_rendering ()) 1393 if (!need_client_side_rendering ())
1396 { 1394 {
1397 if (flags & (blurNeeded | blurServerSide)) 1395 if ((flags & blurNeeded)
1396 && (flags & blurServerSide))
1398 { 1397 {
1399 if (blur_pixmap (tiled_root_pmap, target->visual, window_width, window_height)) 1398 if (blur_pixmap (tiled_root_pmap, target->visual, window_width, window_height))
1400 result |= transpPmapBlurred; 1399 result |= transpPmapBlurred;
1401 } 1400 }
1402 if (flags & (tintNeeded | tintServerSide)) 1401 if ((flags & tintNeeded)
1402 && (flags & tintServerSide))
1403 { 1403 {
1404 if (tint_pixmap (tiled_root_pmap, target->visual, window_width, window_height)) 1404 if (tint_pixmap (tiled_root_pmap, target->visual, window_width, window_height))
1405 result |= transpPmapTinted; 1405 result |= transpPmapTinted;
1406 } 1406 }
1407 } /* server side rendering completed */ 1407 } /* server side rendering completed */
1513 valid_since = ev::now (); 1513 valid_since = ev::now ();
1514 1514
1515 return true; 1515 return true;
1516} 1516}
1517 1517
1518bool 1518void
1519bgPixmap_t::set_target (rxvt_term *new_target) 1519bgPixmap_t::set_target (rxvt_term *new_target)
1520{ 1520{
1521 if (new_target)
1522 if (target != new_target)
1523 {
1524 target = new_target; 1521 target = new_target;
1525 return true;
1526 }
1527
1528 return false;
1529} 1522}
1530 1523
1531void 1524void
1532bgPixmap_t::apply () 1525bgPixmap_t::apply ()
1533{ 1526{
1534 if (target) 1527 if (target == NULL)
1535 { 1528 return;
1529
1536 if (pixmap != None) 1530 if (pixmap != None)
1537 { 1531 {
1538 /* set target's background to pixmap */ 1532 /* set target's background to pixmap */
1539# ifdef ENABLE_TRANSPARENCY 1533# ifdef ENABLE_TRANSPARENCY
1540 if (flags & isTransparent) 1534 if (flags & isTransparent)
1541 { 1535 {
1542 XSetWindowBackgroundPixmap (target->dpy, target->parent[0], pixmap); 1536 XSetWindowBackgroundPixmap (target->dpy, target->parent[0], pixmap);
1543 XSetWindowBackgroundPixmap (target->dpy, target->vt, ParentRelative); 1537 XSetWindowBackgroundPixmap (target->dpy, target->vt, ParentRelative);
1544 1538
1545 if (target->scrollBar.win) 1539 if (target->scrollBar.win)
1546 XSetWindowBackgroundPixmap (target->dpy, target->scrollBar.win, ParentRelative); 1540 XSetWindowBackgroundPixmap (target->dpy, target->scrollBar.win, ParentRelative);
1547 } 1541 }
1548 else 1542 else
1549# endif 1543# endif
1550 { 1544 {
1551 /* force old pixmap dereference in case it was transparent before :*/ 1545 /* force old pixmap dereference in case it was transparent before :*/
1552 XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]);
1553 XSetWindowBackgroundPixmap (target->dpy, target->vt, pixmap);
1554 /* do we also need to set scrollbar's background here ? */
1555
1556 if (target->scrollBar.win)
1557 XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]);
1558 }
1559 }
1560 else
1561 {
1562 /* set target background to a pixel */
1563 XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]); 1546 XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]);
1564 XSetWindowBackground (target->dpy, target->vt, target->pix_colors[Color_bg]); 1547 XSetWindowBackgroundPixmap (target->dpy, target->vt, pixmap);
1565 /* do we also need to set scrollbar's background here ? */ 1548 /* do we also need to set scrollbar's background here ? */
1549
1566 if (target->scrollBar.win) 1550 if (target->scrollBar.win)
1567 XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); 1551 XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]);
1568 } 1552 }
1553 }
1554 else
1555 {
1556 /* set target background to a pixel */
1557 XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]);
1558 XSetWindowBackground (target->dpy, target->vt, target->pix_colors[Color_bg]);
1559 /* do we also need to set scrollbar's background here ? */
1560 if (target->scrollBar.win)
1561 XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]);
1562 }
1569 1563
1570 /* don't want Expose on the parent or vt. It is better to use 1564 /* don't want Expose on the parent or vt. It is better to use
1571 scr_touch or we get a great deal of flicker otherwise: */ 1565 scr_touch or we get a great deal of flicker otherwise: */
1572 XClearWindow (target->dpy, target->parent[0]); 1566 XClearWindow (target->dpy, target->parent[0]);
1573 1567
1574 if (target->scrollBar.state && target->scrollBar.win) 1568 if (target->scrollBar.state && target->scrollBar.win)
1575 { 1569 {
1576 target->scrollBar.state = STATE_IDLE; 1570 target->scrollBar.state = STATE_IDLE;
1577 target->scrollBar.show (0); 1571 target->scrollBar.show (0);
1578 } 1572 }
1579 1573
1580 target->want_refresh = 1; 1574 target->want_refresh = 1;
1581 flags |= hasChanged; 1575 flags |= hasChanged;
1582 }
1583} 1576}
1584 1577
1585#endif /* HAVE_BG_PIXMAP */ 1578#endif /* HAVE_BG_PIXMAP */
1586 1579
1587#if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) && !XRENDER 1580#if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) && !XRENDER

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines