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.106 by sf-exg, Mon Nov 1 11:37:02 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 */
1524} 1522}
1525 1523
1526void 1524void
1527bgPixmap_t::apply () 1525bgPixmap_t::apply ()
1528{ 1526{
1529 if (target) 1527 if (target == NULL)
1530 { 1528 return;
1529
1531 if (pixmap != None) 1530 if (pixmap != None)
1532 { 1531 {
1533 /* set target's background to pixmap */ 1532 /* set target's background to pixmap */
1534# ifdef ENABLE_TRANSPARENCY 1533# ifdef ENABLE_TRANSPARENCY
1535 if (flags & isTransparent) 1534 if (flags & isTransparent)
1536 { 1535 {
1537 XSetWindowBackgroundPixmap (target->dpy, target->parent[0], pixmap); 1536 XSetWindowBackgroundPixmap (target->dpy, target->parent[0], pixmap);
1538 XSetWindowBackgroundPixmap (target->dpy, target->vt, ParentRelative); 1537 XSetWindowBackgroundPixmap (target->dpy, target->vt, ParentRelative);
1539 1538
1540 if (target->scrollBar.win) 1539 if (target->scrollBar.win)
1541 XSetWindowBackgroundPixmap (target->dpy, target->scrollBar.win, ParentRelative); 1540 XSetWindowBackgroundPixmap (target->dpy, target->scrollBar.win, ParentRelative);
1542 } 1541 }
1543 else 1542 else
1544# endif 1543# endif
1545 { 1544 {
1546 /* force old pixmap dereference in case it was transparent before :*/ 1545 /* force old pixmap dereference in case it was transparent before :*/
1547 XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]);
1548 XSetWindowBackgroundPixmap (target->dpy, target->vt, pixmap);
1549 /* do we also need to set scrollbar's background here ? */
1550
1551 if (target->scrollBar.win)
1552 XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]);
1553 }
1554 }
1555 else
1556 {
1557 /* set target background to a pixel */
1558 XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]); 1546 XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]);
1559 XSetWindowBackground (target->dpy, target->vt, target->pix_colors[Color_bg]); 1547 XSetWindowBackgroundPixmap (target->dpy, target->vt, pixmap);
1560 /* do we also need to set scrollbar's background here ? */ 1548 /* do we also need to set scrollbar's background here ? */
1549
1561 if (target->scrollBar.win) 1550 if (target->scrollBar.win)
1562 XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); 1551 XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]);
1563 } 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 }
1564 1563
1565 /* 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
1566 scr_touch or we get a great deal of flicker otherwise: */ 1565 scr_touch or we get a great deal of flicker otherwise: */
1567 XClearWindow (target->dpy, target->parent[0]); 1566 XClearWindow (target->dpy, target->parent[0]);
1568 1567
1569 if (target->scrollBar.state && target->scrollBar.win) 1568 if (target->scrollBar.state && target->scrollBar.win)
1570 { 1569 {
1571 target->scrollBar.state = STATE_IDLE; 1570 target->scrollBar.state = STATE_IDLE;
1572 target->scrollBar.show (0); 1571 target->scrollBar.show (0);
1573 } 1572 }
1574 1573
1575 target->want_refresh = 1; 1574 target->want_refresh = 1;
1576 flags |= hasChanged; 1575 flags |= hasChanged;
1577 }
1578} 1576}
1579 1577
1580#endif /* HAVE_BG_PIXMAP */ 1578#endif /* HAVE_BG_PIXMAP */
1581 1579
1582#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