Atlas - testnativex11.c

Home / ext / SDL / test Lines: 1 | Size: 1179 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1/* 2 Copyright (C) 1997-2025 Sam Lantinga <[email protected]> 3 4 This software is provided 'as-is', without any express or implied 5 warranty. In no event will the authors be held liable for any damages 6 arising from the use of this software. 7 8 Permission is granted to anyone to use this software for any purpose, 9 including commercial applications, and to alter it and redistribute it 10 freely. 11*/ 12 13#include "testnative.h" 14 15#ifdef TEST_NATIVE_X11 16 17#include <X11/Xlib.h> 18 19static void *CreateWindowX11(int w, int h); 20static void DestroyWindowX11(void *window); 21 22NativeWindowFactory X11WindowFactory = { 23 "x11", 24 CreateWindowX11, 25 DestroyWindowX11 26}; 27 28static Display *dpy; 29 30static void * 31CreateWindowX11(int w, int h) 32{ 33 Window window = 0; 34 35 dpy = XOpenDisplay(NULL); 36 if (dpy) { 37 window = 38 XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, w, h, 0, 0, 39 0); 40 XMapRaised(dpy, window); 41 XSync(dpy, False); 42 } 43 return (void *)window; 44} 45 46static void 47DestroyWindowX11(void *window) 48{ 49 if (dpy) { 50 XDestroyWindow(dpy, (Window)window); 51 XCloseDisplay(dpy); 52 } 53} 54 55#endif 56
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.