chromium/third_party/dawn/third_party/glfw/src/x11_window.c

//========================================================================
// 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 <X11/cursorfont.h>
#include <X11/Xmd.h>

#include <poll.h>

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
#include <assert.h>

// Action for EWMH client messages
#define _NET_WM_STATE_REMOVE
#define _NET_WM_STATE_ADD
#define _NET_WM_STATE_TOGGLE

// Additional mouse button names for XButtonEvent
#define Button6
#define Button7

// Motif WM hints flags
#define MWM_HINTS_DECORATIONS
#define MWM_DECOR_ALL

#define _GLFW_XDND_VERSION

// Wait for event data to arrive on the X11 display socket
// This avoids blocking other threads via the per-display Xlib lock that also
// covers GLX functions
//
static GLFWbool waitForX11Event(double* timeout)
{}

// Wait for event data to arrive on any event file descriptor
// This avoids blocking other threads via the per-display Xlib lock that also
// covers GLX functions
//
static GLFWbool waitForAnyEvent(double* timeout)
{}

// Writes a byte to the empty event pipe
//
static void writeEmptyEvent(void)
{}

// Drains available data from the empty event pipe
//
static void drainEmptyEvents(void)
{}

// Waits until a VisibilityNotify event arrives for the specified window or the
// timeout period elapses (ICCCM section 4.2.2)
//
static GLFWbool waitForVisibilityNotify(_GLFWwindow* window)
{}

// Returns whether the window is iconified
//
static int getWindowState(_GLFWwindow* window)
{}

// Returns whether the event is a selection event
//
static Bool isSelectionEvent(Display* display, XEvent* event, XPointer pointer)
{}

// Returns whether it is a _NET_FRAME_EXTENTS event for the specified window
//
static Bool isFrameExtentsEvent(Display* display, XEvent* event, XPointer pointer)
{}

// Returns whether it is a property event for the specified selection transfer
//
static Bool isSelPropNewValueNotify(Display* display, XEvent* event, XPointer pointer)
{}

// Translates an X event modifier state mask
//
static int translateState(int state)
{}

// Translates an X11 key code to a GLFW key token
//
static int translateKey(int scancode)
{}

// Sends an EWMH or ICCCM event to the window manager
//
static void sendEventToWM(_GLFWwindow* window, Atom type,
                          long a, long b, long c, long d, long e)
{}

// Updates the normal hints according to the window settings
//
static void updateNormalHints(_GLFWwindow* window, int width, int height)
{}

// Updates the full screen status of the window
//
static void updateWindowMode(_GLFWwindow* window)
{}

// Decode a Unicode code point from a UTF-8 stream
// Based on cutef8 by Jeff Bezanson (Public Domain)
//
static uint32_t decodeUTF8(const char** s)
{}

// Convert the specified Latin-1 string to UTF-8
//
static char* convertLatin1toUTF8(const char* source)
{}

// Updates the cursor image according to its cursor mode
//
static void updateCursorImage(_GLFWwindow* window)
{}

// Grabs the cursor and confines it to the window
//
static void captureCursor(_GLFWwindow* window)
{}

// Ungrabs the cursor
//
static void releaseCursor(void)
{}

// Enable XI2 raw mouse motion events
//
static void enableRawMouseMotion(_GLFWwindow* window)
{}

// Disable XI2 raw mouse motion events
//
static void disableRawMouseMotion(_GLFWwindow* window)
{}

// Apply disabled cursor mode to a focused window
//
static void disableCursor(_GLFWwindow* window)
{}

// Exit disabled cursor mode for the specified window
//
static void enableCursor(_GLFWwindow* window)
{}

// Clear its handle when the input context has been destroyed
//
static void inputContextDestroyCallback(XIC ic, XPointer clientData, XPointer callData)
{}

// Create the X11 window (and its colormap)
//
static GLFWbool createNativeWindow(_GLFWwindow* window,
                                   const _GLFWwndconfig* wndconfig,
                                   Visual* visual, int depth)
{}

// Set the specified property to the selection converted to the requested target
//
static Atom writeTargetToProperty(const XSelectionRequestEvent* request)
{}

static void handleSelectionRequest(XEvent* event)
{}

static const char* getSelectionString(Atom selection)
{}

// Make the specified window and its video mode active on its monitor
//
static void acquireMonitor(_GLFWwindow* window)
{}

// Remove the window and restore the original video mode
//
static void releaseMonitor(_GLFWwindow* window)
{}

// Process the specified X event
//
static void processEvent(XEvent *event)
{}


//////////////////////////////////////////////////////////////////////////
//////                       GLFW internal API                      //////
//////////////////////////////////////////////////////////////////////////

// Retrieve a single window property of the specified type
// Inspired by fghGetWindowProperty from freeglut
//
unsigned long _glfwGetWindowPropertyX11(Window window,
                                        Atom property,
                                        Atom type,
                                        unsigned char** value)
{}

GLFWbool _glfwIsVisualTransparentX11(Visual* visual)
{}

// Push contents of our selection to clipboard manager
//
void _glfwPushSelectionToManagerX11(void)
{}

void _glfwCreateInputContextX11(_GLFWwindow* window)
{}


//////////////////////////////////////////////////////////////////////////
//////                       GLFW platform API                      //////
//////////////////////////////////////////////////////////////////////////

GLFWbool _glfwCreateWindowX11(_GLFWwindow* window,
                              const _GLFWwndconfig* wndconfig,
                              const _GLFWctxconfig* ctxconfig,
                              const _GLFWfbconfig* fbconfig)
{}

void _glfwDestroyWindowX11(_GLFWwindow* window)
{}

void _glfwSetWindowTitleX11(_GLFWwindow* window, const char* title)
{}

