From fe2146f1a5433aa390f962de40abc3b498bf169a Mon Sep 17 00:00:00 2001 From: Richard Grenville Date: Mon, 22 Oct 2012 08:16:52 +0800 Subject: [PATCH] Misc: Drop support for old versions of libXcomposite Basically dropping support for HAS_NAME_PIXMAP = 0 because I don't think there are many people using it, and I cannot maintain it. CAN_DO_USABLE support is under evaluation. --- src/compton.c | 21 --------------------- src/compton.h | 10 ++-------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/src/compton.c b/src/compton.c index ce46169..c5243c1 100755 --- a/src/compton.c +++ b/src/compton.c @@ -47,9 +47,7 @@ Picture cshadow_picture; Picture dim_picture = 0; Picture root_tile; XserverRegion all_damage; -#if HAS_NAME_WINDOW_PIXMAP Bool has_name_pixmap; -#endif int root_height, root_width; /// Pregenerated alpha pictures. @@ -1384,13 +1382,11 @@ paint_preprocess(Display *dpy, win *list) { XRenderPictFormat *format; Drawable draw = w->id; -#if HAS_NAME_WINDOW_PIXMAP if (has_name_pixmap && !w->pixmap) { set_ignore(dpy, NextRequest(dpy)); w->pixmap = XCompositeNameWindowPixmap(dpy, w->id); } if (w->pixmap) draw = w->pixmap; -#endif format = XRenderFindVisualFormat(dpy, w->a.visual); pa.subwindow_mode = IncludeInferiors; @@ -1500,17 +1496,10 @@ win_paint_shadow(Display *dpy, win *w, Picture root_buffer) { */ static inline void win_paint_win(Display *dpy, win *w, Picture root_buffer) { -#if HAS_NAME_WINDOW_PIXMAP int x = w->a.x; int y = w->a.y; int wid = w->widthb; int hei = w->heightb; -#else - int x = w->a.x + w->a.border_width; - int y = w->a.y + w->a.border_width; - int wid = w->a.width; - int hei = w->a.height; -#endif Picture alpha_mask = (OPAQUE == w->opacity ? None: w->alpha_pict); int op = (w->mode == WINDOW_SOLID ? PictOpSrc: PictOpOver); @@ -1908,9 +1897,7 @@ finish_unmap_win(Display *dpy, win *w) { w->extents = None; } -#if HAS_NAME_WINDOW_PIXMAP free_pixmap(dpy, &w->pixmap); -#endif free_picture(dpy, &w->picture); free_region(dpy, &w->border_size); @@ -2204,9 +2191,7 @@ add_win(Display *dpy, Window id, Window prev, Bool override_redirect) { #if CAN_DO_USABLE new->usable = False; #endif -#if HAS_NAME_WINDOW_PIXMAP new->pixmap = None; -#endif new->picture = None; if (new->a.class == InputOnly) { @@ -2382,10 +2367,8 @@ configure_win(Display *dpy, XConfigureEvent *ce) { w->a.y = ce->y; if (w->a.width != ce->width || w->a.height != ce->height) { -#if HAS_NAME_WINDOW_PIXMAP free_pixmap(dpy, &w->pixmap); free_picture(dpy, &w->picture); -#endif } if (w->a.width != ce->width || w->a.height != ce->height @@ -2449,12 +2432,10 @@ finish_destroy_win(Display *dpy, Window id) { } } -#if HAS_NAME_WINDOW_PIXMAP static void destroy_callback(Display *dpy, win *w) { finish_destroy_win(dpy, w->id); } -#endif static void destroy_win(Display *dpy, Window id, Bool fade) { @@ -4258,11 +4239,9 @@ main(int argc, char **argv) { XCompositeQueryVersion(dpy, &composite_major, &composite_minor); -#if HAS_NAME_WINDOW_PIXMAP if (composite_major > 0 || composite_minor >= 2) { has_name_pixmap = True; } -#endif if (!XDamageQueryExtension(dpy, &damage_event, &damage_error)) { fprintf(stderr, "No damage extension\n"); diff --git a/src/compton.h b/src/compton.h index 56c5809..6aac338 100644 --- a/src/compton.h +++ b/src/compton.h @@ -91,8 +91,8 @@ #endif // === Constants === -#if COMPOSITE_MAJOR > 0 || COMPOSITE_MINOR >= 2 -#define HAS_NAME_WINDOW_PIXMAP 1 +#if !(COMPOSITE_MAJOR > 0 || COMPOSITE_MINOR >= 2) +#error libXcomposite version unsupported #endif #define ROUNDED_PERCENT 0.05 @@ -183,9 +183,7 @@ typedef struct _win { struct _win *next; Window id; Window client_win; -#if HAS_NAME_WINDOW_PIXMAP Pixmap pixmap; -#endif XWindowAttributes a; #if CAN_DO_USABLE Bool usable; /* mapped and all damaged at one point */ @@ -871,10 +869,8 @@ finish_map_win(Display *dpy, win *w); static void finish_unmap_win(Display *dpy, win *w); -#if HAS_NAME_WINDOW_PIXMAP static void unmap_callback(Display *dpy, win *w); -#endif static void unmap_win(Display *dpy, Window id, Bool fade); @@ -931,10 +927,8 @@ circulate_win(Display *dpy, XCirculateEvent *ce); static void finish_destroy_win(Display *dpy, Window id); -#if HAS_NAME_WINDOW_PIXMAP static void destroy_callback(Display *dpy, win *w); -#endif static void destroy_win(Display *dpy, Window id, Bool fade);