23 #if SDL_VIDEO_DRIVER_X11
29 #ifndef NO_SHARED_MEMORY
33 static int (*X_handler)(Display *, XErrorEvent *) =
NULL;
34 static int shm_errhandler(Display *
d, XErrorEvent *
e)
36 if ( e->error_code == BadAccess ) {
40 return(X_handler(d,e));
48 return SDL_X11_HAVE_SHM;
57 void **
pixels,
int *pitch)
68 gcv.graphics_exposures = False;
76 return SDL_SetError(
"Couldn't get window visual information");
88 #ifndef NO_SHARED_MEMORY
90 XShmSegmentInfo *shminfo = &data->
shminfo;
92 shminfo->shmid = shmget(IPC_PRIVATE, window->
h*(*pitch), IPC_CREAT | 0777);
93 if ( shminfo->shmid >= 0 ) {
94 shminfo->shmaddr = (
char *)shmat(shminfo->shmid, 0, 0);
95 shminfo->readOnly = False;
96 if ( shminfo->shmaddr != (
char *)-1 ) {
98 X_handler = XSetErrorHandler(shm_errhandler);
101 XSetErrorHandler(X_handler);
103 shmdt(shminfo->shmaddr);
107 shmctl(shminfo->shmid, IPC_RMID,
NULL);
113 vinfo.depth, ZPixmap,
114 shminfo->shmaddr, shminfo,
115 window->
w, window->
h);
119 shmdt(shminfo->shmaddr);
123 *pixels = shminfo->shmaddr;
131 if (*pixels ==
NULL) {
136 vinfo.depth, ZPixmap, 0, (
char *)(*pixels),
137 window->
w, window->
h, 32, 0);
153 #ifndef NO_SHARED_MEMORY
155 for (
i = 0;
i < numrects; ++
i) {
161 if (
w <= 0 ||
h <= 0 || (x +
w) <= 0 || (
y +
h) <= 0) {
175 if (x +
w > window->
w)
177 if (
y +
h > window->
h)
181 x,
y, x,
y,
w,
h, False);
187 for (
i = 0;
i < numrects; ++
i) {
193 if (
w <= 0 ||
h <= 0 || (x +
w) <= 0 || (
y +
h) <= 0) {
207 if (x +
w > window->
w)
209 if (
y +
h > window->
h)
236 XDestroyImage(data->
ximage);
238 #ifndef NO_SHARED_MEMORY
Uint32 X11_GetPixelFormatFromVisualInfo(Display *display, XVisualInfo *vinfo)
int X11_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
GLfloat GLfloat GLfloat GLfloat h
return Display return Display Bool Bool int int e
DECLSPEC void SDLCALL SDL_free(void *mem)
int X11_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
#define SDL_BYTESPERPIXEL(X)
return Display return Display Bool Bool int d
void X11_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
static SDL_VideoDevice * _this
uint32_t Uint32
An unsigned 32-bit integer type.
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
struct SDL_VideoData * videodata
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int int return Display Window Cursor return Display Window return Display Drawable GC int int unsigned int unsigned int return Display Drawable GC int int _Xconst char int return Display Drawable GC int int unsigned int unsigned int return Display return Display Cursor return Display GC return XModifierKeymap return char Display Window int return Display return Display Atom return Display Window XWindowAttributes return Display Window return Display XEvent Bool(*) XPointer return Display Window Bool unsigned int int int Window Cursor Time return Display Window int return KeySym return Display _Xconst char Bool return Display _Xconst char return XKeyEvent char int KeySym XComposeStatus return Display int int int XVisualInfo return Display Window int int return _Xconst char return Display XEvent return Display Drawable GC XImage int int int int unsigned int unsigned int return Display Window Window Window int int int int unsigned int return Display Window Window int int return Display Window unsigned int unsigned int return Display Window Bool long XEvent return Display GC unsigned long return Display Window int Time return Display Window Window return Display Window unsigned long return Display Window XSizeHints Display Colormap XColor int return char int XTextProperty return XFontStruct _Xconst char int int int int XCharStruct return Display Window return Display Time return Display Colormap return Display Window Window int int unsigned int unsigned int int int return Display Window int return XExtensionInfo Display char XExtensionHooks int XPointer return XExtensionInfo XExtensionInfo Display return Display return Display unsigned long Display GC Display char long Display xReply int Bool return Display Bool return Display int SDL_X11_XESetEventToWireRetType retur XShmAttach)
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum format
DECLSPEC int SDLCALL SDL_SetError(const char *fmt,...)
DECLSPEC void *SDLCALL SDL_malloc(size_t size)
DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
EGLSurface EGLint EGLint y
#define SDL_OutOfMemory()
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int int return Display Window Cursor return Display Window return Display Drawable GC int int unsigned int unsigned int return Display Drawable GC int int _Xconst char int return Display Drawable GC int int unsigned int unsigned int return Display return Display Cursor return Display GC return XModifierKeymap return char Display Window int return Display return Display Atom return Display Window XWindowAttributes return Display Window return Display XEvent Bool(*) XPointer return Display Window Bool unsigned int int int Window Cursor Time return Display Window int return KeySym return Display _Xconst char Bool return Display _Xconst char return XKeyEvent char int KeySym XComposeStatus return Display int int int XVisualInfo return Display Window int int return _Xconst char return Display XEvent retur XPutImage)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char retur XCreateImage)
GLint GLint GLint GLint GLint w
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int int return Display Window Cursor return Display Window return Display Drawable GC int int unsigned int unsigned int return Display Drawable GC int int _Xconst char int return Display Drawable GC int int unsigned int unsigned int return Display return Display Cursor return Display GC return XModifierKeymap return char Display Window int return Display return Display Atom return Display Window XWindowAttributes return Display Window return Display XEvent Bool(*) XPointer return Display Window Bool unsigned int int int Window Cursor Time return Display Window int return KeySym return Display _Xconst char Bool return Display _Xconst char return XKeyEvent char int KeySym XComposeStatus return Display int int int XVisualInfo return Display Window int int return _Xconst char return Display XEvent return Display Drawable GC XImage int int int int unsigned int unsigned int return Display Window Window Window int int int int unsigned int return Display Window Window int int return Display Window unsigned int unsigned int return Display Window Bool long XEvent return Display GC unsigned long return Display Window int Time return Display Window Window return Display Window unsigned long return Display Window XSizeHints Display Colormap XColor int return char int XTextProperty return XFontStruct _Xconst char int int int int XCharStruct return Display Window return Display Time return Display Colormap return Display Window Window int int unsigned int unsigned int int int return Display Window int return XExtensionInfo Display char XExtensionHooks int XPointer return XExtensionInfo XExtensionInfo Display return Display return Display unsigned long Display GC Display char long Display xReply int Bool return Display Bool return Display int SDL_X11_XESetEventToWireRetType return Display XShmSegmentInfo retur XShmPutImage)
int X11_GetVisualInfoFromVisual(Display *display, Visual *visual, XVisualInfo *vinfo)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int int return Display Window Cursor return Display Window return Display Drawable GC int int unsigned int unsigned int return Display Drawable GC int int _Xconst char int return Display Drawable GC int int unsigned int unsigned int return Display return Display Cursor retur XFreeGC)
A rectangle, with the origin at the upper left.