void _glfwSetWindowIconX11(_GLFWwindow* window, int count, const GLFWimage* images)
{}

void _glfwGetWindowPosX11(_GLFWwindow* window, int* xpos, int* ypos)
{}

void _glfwSetWindowPosX11(_GLFWwindow* window, int xpos, int ypos)
{}

void _glfwGetWindowSizeX11(_GLFWwindow* window, int* width, int* height)
{}

void _glfwSetWindowSizeX11(_GLFWwindow* window, int width, int height)
{}

void _glfwSetWindowSizeLimitsX11(_GLFWwindow* window,
                                 int minwidth, int minheight,
                                 int maxwidth, int maxheight)
{}

void _glfwSetWindowAspectRatioX11(_GLFWwindow* window, int numer, int denom)
{}

void _glfwGetFramebufferSizeX11(_GLFWwindow* window, int* width, int* height)
{}

void _glfwGetWindowFrameSizeX11(_GLFWwindow* window,
                                int* left, int* top,
                                int* right, int* bottom)
{}

void _glfwGetWindowContentScaleX11(_GLFWwindow* window, float* xscale, float* yscale)
{}

void _glfwIconifyWindowX11(_GLFWwindow* window)
{}

void _glfwRestoreWindowX11(_GLFWwindow* window)
{}

void _glfwMaximizeWindowX11(_GLFWwindow* window)
{}

void _glfwShowWindowX11(_GLFWwindow* window)
{}

void _glfwHideWindowX11(_GLFWwindow* window)
{}

void _glfwRequestWindowAttentionX11(_GLFWwindow* window)
{}

void _glfwFocusWindowX11(_GLFWwindow* window)
{}

void _glfwSetWindowMonitorX11(_GLFWwindow* window,
                              _GLFWmonitor* monitor,
                              int xpos, int ypos,
                              int width, int height,
                              int refreshRate)
{}

GLFWbool _glfwWindowFocusedX11(_GLFWwindow* window)
{}

GLFWbool _glfwWindowIconifiedX11(_GLFWwindow* window)
{}

GLFWbool _glfwWindowVisibleX11(_GLFWwindow* window)
{}

GLFWbool _glfwWindowMaximizedX11(_GLFWwindow* window)
{}

GLFWbool _glfwWindowHoveredX11(_GLFWwindow* window)
{}

GLFWbool _glfwFramebufferTransparentX11(_GLFWwindow* window)
{}

void _glfwSetWindowResizableX11(_GLFWwindow* window, GLFWbool enabled)
{}

void _glfwSetWindowDecoratedX11(_GLFWwindow* window, GLFWbool enabled)
{}

void _glfwSetWindowFloatingX11(_GLFWwindow* window, GLFWbool enabled)
{}

void _glfwSetWindowMousePassthroughX11(_GLFWwindow* window, GLFWbool enabled)
{}

float _glfwGetWindowOpacityX11(_GLFWwindow* window)
{}

void _glfwSetWindowOpacityX11(_GLFWwindow* window, float opacity)
{}

void _glfwSetRawMouseMotionX11(_GLFWwindow *window, GLFWbool enabled)
{}

GLFWbool _glfwRawMouseMotionSupportedX11(void)
{}

void _glfwPollEventsX11(void)
{}

void _glfwWaitEventsX11(void)
{}

void _glfwWaitEventsTimeoutX11(double timeout)
{}

void _glfwPostEmptyEventX11(void)
{}

void _glfwGetCursorPosX11(_GLFWwindow* window, double* xpos, double* ypos)
{}

void _glfwSetCursorPosX11(_GLFWwindow* window, double x, double y)
{}

void _glfwSetCursorModeX11(_GLFWwindow* window, int mode)
{}

const char* _glfwGetScancodeNameX11(int scancode)
{}

int _glfwGetKeyScancodeX11(int key)
{}

GLFWbool _glfwCreateCursorX11(_GLFWcursor* cursor,
                              const GLFWimage* image,
                              int xhot, int yhot)
{}

GLFWbool _glfwCreateStandardCursorX11(_GLFWcursor* cursor, int shape)
{}

void _glfwDestroyCursorX11(_GLFWcursor* cursor)
{}

void _glfwSetCursorX11(_GLFWwindow* window, _GLFWcursor* cursor)
{}

void _glfwSetClipboardStringX11(const char* string)
{}

const char* _glfwGetClipboardStringX11(void)
{}

EGLenum _glfwGetEGLPlatformX11(EGLint** attribs)
{}

EGLNativeDisplayType _glfwGetEGLNativeDisplayX11(void)
{}

EGLNativeWindowType _glfwGetEGLNativeWindowX11(_GLFWwindow* window)
{}

void _glfwGetRequiredInstanceExtensionsX11(char** extensions)
{}

GLFWbool _glfwGetPhysicalDevicePresentationSupportX11(VkInstance instance,
                                                      VkPhysicalDevice device,
                                                      uint32_t queuefamily)
{}

VkResult _glfwCreateWindowSurfaceX11(VkInstance instance,
                                     _GLFWwindow* window,
                                     const VkAllocationCallbacks* allocator,
                                     VkSurfaceKHR* surface)
{}


//////////////////////////////////////////////////////////////////////////
//////                        GLFW native API                       //////
//////////////////////////////////////////////////////////////////////////

GLFWAPI Display* glfwGetX11Display(void)
{}

GLFWAPI Window glfwGetX11Window(GLFWwindow* handle)
{}

GLFWAPI void glfwSetX11SelectionString(const char* string)
{}

GLFWAPI const char* glfwGetX11SelectionString(void)
{}

#endif // _GLFW_X11