//======================================================================== // GLFW 3.5 X11 - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy <[email protected]> // // 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, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source // distribution. // //======================================================================== #include "internal.h" #if defined(_GLFW_X11) #include <stdlib.h> #include <string.h> #include <limits.h> #include <stdio.h> #include <locale.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <assert.h> // Translate the X11 KeySyms for a key to a GLFW key code // NOTE: This is only used as a fallback, in case the XKB method fails // It is layout-dependent and will fail partially on most non-US layouts // static int translateKeySyms(const KeySym* keysyms, int width) { … } // Create key code translation tables // static void createKeyTables(void) { … } // Check whether the IM has a usable style // static GLFWbool hasUsableInputMethodStyle(void) { … } static void inputMethodDestroyCallback(XIM im, XPointer clientData, XPointer callData) { … } static void inputMethodInstantiateCallback(Display* display, XPointer clientData, XPointer callData) { … } // Return the atom ID only if it is listed in the specified array // static Atom getAtomIfSupported(Atom* supportedAtoms, unsigned long atomCount, const char* atomName) { … } // Check whether the running window manager is EWMH-compliant // static void detectEWMH(void) { … } // Look for and initialize supported X11 extensions // static GLFWbool initExtensions(void) { … } // Retrieve system content scale via folklore heuristics // static void getSystemContentScale(float* xscale, float* yscale) { … } // Create a blank cursor for hidden and disabled cursor modes // static Cursor createHiddenCursor(void) { … } // Create a helper window for IPC // static Window createHelperWindow(void) { … } // Create the pipe for empty events without assumuing the OS has pipe2(2) // static GLFWbool createEmptyEventPipe(void) { … } // X error handler // static int errorHandler(Display *display, XErrorEvent* event) { … } ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// // Sets the X error handler callback // void _glfwGrabErrorHandlerX11(void) { … } // Clears the X error handler callback // void _glfwReleaseErrorHandlerX11(void) { … } // Reports the specified error, appending information about the last X error // void _glfwInputErrorX11(int error, const char* message) { … } // Creates a native cursor object from the specified image and hotspot // Cursor _glfwCreateNativeCursorX11(const GLFWimage* image, int xhot, int yhot) { … } ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform) { … } int _glfwInitX11(void) { … } void _glfwTerminateX11(void) { … } #endif // _GLFW_X11