forked from old/legacy-imlib2
Only check XShmAttach once in __imlib_ShmGetXImage().
SVN revision: 46334
This commit is contained in:
parent
7bf03a945c
commit
08183bec3f
|
@ -38,7 +38,7 @@ __imlib_ShmCheck(Display * d)
|
||||||
{
|
{
|
||||||
/* if its there set x_does_shm flag */
|
/* if its there set x_does_shm flag */
|
||||||
if (XShmQueryExtension(d))
|
if (XShmQueryExtension(d))
|
||||||
x_does_shm = 1;
|
x_does_shm = 2; /* 2: __imlib_ShmGetXImage tests first XShmAttach */
|
||||||
/* clear the flag - no shm at all */
|
/* clear the flag - no shm at all */
|
||||||
else
|
else
|
||||||
x_does_shm = 0;
|
x_does_shm = 0;
|
||||||
|
@ -69,17 +69,25 @@ __imlib_ShmGetXImage(Display * d, Visual * v, Drawable draw, int depth,
|
||||||
{
|
{
|
||||||
XErrorHandler ph;
|
XErrorHandler ph;
|
||||||
|
|
||||||
/* setup a temporary error handler */
|
if (x_does_shm == 2)
|
||||||
_x_err = 0;
|
{
|
||||||
ph = XSetErrorHandler((XErrorHandler) TmpXError);
|
/* setup a temporary error handler */
|
||||||
|
_x_err = 0;
|
||||||
|
XSync(d, False);
|
||||||
|
ph = XSetErrorHandler((XErrorHandler) TmpXError);
|
||||||
|
}
|
||||||
/* ask X to attach to the shared mem segment */
|
/* ask X to attach to the shared mem segment */
|
||||||
XShmAttach(d, si);
|
XShmAttach(d, si);
|
||||||
if (draw != None)
|
if (draw != None)
|
||||||
XShmGetImage(d, draw, xim, x, y, 0xffffffff);
|
XShmGetImage(d, draw, xim, x, y, 0xffffffff);
|
||||||
/* wait for X to reply and do this */
|
if (x_does_shm == 2)
|
||||||
XSync(d, False);
|
{
|
||||||
/* reset the error handler */
|
/* wait for X to reply and do this */
|
||||||
XSetErrorHandler((XErrorHandler) ph);
|
XSync(d, False);
|
||||||
|
/* reset the error handler */
|
||||||
|
XSetErrorHandler((XErrorHandler) ph);
|
||||||
|
x_does_shm = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* if we attached without an error we're set */
|
/* if we attached without an error we're set */
|
||||||
if (_x_err == 0)
|
if (_x_err == 0)
|
||||||
|
|
Loading…
Reference in New Issue