mirror of https://github.com/encounter/SDL.git
have_mitshm: use XShmQueryExtension to check for MIT-SHM extension
Do not try to guess MIT_SHM extension availability from the string returned by XDisplayName, use the appropriate API instead. This fixes SDL2 inside hasher.
This commit is contained in:
parent
cdbeae521e
commit
ed514cd0e4
|
@ -40,14 +40,10 @@ static int shm_errhandler(Display *d, XErrorEvent *e)
|
||||||
return(X_handler(d,e));
|
return(X_handler(d,e));
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_bool have_mitshm(void)
|
static SDL_bool have_mitshm(Display *dpy)
|
||||||
{
|
{
|
||||||
/* Only use shared memory on local X servers */
|
/* Only use shared memory on local X servers */
|
||||||
if ( (SDL_strncmp(X11_XDisplayName(NULL), ":", 1) == 0) ||
|
return X11_XShmQueryExtension(dpy) ? SDL_X11_HAVE_SHM : SDL_FALSE;
|
||||||
(SDL_strncmp(X11_XDisplayName(NULL), "unix:", 5) == 0) ) {
|
|
||||||
return SDL_X11_HAVE_SHM;
|
|
||||||
}
|
|
||||||
return SDL_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !NO_SHARED_MEMORY */
|
#endif /* !NO_SHARED_MEMORY */
|
||||||
|
@ -86,7 +82,7 @@ X11_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format,
|
||||||
|
|
||||||
/* Create the actual image */
|
/* Create the actual image */
|
||||||
#ifndef NO_SHARED_MEMORY
|
#ifndef NO_SHARED_MEMORY
|
||||||
if (have_mitshm()) {
|
if (have_mitshm(display)) {
|
||||||
XShmSegmentInfo *shminfo = &data->shminfo;
|
XShmSegmentInfo *shminfo = &data->shminfo;
|
||||||
|
|
||||||
shminfo->shmid = shmget(IPC_PRIVATE, window->h*(*pitch), IPC_CREAT | 0777);
|
shminfo->shmid = shmget(IPC_PRIVATE, window->h*(*pitch), IPC_CREAT | 0777);
|
||||||
|
|
Loading…
Reference in New Issue