1 | /*----------------------------------------------------------------------* |
1 | /*----------------------------------------------------------------------* |
2 | * File: background.C - former xmp.C |
2 | * File: background.C - former xpm.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) 1997 Carsten Haitzler <raster@zip.com.au> |
6 | * Copyright (c) 1997 Carsten Haitzler <raster@zip.com.au> |
7 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
7 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
… | |
… | |
130 | return true; |
130 | return true; |
131 | # endif |
131 | # endif |
132 | # ifdef ENABLE_TRANSPARENCY |
132 | # ifdef ENABLE_TRANSPARENCY |
133 | if (flags & isTransparent) |
133 | if (flags & isTransparent) |
134 | { |
134 | { |
|
|
135 | # ifdef HAVE_AFTERIMAGE // can't blur without libAI anyways |
135 | if (((flags & blurNeeded) && !(flags & blurServerSide)) |
136 | if ((flags & blurNeeded) && !(flags & blurServerSide)) |
|
|
137 | return true; |
|
|
138 | # endif |
136 | || ((flags & tintNeeded) && !(flags & tintServerSide))) |
139 | if ((flags & tintNeeded) && !(flags & tintServerSide)) |
137 | return true; |
140 | return true; |
138 | } |
141 | } |
139 | # endif |
142 | # endif |
140 | return false; |
143 | return false; |
141 | } |
144 | } |
142 | |
145 | |
… | |
… | |
738 | bool |
741 | bool |
739 | bgPixmap_t::set_shade (const char *shade_str) |
742 | bgPixmap_t::set_shade (const char *shade_str) |
740 | { |
743 | { |
741 | int new_shade = (shade_str) ? atoi (shade_str) : 0; |
744 | int new_shade = (shade_str) ? atoi (shade_str) : 0; |
742 | |
745 | |
|
|
746 | if (new_shade < 0 && new_shade > -100) |
|
|
747 | new_shade = 200 - (100 + new_shade); |
743 | if (new_shade == 100) |
748 | else if (new_shade == 100) |
744 | new_shade = 0; |
749 | new_shade = 0; |
745 | |
750 | |
746 | if (new_shade != shade) |
751 | if (new_shade != shade) |
747 | { |
752 | { |
748 | unsigned long new_flags = compute_tint_shade_flags ((flags & tintSet) ? &tint : NULL, new_shade); |
753 | unsigned long new_flags = compute_tint_shade_flags ((flags & tintSet) ? &tint : NULL, new_shade); |
… | |
… | |
862 | else |
867 | else |
863 | {/* strightforward pixmap copy */ |
868 | {/* strightforward pixmap copy */ |
864 | gcv.tile = root_pixmap; |
869 | gcv.tile = root_pixmap; |
865 | gcv.fill_style = FillTiled; |
870 | gcv.fill_style = FillTiled; |
866 | |
871 | |
867 | while (sx < 0) sx += (int)window_width; |
872 | while (sx < 0) sx += (int)root_width; |
868 | while (sy < 0) sy += (int)window_height; |
873 | while (sy < 0) sy += (int)root_height; |
869 | |
874 | |
870 | gcv.ts_x_origin = -sx; |
875 | gcv.ts_x_origin = -sx; |
871 | gcv.ts_y_origin = -sy; |
876 | gcv.ts_y_origin = -sy; |
872 | gc = XCreateGC (dpy, root, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
877 | gc = XCreateGC (dpy, root, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
873 | |
878 | |
… | |
… | |
932 | pf.direct.greenMask = 0xff; |
937 | pf.direct.greenMask = 0xff; |
933 | pf.direct.blueMask = 0xff; |
938 | pf.direct.blueMask = 0xff; |
934 | pf.direct.alphaMask = 0xff; |
939 | pf.direct.alphaMask = 0xff; |
935 | |
940 | |
936 | XRenderPictFormat *solid_format = XRenderFindFormat (dpy, |
941 | XRenderPictFormat *solid_format = XRenderFindFormat (dpy, |
937 | (PictFormatType| |
942 | (PictFormatType| |
938 | PictFormatDepth| |
943 | PictFormatDepth| |
939 | PictFormatRedMask| |
944 | PictFormatRedMask| |
940 | PictFormatGreenMask| |
945 | PictFormatGreenMask| |
941 | PictFormatBlueMask| |
946 | PictFormatBlueMask| |
942 | PictFormatAlphaMask), |
947 | PictFormatAlphaMask), |
943 | &pf, |
948 | &pf, |
944 | 0); |
949 | 0); |
945 | XRenderPictFormat *root_format = XRenderFindVisualFormat (dpy, DefaultVisualOfScreen (ScreenOfDisplay (dpy, target->display->screen))); |
950 | XRenderPictFormat *root_format = XRenderFindVisualFormat (dpy, DefaultVisualOfScreen (ScreenOfDisplay (dpy, target->display->screen))); |
946 | XRenderPictureAttributes pa ; |
951 | XRenderPictureAttributes pa ; |
947 | |
952 | |
948 | back_pic = XRenderCreatePicture (dpy, tiled_root_pmap, root_format, 0, &pa); |
953 | back_pic = XRenderCreatePicture (dpy, tiled_root_pmap, root_format, 0, &pa); |
949 | |
954 | |
… | |
… | |
1094 | } |
1099 | } |
1095 | else if (background_flags && pmap_depth != target->depth) |
1100 | else if (background_flags && pmap_depth != target->depth) |
1096 | { |
1101 | { |
1097 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1102 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1098 | } |
1103 | } |
|
|
1104 | |
1099 | # else /* our own client-side tinting */ |
1105 | # elif !XFT /* our own client-side tinting */ |
|
|
1106 | |
|
|
1107 | /* ATTENTION: We ASSUME that XFT will let us do all the tinting neccessary server-side. |
|
|
1108 | This may need to be changed in need_client_side_rendering() logic is altered !!! */ |
|
|
1109 | |
1100 | if (background_flags && (flags & isInvalid)) |
1110 | if (background_flags && (flags & isInvalid)) |
1101 | { |
1111 | { |
1102 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1112 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1103 | if (result != NULL && !(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
1113 | if (result != NULL && !(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
1104 | { |
1114 | { |
… | |
… | |
1217 | # if HAVE_SCROLLBARS |
1227 | # if HAVE_SCROLLBARS |
1218 | if (target->scrollBar.win) |
1228 | if (target->scrollBar.win) |
1219 | XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); |
1229 | XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); |
1220 | # endif |
1230 | # endif |
1221 | } |
1231 | } |
1222 | |
1232 | /* don't want Expose on the parent or vt. It is better to use |
1223 | /* don't want Expose on the parent */ |
1233 | scr_touch or we get a great deal of flicker otherwise: */ |
1224 | XClearArea (target->dpy, target->parent[0], 0, 0, 0, 0, False); |
1234 | XClearWindow (target->dpy, target->parent[0]); |
1225 | /* do want Expose on the vt, so we get refreshed properly */ |
|
|
1226 | XClearArea (target->dpy, target->vt, 0, 0, 0, 0, True); |
|
|
1227 | |
1235 | |
1228 | # if HAVE_SCROLLBARS |
1236 | # if HAVE_SCROLLBARS |
1229 | if (target->scrollBar.win) |
1237 | if (target->scrollBar.win) |
1230 | { |
1238 | { |
1231 | target->scrollBar.setIdle (); |
1239 | target->scrollBar.setIdle (); |
1232 | target->scrollbar_show (0); |
1240 | target->scrollbar_show (0); |
1233 | } |
1241 | } |
1234 | # endif |
1242 | # endif |
|
|
1243 | |
|
|
1244 | target->want_refresh = 1; |
|
|
1245 | flags |= hasChanged; |
1235 | } |
1246 | } |
1236 | } |
1247 | } |
1237 | |
1248 | |
1238 | #endif /* HAVE_BG_PIXMAP */ |
1249 | #endif /* HAVE_BG_PIXMAP */ |
1239 | |
1250 | |
1240 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
1251 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) && !XFT |
1241 | /* taken from aterm-0.4.2 */ |
1252 | /* taken from aterm-0.4.2 */ |
1242 | |
1253 | |
1243 | typedef uint32_t RUINT32T; |
1254 | typedef uint32_t RUINT32T; |
1244 | |
1255 | |
1245 | static void |
1256 | static void |