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.19 by ayin, Tue Dec 18 11:15:24 2007 UTC vs.
Revision 1.20 by root, Mon Dec 24 06:51:37 2007 UTC

779 unsigned long new_flags = compute_tint_shade_flags (&new_tint, shade); 779 unsigned long new_flags = compute_tint_shade_flags (&new_tint, shade);
780 tint = new_tint; 780 tint = new_tint;
781 flags = (flags & ~tintFlags) | new_flags | tintSet; 781 flags = (flags & ~tintFlags) | new_flags | tintSet;
782 return true; 782 return true;
783 } 783 }
784
784 return false; 785 return false;
785} 786}
786 787
787bool 788bool
788bgPixmap_t::unset_tint () 789bgPixmap_t::unset_tint ()
792 if (new_flags != (flags & tintFlags)) 793 if (new_flags != (flags & tintFlags))
793 { 794 {
794 flags = (flags&~tintFlags)|new_flags; 795 flags = (flags&~tintFlags)|new_flags;
795 return true; 796 return true;
796 } 797 }
798
797 return false; 799 return false;
798} 800}
799 801
800bool 802bool
801bgPixmap_t::set_shade (const char *shade_str) 803bgPixmap_t::set_shade (const char *shade_str)
802{ 804{
803 int new_shade = (shade_str) ? atoi (shade_str) : 0; 805 int new_shade = (shade_str) ? atoi (shade_str) : 0;
804 806
805 if (new_shade < 0 && new_shade > -100) 807 if (new_shade < 0 && new_shade > -100)
806 new_shade = 200 - (100 + new_shade); 808 new_shade = 200 - (100 + new_shade);
807 else if (new_shade == 100) 809 else if (new_shade == 100)
808 new_shade = 0; 810 new_shade = 0;
809 811
810 if (new_shade != shade) 812 if (new_shade != shade)
811 { 813 {
812 unsigned long new_flags = compute_tint_shade_flags ((flags & tintSet) ? &tint : NULL, new_shade); 814 unsigned long new_flags = compute_tint_shade_flags ((flags & tintSet) ? &tint : NULL, new_shade);
813 shade = new_shade; 815 shade = new_shade;
814 flags = (flags & (~tintFlags | tintSet)) | new_flags; 816 flags = (flags & (~tintFlags | tintSet)) | new_flags;
815 return true; 817 return true;
816 } 818 }
819
817 return false; 820 return false;
818} 821}
819 822
820/* make_transparency_pixmap() 823/* make_transparency_pixmap()
821 * Builds a pixmap sized the same as terminal window, with depth same as the root window 824 * Builds a pixmap sized the same as terminal window, with depth same as the root window
911 { 914 {
912 XCopyArea (dpy, src, tiled_root_pmap, gc, 0, 0, window_width, window_height, 0, 0); 915 XCopyArea (dpy, src, tiled_root_pmap, gc, 0, 0, window_width, window_height, 0, 0);
913 success = true; 916 success = true;
914 } 917 }
915 } 918 }
919
916 XDestroyWindow (dpy, src); 920 XDestroyWindow (dpy, src);
917 XUngrabServer (dpy); 921 XUngrabServer (dpy);
918 //fprintf (stderr, "%s:%d: ev_count = %d\n", __FUNCTION__, __LINE__, ev_count); 922 //fprintf (stderr, "%s:%d: ev_count = %d\n", __FUNCTION__, __LINE__, ev_count);
919 } 923 }
920 924
1040 mask_c.blue = 0xffff - c.b; 1044 mask_c.blue = 0xffff - c.b;
1041 XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); 1045 XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1);
1042 XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, window_width, window_height); 1046 XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, window_width, window_height);
1043 result |= transpPmapTinted; 1047 result |= transpPmapTinted;
1044 } 1048 }
1049
1045 XRenderFreePicture (dpy, mask_pic); 1050 XRenderFreePicture (dpy, mask_pic);
1046 XRenderFreePicture (dpy, overlay_pic); 1051 XRenderFreePicture (dpy, overlay_pic);
1047 XRenderFreePicture (dpy, back_pic); 1052 XRenderFreePicture (dpy, back_pic);
1048# if DO_TIMING_TEST 1053# if DO_TIMING_TEST
1049 XSync (dpy, False); 1054 XSync (dpy, False);
1071} 1076}
1072 1077
1073bool 1078bool
1074bgPixmap_t::set_root_pixmap () 1079bgPixmap_t::set_root_pixmap ()
1075{ 1080{
1076 Pixmap new_root_pixmap = None;
1077
1078 new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID); 1081 Pixmap new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID);
1079 if (new_root_pixmap == None) 1082 if (new_root_pixmap == None)
1080 new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID); 1083 new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID);
1081 1084
1082 if (new_root_pixmap != root_pixmap) 1085 if (new_root_pixmap != root_pixmap)
1083 { 1086 {
1084 root_pixmap = new_root_pixmap; 1087 root_pixmap = new_root_pixmap;
1085 return true; 1088 return true;
1086 } 1089 }
1090
1087 return false; 1091 return false;
1088} 1092}
1089# endif /* ENABLE_TRANSPARENCY */ 1093# endif /* ENABLE_TRANSPARENCY */
1090 1094
1091# ifndef HAVE_AFTERIMAGE 1095# ifndef HAVE_AFTERIMAGE
1092static void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm); 1096static void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm);
1093# endif 1097# endif
1094
1095 1098
1096bool 1099bool
1097bgPixmap_t::render () 1100bgPixmap_t::render ()
1098{ 1101{
1099 unsigned long background_flags = 0; 1102 unsigned long background_flags = 0;
1181 ShadeXImage (target, result, shade, c.r, c.g, c.b); 1184 ShadeXImage (target, result, shade, c.r, c.g, c.b);
1182 } 1185 }
1183 } 1186 }
1184# endif /* HAVE_AFTERIMAGE */ 1187# endif /* HAVE_AFTERIMAGE */
1185 1188
1186 if (result != NULL) 1189 if (result)
1187 { 1190 {
1188 GC gc = XCreateGC (target->dpy, target->vt, 0UL, NULL); 1191 GC gc = XCreateGC (target->dpy, target->vt, 0UL, NULL);
1192
1189 if (gc) 1193 if (gc)
1190 { 1194 {
1191 if (/*pmap_depth != target->depth &&*/ pixmap != None) 1195 if (/*pmap_depth != target->depth &&*/ pixmap != None)
1192 { 1196 {
1193 XFreePixmap (target->dpy, pixmap); 1197 XFreePixmap (target->dpy, pixmap);
1194 pixmap = None; 1198 pixmap = None;
1195 } 1199 }
1200
1196 if (pixmap == None) 1201 if (pixmap == None)
1197 { 1202 {
1198 pixmap = XCreatePixmap (target->dpy, target->vt, result->width, result->height, target->depth); 1203 pixmap = XCreatePixmap (target->dpy, target->vt, result->width, result->height, target->depth);
1199 pmap_width = result->width; 1204 pmap_width = result->width;
1200 pmap_height = result->height; 1205 pmap_height = result->height;
1201 pmap_depth = target->depth; 1206 pmap_depth = target->depth;
1202 } 1207 }
1208
1203 if (pmap_depth != result->depth) 1209 if (pmap_depth != result->depth)
1204 { 1210 {
1205 /* Bad Match error will ensue ! stupid X !!!! */ 1211 /* Bad Match error will ensue ! stupid X !!!! */
1206 if (result->depth == 24 && pmap_depth == 32) 1212 if (result->depth == 24 && pmap_depth == 32)
1207 result->depth = 32; 1213 result->depth = 32;
1210 else 1216 else
1211 { 1217 {
1212 /* TODO: implement image recoding */ 1218 /* TODO: implement image recoding */
1213 } 1219 }
1214 } 1220 }
1221
1215 if (pmap_depth == result->depth) 1222 if (pmap_depth == result->depth)
1216 XPutImage (target->dpy, pixmap, gc, result, 0, 0, 0, 0, result->width, result->height); 1223 XPutImage (target->dpy, pixmap, gc, result, 0, 0, 0, 0, result->width, result->height);
1224
1217 XFreeGC (target->dpy, gc); 1225 XFreeGC (target->dpy, gc);
1218 flags = flags & ~isInvalid; 1226 flags = flags & ~isInvalid;
1219 } 1227 }
1228
1220 XDestroyImage (result); 1229 XDestroyImage (result);
1221 } 1230 }
1222 1231
1223 if (flags & isInvalid) 1232 if (flags & isInvalid)
1224 { 1233 {
1250 } 1259 }
1251 return false; 1260 return false;
1252} 1261}
1253 1262
1254void 1263void
1255bgPixmap_t::apply() 1264bgPixmap_t::apply ()
1256{ 1265{
1257 if (target) 1266 if (target)
1258 { 1267 {
1259 flags &= ~isVtOrigin; 1268 flags &= ~isVtOrigin;
1260 if (pixmap != None) 1269 if (pixmap != None)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines