testnativex11.c
Go to the documentation of this file.
/*
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely.
*/
#include "testnative.h"
#ifdef TEST_NATIVE_X11
static void *CreateWindowX11(int w, int h);
static void DestroyWindowX11(void *window);
NativeWindowFactory X11WindowFactory = {
"x11",
CreateWindowX11,
DestroyWindowX11
};
static Display *dpy;
static void *
CreateWindowX11(int w, int h)
{
Window window = 0;
dpy = XOpenDisplay(NULL);
if (dpy) {
window =
XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, w, h, 0, 0,
0);
XMapRaised(dpy, window);
XSync(dpy, False);
}
return (void *) window;
}
static void
DestroyWindowX11(void *window)
{
if (dpy) {
XDestroyWindow(dpy, (Window) window);
XCloseDisplay(dpy);
}
}
#endif
dpy
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display dpy)
Definition: SDL_x11sym.h:44
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1946
NativeWindowFactory
Definition: testnative.h:22
XCloseDisplay
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer retur XCloseDisplay)
Definition: SDL_x11sym.h:42
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:731
testnative.h
NULL
#define NULL
Definition: begin_code.h:164
window
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
XDestroyWindow
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 retur XDestroyWindow)
Definition: SDL_x11sym.h:54
XOpenDisplay
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 retur XOpenDisplay)
Definition: SDL_x11sym.h:100