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.
This commit is contained in:
Richard Grenville 2012-10-22 08:16:52 +08:00
parent 6a95d49a87
commit fe2146f1a5
2 changed files with 2 additions and 29 deletions

View File

@ -47,9 +47,7 @@ Picture cshadow_picture;
Picture dim_picture = 0; Picture dim_picture = 0;
Picture root_tile; Picture root_tile;
XserverRegion all_damage; XserverRegion all_damage;
#if HAS_NAME_WINDOW_PIXMAP
Bool has_name_pixmap; Bool has_name_pixmap;
#endif
int root_height, root_width; int root_height, root_width;
/// Pregenerated alpha pictures. /// Pregenerated alpha pictures.
@ -1384,13 +1382,11 @@ paint_preprocess(Display *dpy, win *list) {
XRenderPictFormat *format; XRenderPictFormat *format;
Drawable draw = w->id; Drawable draw = w->id;
#if HAS_NAME_WINDOW_PIXMAP
if (has_name_pixmap && !w->pixmap) { if (has_name_pixmap && !w->pixmap) {
set_ignore(dpy, NextRequest(dpy)); set_ignore(dpy, NextRequest(dpy));
w->pixmap = XCompositeNameWindowPixmap(dpy, w->id); w->pixmap = XCompositeNameWindowPixmap(dpy, w->id);
} }
if (w->pixmap) draw = w->pixmap; if (w->pixmap) draw = w->pixmap;
#endif
format = XRenderFindVisualFormat(dpy, w->a.visual); format = XRenderFindVisualFormat(dpy, w->a.visual);
pa.subwindow_mode = IncludeInferiors; pa.subwindow_mode = IncludeInferiors;
@ -1500,17 +1496,10 @@ win_paint_shadow(Display *dpy, win *w, Picture root_buffer) {
*/ */
static inline void static inline void
win_paint_win(Display *dpy, win *w, Picture root_buffer) { win_paint_win(Display *dpy, win *w, Picture root_buffer) {
#if HAS_NAME_WINDOW_PIXMAP
int x = w->a.x; int x = w->a.x;
int y = w->a.y; int y = w->a.y;
int wid = w->widthb; int wid = w->widthb;
int hei = w->heightb; 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); Picture alpha_mask = (OPAQUE == w->opacity ? None: w->alpha_pict);
int op = (w->mode == WINDOW_SOLID ? PictOpSrc: PictOpOver); int op = (w->mode == WINDOW_SOLID ? PictOpSrc: PictOpOver);
@ -1908,9 +1897,7 @@ finish_unmap_win(Display *dpy, win *w) {
w->extents = None; w->extents = None;
} }
#if HAS_NAME_WINDOW_PIXMAP
free_pixmap(dpy, &w->pixmap); free_pixmap(dpy, &w->pixmap);
#endif
free_picture(dpy, &w->picture); free_picture(dpy, &w->picture);
free_region(dpy, &w->border_size); 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 #if CAN_DO_USABLE
new->usable = False; new->usable = False;
#endif #endif
#if HAS_NAME_WINDOW_PIXMAP
new->pixmap = None; new->pixmap = None;
#endif
new->picture = None; new->picture = None;
if (new->a.class == InputOnly) { if (new->a.class == InputOnly) {
@ -2382,10 +2367,8 @@ configure_win(Display *dpy, XConfigureEvent *ce) {
w->a.y = ce->y; w->a.y = ce->y;
if (w->a.width != ce->width || w->a.height != ce->height) { if (w->a.width != ce->width || w->a.height != ce->height) {
#if HAS_NAME_WINDOW_PIXMAP
free_pixmap(dpy, &w->pixmap); free_pixmap(dpy, &w->pixmap);
free_picture(dpy, &w->picture); free_picture(dpy, &w->picture);
#endif
} }
if (w->a.width != ce->width || w->a.height != ce->height 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 static void
destroy_callback(Display *dpy, win *w) { destroy_callback(Display *dpy, win *w) {
finish_destroy_win(dpy, w->id); finish_destroy_win(dpy, w->id);
} }
#endif
static void static void
destroy_win(Display *dpy, Window id, Bool fade) { destroy_win(Display *dpy, Window id, Bool fade) {
@ -4258,11 +4239,9 @@ main(int argc, char **argv) {
XCompositeQueryVersion(dpy, &composite_major, &composite_minor); XCompositeQueryVersion(dpy, &composite_major, &composite_minor);
#if HAS_NAME_WINDOW_PIXMAP
if (composite_major > 0 || composite_minor >= 2) { if (composite_major > 0 || composite_minor >= 2) {
has_name_pixmap = True; has_name_pixmap = True;
} }
#endif
if (!XDamageQueryExtension(dpy, &damage_event, &damage_error)) { if (!XDamageQueryExtension(dpy, &damage_event, &damage_error)) {
fprintf(stderr, "No damage extension\n"); fprintf(stderr, "No damage extension\n");

View File

@ -91,8 +91,8 @@
#endif #endif
// === Constants === // === Constants ===
#if COMPOSITE_MAJOR > 0 || COMPOSITE_MINOR >= 2 #if !(COMPOSITE_MAJOR > 0 || COMPOSITE_MINOR >= 2)
#define HAS_NAME_WINDOW_PIXMAP 1 #error libXcomposite version unsupported
#endif #endif
#define ROUNDED_PERCENT 0.05 #define ROUNDED_PERCENT 0.05
@ -183,9 +183,7 @@ typedef struct _win {
struct _win *next; struct _win *next;
Window id; Window id;
Window client_win; Window client_win;
#if HAS_NAME_WINDOW_PIXMAP
Pixmap pixmap; Pixmap pixmap;
#endif
XWindowAttributes a; XWindowAttributes a;
#if CAN_DO_USABLE #if CAN_DO_USABLE
Bool usable; /* mapped and all damaged at one point */ Bool usable; /* mapped and all damaged at one point */
@ -871,10 +869,8 @@ finish_map_win(Display *dpy, win *w);
static void static void
finish_unmap_win(Display *dpy, win *w); finish_unmap_win(Display *dpy, win *w);
#if HAS_NAME_WINDOW_PIXMAP
static void static void
unmap_callback(Display *dpy, win *w); unmap_callback(Display *dpy, win *w);
#endif
static void static void
unmap_win(Display *dpy, Window id, Bool fade); unmap_win(Display *dpy, Window id, Bool fade);
@ -931,10 +927,8 @@ circulate_win(Display *dpy, XCirculateEvent *ce);
static void static void
finish_destroy_win(Display *dpy, Window id); finish_destroy_win(Display *dpy, Window id);
#if HAS_NAME_WINDOW_PIXMAP
static void static void
destroy_callback(Display *dpy, win *w); destroy_callback(Display *dpy, win *w);
#endif
static void static void
destroy_win(Display *dpy, Window id, Bool fade); destroy_win(Display *dpy, Window id, Bool fade);