Skip to content

Commit

Permalink
Merge pull request chjj#52 from yshui/dri2-hack
Browse files Browse the repository at this point in the history
Workaround the incompatibility between DRI2 and xcb

Fixes chjj#33 chjj#34 chjj#47
  • Loading branch information
yshui committed Nov 11, 2018
2 parents 47377df + bcab5d1 commit a61b877
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/compton.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#include <ctype.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
#include <xcb/randr.h>
#include <xcb/present.h>
#include <xcb/damage.h>
Expand All @@ -28,6 +30,8 @@
#include "config.h"
#include "diagnostic.h"

#define auto __auto_type

static void
finish_destroy_win(session_t *ps, win **_w);

Expand Down Expand Up @@ -3236,6 +3240,28 @@ ev_handle(session_t *ps, xcb_generic_event_t *ev) {
}
#endif

// Check if a custom XEvent constructor was registered in xlib for this event
// type, and call it discarding the constructed XEvent if any. XESetWireToEvent
// might be used by libraries to intercept messages from the X server e.g. the
// OpenGL lib waiting for DRI2 events.

// XXX This exists to workaround compton issue #33, #34, #47
// For even more details, see:
// https://bugs.freedesktop.org/show_bug.cgi?id=35945
// https://lists.freedesktop.org/archives/xcb/2011-November/007337.html
auto proc = XESetWireToEvent(ps->dpy, ev->response_type, 0);
if (proc) {
XESetWireToEvent(ps->dpy, ev->response_type, proc);
XEvent dummy;

// Stop Xlib from complaining about lost sequence numbers.
// proc might also just be Xlib internal event processing functions, and
// because they probably won't see all X replies, they will complain about
// missing sequence numbers.
ev->sequence = LastKnownRequestProcessed(ps->dpy);
proc(ps->dpy, &dummy, (xEvent *)ev);
}

// XXX redraw needs to be more fine grained
queue_redraw(ps);

Expand Down

0 comments on commit a61b877

Please sign in to comment.