Skip to content

Commit

Permalink
Drop support for Composite < 0.2
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
yshui committed Mar 5, 2019
1 parent eed5ea7 commit d0fd21e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 16 deletions.
8 changes: 2 additions & 6 deletions src/backend/gl/glx.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,8 @@ void *glx_prepare_win(void *backend_data, session_t *ps, win *w) {
}

auto wd = ccalloc(1, struct _glx_win_data);
if (ps->has_name_pixmap) {
wd->pixmap = xcb_generate_id(ps->c);
xcb_composite_name_window_pixmap(ps->c, w->id, wd->pixmap);
} else {
wd->pixmap = w->id;
}
wd->pixmap = xcb_generate_id(ps->c);
xcb_composite_name_window_pixmap(ps->c, w->id, wd->pixmap);
if (!wd->pixmap) {
log_error("Failed to get pixmap for window %#010x", w->id);
goto err;
Expand Down
3 changes: 0 additions & 3 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,6 @@ typedef struct session {
int composite_error;
/// Major opcode for X Composite extension.
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.
bool shape_exists;
/// Event base number for X Shape extension.
Expand Down
6 changes: 3 additions & 3 deletions src/compton.c
Original file line number Diff line number Diff line change
Expand Up @@ -2426,7 +2426,6 @@ session_init(int argc, char **argv, Display *dpy, const char *config_file,
.composite_event = 0,
.composite_error = 0,
.composite_opcode = 0,
.has_name_pixmap = false,
.shape_exists = false,
.shape_event = 0,
.shape_error = 0,
Expand Down Expand Up @@ -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),
NULL);

if (reply && (reply->major_version > 0 || reply->minor_version >= 2)) {
ps->has_name_pixmap = true;
if (!reply || (reply->major_version == 0 && reply->minor_version < 2)) {
log_fatal("Your X server doesn't have Composite >= 0.2 support, compton cannot run.");
exit(1);
}
free(reply);
}
Expand Down
1 change: 0 additions & 1 deletion src/diagnostic.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ void print_diagnostics(session_t *ps, const char *config_file) {
printf("**Version:** " COMPTON_VERSION "\n");
//printf("**CFLAGS:** %s\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("* XRandR: %s\n", ps->randr_exists ? "Yes" : "No");
printf("* Present: %s\n", ps->present_exists ? "Present" : "Not Present");
Expand Down
10 changes: 7 additions & 3 deletions src/render.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
// Fetch Pixmap
if (!w->paint.pixmap && ps->has_name_pixmap) {
if (!w->paint.pixmap) {
w->paint.pixmap = xcb_generate_id(ps->c);
set_ignore_cookie(
ps, xcb_composite_name_window_pixmap(ps->c, w->id, w->paint.pixmap));
}

xcb_drawable_t draw = w->paint.pixmap;
if (!draw)
draw = w->id;
if (!draw) {
log_error("Failed to get pixmap from window %#010x (%s), window won't be "
"visible",
w->id, w->name);
return;
}

// XRender: Build picture
if (bkend_use_xrender(ps) && !w->paint.pict) {
Expand Down

0 comments on commit d0fd21e

Please sign in to comment.