Drop support for Composite < 0.2

Rational: current workaround for Composite < 0.2 doesn't work with the
GLX backend, it also doesn't handle window border properly. Plus,
Composite 0.2 came out more than a decade ago, it's safe to assume
everyone has it.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-03-05 22:13:22 +00:00
parent eed5ea719e
commit d0fd21e167
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
5 changed files with 12 additions and 16 deletions

View File

@ -389,12 +389,8 @@ void *glx_prepare_win(void *backend_data, session_t *ps, win *w) {
} }
auto wd = ccalloc(1, struct _glx_win_data); auto wd = ccalloc(1, struct _glx_win_data);
if (ps->has_name_pixmap) {
wd->pixmap = xcb_generate_id(ps->c); wd->pixmap = xcb_generate_id(ps->c);
xcb_composite_name_window_pixmap(ps->c, w->id, wd->pixmap); xcb_composite_name_window_pixmap(ps->c, w->id, wd->pixmap);
} else {
wd->pixmap = w->id;
}
if (!wd->pixmap) { if (!wd->pixmap) {
log_error("Failed to get pixmap for window %#010x", w->id); log_error("Failed to get pixmap for window %#010x", w->id);
goto err; goto err;

View File

@ -457,9 +457,6 @@ typedef struct session {
int composite_error; int composite_error;
/// Major opcode for X Composite extension. /// Major opcode for X Composite extension.
int composite_opcode; int composite_opcode;
/// Whether X Composite NameWindowPixmap is available. Aka if X
/// Composite version >= 0.2.
bool has_name_pixmap;
/// Whether X Shape extension exists. /// Whether X Shape extension exists.
bool shape_exists; bool shape_exists;
/// Event base number for X Shape extension. /// Event base number for X Shape extension.

View File

@ -2426,7 +2426,6 @@ session_init(int argc, char **argv, Display *dpy, const char *config_file,
.composite_event = 0, .composite_event = 0,
.composite_error = 0, .composite_error = 0,
.composite_opcode = 0, .composite_opcode = 0,
.has_name_pixmap = false,
.shape_exists = false, .shape_exists = false,
.shape_event = 0, .shape_event = 0,
.shape_error = 0, .shape_error = 0,
@ -2541,8 +2540,9 @@ session_init(int argc, char **argv, Display *dpy, const char *config_file,
xcb_composite_query_version(ps->c, XCB_COMPOSITE_MAJOR_VERSION, XCB_COMPOSITE_MINOR_VERSION), xcb_composite_query_version(ps->c, XCB_COMPOSITE_MAJOR_VERSION, XCB_COMPOSITE_MINOR_VERSION),
NULL); NULL);
if (reply && (reply->major_version > 0 || reply->minor_version >= 2)) { if (!reply || (reply->major_version == 0 && reply->minor_version < 2)) {
ps->has_name_pixmap = true; log_fatal("Your X server doesn't have Composite >= 0.2 support, compton cannot run.");
exit(1);
} }
free(reply); free(reply);
} }

View File

@ -12,7 +12,6 @@ void print_diagnostics(session_t *ps, const char *config_file) {
printf("**Version:** " COMPTON_VERSION "\n"); printf("**Version:** " COMPTON_VERSION "\n");
//printf("**CFLAGS:** %s\n", "??"); //printf("**CFLAGS:** %s\n", "??");
printf("\n### Extensions:\n\n"); printf("\n### Extensions:\n\n");
printf("* Name Pixmap: %s\n", ps->has_name_pixmap ? "Yes" : "No");
printf("* Shape: %s\n", ps->shape_exists ? "Yes" : "No"); printf("* Shape: %s\n", ps->shape_exists ? "Yes" : "No");
printf("* XRandR: %s\n", ps->randr_exists ? "Yes" : "No"); printf("* XRandR: %s\n", ps->randr_exists ? "Yes" : "No");
printf("* Present: %s\n", ps->present_exists ? "Present" : "Not Present"); printf("* Present: %s\n", ps->present_exists ? "Present" : "Not Present");

View File

@ -234,15 +234,19 @@ static inline bool paint_isvalid(session_t *ps, const paint_t *ppaint) {
*/ */
void paint_one(session_t *ps, win *w, const region_t *reg_paint) { void paint_one(session_t *ps, win *w, const region_t *reg_paint) {
// Fetch Pixmap // Fetch Pixmap
if (!w->paint.pixmap && ps->has_name_pixmap) { if (!w->paint.pixmap) {
w->paint.pixmap = xcb_generate_id(ps->c); w->paint.pixmap = xcb_generate_id(ps->c);
set_ignore_cookie( set_ignore_cookie(
ps, xcb_composite_name_window_pixmap(ps->c, w->id, w->paint.pixmap)); ps, xcb_composite_name_window_pixmap(ps->c, w->id, w->paint.pixmap));
} }
xcb_drawable_t draw = w->paint.pixmap; xcb_drawable_t draw = w->paint.pixmap;
if (!draw) if (!draw) {
draw = w->id; log_error("Failed to get pixmap from window %#010x (%s), window won't be "
"visible",
w->id, w->name);
return;
}
// XRender: Build picture // XRender: Build picture
if (bkend_use_xrender(ps) && !w->paint.pict) { if (bkend_use_xrender(ps) && !w->paint.pict) {