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 | |
… | |
… | |
862 | else |
865 | else |
863 | {/* strightforward pixmap copy */ |
866 | {/* strightforward pixmap copy */ |
864 | gcv.tile = root_pixmap; |
867 | gcv.tile = root_pixmap; |
865 | gcv.fill_style = FillTiled; |
868 | gcv.fill_style = FillTiled; |
866 | |
869 | |
867 | while (sx < 0) sx += (int)window_width; |
870 | while (sx < 0) sx += (int)root_width; |
868 | while (sy < 0) sy += (int)window_height; |
871 | while (sy < 0) sy += (int)root_height; |
869 | |
872 | |
870 | gcv.ts_x_origin = -sx; |
873 | gcv.ts_x_origin = -sx; |
871 | gcv.ts_y_origin = -sy; |
874 | gcv.ts_y_origin = -sy; |
872 | gc = XCreateGC (dpy, root, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
875 | gc = XCreateGC (dpy, root, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
873 | |
876 | |
… | |
… | |
932 | pf.direct.greenMask = 0xff; |
935 | pf.direct.greenMask = 0xff; |
933 | pf.direct.blueMask = 0xff; |
936 | pf.direct.blueMask = 0xff; |
934 | pf.direct.alphaMask = 0xff; |
937 | pf.direct.alphaMask = 0xff; |
935 | |
938 | |
936 | XRenderPictFormat *solid_format = XRenderFindFormat (dpy, |
939 | XRenderPictFormat *solid_format = XRenderFindFormat (dpy, |
937 | (PictFormatType| |
940 | (PictFormatType| |
938 | PictFormatDepth| |
941 | PictFormatDepth| |
939 | PictFormatRedMask| |
942 | PictFormatRedMask| |
940 | PictFormatGreenMask| |
943 | PictFormatGreenMask| |
941 | PictFormatBlueMask| |
944 | PictFormatBlueMask| |
942 | PictFormatAlphaMask), |
945 | PictFormatAlphaMask), |
943 | &pf, |
946 | &pf, |
944 | 0); |
947 | 0); |
945 | XRenderPictFormat *root_format = XRenderFindVisualFormat (dpy, DefaultVisualOfScreen (ScreenOfDisplay (dpy, target->display->screen))); |
948 | XRenderPictFormat *root_format = XRenderFindVisualFormat (dpy, DefaultVisualOfScreen (ScreenOfDisplay (dpy, target->display->screen))); |
946 | XRenderPictureAttributes pa ; |
949 | XRenderPictureAttributes pa ; |
947 | |
950 | |
948 | back_pic = XRenderCreatePicture (dpy, tiled_root_pmap, root_format, 0, &pa); |
951 | back_pic = XRenderCreatePicture (dpy, tiled_root_pmap, root_format, 0, &pa); |
949 | |
952 | |
… | |
… | |
1094 | } |
1097 | } |
1095 | else if (background_flags && pmap_depth != target->depth) |
1098 | else if (background_flags && pmap_depth != target->depth) |
1096 | { |
1099 | { |
1097 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1100 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1098 | } |
1101 | } |
|
|
1102 | |
1099 | # else /* our own client-side tinting */ |
1103 | # elif !XFT /* our own client-side tinting */ |
|
|
1104 | |
|
|
1105 | /* ATTENTION: We ASSUME that XFT will let us do all the tinint neccessary server-side. |
|
|
1106 | This may need to be changed in need_client_seide_rendering() logic is altered !!! */ |
|
|
1107 | |
1100 | if (background_flags && (flags & isInvalid)) |
1108 | if (background_flags && (flags & isInvalid)) |
1101 | { |
1109 | { |
1102 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1110 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1103 | if (result != NULL && !(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
1111 | if (result != NULL && !(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
1104 | { |
1112 | { |
… | |
… | |
1217 | # if HAVE_SCROLLBARS |
1225 | # if HAVE_SCROLLBARS |
1218 | if (target->scrollBar.win) |
1226 | if (target->scrollBar.win) |
1219 | XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); |
1227 | XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); |
1220 | # endif |
1228 | # endif |
1221 | } |
1229 | } |
1222 | |
1230 | /* don't want Expose on the parent or vt. It is better to use |
1223 | /* don't want Expose on the parent */ |
1231 | scr_touch or we get a great deal of flicker otherwise: */ |
1224 | XClearArea (target->dpy, target->parent[0], 0, 0, 0, 0, False); |
1232 | 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 | |
1233 | |
1228 | # if HAVE_SCROLLBARS |
1234 | # if HAVE_SCROLLBARS |
1229 | if (target->scrollBar.win) |
1235 | if (target->scrollBar.win) |
1230 | { |
1236 | { |
1231 | target->scrollBar.setIdle (); |
1237 | target->scrollBar.setIdle (); |
1232 | target->scrollbar_show (0); |
1238 | target->scrollbar_show (0); |
1233 | } |
1239 | } |
1234 | # endif |
1240 | # endif |
|
|
1241 | |
|
|
1242 | target->want_refresh = 1; |
|
|
1243 | flags |= hasChanged; |
1235 | } |
1244 | } |
1236 | } |
1245 | } |
1237 | |
1246 | |
1238 | #endif /* HAVE_BG_PIXMAP */ |
1247 | #endif /* HAVE_BG_PIXMAP */ |
1239 | |
1248 | |
1240 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
1249 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) && !XFT |
1241 | /* taken from aterm-0.4.2 */ |
1250 | /* taken from aterm-0.4.2 */ |
1242 | |
1251 | |
1243 | typedef uint32_t RUINT32T; |
1252 | typedef uint32_t RUINT32T; |
1244 | |
1253 | |
1245 | static void |
1254 | static void |