mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-09 04:58:04 +02:00
xlib/shm: Avoid using XSendEvent with old versions of Xorg
Søren Sandmann Pedersen pointed out that all versions of Xorg prior to
and including xorg-1.11.0 contained a bug that would cause them to crash
if they ever processed an event sent by XSendEvent. This was fixed in
commit 2d2dce558d24eeea0eb011ec9ebaa6c5c2273c39
Author: Sam Spilsbury <sam.spilsbury@canonical.com>
Date: Wed Sep 14 09:58:34 2011 +0800
Remove the SendEvent bit (0x80) before doing range checks on event type.
so make sure we do not use XSendEvent prior to that commit, which
fortuitously is quite easy as we only do so along the ShmPixmap path.
Reported-by: Søren Sandmann Pedersen <ssp@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
dba46f4eab
commit
b1532f465e
1 changed files with 21 additions and 0 deletions
|
|
@ -1121,6 +1121,24 @@ _cairo_xlib_shm_surface_is_idle (cairo_surface_t *surface)
|
|||
return shm->idle > 0;
|
||||
}
|
||||
|
||||
#define XORG_VERSION_ENCODE(major,minor,patch,snap) \
|
||||
(((major) * 10000000) + ((minor) * 100000) + ((patch) * 1000) + snap)
|
||||
|
||||
static cairo_bool_t
|
||||
xorg_has_buggy_send_event(Display *dpy)
|
||||
{
|
||||
/* Avoid incurring the wrath fixed by:
|
||||
*
|
||||
* commit 2d2dce558d24eeea0eb011ec9ebaa6c5c2273c39
|
||||
* Author: Sam Spilsbury <sam.spilsbury@canonical.com>
|
||||
* Date: Wed Sep 14 09:58:34 2011 +0800
|
||||
*
|
||||
* Remove the SendEvent bit (0x80) before doing range checks on event type.
|
||||
*/
|
||||
return (strstr (ServerVendor (dpy), "X.Org") != NULL &&
|
||||
VendorRelease (dpy) < XORG_VERSION_ENCODE(1,11,0,1));
|
||||
}
|
||||
|
||||
void
|
||||
_cairo_xlib_display_init_shm (cairo_xlib_display_t *display)
|
||||
{
|
||||
|
|
@ -1153,6 +1171,9 @@ _cairo_xlib_display_init_shm (cairo_xlib_display_t *display)
|
|||
DefaultVisual (display->display, scr),
|
||||
CWOverrideRedirect, &attr);
|
||||
|
||||
if (xorg_has_buggy_send_event(display->display))
|
||||
has_pixmap = 0;
|
||||
|
||||
shm->has_pixmaps = has_pixmap ? MIN_PIXMAP_SIZE : 0;
|
||||
cairo_list_init (&shm->pool);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue