initial
This commit is contained in:
commit
ded8dbba8c
199 changed files with 367950 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
build
|
||||||
3
NOTES.MD
Normal file
3
NOTES.MD
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
For a release build you can do
|
||||||
|
upx --best --lzma game_desktop.bin
|
||||||
|
Though apparently this is somewhat problematic
|
||||||
12
assets/shaders/base.frag
Normal file
12
assets/shaders/base.frag
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
#version 120
|
||||||
|
|
||||||
|
varying vec2 texcoord;
|
||||||
|
varying vec4 color;
|
||||||
|
varying vec2 pixel_position;
|
||||||
|
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec4 colDiffuse;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
gl_FragColor = texture2D(texture0, texcoord) * colDiffuse;
|
||||||
|
}
|
||||||
19
assets/shaders/base.vert
Normal file
19
assets/shaders/base.vert
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
#version 120
|
||||||
|
|
||||||
|
attribute vec3 vertexPosition;
|
||||||
|
attribute vec2 vertexTexCoord;
|
||||||
|
attribute vec3 vertexNormal;
|
||||||
|
attribute vec4 vertexColor;
|
||||||
|
|
||||||
|
uniform mat4 mvp;
|
||||||
|
|
||||||
|
varying vec2 texcoord;
|
||||||
|
varying vec4 color;
|
||||||
|
varying vec2 pixel_position;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
texcoord = vertexTexCoord;
|
||||||
|
color = vertexColor;
|
||||||
|
pixel_position = vertexPosition.xy;
|
||||||
|
gl_Position = mvp * vec4(vertexPosition, 1.0);
|
||||||
|
}
|
||||||
7
build_desktop.sh
Executable file
7
build_desktop.sh
Executable file
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash -eu
|
||||||
|
|
||||||
|
OUT_DIR="build/desktop"
|
||||||
|
mkdir -p $OUT_DIR
|
||||||
|
odin build . -strict-style -out:$OUT_DIR/game_desktop.bin -no-bounds-check -disable-assert -o:size -extra-linker-flags:"-Wl,--gc-sections,-s"
|
||||||
|
cp -R ./assets/ ./$OUT_DIR/
|
||||||
|
echo "Desktop build created in ${OUT_DIR}"
|
||||||
37
build_web.sh
Executable file
37
build_web.sh
Executable file
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash -eu
|
||||||
|
|
||||||
|
# Point this to where you installed emscripten. Optional on systems that already
|
||||||
|
# have `emcc` in the path.
|
||||||
|
EMSCRIPTEN_SDK_DIR="$HOME/programs/emsdk"
|
||||||
|
OUT_DIR="build/web"
|
||||||
|
|
||||||
|
mkdir -p $OUT_DIR
|
||||||
|
|
||||||
|
export EMSDK_QUIET=1
|
||||||
|
[[ -f "$EMSCRIPTEN_SDK_DIR/emsdk_env.sh" ]] && . "$EMSCRIPTEN_SDK_DIR/emsdk_env.sh"
|
||||||
|
|
||||||
|
# Note RAYLIB_WASM_LIB=env.o -- env.o is an internal WASM object file. You can
|
||||||
|
# see how RAYLIB_WASM_LIB is used inside <odin>/vendor/raylib/raylib.odin.
|
||||||
|
#
|
||||||
|
# The emcc call will be fed the actual raylib library file. That stuff will end
|
||||||
|
# up in env.o
|
||||||
|
#
|
||||||
|
# Note that there is a rayGUI equivalent: -define:RAYGUI_WASM_LIB=env.o
|
||||||
|
odin build . -target:js_wasm32 -build-mode:obj -define:RAYLIB_WASM_LIB=env.o -define:RAYGUI_WASM_LIB=env.o -vet -strict-style -out:$OUT_DIR/game.wasm.obj
|
||||||
|
|
||||||
|
ODIN_PATH=$(odin root)
|
||||||
|
|
||||||
|
cp $ODIN_PATH/core/sys/wasm/js/odin.js $OUT_DIR
|
||||||
|
|
||||||
|
files="$OUT_DIR/game.wasm.obj libraries/raylib/wasm/libraylib.a libraries/raylib/wasm/libraygui.a"
|
||||||
|
|
||||||
|
# index_template.html contains the javascript code that calls the procedures in
|
||||||
|
# source/main_web/main_web.odin
|
||||||
|
flags="-Oz -sASSERTIONS=0 --closure 0 -sEXPORTED_RUNTIME_METHODS=['HEAPF32'] -sUSE_GLFW=3 -sWASM_BIGINT -sWARN_ON_UNDEFINED_SYMBOLS=0 -sDECLARE_ASM_MODULE_EXPORTS=0 --shell-file index_template.html --preload-file assets"
|
||||||
|
|
||||||
|
# For debugging: Add `-g` to `emcc` (gives better error callstack in chrome)
|
||||||
|
emcc -o $OUT_DIR/index.html $files $flags
|
||||||
|
|
||||||
|
rm $OUT_DIR/game.wasm.obj
|
||||||
|
|
||||||
|
echo "Web build created in ${OUT_DIR}"
|
||||||
114
index_template.html
Normal file
114
index_template.html
Normal file
|
|
@ -0,0 +1,114 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en-us">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
|
||||||
|
<title>Odin + Raylib on the web</title>
|
||||||
|
<meta name="title" content="Odin + Raylib on the web">
|
||||||
|
<meta name="description" content="Make games using Odin + Raylib that work in the browser">
|
||||||
|
<meta name="viewport" content="width=device-width">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0px;
|
||||||
|
overflow: hidden;
|
||||||
|
background-color: black;
|
||||||
|
}
|
||||||
|
canvas.game_canvas {
|
||||||
|
border: 0px none;
|
||||||
|
background-color: black;
|
||||||
|
padding-left: 0;
|
||||||
|
padding-right: 0;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<canvas class="game_canvas" id="canvas" oncontextmenu="event.preventDefault()" tabindex="-1" onmousedown="event.target.focus()" onkeydown="event.preventDefault()"></canvas>
|
||||||
|
<script type="text/javascript" src="odin.js"></script>
|
||||||
|
<script>
|
||||||
|
var odinMemoryInterface = new odin.WasmMemoryInterface();
|
||||||
|
odinMemoryInterface.setIntSize(4);
|
||||||
|
var odinImports = odin.setupDefaultImports(odinMemoryInterface);
|
||||||
|
|
||||||
|
// The Module is used as configuration for emscripten.
|
||||||
|
var Module = {
|
||||||
|
// This is called by emscripten when it starts up.
|
||||||
|
instantiateWasm: (imports, successCallback) => {
|
||||||
|
const newImports = {
|
||||||
|
...odinImports,
|
||||||
|
...imports
|
||||||
|
}
|
||||||
|
|
||||||
|
return WebAssembly.instantiateStreaming(fetch("index.wasm"), newImports).then(function(output) {
|
||||||
|
var e = output.instance.exports;
|
||||||
|
odinMemoryInterface.setExports(e);
|
||||||
|
odinMemoryInterface.setMemory(e.memory);
|
||||||
|
return successCallback(output.instance);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// This happens a bit after `instantiateWasm`, when everything is
|
||||||
|
// done setting up. At that point we can run code.
|
||||||
|
onRuntimeInitialized: () => {
|
||||||
|
var e = wasmExports;
|
||||||
|
|
||||||
|
// Calls any procedure marked with @init
|
||||||
|
e._start();
|
||||||
|
|
||||||
|
// See source/main_web/main_web.odin for main_start,
|
||||||
|
// main_update and main_end.
|
||||||
|
e.main_start();
|
||||||
|
|
||||||
|
function send_resize() {
|
||||||
|
var canvas = document.getElementById('canvas');
|
||||||
|
e.web_window_size_changed(canvas.width, canvas.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('resize', function(event) {
|
||||||
|
send_resize();
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
// This can probably be done better: Ideally we'd feed the
|
||||||
|
// initial size to `main_start`. But there seems to be a
|
||||||
|
// race condition. `canvas` doesn't have it's correct size yet.
|
||||||
|
send_resize();
|
||||||
|
|
||||||
|
// Runs the "main loop".
|
||||||
|
function do_main_update() {
|
||||||
|
if (!e.main_update()) {
|
||||||
|
e.main_end();
|
||||||
|
|
||||||
|
// Calls procedures marked with @fini
|
||||||
|
e._end();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
window.requestAnimationFrame(do_main_update);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.requestAnimationFrame(do_main_update);
|
||||||
|
},
|
||||||
|
print: (function() {
|
||||||
|
var element = document.getElementById("output");
|
||||||
|
if (element) element.value = ''; // clear browser cache
|
||||||
|
return function(text) {
|
||||||
|
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
|
||||||
|
console.log(text);
|
||||||
|
if (element) {
|
||||||
|
element.value += text + "\n";
|
||||||
|
element.scrollTop = element.scrollHeight; // focus on bottom
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})(),
|
||||||
|
canvas: (function() {
|
||||||
|
return document.getElementById("canvas");
|
||||||
|
})()
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- Emscripten injects its javascript here -->
|
||||||
|
{{{ SCRIPT }}}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
16
libraries/raylib/LICENSE
Normal file
16
libraries/raylib/LICENSE
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
Copyright (c) 2013-2026 Ramon Santamaria (@raysan5)
|
||||||
|
|
||||||
|
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.
|
||||||
101
libraries/raylib/build.sh
Executable file
101
libraries/raylib/build.sh
Executable file
|
|
@ -0,0 +1,101 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
emsdk_env="$HOME/programs/emsdk/emsdk_env.sh"
|
||||||
|
modules="RAYLIB_MODULE_AUDIO=FALSE RAYLIB_MODULE_RAYGUI=FALSE RAYLIB_MODULE_MODELS=FALSE"
|
||||||
|
linux_library_dest="../../linux"
|
||||||
|
windows_library_dest="../../windows"
|
||||||
|
darwin_library_dest="../../darwin"
|
||||||
|
wasm_library_dest="../../wasm"
|
||||||
|
|
||||||
|
config_cflags="\
|
||||||
|
-DSUPPORT_MODULE_RSHAPES=1 \
|
||||||
|
-DSUPPORT_MODULE_RTEXTURES=1 \
|
||||||
|
-DSUPPORT_MODULE_RTEXT=1 \
|
||||||
|
-DSUPPORT_MODULE_RMODELS=0 \
|
||||||
|
-DSUPPORT_MODULE_RAUDIO=0 \
|
||||||
|
-DSUPPORT_TRACELOG=0 \
|
||||||
|
-DSUPPORT_CAMERA_SYSTEM=0 \
|
||||||
|
-DSUPPORT_GESTURES_SYSTEM=0 \
|
||||||
|
-DSUPPORT_RPRAND_GENERATOR=0 \
|
||||||
|
-DSUPPORT_MOUSE_GESTURES=0 \
|
||||||
|
-DSUPPORT_SSH_KEYBOARD_RPI=0 \
|
||||||
|
-DSUPPORT_WINMM_HIGHRES_TIMER=0 \
|
||||||
|
-DSUPPORT_BUSY_WAIT_LOOP=0 \
|
||||||
|
-DSUPPORT_PARTIALBUSY_WAIT_LOOP=0 \
|
||||||
|
-DSUPPORT_SCREEN_CAPTURE=0 \
|
||||||
|
-DSUPPORT_COMPRESSION_API=0 \
|
||||||
|
-DSUPPORT_AUTOMATION_EVENTS=0 \
|
||||||
|
-DSUPPORT_CUSTOM_FRAME_CONTROL=0 \
|
||||||
|
-DSUPPORT_CLIPBOARD_IMAGE=0 \
|
||||||
|
-DRLGL_ENABLE_OPENGL_DEBUG_CONTEXT=0 \
|
||||||
|
-DRLGL_SHOW_GL_DETAILS_INFO=0 \
|
||||||
|
-DSUPPORT_QUADS_DRAW_MODE=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_PNG=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_BMP=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_TGA=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_JPG=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_GIF=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_QOI=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_PEP=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_PSD=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_DDS=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_HDR=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_PIC=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_PNM=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_KTX=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_ASTC=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_PKM=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_PVR=0 \
|
||||||
|
-DSUPPORT_IMAGE_EXPORT=0 \
|
||||||
|
-DSUPPORT_IMAGE_GENERATION=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_TTF=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_FNT=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_BDF=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_OBJ=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_MTL=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_IQM=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_GLTF=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_VOX=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_M3D=0 \
|
||||||
|
-DSUPPORT_MESH_GENERATION=0 \
|
||||||
|
-DSUPPORT_GPU_SKINNING=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_WAV=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_OGG=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_MP3=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_QOA=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_FLAC=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_XM=0 \
|
||||||
|
-DSUPPORT_FILEFORMAT_MOD=0"
|
||||||
|
|
||||||
|
source $emsdk_env
|
||||||
|
|
||||||
|
pushd raylib/src
|
||||||
|
echo "Compiling raylib static library for linux"
|
||||||
|
make --silent $modules RAYLIB_CONFIG_FLAGS="$config_cflags" CUSTOM_CFLAGS="-Os -ffunction-sections -fdata-sections" PLATFORM_OS=LINUX
|
||||||
|
mv libraylib.a $linux_library_dest
|
||||||
|
make --silent clean
|
||||||
|
|
||||||
|
# echo "Compiling static library for windows"
|
||||||
|
# make --silent $modules RAYLIB_CONFIG_FLAGS="$config_cflags" CC=x86_64-w64-mingw32-gcc PLATFORM_OS=WINDOWS
|
||||||
|
# mv libraylib.a $windows_library_dest
|
||||||
|
# make --silent clean
|
||||||
|
|
||||||
|
echo "Compiling static library for web"
|
||||||
|
make --silent $modules RAYLIB_CONFIG_FLAGS="$config_cflags" PLATFORM=PLATFORM_WEB
|
||||||
|
mv libraylib.web.a libraylib.a
|
||||||
|
mv libraylib.a $wasm_library_dest
|
||||||
|
make --silent clean
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd raygui
|
||||||
|
echo "Compiling raygui static library for linux"
|
||||||
|
gcc -c -Os -ffunction-sections -fdata-sections -fPIC -x c -DRAYGUI_IMPLEMENTATION -I../raylib/src raygui.h -o raygui.o
|
||||||
|
ar rcs ../linux/libraygui.a raygui.o
|
||||||
|
rm raygui.o
|
||||||
|
|
||||||
|
echo "Compiling raygui static library for web"
|
||||||
|
emcc -c -Os -ffunction-sections -fdata-sections -x c -DRAYGUI_IMPLEMENTATION -DPLATFORM_WEB -I../raylib/src raygui.h -o raygui_wasm.o
|
||||||
|
emar rcs ../wasm/libraygui.a raygui_wasm.o
|
||||||
|
rm raygui_wasm.o
|
||||||
|
popd
|
||||||
223
libraries/raylib/easings.odin
Normal file
223
libraries/raylib/easings.odin
Normal file
|
|
@ -0,0 +1,223 @@
|
||||||
|
package raylib
|
||||||
|
|
||||||
|
import "core:math"
|
||||||
|
|
||||||
|
EaseLinearNone :: proc(t, b, c, d: f32) -> f32 { return (c*t/d + b) }
|
||||||
|
EaseLinearIn :: proc(t, b, c, d: f32) -> f32 { return (c*t/d + b) }
|
||||||
|
EaseLinearOut :: proc(t, b, c, d: f32) -> f32 { return (c*t/d + b) }
|
||||||
|
EaseLinearInOut :: proc(t, b, c, d: f32) -> f32 { return (c*t/d + b) }
|
||||||
|
|
||||||
|
// Sine Easing functions
|
||||||
|
EaseSineIn :: proc(t, b, c, d: f32) -> f32 { return (-c*math.cos(t/d*(PI/2.0)) + c + b) }
|
||||||
|
EaseSineOut :: proc(t, b, c, d: f32) -> f32 { return (c*math.sin(t/d*(PI/2.0)) + b) }
|
||||||
|
EaseSineInOut :: proc(t, b, c, d: f32) -> f32 { return (-c/2.0*(math.cos(PI*t/d) - 1.0) + b) }
|
||||||
|
|
||||||
|
// Circular Easing functions
|
||||||
|
EaseCircIn :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t /= d
|
||||||
|
return -c*(math.sqrt(1.0 - t*t) - 1.0) + b
|
||||||
|
}
|
||||||
|
EaseCircOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t = t/d - 1.0
|
||||||
|
return c*math.sqrt(1.0 - t*t) + b
|
||||||
|
}
|
||||||
|
EaseCircInOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t /= d/2.0
|
||||||
|
if t < 1.0 {
|
||||||
|
return -c/2.0*(math.sqrt(1.0 - t*t) - 1.0) + b
|
||||||
|
}
|
||||||
|
t -= 2.0
|
||||||
|
return c/2.0*(math.sqrt(1.0 - t*t) + 1.0) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cubic Easing functions
|
||||||
|
EaseCubicIn :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t /= d
|
||||||
|
return c*t*t*t + b
|
||||||
|
}
|
||||||
|
EaseCubicOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t = t/d - 1.0
|
||||||
|
return c*(t*t*t + 1.0) + b
|
||||||
|
}
|
||||||
|
EaseCubicInOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t /= d/2.0
|
||||||
|
if t < 1.0 {
|
||||||
|
return c/2.0*t*t*t + b
|
||||||
|
}
|
||||||
|
t -= 2.0
|
||||||
|
return c/2.0*(t*t*t + 2.0) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
// Quadratic Easing functions
|
||||||
|
EaseQuadIn :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t /= d
|
||||||
|
return c*t*t + b
|
||||||
|
}
|
||||||
|
EaseQuadOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t /= d
|
||||||
|
return -c*t*(t - 2.0) + b
|
||||||
|
}
|
||||||
|
EaseQuadInOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t /= d/2.0
|
||||||
|
if t < 1 {
|
||||||
|
return ((c/2)*(t*t)) + b
|
||||||
|
}
|
||||||
|
return -c/2.0*(((t - 1.0)*(t - 3.0)) - 1.0) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exponential Easing functions
|
||||||
|
EaseExpoIn :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
return (t == 0.0) ? b : (c*math.pow(2.0, 10.0*(t/d - 1.0)) + b)
|
||||||
|
}
|
||||||
|
EaseExpoOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
return (t == d) ? (b + c) : (c*(-math.pow(2.0, -10.0*t/d) + 1.0) + b)
|
||||||
|
}
|
||||||
|
EaseExpoInOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
if t == 0.0 {
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
if t == d {
|
||||||
|
return b + c
|
||||||
|
}
|
||||||
|
t := t
|
||||||
|
t /= d/2.0
|
||||||
|
if t < 1.0 {
|
||||||
|
return c/2.0*math.pow(2.0, 10.0*(t - 1.0)) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
return c/2.0*(-math.pow(2.0, -10.0*(t - 1.0)) + 2.0) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
// Back Easing functions
|
||||||
|
EaseBackIn :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
s :: 1.70158
|
||||||
|
t := t
|
||||||
|
t /= d
|
||||||
|
postFix := t
|
||||||
|
return (c*(postFix)*t*((s + 1.0)*t - s) + b)
|
||||||
|
}
|
||||||
|
|
||||||
|
EaseBackOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
s :: 1.70158
|
||||||
|
t = t/d - 1.0
|
||||||
|
return (c*(t*t*((s + 1.0)*t + s) + 1.0) + b)
|
||||||
|
}
|
||||||
|
|
||||||
|
EaseBackInOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
s := f32(1.70158)
|
||||||
|
t /= d/2
|
||||||
|
if t < 1.0 {
|
||||||
|
s *= 1.525
|
||||||
|
return (c/2.0*(t*t*((s + 1.0)*t - s)) + b)
|
||||||
|
}
|
||||||
|
|
||||||
|
t -= 2
|
||||||
|
postFix := t
|
||||||
|
s *= 1.525
|
||||||
|
return (c/2.0*((postFix)*t*((s + 1.0)*t + s) + 2.0) + b)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bounce Easing functions
|
||||||
|
EaseBounceOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
t := t
|
||||||
|
t /= d
|
||||||
|
switch {
|
||||||
|
case t < 1.0/2.75:
|
||||||
|
return (c*(7.5625*t*t) + b)
|
||||||
|
case t < 2.0/2.75:
|
||||||
|
t -= 1.5/2.75
|
||||||
|
postFix := t
|
||||||
|
return (c*(7.5625*(postFix)*t + 0.75) + b)
|
||||||
|
case t < 2.5/2.75:
|
||||||
|
t -= 2.25/2.75
|
||||||
|
postFix := t
|
||||||
|
return (c*(7.5625*(postFix)*t + 0.9375) + b)
|
||||||
|
case:
|
||||||
|
t -= 2.625/2.75
|
||||||
|
postFix := t
|
||||||
|
return (c*(7.5625*(postFix)*t + 0.984375) + b)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EaseBounceIn :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
return c - EaseBounceOut(d - t, 0.0, c, d) + b
|
||||||
|
}
|
||||||
|
EaseBounceInOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
if t < d/2.0 {
|
||||||
|
return EaseBounceIn(t*2.0, 0.0, c, d)*0.5 + b
|
||||||
|
} else {
|
||||||
|
return EaseBounceOut(t*2.0 - d, 0.0, c, d)*0.5 + c*0.5 + b
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Elastic Easing functions
|
||||||
|
EaseElasticIn :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
if t == 0.0 {
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
t := t
|
||||||
|
t /= d
|
||||||
|
if t == 1.0 {
|
||||||
|
return b + c
|
||||||
|
}
|
||||||
|
|
||||||
|
p := d*0.3
|
||||||
|
a := c
|
||||||
|
s := p/4.0
|
||||||
|
t -= 1
|
||||||
|
postFix := a*math.pow(2.0, 10.0*t)
|
||||||
|
|
||||||
|
return -(postFix*math.sin((t*d-s)*(2.0*PI)/p )) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
EaseElasticOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
if t == 0.0 {
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
t := t
|
||||||
|
t /= d
|
||||||
|
if t == 1.0 {
|
||||||
|
return b + c
|
||||||
|
}
|
||||||
|
|
||||||
|
p := d*0.3
|
||||||
|
a := c
|
||||||
|
s := p/4.0
|
||||||
|
|
||||||
|
return a*math.pow(2.0,-10.0*t)*math.sin((t*d-s)*(2.0*PI)/p) + c + b
|
||||||
|
}
|
||||||
|
|
||||||
|
EaseElasticInOut :: proc(t, b, c, d: f32) -> f32 {
|
||||||
|
if t == 0.0 {
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
t := t
|
||||||
|
t /= d/2.0
|
||||||
|
if t == 2.0 {
|
||||||
|
return b + c
|
||||||
|
}
|
||||||
|
|
||||||
|
p := d*(0.3*1.5)
|
||||||
|
a := c
|
||||||
|
s := p/4.0
|
||||||
|
|
||||||
|
t -= 1
|
||||||
|
if t < 1.0 {
|
||||||
|
postFix := a*math.pow(2.0, 10.0*t)
|
||||||
|
return -0.5*(postFix*math.sin((t*d-s)*(2.0*PI)/p)) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
postFix := a*math.pow(2.0, -10.0*t)
|
||||||
|
return (postFix*math.sin((t*d-s)*(2.0*PI)/p)*0.5 + c + b)
|
||||||
|
}
|
||||||
BIN
libraries/raylib/linux/libraygui.a
Normal file
BIN
libraries/raylib/linux/libraygui.a
Normal file
Binary file not shown.
BIN
libraries/raylib/linux/libraylib.a
Normal file
BIN
libraries/raylib/linux/libraylib.a
Normal file
Binary file not shown.
566
libraries/raylib/raygui.odin
Normal file
566
libraries/raylib/raygui.odin
Normal file
|
|
@ -0,0 +1,566 @@
|
||||||
|
package raylib
|
||||||
|
|
||||||
|
import "core:c"
|
||||||
|
|
||||||
|
RAYGUI_SHARED :: #config(RAYGUI_SHARED, false)
|
||||||
|
RAYGUI_WASM_LIB :: #config(RAYGUI_WASM_LIB, "wasm/libraygui.a")
|
||||||
|
|
||||||
|
when ODIN_OS == .Windows {
|
||||||
|
foreign import lib {
|
||||||
|
"windows/rayguidll.lib" when RAYGUI_SHARED else "windows/raygui.lib",
|
||||||
|
}
|
||||||
|
} else when ODIN_OS == .Linux {
|
||||||
|
foreign import lib {
|
||||||
|
"linux/libraygui.so" when RAYGUI_SHARED else "linux/libraygui.a",
|
||||||
|
}
|
||||||
|
} else when ODIN_OS == .Darwin {
|
||||||
|
when ODIN_ARCH == .arm64 {
|
||||||
|
foreign import lib {
|
||||||
|
"macos/libraygui-arm64.dylib" when RAYGUI_SHARED else "macos/libraygui-arm64.a",
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreign import lib {
|
||||||
|
"macos/libraygui.dylib" when RAYGUI_SHARED else "macos/libraygui.a",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
|
||||||
|
foreign import lib {
|
||||||
|
RAYGUI_WASM_LIB,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreign import lib "system:raygui"
|
||||||
|
}
|
||||||
|
|
||||||
|
RAYGUI_VERSION :: "4.0"
|
||||||
|
|
||||||
|
// Gui control state
|
||||||
|
GuiState :: enum c.int {
|
||||||
|
STATE_NORMAL = 0,
|
||||||
|
STATE_FOCUSED,
|
||||||
|
STATE_PRESSED,
|
||||||
|
STATE_DISABLED,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gui control text alignment
|
||||||
|
GuiTextAlignment :: enum c.int {
|
||||||
|
TEXT_ALIGN_LEFT = 0,
|
||||||
|
TEXT_ALIGN_CENTER,
|
||||||
|
TEXT_ALIGN_RIGHT,
|
||||||
|
}
|
||||||
|
|
||||||
|
GuiTextAlignmentVertical :: enum c.int {
|
||||||
|
TEXT_ALIGN_TOP = 0,
|
||||||
|
TEXT_ALIGN_MIDDLE,
|
||||||
|
TEXT_ALIGN_BOTTOM,
|
||||||
|
}
|
||||||
|
|
||||||
|
GuiTextWrapMode :: enum c.int {
|
||||||
|
TEXT_WRAP_NONE = 0,
|
||||||
|
TEXT_WRAP_CHAR,
|
||||||
|
TEXT_WRAP_WORD,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gui controls
|
||||||
|
GuiControl :: enum c.int {
|
||||||
|
// Default -> populates to all controls when set
|
||||||
|
DEFAULT = 0,
|
||||||
|
// Basic controls
|
||||||
|
LABEL, // Used also for: LABELBUTTON
|
||||||
|
BUTTON,
|
||||||
|
TOGGLE, // Used also for: TOGGLEGROUP
|
||||||
|
SLIDER, // Used also for: SLIDERBAR
|
||||||
|
PROGRESSBAR,
|
||||||
|
CHECKBOX,
|
||||||
|
COMBOBOX,
|
||||||
|
DROPDOWNBOX,
|
||||||
|
TEXTBOX, // Used also for: TEXTBOXMULTI
|
||||||
|
VALUEBOX,
|
||||||
|
SPINNER, // Uses: BUTTON, VALUEBOX
|
||||||
|
LISTVIEW,
|
||||||
|
COLORPICKER,
|
||||||
|
SCROLLBAR,
|
||||||
|
STATUSBAR,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gui base properties for every control
|
||||||
|
// NOTE: RAYGUI_MAX_PROPS_BASE properties (by default 16 properties)
|
||||||
|
GuiControlProperty :: enum c.int {
|
||||||
|
BORDER_COLOR_NORMAL = 0,
|
||||||
|
BASE_COLOR_NORMAL,
|
||||||
|
TEXT_COLOR_NORMAL,
|
||||||
|
BORDER_COLOR_FOCUSED,
|
||||||
|
BASE_COLOR_FOCUSED,
|
||||||
|
TEXT_COLOR_FOCUSED,
|
||||||
|
BORDER_COLOR_PRESSED,
|
||||||
|
BASE_COLOR_PRESSED,
|
||||||
|
TEXT_COLOR_PRESSED,
|
||||||
|
BORDER_COLOR_DISABLED,
|
||||||
|
BASE_COLOR_DISABLED,
|
||||||
|
TEXT_COLOR_DISABLED,
|
||||||
|
BORDER_WIDTH,
|
||||||
|
TEXT_PADDING,
|
||||||
|
TEXT_ALIGNMENT,
|
||||||
|
RESERVED,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gui extended properties depend on control
|
||||||
|
// NOTE: RAYGUI_MAX_PROPS_EXTENDED properties (by default, max 8 properties)
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// DEFAULT extended properties
|
||||||
|
// NOTE: Those properties are common to all controls or global
|
||||||
|
GuiDefaultProperty :: enum c.int {
|
||||||
|
TEXT_SIZE = 16, // Text size (glyphs max height)
|
||||||
|
TEXT_SPACING, // Text spacing between glyphs
|
||||||
|
LINE_COLOR, // Line control color
|
||||||
|
BACKGROUND_COLOR, // Background color
|
||||||
|
TEXT_LINE_SPACING, // Text spacing between lines
|
||||||
|
TEXT_ALIGNMENT_VERTICAL, // Text vertical alignment inside text bounds (after border and padding)
|
||||||
|
TEXT_WRAP_MODE, // Text wrap-mode inside text bounds
|
||||||
|
}
|
||||||
|
|
||||||
|
// Label
|
||||||
|
//GuiLabelProperty :: enum c.int { }
|
||||||
|
|
||||||
|
// Button/Spinner
|
||||||
|
//GuiButtonProperty :: enum c.int { }
|
||||||
|
|
||||||
|
// Toggle/ToggleGroup
|
||||||
|
GuiToggleProperty :: enum c.int {
|
||||||
|
GROUP_PADDING = 16, // ToggleGroup separation between toggles
|
||||||
|
}
|
||||||
|
|
||||||
|
// Slider/SliderBar
|
||||||
|
GuiSliderProperty :: enum c.int {
|
||||||
|
SLIDER_WIDTH = 16, // Slider size of internal bar
|
||||||
|
SLIDER_PADDING, // Slider/SliderBar internal bar padding
|
||||||
|
}
|
||||||
|
|
||||||
|
// ProgressBar
|
||||||
|
GuiProgressBarProperty :: enum c.int {
|
||||||
|
PROGRESS_PADDING = 16, // ProgressBar internal padding
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScrollBar
|
||||||
|
GuiScrollBarProperty :: enum c.int {
|
||||||
|
ARROWS_SIZE = 16,
|
||||||
|
ARROWS_VISIBLE,
|
||||||
|
SCROLL_SLIDER_PADDING, // (SLIDERBAR, SLIDER_PADDING)
|
||||||
|
SCROLL_SLIDER_SIZE,
|
||||||
|
SCROLL_PADDING,
|
||||||
|
SCROLL_SPEED,
|
||||||
|
}
|
||||||
|
|
||||||
|
// CheckBox
|
||||||
|
GuiCheckBoxProperty :: enum c.int {
|
||||||
|
CHECK_PADDING = 16, // CheckBox internal check padding
|
||||||
|
}
|
||||||
|
|
||||||
|
// ComboBox
|
||||||
|
GuiComboBoxProperty :: enum c.int {
|
||||||
|
COMBO_BUTTON_WIDTH = 16, // ComboBox right button width
|
||||||
|
COMBO_BUTTON_SPACING, // ComboBox button separation
|
||||||
|
}
|
||||||
|
|
||||||
|
// DropdownBox
|
||||||
|
GuiDropdownBoxProperty :: enum c.int {
|
||||||
|
ARROW_PADDING = 16, // DropdownBox arrow separation from border and items
|
||||||
|
DROPDOWN_ITEMS_SPACING, // DropdownBox items separation
|
||||||
|
}
|
||||||
|
|
||||||
|
// TextBox/TextBoxMulti/ValueBox/Spinner
|
||||||
|
GuiTextBoxProperty :: enum c.int {
|
||||||
|
TEXT_READONLY = 16, // TextBox in read-only mode: 0-text editable, 1-text no-editable
|
||||||
|
}
|
||||||
|
|
||||||
|
// Spinner
|
||||||
|
GuiSpinnerProperty :: enum c.int {
|
||||||
|
SPIN_BUTTON_WIDTH = 16, // Spinner left/right buttons width
|
||||||
|
SPIN_BUTTON_SPACING, // Spinner buttons separation
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListView
|
||||||
|
GuiListViewProperty :: enum c.int {
|
||||||
|
LIST_ITEMS_HEIGHT = 16, // ListView items height
|
||||||
|
LIST_ITEMS_SPACING, // ListView items separation
|
||||||
|
SCROLLBAR_WIDTH, // ListView scrollbar size (usually width)
|
||||||
|
SCROLLBAR_SIDE, // ListView scrollbar side (0-left, 1-right)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ColorPicker
|
||||||
|
GuiColorPickerProperty :: enum c.int {
|
||||||
|
COLOR_SELECTOR_SIZE = 16,
|
||||||
|
HUEBAR_WIDTH, // ColorPicker right hue bar width
|
||||||
|
HUEBAR_PADDING, // ColorPicker right hue bar separation from panel
|
||||||
|
HUEBAR_SELECTOR_HEIGHT, // ColorPicker right hue bar selector height
|
||||||
|
HUEBAR_SELECTOR_OVERFLOW, // ColorPicker right hue bar selector overflow
|
||||||
|
}
|
||||||
|
|
||||||
|
SCROLLBAR_LEFT_SIDE :: 0
|
||||||
|
SCROLLBAR_RIGHT_SIDE :: 1
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Global Variables Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// ...
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module Functions Declaration
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@(default_calling_convention="c")
|
||||||
|
foreign lib {
|
||||||
|
// WASM does not have foreign variable declarations.
|
||||||
|
when ODIN_ARCH != .wasm32 && ODIN_ARCH != .wasm64p32 {
|
||||||
|
@(link_name="raylib_version") version: cstring
|
||||||
|
}
|
||||||
|
// Global gui state control functions
|
||||||
|
|
||||||
|
GuiEnable :: proc() --- // Enable gui controls (global state)
|
||||||
|
GuiLock :: proc() --- // Lock gui controls (global state)
|
||||||
|
GuiDisable :: proc() --- // Disable gui controls (global state)
|
||||||
|
GuiUnlock :: proc() --- // Unlock gui controls (global state)
|
||||||
|
GuiIsLocked :: proc() -> bool --- // Check if gui is locked (global state)
|
||||||
|
GuiSetAlpha :: proc(alpha: f32) --- // Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f
|
||||||
|
GuiSetState :: proc(state: c.int) --- // Set gui state (global state)
|
||||||
|
GuiGetState :: proc() -> c.int --- // Get gui state (global state)
|
||||||
|
|
||||||
|
// Font set/get functions
|
||||||
|
|
||||||
|
GuiSetFont :: proc(font: Font) --- // Set gui custom font (global state)
|
||||||
|
GuiGetFont :: proc() -> Font --- // Get gui custom font (global state)
|
||||||
|
|
||||||
|
// Style set/get functions
|
||||||
|
|
||||||
|
GuiSetStyle :: proc(control: GuiControl, property: c.int, value: c.int) --- // Set one style property
|
||||||
|
GuiGetStyle :: proc(control: GuiControl, property: c.int) -> c.int --- // Get one style property
|
||||||
|
|
||||||
|
// Styles loading functions
|
||||||
|
|
||||||
|
GuiLoadStyle :: proc(fileName: cstring) --- // Load style file over global style variable (.rgs)
|
||||||
|
GuiLoadStyleDefault :: proc() --- // Load style default over global style
|
||||||
|
|
||||||
|
// Tooltips management functions
|
||||||
|
|
||||||
|
GuiEnableTooltip :: proc() --- // Enable gui tooltips (global state)
|
||||||
|
GuiDisableTooltip :: proc() --- // Disable gui tooltips (global state)
|
||||||
|
GuiSetTooltip :: proc(tooltip: cstring) --- // Set tooltip string
|
||||||
|
|
||||||
|
// Icons functionality
|
||||||
|
|
||||||
|
GuiIconText :: proc(iconId: GuiIconName, text: cstring) -> cstring --- // Get text with icon id prepended (if supported)
|
||||||
|
GuiSetIconScale :: proc(scale: c.int) --- // Set default icon drawing size
|
||||||
|
GuiGetIcons :: proc() -> [^]u32 --- // Get raygui icons data pointer
|
||||||
|
GuiLoadIcons :: proc(fileName: cstring, loadIconsName: bool) -> [^]cstring --- // Load raygui icons file (.rgi) into internal icons data
|
||||||
|
GuiDrawIcon :: proc(iconId: GuiIconName, posX, posY: c.int, pixelSize: c.int, color: Color) --- // Draw icon using pixel size at specified position
|
||||||
|
|
||||||
|
|
||||||
|
// Controls
|
||||||
|
//----------------------------------------------------------------------------------------------------------
|
||||||
|
// Container/separator controls, useful for controls organization
|
||||||
|
|
||||||
|
GuiWindowBox :: proc(bounds: Rectangle, title: cstring) -> c.int --- // Window Box control, shows a window that can be closed
|
||||||
|
GuiGroupBox :: proc(bounds: Rectangle, text: cstring) -> c.int --- // Group Box control with text name
|
||||||
|
GuiLine :: proc(bounds: Rectangle, text: cstring) -> c.int --- // Line separator control, could contain text
|
||||||
|
GuiPanel :: proc(bounds: Rectangle, text: cstring) -> c.int --- // Panel control, useful to group controls
|
||||||
|
GuiTabBar :: proc(bounds: Rectangle, text: [^]cstring, count: c.int, active: ^c.int) -> c.int --- // Tab Bar control, returns TAB to be closed or -1
|
||||||
|
GuiScrollPanel :: proc(bounds: Rectangle, text: cstring, content: Rectangle, scroll: ^Vector2, view: ^Rectangle) -> c.int --- // Scroll Panel control
|
||||||
|
|
||||||
|
// Basic controls set
|
||||||
|
|
||||||
|
GuiLabel :: proc(bounds: Rectangle, text: cstring) -> c.int --- // Label control, shows text
|
||||||
|
GuiButton :: proc(bounds: Rectangle, text: cstring) -> bool --- // Button control, returns true when clicked
|
||||||
|
GuiLabelButton :: proc(bounds: Rectangle, text: cstring) -> bool --- // Label button control, show true when clicked
|
||||||
|
GuiToggle :: proc(bounds: Rectangle, text: cstring, active: ^bool) -> c.int --- // Toggle Button control, returns true when active
|
||||||
|
GuiToggleGroup :: proc(bounds: Rectangle, text: cstring, active: ^c.int) -> c.int --- // Toggle Group control, returns active toggle index
|
||||||
|
GuiToggleSlider :: proc(bounds: Rectangle, text: cstring, active: ^c.int) -> c.int ---
|
||||||
|
GuiCheckBox :: proc(bounds: Rectangle, text: cstring, checked: ^bool) -> bool --- // Check Box control, returns true when active
|
||||||
|
GuiComboBox :: proc(bounds: Rectangle, text: cstring, active: ^c.int) -> c.int --- // Combo Box control, returns selected item index
|
||||||
|
|
||||||
|
GuiDropdownBox :: proc(bounds: Rectangle, text: cstring, active: ^c.int, editMode: bool) -> bool --- // Dropdown Box control, returns selected item
|
||||||
|
GuiSpinner :: proc(bounds: Rectangle, text: cstring, value: ^c.int, minValue, maxValue: c.int, editMode: bool) -> c.int --- // Spinner control, returns selected value
|
||||||
|
GuiValueBox :: proc(bounds: Rectangle, text: cstring, value: ^c.int, minValue, maxValue: c.int, editMode: bool) -> c.int --- // Value Box control, updates input text with numbers
|
||||||
|
GuiTextBox :: proc(bounds: Rectangle, text: cstring, textSize: c.int, editMode: bool) -> bool --- // Text Box control, updates input text
|
||||||
|
|
||||||
|
GuiSlider :: proc(bounds: Rectangle, textLeft: cstring, textRight: cstring, value: ^f32, minValue: f32, maxValue: f32) -> c.int --- // Slider control, returns selected value
|
||||||
|
GuiSliderBar :: proc(bounds: Rectangle, textLeft: cstring, textRight: cstring, value: ^f32, minValue: f32, maxValue: f32) -> c.int --- // Slider Bar control, returns selected value
|
||||||
|
GuiProgressBar :: proc(bounds: Rectangle, textLeft: cstring, textRight: cstring, value: ^f32, minValue: f32, maxValue: f32) -> c.int --- // Progress Bar control, shows current progress value
|
||||||
|
GuiStatusBar :: proc(bounds: Rectangle, text: cstring) -> c.int --- // Status Bar control, shows info text
|
||||||
|
GuiDummyRec :: proc(bounds: Rectangle, text: cstring) -> c.int --- // Dummy control for placeholders
|
||||||
|
GuiGrid :: proc(bounds: Rectangle, text: cstring, spacing: f32, subdivs: c.int, mouseCell: ^Vector2) -> c.int --- // Grid control, returns mouse cell position
|
||||||
|
|
||||||
|
// Advance controls set
|
||||||
|
GuiListView :: proc(bounds: Rectangle, text: cstring, scrollIndex: ^c.int, active: ^c.int) -> c.int --- // List View control, returns selected list item index
|
||||||
|
GuiListViewEx :: proc(bounds: Rectangle, text:[^]cstring, count: c.int, scrollIndex: ^c.int, active: ^c.int, focus: ^c.int) -> c.int --- // List View with extended parameters
|
||||||
|
GuiMessageBox :: proc(bounds: Rectangle, title: cstring, message: cstring, buttons: cstring) -> c.int --- // Message Box control, displays a message
|
||||||
|
GuiTextInputBox :: proc(bounds: Rectangle, title: cstring, message: cstring, buttons: cstring, text: cstring, textMaxSize: c.int, secretViewActive: ^bool) -> c.int --- // Text Input Box control, ask for text, supports secret
|
||||||
|
GuiColorPicker :: proc(bounds: Rectangle, text: cstring, color: ^Color) -> c.int --- // Color Picker control (multiple color controls)
|
||||||
|
GuiColorPanel :: proc(bounds: Rectangle, text: cstring, color: ^Color) -> c.int --- // Color Panel control
|
||||||
|
GuiColorBarAlpha :: proc(bounds: Rectangle, text: cstring, alpha: ^f32) -> c.int --- // Color Bar Alpha control
|
||||||
|
GuiColorBarHue :: proc(bounds: Rectangle, text: cstring, value: ^f32) -> c.int --- // Color Bar Hue control
|
||||||
|
GuiColorPickerHSV :: proc(bounds: Rectangle, text: cstring, colorHsv: ^Vector3) -> c.int --- // Color Picker control that avoids conversion to RGB on each call (multiple color controls)
|
||||||
|
GuiColorPanelHSV :: proc(bounds: Rectangle, text: cstring, colorHsv: ^Vector3) -> c.int --- // Color Panel control that returns HSV color value, used by GuiColorPickerHSV()
|
||||||
|
//----------------------------------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Icons enumeration
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
GuiIconName :: enum c.int {
|
||||||
|
ICON_NONE = 0,
|
||||||
|
ICON_FOLDER_FILE_OPEN = 1,
|
||||||
|
ICON_FILE_SAVE_CLASSIC = 2,
|
||||||
|
ICON_FOLDER_OPEN = 3,
|
||||||
|
ICON_FOLDER_SAVE = 4,
|
||||||
|
ICON_FILE_OPEN = 5,
|
||||||
|
ICON_FILE_SAVE = 6,
|
||||||
|
ICON_FILE_EXPORT = 7,
|
||||||
|
ICON_FILE_ADD = 8,
|
||||||
|
ICON_FILE_DELETE = 9,
|
||||||
|
ICON_FILETYPE_TEXT = 10,
|
||||||
|
ICON_FILETYPE_AUDIO = 11,
|
||||||
|
ICON_FILETYPE_IMAGE = 12,
|
||||||
|
ICON_FILETYPE_PLAY = 13,
|
||||||
|
ICON_FILETYPE_VIDEO = 14,
|
||||||
|
ICON_FILETYPE_INFO = 15,
|
||||||
|
ICON_FILE_COPY = 16,
|
||||||
|
ICON_FILE_CUT = 17,
|
||||||
|
ICON_FILE_PASTE = 18,
|
||||||
|
ICON_CURSOR_HAND = 19,
|
||||||
|
ICON_CURSOR_POINTER = 20,
|
||||||
|
ICON_CURSOR_CLASSIC = 21,
|
||||||
|
ICON_PENCIL = 22,
|
||||||
|
ICON_PENCIL_BIG = 23,
|
||||||
|
ICON_BRUSH_CLASSIC = 24,
|
||||||
|
ICON_BRUSH_PAINTER = 25,
|
||||||
|
ICON_WATER_DROP = 26,
|
||||||
|
ICON_COLOR_PICKER = 27,
|
||||||
|
ICON_RUBBER = 28,
|
||||||
|
ICON_COLOR_BUCKET = 29,
|
||||||
|
ICON_TEXT_T = 30,
|
||||||
|
ICON_TEXT_A = 31,
|
||||||
|
ICON_SCALE = 32,
|
||||||
|
ICON_RESIZE = 33,
|
||||||
|
ICON_FILTER_POINT = 34,
|
||||||
|
ICON_FILTER_BILINEAR = 35,
|
||||||
|
ICON_CROP = 36,
|
||||||
|
ICON_CROP_ALPHA = 37,
|
||||||
|
ICON_SQUARE_TOGGLE = 38,
|
||||||
|
ICON_SYMMETRY = 39,
|
||||||
|
ICON_SYMMETRY_HORIZONTAL = 40,
|
||||||
|
ICON_SYMMETRY_VERTICAL = 41,
|
||||||
|
ICON_LENS = 42,
|
||||||
|
ICON_LENS_BIG = 43,
|
||||||
|
ICON_EYE_ON = 44,
|
||||||
|
ICON_EYE_OFF = 45,
|
||||||
|
ICON_FILTER_TOP = 46,
|
||||||
|
ICON_FILTER = 47,
|
||||||
|
ICON_TARGET_POINT = 48,
|
||||||
|
ICON_TARGET_SMALL = 49,
|
||||||
|
ICON_TARGET_BIG = 50,
|
||||||
|
ICON_TARGET_MOVE = 51,
|
||||||
|
ICON_CURSOR_MOVE = 52,
|
||||||
|
ICON_CURSOR_SCALE = 53,
|
||||||
|
ICON_CURSOR_SCALE_RIGHT = 54,
|
||||||
|
ICON_CURSOR_SCALE_LEFT = 55,
|
||||||
|
ICON_UNDO = 56,
|
||||||
|
ICON_REDO = 57,
|
||||||
|
ICON_REREDO = 58,
|
||||||
|
ICON_MUTATE = 59,
|
||||||
|
ICON_ROTATE = 60,
|
||||||
|
ICON_REPEAT = 61,
|
||||||
|
ICON_SHUFFLE = 62,
|
||||||
|
ICON_EMPTYBOX = 63,
|
||||||
|
ICON_TARGET = 64,
|
||||||
|
ICON_TARGET_SMALL_FILL = 65,
|
||||||
|
ICON_TARGET_BIG_FILL = 66,
|
||||||
|
ICON_TARGET_MOVE_FILL = 67,
|
||||||
|
ICON_CURSOR_MOVE_FILL = 68,
|
||||||
|
ICON_CURSOR_SCALE_FILL = 69,
|
||||||
|
ICON_CURSOR_SCALE_RIGHT_FILL = 70,
|
||||||
|
ICON_CURSOR_SCALE_LEFT_FILL = 71,
|
||||||
|
ICON_UNDO_FILL = 72,
|
||||||
|
ICON_REDO_FILL = 73,
|
||||||
|
ICON_REREDO_FILL = 74,
|
||||||
|
ICON_MUTATE_FILL = 75,
|
||||||
|
ICON_ROTATE_FILL = 76,
|
||||||
|
ICON_REPEAT_FILL = 77,
|
||||||
|
ICON_SHUFFLE_FILL = 78,
|
||||||
|
ICON_EMPTYBOX_SMALL = 79,
|
||||||
|
ICON_BOX = 80,
|
||||||
|
ICON_BOX_TOP = 81,
|
||||||
|
ICON_BOX_TOP_RIGHT = 82,
|
||||||
|
ICON_BOX_RIGHT = 83,
|
||||||
|
ICON_BOX_BOTTOM_RIGHT = 84,
|
||||||
|
ICON_BOX_BOTTOM = 85,
|
||||||
|
ICON_BOX_BOTTOM_LEFT = 86,
|
||||||
|
ICON_BOX_LEFT = 87,
|
||||||
|
ICON_BOX_TOP_LEFT = 88,
|
||||||
|
ICON_BOX_CENTER = 89,
|
||||||
|
ICON_BOX_CIRCLE_MASK = 90,
|
||||||
|
ICON_POT = 91,
|
||||||
|
ICON_ALPHA_MULTIPLY = 92,
|
||||||
|
ICON_ALPHA_CLEAR = 93,
|
||||||
|
ICON_DITHERING = 94,
|
||||||
|
ICON_MIPMAPS = 95,
|
||||||
|
ICON_BOX_GRID = 96,
|
||||||
|
ICON_GRID = 97,
|
||||||
|
ICON_BOX_CORNERS_SMALL = 98,
|
||||||
|
ICON_BOX_CORNERS_BIG = 99,
|
||||||
|
ICON_FOUR_BOXES = 100,
|
||||||
|
ICON_GRID_FILL = 101,
|
||||||
|
ICON_BOX_MULTISIZE = 102,
|
||||||
|
ICON_ZOOM_SMALL = 103,
|
||||||
|
ICON_ZOOM_MEDIUM = 104,
|
||||||
|
ICON_ZOOM_BIG = 105,
|
||||||
|
ICON_ZOOM_ALL = 106,
|
||||||
|
ICON_ZOOM_CENTER = 107,
|
||||||
|
ICON_BOX_DOTS_SMALL = 108,
|
||||||
|
ICON_BOX_DOTS_BIG = 109,
|
||||||
|
ICON_BOX_CONCENTRIC = 110,
|
||||||
|
ICON_BOX_GRID_BIG = 111,
|
||||||
|
ICON_OK_TICK = 112,
|
||||||
|
ICON_CROSS = 113,
|
||||||
|
ICON_ARROW_LEFT = 114,
|
||||||
|
ICON_ARROW_RIGHT = 115,
|
||||||
|
ICON_ARROW_DOWN = 116,
|
||||||
|
ICON_ARROW_UP = 117,
|
||||||
|
ICON_ARROW_LEFT_FILL = 118,
|
||||||
|
ICON_ARROW_RIGHT_FILL = 119,
|
||||||
|
ICON_ARROW_DOWN_FILL = 120,
|
||||||
|
ICON_ARROW_UP_FILL = 121,
|
||||||
|
ICON_AUDIO = 122,
|
||||||
|
ICON_FX = 123,
|
||||||
|
ICON_WAVE = 124,
|
||||||
|
ICON_WAVE_SINUS = 125,
|
||||||
|
ICON_WAVE_SQUARE = 126,
|
||||||
|
ICON_WAVE_TRIANGULAR = 127,
|
||||||
|
ICON_CROSS_SMALL = 128,
|
||||||
|
ICON_PLAYER_PREVIOUS = 129,
|
||||||
|
ICON_PLAYER_PLAY_BACK = 130,
|
||||||
|
ICON_PLAYER_PLAY = 131,
|
||||||
|
ICON_PLAYER_PAUSE = 132,
|
||||||
|
ICON_PLAYER_STOP = 133,
|
||||||
|
ICON_PLAYER_NEXT = 134,
|
||||||
|
ICON_PLAYER_RECORD = 135,
|
||||||
|
ICON_MAGNET = 136,
|
||||||
|
ICON_LOCK_CLOSE = 137,
|
||||||
|
ICON_LOCK_OPEN = 138,
|
||||||
|
ICON_CLOCK = 139,
|
||||||
|
ICON_TOOLS = 140,
|
||||||
|
ICON_GEAR = 141,
|
||||||
|
ICON_GEAR_BIG = 142,
|
||||||
|
ICON_BIN = 143,
|
||||||
|
ICON_HAND_POINTER = 144,
|
||||||
|
ICON_LASER = 145,
|
||||||
|
ICON_COIN = 146,
|
||||||
|
ICON_EXPLOSION = 147,
|
||||||
|
ICON_1UP = 148,
|
||||||
|
ICON_PLAYER = 149,
|
||||||
|
ICON_PLAYER_JUMP = 150,
|
||||||
|
ICON_KEY = 151,
|
||||||
|
ICON_DEMON = 152,
|
||||||
|
ICON_TEXT_POPUP = 153,
|
||||||
|
ICON_GEAR_EX = 154,
|
||||||
|
ICON_CRACK = 155,
|
||||||
|
ICON_CRACK_POINTS = 156,
|
||||||
|
ICON_STAR = 157,
|
||||||
|
ICON_DOOR = 158,
|
||||||
|
ICON_EXIT = 159,
|
||||||
|
ICON_MODE_2D = 160,
|
||||||
|
ICON_MODE_3D = 161,
|
||||||
|
ICON_CUBE = 162,
|
||||||
|
ICON_CUBE_FACE_TOP = 163,
|
||||||
|
ICON_CUBE_FACE_LEFT = 164,
|
||||||
|
ICON_CUBE_FACE_FRONT = 165,
|
||||||
|
ICON_CUBE_FACE_BOTTOM = 166,
|
||||||
|
ICON_CUBE_FACE_RIGHT = 167,
|
||||||
|
ICON_CUBE_FACE_BACK = 168,
|
||||||
|
ICON_CAMERA = 169,
|
||||||
|
ICON_SPECIAL = 170,
|
||||||
|
ICON_LINK_NET = 171,
|
||||||
|
ICON_LINK_BOXES = 172,
|
||||||
|
ICON_LINK_MULTI = 173,
|
||||||
|
ICON_LINK = 174,
|
||||||
|
ICON_LINK_BROKE = 175,
|
||||||
|
ICON_TEXT_NOTES = 176,
|
||||||
|
ICON_NOTEBOOK = 177,
|
||||||
|
ICON_SUITCASE = 178,
|
||||||
|
ICON_SUITCASE_ZIP = 179,
|
||||||
|
ICON_MAILBOX = 180,
|
||||||
|
ICON_MONITOR = 181,
|
||||||
|
ICON_PRINTER = 182,
|
||||||
|
ICON_PHOTO_CAMERA = 183,
|
||||||
|
ICON_PHOTO_CAMERA_FLASH = 184,
|
||||||
|
ICON_HOUSE = 185,
|
||||||
|
ICON_HEART = 186,
|
||||||
|
ICON_CORNER = 187,
|
||||||
|
ICON_VERTICAL_BARS = 188,
|
||||||
|
ICON_VERTICAL_BARS_FILL = 189,
|
||||||
|
ICON_LIFE_BARS = 190,
|
||||||
|
ICON_INFO = 191,
|
||||||
|
ICON_CROSSLINE = 192,
|
||||||
|
ICON_HELP = 193,
|
||||||
|
ICON_FILETYPE_ALPHA = 194,
|
||||||
|
ICON_FILETYPE_HOME = 195,
|
||||||
|
ICON_LAYERS_VISIBLE = 196,
|
||||||
|
ICON_LAYERS = 197,
|
||||||
|
ICON_WINDOW = 198,
|
||||||
|
ICON_HIDPI = 199,
|
||||||
|
ICON_FILETYPE_BINARY = 200,
|
||||||
|
ICON_HEX = 201,
|
||||||
|
ICON_SHIELD = 202,
|
||||||
|
ICON_FILE_NEW = 203,
|
||||||
|
ICON_FOLDER_ADD = 204,
|
||||||
|
ICON_ALARM = 205,
|
||||||
|
ICON_CPU = 206,
|
||||||
|
ICON_ROM = 207,
|
||||||
|
ICON_STEP_OVER = 208,
|
||||||
|
ICON_STEP_INTO = 209,
|
||||||
|
ICON_STEP_OUT = 210,
|
||||||
|
ICON_RESTART = 211,
|
||||||
|
ICON_BREAKPOINT_ON = 212,
|
||||||
|
ICON_BREAKPOINT_OFF = 213,
|
||||||
|
ICON_BURGER_MENU = 214,
|
||||||
|
ICON_CASE_SENSITIVE = 215,
|
||||||
|
ICON_REG_EXP = 216,
|
||||||
|
ICON_FOLDER = 217,
|
||||||
|
ICON_FILE = 218,
|
||||||
|
ICON_SAND_TIMER = 219,
|
||||||
|
ICON_220 = 220,
|
||||||
|
ICON_221 = 221,
|
||||||
|
ICON_222 = 222,
|
||||||
|
ICON_223 = 223,
|
||||||
|
ICON_224 = 224,
|
||||||
|
ICON_225 = 225,
|
||||||
|
ICON_226 = 226,
|
||||||
|
ICON_227 = 227,
|
||||||
|
ICON_228 = 228,
|
||||||
|
ICON_229 = 229,
|
||||||
|
ICON_230 = 230,
|
||||||
|
ICON_231 = 231,
|
||||||
|
ICON_232 = 232,
|
||||||
|
ICON_233 = 233,
|
||||||
|
ICON_234 = 234,
|
||||||
|
ICON_235 = 235,
|
||||||
|
ICON_236 = 236,
|
||||||
|
ICON_237 = 237,
|
||||||
|
ICON_238 = 238,
|
||||||
|
ICON_239 = 239,
|
||||||
|
ICON_240 = 240,
|
||||||
|
ICON_241 = 241,
|
||||||
|
ICON_242 = 242,
|
||||||
|
ICON_243 = 243,
|
||||||
|
ICON_244 = 244,
|
||||||
|
ICON_245 = 245,
|
||||||
|
ICON_246 = 246,
|
||||||
|
ICON_247 = 247,
|
||||||
|
ICON_248 = 248,
|
||||||
|
ICON_249 = 249,
|
||||||
|
ICON_250 = 250,
|
||||||
|
ICON_251 = 251,
|
||||||
|
ICON_252 = 252,
|
||||||
|
ICON_253 = 253,
|
||||||
|
ICON_254 = 254,
|
||||||
|
ICON_255 = 255,
|
||||||
|
}
|
||||||
17
libraries/raylib/raygui/HISTORY.md
Normal file
17
libraries/raylib/raygui/HISTORY.md
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
## raygui history
|
||||||
|
|
||||||
|
raygui development started on December 2014 by two internship students (Kevin and Daniel) guided by me, objective was creating a simple and easy-to-use immediate-mode-gui module for raylib, intended for tools development. On June 2015, library was mostly functional (including basic controls) and we started working in the styling posibilities for the library, focusing on an easy way to style controls properties. Consequently, development of [rGuiStyler](https://raylibtech.itch.io/rguistyler) also started at that point... but resources were quite limited and project was stopped for several months, most of the time was invested in [raylib](https://github.com/raysan5/raylib) development.
|
||||||
|
|
||||||
|
On June 2016, project was picked up again and raygui 1.0 was released by the end of that month. During August 2016, raygui was used to develop [rFXGen](https://github.com/raysan5/rfxgen) and also an early protoype of [rGuiLayout](https://raylibtech.itch.io/rguilayout), those tools were a testbed for the library. By the end of 2016, raygui project development was stopped again for several months.
|
||||||
|
|
||||||
|
On June 2017, a complete redesign of the library started, almost from scratch, all functions were reviewed and mostly rewritten and a brand new styling system was developed. The objective was using raygui professionally in several tools. It was the beginning of raygui 2.0.
|
||||||
|
|
||||||
|
On January 2018, two students (Adria and Jordi) started working on raygui and related tools; library evolved considerably in the following months. [rGuiStyler](https://raylibtech.itch.io/rguistyler) was completely redesigned and rewritten from scratch (rGuiStyler v2.0). [rGuiLayout](https://raylibtech.itch.io/rguilayout) turned from a protoype into a professional software and raygui reached version 2.0 with plenty of new controls and features.
|
||||||
|
|
||||||
|
On July 2018, I started working full time on raygui and its tools, improving the library considerably. On October 2018 [Sergio](https://github.com/anidealgift) joined the project and focused efforts on [rGuiLayout](https://raylibtech.itch.io/rguilayout) tool redesign. We reached 2019 with continuous improvement and redesigns of mostly all raygui functions along rGuiLayout 2.0 and rGuiStyler 3.0.
|
||||||
|
|
||||||
|
On March 2019, the first set of new raygui tools was published: [rFXGen 2.0](https://raylibtech.itch.io/rfxgen), [rTexViewer 1.0](https://raylibtech.itch.io/rtexviewer) and [rIconPacker 1.0](https://raylibtech.itch.io/riconpacker).
|
||||||
|
|
||||||
|
From March 2019 to June 2019 raygui development decelerated, Sergio left the project and efforts were focused on raylib 2.5, during this time one external contributor, [Vlad Adrian](https://github.com/Demizdor), completely redesigned `GuiTextBox()` and related controls and version was bumped to raygui 2.5.
|
||||||
|
|
||||||
|
During summer 2019 lots of raygui functions were reviewed, breaking compatibility to any previous version and pointing to a **raygui 2.6** update.
|
||||||
18
libraries/raylib/raygui/LICENSE
Normal file
18
libraries/raylib/raygui/LICENSE
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
zlib License
|
||||||
|
|
||||||
|
Copyright (c) 2014-2026 Ramon Santamaria (@raysan5)
|
||||||
|
|
||||||
|
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.
|
||||||
6460
libraries/raylib/raygui/raygui.h
Normal file
6460
libraries/raylib/raygui/raygui.h
Normal file
File diff suppressed because it is too large
Load diff
1842
libraries/raylib/raylib.odin
Normal file
1842
libraries/raylib/raylib.odin
Normal file
File diff suppressed because it is too large
Load diff
3403
libraries/raylib/raylib/CHANGELOG
Normal file
3403
libraries/raylib/raylib/CHANGELOG
Normal file
File diff suppressed because it is too large
Load diff
16
libraries/raylib/raylib/LICENSE
Normal file
16
libraries/raylib/raylib/LICENSE
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
Copyright (c) 2013-2026 Ramon Santamaria (@raysan5)
|
||||||
|
|
||||||
|
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.
|
||||||
152
libraries/raylib/raylib/README.md
Normal file
152
libraries/raylib/raylib/README.md
Normal file
|
|
@ -0,0 +1,152 @@
|
||||||
|
<img align="left" style="width:260px" src="https://github.com/raysan5/raylib/blob/master/logo/raylib_logo_animation.gif" width="288px">
|
||||||
|
|
||||||
|
**raylib is a simple and easy-to-use library to enjoy videogames programming.**
|
||||||
|
|
||||||
|
raylib is highly inspired by Borland BGI graphics lib and by XNA framework and it's especially well suited for prototyping, tooling, graphical applications, embedded systems and education.
|
||||||
|
|
||||||
|
*NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no debug button... just coding in the most pure spartan-programmers way.*
|
||||||
|
|
||||||
|
Ready to learn? Jump to [code examples!](https://www.raylib.com/examples.html)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
[](https://github.com/raysan5/raylib/releases)
|
||||||
|
[](https://github.com/raysan5/raylib/stargazers)
|
||||||
|
[](https://github.com/raysan5/raylib/commits/master)
|
||||||
|
[](https://github.com/sponsors/raysan5)
|
||||||
|
[](https://repology.org/project/raylib/versions)
|
||||||
|
[](LICENSE)
|
||||||
|
|
||||||
|
[](https://discord.gg/raylib)
|
||||||
|
[](https://www.reddit.com/r/raylib/)
|
||||||
|
[](https://www.youtube.com/c/raylib)
|
||||||
|
[](https://www.twitch.tv/raysan5)
|
||||||
|
|
||||||
|
[](https://github.com/raysan5/raylib/actions/workflows/build_windows.yml)
|
||||||
|
[](https://github.com/raysan5/raylib/actions/workflows/build_linux.yml)
|
||||||
|
[](https://github.com/raysan5/raylib/actions/workflows/build_macos.yml)
|
||||||
|
[](https://github.com/raysan5/raylib/actions/workflows/build_webassembly.yml)
|
||||||
|
|
||||||
|
[](https://github.com/raysan5/raylib/actions/workflows/build_cmake.yml)
|
||||||
|
[](https://github.com/raysan5/raylib/actions/workflows/build_examples_windows.yml)
|
||||||
|
[](https://github.com/raysan5/raylib/actions/workflows/build_examples_linux.yml)
|
||||||
|
|
||||||
|
features
|
||||||
|
--------
|
||||||
|
- **NO external dependencies**, all required libraries are [included into raylib](https://github.com/raysan5/raylib/tree/master/src/external)
|
||||||
|
- Multiple platforms supported: **Windows, Linux, MacOS, RPI, Android, HTML5... and more!**
|
||||||
|
- Written in plain C code (C99) using PascalCase/camelCase notation
|
||||||
|
- Hardware accelerated with OpenGL: **1.1, 2.1, 3.3, 4.3, ES 2.0, ES 3.0**
|
||||||
|
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
|
||||||
|
- **Software Renderer** backend (no OpenGL required!): [rlsw](https://github.com/raysan5/raylib/blob/master/src/external/rlsw.h)
|
||||||
|
- Multiple **Fonts** formats supported (TTF, OTF, FNT, BDF, sprite fonts)
|
||||||
|
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
|
||||||
|
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
|
||||||
|
- Flexible Materials system, supporting classic maps and **PBR maps**
|
||||||
|
- **Animated 3D models** supported (skeletal bones animation) (IQM, M3D, glTF)
|
||||||
|
- Shaders support, including model shaders and **postprocessing** shaders
|
||||||
|
- **Powerful math module** for Vector, Matrix and Quaternion operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h)
|
||||||
|
- Audio loading and playing with streaming support (WAV, QOA, OGG, MP3, FLAC, XM, MOD)
|
||||||
|
- **VR stereo rendering** support with configurable HMD device parameters
|
||||||
|
- Huge examples collection with [+140 code examples](https://github.com/raysan5/raylib/tree/master/examples)!
|
||||||
|
- Bindings to [+70 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
|
||||||
|
- **Free and open source**
|
||||||
|
|
||||||
|
basic example
|
||||||
|
--------------
|
||||||
|
This is a basic raylib example, it creates a window and draws the text `"Congrats! You created your first window!"` in the middle of the screen. Check this example [running live on web here](https://www.raylib.com/examples/core/loader.html?name=core_basic_window).
|
||||||
|
```c
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
InitWindow(800, 450, "raylib example - basic window");
|
||||||
|
|
||||||
|
while (!WindowShouldClose())
|
||||||
|
{
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
|
||||||
|
EndDrawing();
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseWindow();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
build and installation
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
raylib binary releases for Windows, Linux, macOS, Android and HTML5 are available at the [Github Releases page](https://github.com/raysan5/raylib/releases).
|
||||||
|
|
||||||
|
raylib is also available via multiple package managers on multiple OS distributions.
|
||||||
|
|
||||||
|
#### Installing and building raylib on multiple platforms
|
||||||
|
|
||||||
|
[raylib Wiki](https://github.com/raysan5/raylib/wiki#development-platforms) contains detailed instructions on building and usage on multiple platforms.
|
||||||
|
|
||||||
|
- [Working on Windows](https://github.com/raysan5/raylib/wiki/Working-on-Windows)
|
||||||
|
- [Working on macOS](https://github.com/raysan5/raylib/wiki/Working-on-macOS)
|
||||||
|
- [Working on GNU Linux](https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux)
|
||||||
|
- [Working on Chrome OS](https://github.com/raysan5/raylib/wiki/Working-on-Chrome-OS)
|
||||||
|
- [Working on FreeBSD](https://github.com/raysan5/raylib/wiki/Working-on-FreeBSD)
|
||||||
|
- [Working on Raspberry Pi](https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi)
|
||||||
|
- [Working for Android](https://github.com/raysan5/raylib/wiki/Working-for-Android)
|
||||||
|
- [Working for Web (HTML5)](https://github.com/raysan5/raylib/wiki/Working-for-Web-(HTML5))
|
||||||
|
- [Working anywhere with CMake](https://github.com/raysan5/raylib/wiki/Working-with-CMake)
|
||||||
|
|
||||||
|
*Note that the Wiki is open for edit, if you find some issues while building raylib for your target platform, feel free to edit the Wiki or open an issue related to it.*
|
||||||
|
|
||||||
|
#### Setup raylib with multiple IDEs
|
||||||
|
|
||||||
|
raylib has been developed on Windows platform using [Notepad++](https://notepad-plus-plus.org/) and [MinGW GCC](https://www.mingw-w64.org/) compiler but it can be used with other IDEs on multiple platforms.
|
||||||
|
|
||||||
|
[Projects directory](https://github.com/raysan5/raylib/tree/master/projects) contains several ready-to-use **project templates** to build raylib and code examples with multiple IDEs.
|
||||||
|
|
||||||
|
*Note that there are lots of IDEs supported, some of the provided templates could require some review, so please, if you find some issue with a template or you think they could be improved, feel free to send a PR or open a related issue.*
|
||||||
|
|
||||||
|
learning and docs
|
||||||
|
------------------
|
||||||
|
|
||||||
|
raylib is designed to be learned using [the examples](https://github.com/raysan5/raylib/tree/master/examples) as the main reference. There is no standard API documentation but there is a [**cheatsheet**](https://www.raylib.com/cheatsheet/cheatsheet.html) containing all the functions available on the library a short description of each one of them, input parameters and result value names should be intuitive enough to understand how each function works.
|
||||||
|
|
||||||
|
Some additional documentation about raylib design can be found in [raylib GitHub Wiki](https://github.com/raysan5/raylib/wiki). Here are the relevant links:
|
||||||
|
|
||||||
|
- [raylib cheatsheet](https://www.raylib.com/cheatsheet/cheatsheet.html)
|
||||||
|
- [raylib architecture](https://github.com/raysan5/raylib/wiki/raylib-architecture)
|
||||||
|
- [raylib library design](https://github.com/raysan5/raylib/wiki)
|
||||||
|
- [raylib examples collection](https://github.com/raysan5/raylib/tree/master/examples)
|
||||||
|
- [raylib games collection](https://github.com/raysan5/raylib-games)
|
||||||
|
|
||||||
|
|
||||||
|
contact and networks
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
raylib is present in several networks and raylib community is growing everyday. If you are using raylib and enjoying it, feel free to join us in any of these networks. The most active network is our [Discord server](https://discord.gg/raylib)! :)
|
||||||
|
|
||||||
|
- Webpage: [https://www.raylib.com](https://www.raylib.com)
|
||||||
|
- Discord: [https://discord.gg/raylib](https://discord.gg/raylib)
|
||||||
|
- X: [https://x.com/raysan5](https://x.com/raysan5)
|
||||||
|
- BlueSky: [https://bsky.app/profile/raysan5](https://bsky.app/profile/raysan5.bsky.social)
|
||||||
|
- Twitch: [https://www.twitch.tv/raysan5](https://www.twitch.tv/raysan5)
|
||||||
|
- Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
|
||||||
|
- Patreon: [https://www.patreon.com/raylib](https://www.patreon.com/raylib)
|
||||||
|
- YouTube: [https://www.youtube.com/channel/raylib](https://www.youtube.com/c/raylib)
|
||||||
|
|
||||||
|
contributors
|
||||||
|
------------
|
||||||
|
|
||||||
|
<a href="https://github.com/raysan5/raylib/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=raysan5/raylib&max=800&columns=24&anon=0" />
|
||||||
|
</a>
|
||||||
|
|
||||||
|
license
|
||||||
|
-------
|
||||||
|
|
||||||
|
raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details.
|
||||||
|
|
||||||
|
raylib uses internally some libraries for window/graphics/inputs management and also to support different file formats loading, all those libraries are embedded with and are available in [src/external](https://github.com/raysan5/raylib/tree/master/src/external) directory. Check [raylib dependencies LICENSES](https://github.com/raysan5/raylib/wiki/raylib-dependencies) on [raylib Wiki](https://github.com/raysan5/raylib/wiki) for details.
|
||||||
154
libraries/raylib/raylib/src/CMakeLists.txt
Normal file
154
libraries/raylib/raylib/src/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,154 @@
|
||||||
|
# Setup the project and settings
|
||||||
|
project(raylib C)
|
||||||
|
set(PROJECT_VERSION 6.0.0)
|
||||||
|
set(API_VERSION 600)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
include(JoinPaths)
|
||||||
|
|
||||||
|
# Sets build type if not set by now
|
||||||
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
|
if(PROJECT_IS_TOP_LEVEL)
|
||||||
|
set(default_build_type Debug)
|
||||||
|
else()
|
||||||
|
message(WARNING "Default build type is not set (CMAKE_BUILD_TYPE)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
|
||||||
|
|
||||||
|
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
|
||||||
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Used as public API to be included into other projects
|
||||||
|
set(raylib_public_headers
|
||||||
|
raylib.h
|
||||||
|
rcamera.h
|
||||||
|
rlgl.h
|
||||||
|
raymath.h
|
||||||
|
)
|
||||||
|
|
||||||
|
# Sources to be compiled
|
||||||
|
set(raylib_sources
|
||||||
|
raudio.c
|
||||||
|
rcore.c
|
||||||
|
rmodels.c
|
||||||
|
rshapes.c
|
||||||
|
rtext.c
|
||||||
|
rtextures.c
|
||||||
|
)
|
||||||
|
|
||||||
|
# <root>/cmake/GlfwImport.cmake handles the details around the inclusion of glfw
|
||||||
|
if (NOT ${PLATFORM} MATCHES "Web")
|
||||||
|
include(GlfwImport)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Sets additional platform options and link libraries for each platform
|
||||||
|
# also selects the proper graphics API and version for that platform
|
||||||
|
# Produces a variable LIBS_PRIVATE that will be used later
|
||||||
|
include(LibraryConfigurations)
|
||||||
|
|
||||||
|
if (SUPPORT_MODULE_RAUDIO)
|
||||||
|
MESSAGE(STATUS "Audio Backend: miniaudio")
|
||||||
|
else ()
|
||||||
|
MESSAGE(STATUS "Audio Backend: None (-DCUSTOMIZE_BUILD=ON -DSUPPORT_MODULE_RAUDIO=OFF)")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
add_library(raylib ${raylib_sources} ${raylib_public_headers})
|
||||||
|
|
||||||
|
if (NOT BUILD_SHARED_LIBS)
|
||||||
|
MESSAGE(STATUS "Building raylib static library")
|
||||||
|
add_library(raylib_static ALIAS raylib)
|
||||||
|
else()
|
||||||
|
MESSAGE(STATUS "Building raylib shared library")
|
||||||
|
target_compile_definitions(raylib
|
||||||
|
PRIVATE $<BUILD_INTERFACE:BUILD_LIBTYPE_SHARED>
|
||||||
|
INTERFACE $<INSTALL_INTERFACE:USE_LIBTYPE_SHARED>
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (${PLATFORM} MATCHES "Web")
|
||||||
|
target_link_options(raylib PUBLIC "-sUSE_GLFW=3" -sEXPORTED_RUNTIME_METHODS=ccall)
|
||||||
|
if(${GRAPHICS} MATCHES "GRAPHICS_API_OPENGL_ES3")
|
||||||
|
target_link_options(raylib PUBLIC "-sMIN_WEBGL_VERSION=2")
|
||||||
|
target_link_options(raylib PUBLIC "-sMAX_WEBGL_VERSION=2")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (${PLATFORM} MATCHES "Android")
|
||||||
|
# Wrap fopen at link time so all code (including third-party libs) goes
|
||||||
|
# through __wrap_fopen, which handles Android APK asset loading
|
||||||
|
target_link_options(raylib PUBLIC -Wl,--wrap=fopen)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_target_properties(raylib PROPERTIES
|
||||||
|
PUBLIC_HEADER "${raylib_public_headers}"
|
||||||
|
VERSION ${PROJECT_VERSION}
|
||||||
|
SOVERSION ${API_VERSION}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (WITH_PIC OR BUILD_SHARED_LIBS)
|
||||||
|
set_property(TARGET raylib PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (BUILD_SHARED_LIBS)
|
||||||
|
# Hide raylib's symbols by default so RLAPI can expose them
|
||||||
|
set_property(TARGET raylib PROPERTY C_VISIBILITY_PRESET hidden)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
target_link_libraries(raylib PRIVATE $<BUILD_INTERFACE:${LIBS_PRIVATE}>)
|
||||||
|
target_link_libraries(raylib PUBLIC ${LIBS_PUBLIC})
|
||||||
|
|
||||||
|
# Sets some compile time definitions for the pre-processor
|
||||||
|
# If CUSTOMIZE_BUILD option is on you will not use config.h by default
|
||||||
|
# and you will be able to select more build options
|
||||||
|
include(CompileDefinitions)
|
||||||
|
|
||||||
|
# Registering include directories
|
||||||
|
target_include_directories(raylib
|
||||||
|
PUBLIC
|
||||||
|
$<INSTALL_INTERFACE:include>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
|
PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${OPENGL_INCLUDE_DIR}
|
||||||
|
${OPENAL_INCLUDE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Copy the header files to the build directory for convenience
|
||||||
|
file(COPY ${raylib_public_headers} DESTINATION "include")
|
||||||
|
if (PLATFORM STREQUAL "Desktop")
|
||||||
|
if (UNIX AND NOT APPLE)
|
||||||
|
if (GLFW_BUILD_X11)
|
||||||
|
find_package(X11 REQUIRED)
|
||||||
|
|
||||||
|
target_compile_definitions(raylib PRIVATE _GLFW_X11)
|
||||||
|
|
||||||
|
target_link_libraries(raylib PRIVATE
|
||||||
|
${X11_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
message(STATUS "X11 support enabled for raylib")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Includes information on how the library will be installed on the system
|
||||||
|
# when cmake --install is run
|
||||||
|
include(InstallConfigurations)
|
||||||
|
|
||||||
|
# Print the flags for the user
|
||||||
|
if (DEFINED CMAKE_BUILD_TYPE)
|
||||||
|
message(STATUS "Generated build type: ${CMAKE_BUILD_TYPE}")
|
||||||
|
else ()
|
||||||
|
message(STATUS "Generated config types: ${CMAKE_CONFIGURATION_TYPES}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
message(STATUS "Compiling with the flags:")
|
||||||
|
message(STATUS " PLATFORM=" ${PLATFORM_CPP})
|
||||||
|
message(STATUS " GRAPHICS=" ${GRAPHICS})
|
||||||
|
|
||||||
|
# Options if you want to create an installer using CPack
|
||||||
|
include(PackConfigurations)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
1001
libraries/raylib/raylib/src/Makefile
Normal file
1001
libraries/raylib/raylib/src/Makefile
Normal file
File diff suppressed because it is too large
Load diff
375
libraries/raylib/raylib/src/config.h
Normal file
375
libraries/raylib/raylib/src/config.h
Normal file
|
|
@ -0,0 +1,375 @@
|
||||||
|
/**********************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib configuration flags
|
||||||
|
*
|
||||||
|
* This file defines the configuration flags for different raylib features per-module
|
||||||
|
*
|
||||||
|
* NOTE: Additional values are configured per-module and can be set on compile time
|
||||||
|
*
|
||||||
|
* LICENSE: zlib/libpng
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018-2026 Ahmad Fatoum and Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
**********************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
#if !defined(EXTERNAL_CONFIG_FLAGS)
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module selection - Some modules could be avoided
|
||||||
|
// Mandatory modules: rcore, rlgl
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
#ifndef SUPPORT_MODULE_RSHAPES
|
||||||
|
#define SUPPORT_MODULE_RSHAPES 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_MODULE_RTEXTURES
|
||||||
|
#define SUPPORT_MODULE_RTEXTURES 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_MODULE_RTEXT
|
||||||
|
#define SUPPORT_MODULE_RTEXT 1 // WARNING: It requires SUPPORT_MODULE_RTEXTURES to load sprite font textures
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_MODULE_RMODELS
|
||||||
|
#define SUPPORT_MODULE_RMODELS 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_MODULE_RAUDIO
|
||||||
|
#define SUPPORT_MODULE_RAUDIO 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module: rcore - Configuration Flags
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
#ifndef SUPPORT_TRACELOG
|
||||||
|
// Show TRACELOG() output messages
|
||||||
|
#define SUPPORT_TRACELOG 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_CAMERA_SYSTEM
|
||||||
|
// Camera module is included (rcamera.h) and multiple predefined
|
||||||
|
// cameras are available: free, 1st/3rd person, orbital
|
||||||
|
#define SUPPORT_CAMERA_SYSTEM 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_GESTURES_SYSTEM
|
||||||
|
// Gestures module is included (rgestures.h) to support gestures detection: tap, hold, swipe, drag
|
||||||
|
#define SUPPORT_GESTURES_SYSTEM 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_RPRAND_GENERATOR
|
||||||
|
// Include pseudo-random numbers generator (rprand.h), based on Xoshiro128** and SplitMix64
|
||||||
|
#define SUPPORT_RPRAND_GENERATOR 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_MOUSE_GESTURES
|
||||||
|
// Mouse gestures are directly mapped like touches and processed by the gestures system
|
||||||
|
#define SUPPORT_MOUSE_GESTURES 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_SSH_KEYBOARD_RPI
|
||||||
|
// Reconfigure standard input to receive key inputs, works with SSH connection
|
||||||
|
#define SUPPORT_SSH_KEYBOARD_RPI 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_WINMM_HIGHRES_TIMER
|
||||||
|
// Setting a higher resolution can improve the accuracy of time-out intervals in wait functions
|
||||||
|
// However, it can also reduce overall system performance, because the thread scheduler switches tasks more often
|
||||||
|
#define SUPPORT_WINMM_HIGHRES_TIMER 1
|
||||||
|
#endif
|
||||||
|
#if !SUPPORT_BUSY_WAIT_LOOP && !SUPPORT_PARTIALBUSY_WAIT_LOOP
|
||||||
|
// Use busy wait loop for timing sync, if not defined, a high-resolution timer is set up and used
|
||||||
|
#define SUPPORT_BUSY_WAIT_LOOP 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#if !SUPPORT_PARTIALBUSY_WAIT_LOOP && !SUPPORT_BUSY_WAIT_LOOP
|
||||||
|
// Use a partial-busy wait loop, in this case frame sleeps for most of the time,
|
||||||
|
// but then runs a busy loop at the end for accuracy
|
||||||
|
#define SUPPORT_PARTIALBUSY_WAIT_LOOP 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_SCREEN_CAPTURE
|
||||||
|
// Allow automatic screen capture of current screen pressing F12, defined in KeyCallback()
|
||||||
|
// WARNING: It requires SUPPORT_FILEFORMAT_PNG flag
|
||||||
|
#define SUPPORT_SCREEN_CAPTURE 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_COMPRESSION_API
|
||||||
|
// Support CompressData() and DecompressData() functions
|
||||||
|
#define SUPPORT_COMPRESSION_API 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_AUTOMATION_EVENTS
|
||||||
|
// Support automatic generated events, loading and recording of those events when required
|
||||||
|
#define SUPPORT_AUTOMATION_EVENTS 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_CUSTOM_FRAME_CONTROL
|
||||||
|
// Support custom frame control, only for advanced users
|
||||||
|
// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents()
|
||||||
|
// Enabling this flag allows manual control of the frame processes, use at your own risk
|
||||||
|
#define SUPPORT_CUSTOM_FRAME_CONTROL 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_CLIPBOARD_IMAGE
|
||||||
|
// Support for clipboard image loading
|
||||||
|
// NOTE: Only working on SDL3, GLFW (Windows) and RGFW (Windows)
|
||||||
|
// WARNING: It requires support for some additional flags:
|
||||||
|
// - SUPPORT_MODULE_RTEXTURES
|
||||||
|
// - SUPPORT_FILEFORMAT_BMP (Windows clipboard)
|
||||||
|
// - SUPPORT_FILEFORMAT_PNG (Wayland clipboard)
|
||||||
|
// - SUPPORT_FILEFORMAT_JPG
|
||||||
|
#define SUPPORT_CLIPBOARD_IMAGE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// rcore: Configuration values
|
||||||
|
// NOTE: Below values are already defined inside [rcore.c] so there is no need to be
|
||||||
|
// redefined here, in case it must be done, uncomment the required line and update
|
||||||
|
// the value; it can also be done on compilation with -DVALUE_TO_REDEFINE=128
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
//#define MAX_TRACELOG_MSG_LENGTH 256 // Max length of one trace-log message
|
||||||
|
//#define MAX_FILEPATH_CAPACITY 8192 // Maximum file paths capacity
|
||||||
|
//#define MAX_FILEPATH_LENGTH 4096 // Maximum length for filepaths (Linux PATH_MAX default value)
|
||||||
|
//#define MAX_KEYBOARD_KEYS 512 // Maximum number of keyboard keys supported
|
||||||
|
//#define MAX_MOUSE_BUTTONS 8 // Maximum number of mouse buttons supported
|
||||||
|
//#define MAX_GAMEPADS 4 // Maximum number of gamepads supported
|
||||||
|
//#define MAX_GAMEPAD_AXES 8 // Maximum number of axes supported (per gamepad)
|
||||||
|
//#define MAX_GAMEPAD_BUTTONS 32 // Maximum number of buttons supported (per gamepad)
|
||||||
|
//#define MAX_GAMEPAD_VIBRATION_TIME 2.0f // Maximum vibration time in seconds
|
||||||
|
//#define MAX_TOUCH_POINTS 10 // Maximum number of touch points supported
|
||||||
|
//#define MAX_KEY_PRESSED_QUEUE 16 // Maximum number of keys in the key input queue
|
||||||
|
//#define MAX_CHAR_PRESSED_QUEUE 16 // Maximum number of characters in the char input queue
|
||||||
|
//#define MAX_DECOMPRESSION_SIZE 64 // Max size allocated for decompression in MB
|
||||||
|
//#define MAX_AUTOMATION_EVENTS 16384 // Maximum number of automation events to record
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module: rlgl - Configuration values
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
#ifndef RLGL_ENABLE_OPENGL_DEBUG_CONTEXT
|
||||||
|
// Request OpenGL debug context (only available on OpenGL 4.3)
|
||||||
|
#define RLGL_ENABLE_OPENGL_DEBUG_CONTEXT 0
|
||||||
|
#endif
|
||||||
|
#ifndef RLGL_SHOW_GL_DETAILS_INFO
|
||||||
|
// Show OpenGL detailed info on initialization,
|
||||||
|
// supported GL extensions and GL capabilities
|
||||||
|
#define RLGL_SHOW_GL_DETAILS_INFO 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// rlgl: Configuration values
|
||||||
|
// NOTE: Below values are already defined inside [rlgl.h] so there is no need to be
|
||||||
|
// redefined here, in case it must be done, uncomment the required line and update
|
||||||
|
// the value; it can also be done on compilation with -DVALUE_TO_REDEFINE=128
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
//#define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 4096 // Default internal render batch elements limits
|
||||||
|
//#define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering)
|
||||||
|
//#define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture)
|
||||||
|
//#define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture())
|
||||||
|
//#define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of internal Matrix stack
|
||||||
|
//#define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported
|
||||||
|
//#define RL_CULL_DISTANCE_NEAR 0.05 // Default projection matrix near cull distance
|
||||||
|
//#define RL_CULL_DISTANCE_FAR 4000.0 // Default projection matrix far cull distance
|
||||||
|
|
||||||
|
// Default shader vertex attribute locations
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 0
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 1
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 2
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR 3
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT 4
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 5
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES 6
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEINDICES 7
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS 8
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCETRANSFORM 9
|
||||||
|
|
||||||
|
// Default shader vertex attribute/uniform names to set location points
|
||||||
|
// NOTE: When a new shader is loaded, locations are tried to be set for convenience, looking for the names defined here
|
||||||
|
// In case custom shader names are used, it's up to the user to set locations with GetShaderLocation*() functions
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEINDICES "vertexBoneIndices" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEINDICES
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS "vertexBoneWeights" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS
|
||||||
|
//#define RL_DEFAULT_SHADER_ATTRIB_NAME_INSTANCETRANSFORM "instanceTransform" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCETRANSFORM
|
||||||
|
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
|
||||||
|
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix
|
||||||
|
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix
|
||||||
|
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix
|
||||||
|
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView))
|
||||||
|
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (tint color, multiplied by texture color)
|
||||||
|
//#define RL_DEFAULT_SHADER_UNIFORM_NAME_BONEMATRICES "boneMatrices" // bone matrices
|
||||||
|
//#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
|
||||||
|
//#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1)
|
||||||
|
//#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2)
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module: rshapes - Configuration Flags
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
#ifndef SUPPORT_QUADS_DRAW_MODE
|
||||||
|
// Use QUADS instead of TRIANGLES for drawing when possible
|
||||||
|
// Some lines-based shapes could still use lines
|
||||||
|
#define SUPPORT_QUADS_DRAW_MODE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module: rtextures - Configuration Flags
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Selected desired fileformats to be supported for image data loading
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_PNG
|
||||||
|
#define SUPPORT_FILEFORMAT_PNG 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_BMP
|
||||||
|
// NOTE: BMP support required for clipboard images on Windows
|
||||||
|
#define SUPPORT_FILEFORMAT_BMP 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_TGA
|
||||||
|
#define SUPPORT_FILEFORMAT_TGA 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_JPG
|
||||||
|
#define SUPPORT_FILEFORMAT_JPG 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_GIF
|
||||||
|
#define SUPPORT_FILEFORMAT_GIF 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_QOI
|
||||||
|
#define SUPPORT_FILEFORMAT_QOI 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_PSD
|
||||||
|
#define SUPPORT_FILEFORMAT_PSD 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_DDS
|
||||||
|
#define SUPPORT_FILEFORMAT_DDS 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_HDR
|
||||||
|
#define SUPPORT_FILEFORMAT_HDR 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_PIC
|
||||||
|
#define SUPPORT_FILEFORMAT_PIC 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_PNM
|
||||||
|
#define SUPPORT_FILEFORMAT_PNM 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_KTX
|
||||||
|
#define SUPPORT_FILEFORMAT_KTX 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_ASTC
|
||||||
|
#define SUPPORT_FILEFORMAT_ASTC 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_PKM
|
||||||
|
#define SUPPORT_FILEFORMAT_PKM 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_PVR
|
||||||
|
#define SUPPORT_FILEFORMAT_PVR 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SUPPORT_IMAGE_EXPORT
|
||||||
|
// Support image export functionality (.png, .bmp, .tga, .jpg, .qoi)
|
||||||
|
// NOTE: Image export requires stb_image_write.h library
|
||||||
|
#define SUPPORT_IMAGE_EXPORT 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_IMAGE_GENERATION
|
||||||
|
// Support procedural image generation functionality: gradient, spot, perlin-noise, cellular...
|
||||||
|
// NOTE: Perlin noise requires stb_perlin.h library
|
||||||
|
#define SUPPORT_IMAGE_GENERATION 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module: rtext - Configuration Flags
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Selected desired font fileformats to be supported for loading
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_TTF
|
||||||
|
#define SUPPORT_FILEFORMAT_TTF 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_FNT
|
||||||
|
#define SUPPORT_FILEFORMAT_FNT 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_BDF
|
||||||
|
#define SUPPORT_FILEFORMAT_BDF 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module: rmodels - Configuration Flags
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Selected desired model fileformats to be supported for loading
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_OBJ
|
||||||
|
#define SUPPORT_FILEFORMAT_OBJ 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_MTL
|
||||||
|
#define SUPPORT_FILEFORMAT_MTL 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_IQM
|
||||||
|
#define SUPPORT_FILEFORMAT_IQM 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_GLTF
|
||||||
|
#define SUPPORT_FILEFORMAT_GLTF 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_VOX
|
||||||
|
#define SUPPORT_FILEFORMAT_VOX 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_M3D
|
||||||
|
#define SUPPORT_FILEFORMAT_M3D 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_MESH_GENERATION
|
||||||
|
// Support procedural mesh generation functions, uses external par_shapes.h library
|
||||||
|
// NOTE: Some generated meshes DO NOT include generated texture coordinates
|
||||||
|
#define SUPPORT_MESH_GENERATION 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_GPU_SKINNING
|
||||||
|
// GPU skinning disabled by default, some GPUs do not support more than 8 VBOs
|
||||||
|
#define SUPPORT_GPU_SKINNING 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Module: raudio - Configuration Flags
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Desired audio fileformats to be supported for loading
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_WAV
|
||||||
|
#define SUPPORT_FILEFORMAT_WAV 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_OGG
|
||||||
|
#define SUPPORT_FILEFORMAT_OGG 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_MP3
|
||||||
|
#define SUPPORT_FILEFORMAT_MP3 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_QOA
|
||||||
|
#define SUPPORT_FILEFORMAT_QOA 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_FLAC
|
||||||
|
#define SUPPORT_FILEFORMAT_FLAC 0 // Disabled by default
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_XM
|
||||||
|
#define SUPPORT_FILEFORMAT_XM 1
|
||||||
|
#endif
|
||||||
|
#ifndef SUPPORT_FILEFORMAT_MOD
|
||||||
|
#define SUPPORT_FILEFORMAT_MOD 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// raudio: Configuration values
|
||||||
|
// NOTE: Below values are already defined inside [rlgl.h] so there is no need to be
|
||||||
|
// redefined here, in case it must be done, uncomment the required line and update
|
||||||
|
// the value; it can also be done on compilation with -DVALUE_TO_REDEFINE=128
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
//#define AUDIO_DEVICE_FORMAT ma_format_f32 // Device output format (miniaudio: float-32bit)
|
||||||
|
//#define AUDIO_DEVICE_CHANNELS 2 // Device output channels: stereo
|
||||||
|
//#define AUDIO_DEVICE_SAMPLE_RATE 0 // Device sample rate (device default)
|
||||||
|
//#define AUDIO_DEVICE_PERIOD_SIZE_IN_FRAMES 0 // Device period size (controls latency, 0 defaults to 10ms)
|
||||||
|
//#define MAX_AUDIO_BUFFER_POOL_CHANNELS 16 // Maximum number of audio pool channels
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
#endif // !EXTERNAL_CONFIG_FLAGS
|
||||||
|
|
||||||
|
// NOTE: Following macro depends on config flag that can
|
||||||
|
// be externally defined, so, it needs to be outside EXTERNAL_CONFIG_FLAGS
|
||||||
|
#if SUPPORT_TRACELOG
|
||||||
|
#define TRACELOG(level, ...) TraceLog(level, __VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define TRACELOG(level, ...) (void)0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // CONFIG_H
|
||||||
15891
libraries/raylib/raylib/src/external/RGFW/RGFW.h
vendored
Normal file
15891
libraries/raylib/raylib/src/external/RGFW/RGFW.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
5242
libraries/raylib/raylib/src/external/RGFW/deps/minigamepad.h
vendored
Normal file
5242
libraries/raylib/raylib/src/external/RGFW/deps/minigamepad.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
334
libraries/raylib/raylib/src/external/RGFW/deps/wayland/pointer-constraints-unstable-v1.xml
vendored
Normal file
334
libraries/raylib/raylib/src/external/RGFW/deps/wayland/pointer-constraints-unstable-v1.xml
vendored
Normal file
|
|
@ -0,0 +1,334 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="pointer_constraints_unstable_v1">
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2014 Jonas Ådahl
|
||||||
|
Copyright © 2015 Red Hat Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<description summary="protocol for constraining pointer motions">
|
||||||
|
This protocol specifies a set of interfaces used for adding constraints to
|
||||||
|
the motion of a pointer. Possible constraints include confining pointer
|
||||||
|
motions to a given region, or locking it to its current position.
|
||||||
|
|
||||||
|
In order to constrain the pointer, a client must first bind the global
|
||||||
|
interface "wp_pointer_constraints" which, if a compositor supports pointer
|
||||||
|
constraints, is exposed by the registry. Using the bound global object, the
|
||||||
|
client uses the request that corresponds to the type of constraint it wants
|
||||||
|
to make. See wp_pointer_constraints for more details.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is experimental and backward
|
||||||
|
incompatible changes may be made. Backward compatible changes may be added
|
||||||
|
together with the corresponding interface version bump. Backward
|
||||||
|
incompatible changes are done by bumping the version number in the protocol
|
||||||
|
and interface names and resetting the interface version. Once the protocol
|
||||||
|
is to be declared stable, the 'z' prefix and the version number in the
|
||||||
|
protocol and interface names are removed and the interface version number is
|
||||||
|
reset.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<interface name="zwp_pointer_constraints_v1" version="1">
|
||||||
|
<description summary="constrain the movement of a pointer">
|
||||||
|
The global interface exposing pointer constraining functionality. It
|
||||||
|
exposes two requests: lock_pointer for locking the pointer to its
|
||||||
|
position, and confine_pointer for locking the pointer to a region.
|
||||||
|
|
||||||
|
The lock_pointer and confine_pointer requests create the objects
|
||||||
|
wp_locked_pointer and wp_confined_pointer respectively, and the client can
|
||||||
|
use these objects to interact with the lock.
|
||||||
|
|
||||||
|
For any surface, only one lock or confinement may be active across all
|
||||||
|
wl_pointer objects of the same seat. If a lock or confinement is requested
|
||||||
|
when another lock or confinement is active or requested on the same surface
|
||||||
|
and with any of the wl_pointer objects of the same seat, an
|
||||||
|
'already_constrained' error will be raised.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<description summary="wp_pointer_constraints error values">
|
||||||
|
These errors can be emitted in response to wp_pointer_constraints
|
||||||
|
requests.
|
||||||
|
</description>
|
||||||
|
<entry name="already_constrained" value="1"
|
||||||
|
summary="pointer constraint already requested on that surface"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<enum name="lifetime">
|
||||||
|
<description summary="constraint lifetime">
|
||||||
|
These values represent different lifetime semantics. They are passed
|
||||||
|
as arguments to the factory requests to specify how the constraint
|
||||||
|
lifetimes should be managed.
|
||||||
|
</description>
|
||||||
|
<entry name="oneshot" value="1">
|
||||||
|
<description summary="the pointer constraint is defunct once deactivated">
|
||||||
|
A oneshot pointer constraint will never reactivate once it has been
|
||||||
|
deactivated. See the corresponding deactivation event
|
||||||
|
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
|
||||||
|
details.
|
||||||
|
</description>
|
||||||
|
</entry>
|
||||||
|
<entry name="persistent" value="2">
|
||||||
|
<description summary="the pointer constraint may reactivate">
|
||||||
|
A persistent pointer constraint may again reactivate once it has
|
||||||
|
been deactivated. See the corresponding deactivation event
|
||||||
|
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
|
||||||
|
details.
|
||||||
|
</description>
|
||||||
|
</entry>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the pointer constraints manager object">
|
||||||
|
Used by the client to notify the server that it will no longer use this
|
||||||
|
pointer constraints object.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="lock_pointer">
|
||||||
|
<description summary="lock pointer to a position">
|
||||||
|
The lock_pointer request lets the client request to disable movements of
|
||||||
|
the virtual pointer (i.e. the cursor), effectively locking the pointer
|
||||||
|
to a position. This request may not take effect immediately; in the
|
||||||
|
future, when the compositor deems implementation-specific constraints
|
||||||
|
are satisfied, the pointer lock will be activated and the compositor
|
||||||
|
sends a locked event.
|
||||||
|
|
||||||
|
The protocol provides no guarantee that the constraints are ever
|
||||||
|
satisfied, and does not require the compositor to send an error if the
|
||||||
|
constraints cannot ever be satisfied. It is thus possible to request a
|
||||||
|
lock that will never activate.
|
||||||
|
|
||||||
|
There may not be another pointer constraint of any kind requested or
|
||||||
|
active on the surface for any of the wl_pointer objects of the seat of
|
||||||
|
the passed pointer when requesting a lock. If there is, an error will be
|
||||||
|
raised. See general pointer lock documentation for more details.
|
||||||
|
|
||||||
|
The intersection of the region passed with this request and the input
|
||||||
|
region of the surface is used to determine where the pointer must be
|
||||||
|
in order for the lock to activate. It is up to the compositor whether to
|
||||||
|
warp the pointer or require some kind of user interaction for the lock
|
||||||
|
to activate. If the region is null the surface input region is used.
|
||||||
|
|
||||||
|
A surface may receive pointer focus without the lock being activated.
|
||||||
|
|
||||||
|
The request creates a new object wp_locked_pointer which is used to
|
||||||
|
interact with the lock as well as receive updates about its state. See
|
||||||
|
the the description of wp_locked_pointer for further information.
|
||||||
|
|
||||||
|
Note that while a pointer is locked, the wl_pointer objects of the
|
||||||
|
corresponding seat will not emit any wl_pointer.motion events, but
|
||||||
|
relative motion events will still be emitted via wp_relative_pointer
|
||||||
|
objects of the same seat. wl_pointer.axis and wl_pointer.button events
|
||||||
|
are unaffected.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zwp_locked_pointer_v1"/>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="surface to lock pointer to"/>
|
||||||
|
<arg name="pointer" type="object" interface="wl_pointer"
|
||||||
|
summary="the pointer that should be locked"/>
|
||||||
|
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||||
|
summary="region of surface"/>
|
||||||
|
<arg name="lifetime" type="uint" enum="lifetime" summary="lock lifetime"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="confine_pointer">
|
||||||
|
<description summary="confine pointer to a region">
|
||||||
|
The confine_pointer request lets the client request to confine the
|
||||||
|
pointer cursor to a given region. This request may not take effect
|
||||||
|
immediately; in the future, when the compositor deems implementation-
|
||||||
|
specific constraints are satisfied, the pointer confinement will be
|
||||||
|
activated and the compositor sends a confined event.
|
||||||
|
|
||||||
|
The intersection of the region passed with this request and the input
|
||||||
|
region of the surface is used to determine where the pointer must be
|
||||||
|
in order for the confinement to activate. It is up to the compositor
|
||||||
|
whether to warp the pointer or require some kind of user interaction for
|
||||||
|
the confinement to activate. If the region is null the surface input
|
||||||
|
region is used.
|
||||||
|
|
||||||
|
The request will create a new object wp_confined_pointer which is used
|
||||||
|
to interact with the confinement as well as receive updates about its
|
||||||
|
state. See the the description of wp_confined_pointer for further
|
||||||
|
information.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zwp_confined_pointer_v1"/>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="surface to lock pointer to"/>
|
||||||
|
<arg name="pointer" type="object" interface="wl_pointer"
|
||||||
|
summary="the pointer that should be confined"/>
|
||||||
|
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||||
|
summary="region of surface"/>
|
||||||
|
<arg name="lifetime" type="uint" enum="lifetime" summary="confinement lifetime"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zwp_locked_pointer_v1" version="1">
|
||||||
|
<description summary="receive relative pointer motion events">
|
||||||
|
The wp_locked_pointer interface represents a locked pointer state.
|
||||||
|
|
||||||
|
While the lock of this object is active, the wl_pointer objects of the
|
||||||
|
associated seat will not emit any wl_pointer.motion events.
|
||||||
|
|
||||||
|
This object will send the event 'locked' when the lock is activated.
|
||||||
|
Whenever the lock is activated, it is guaranteed that the locked surface
|
||||||
|
will already have received pointer focus and that the pointer will be
|
||||||
|
within the region passed to the request creating this object.
|
||||||
|
|
||||||
|
To unlock the pointer, send the destroy request. This will also destroy
|
||||||
|
the wp_locked_pointer object.
|
||||||
|
|
||||||
|
If the compositor decides to unlock the pointer the unlocked event is
|
||||||
|
sent. See wp_locked_pointer.unlock for details.
|
||||||
|
|
||||||
|
When unlocking, the compositor may warp the cursor position to the set
|
||||||
|
cursor position hint. If it does, it will not result in any relative
|
||||||
|
motion events emitted via wp_relative_pointer.
|
||||||
|
|
||||||
|
If the surface the lock was requested on is destroyed and the lock is not
|
||||||
|
yet activated, the wp_locked_pointer object is now defunct and must be
|
||||||
|
destroyed.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the locked pointer object">
|
||||||
|
Destroy the locked pointer object. If applicable, the compositor will
|
||||||
|
unlock the pointer.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_cursor_position_hint">
|
||||||
|
<description summary="set the pointer cursor position hint">
|
||||||
|
Set the cursor position hint relative to the top left corner of the
|
||||||
|
surface.
|
||||||
|
|
||||||
|
If the client is drawing its own cursor, it should update the position
|
||||||
|
hint to the position of its own cursor. A compositor may use this
|
||||||
|
information to warp the pointer upon unlock in order to avoid pointer
|
||||||
|
jumps.
|
||||||
|
|
||||||
|
The cursor position hint is double-buffered state, see
|
||||||
|
wl_surface.commit.
|
||||||
|
</description>
|
||||||
|
<arg name="surface_x" type="fixed"
|
||||||
|
summary="surface-local x coordinate"/>
|
||||||
|
<arg name="surface_y" type="fixed"
|
||||||
|
summary="surface-local y coordinate"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_region">
|
||||||
|
<description summary="set a new lock region">
|
||||||
|
Set a new region used to lock the pointer.
|
||||||
|
|
||||||
|
The new lock region is double-buffered, see wl_surface.commit.
|
||||||
|
|
||||||
|
For details about the lock region, see wp_locked_pointer.
|
||||||
|
</description>
|
||||||
|
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||||
|
summary="region of surface"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="locked">
|
||||||
|
<description summary="lock activation event">
|
||||||
|
Notification that the pointer lock of the seat's pointer is activated.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="unlocked">
|
||||||
|
<description summary="lock deactivation event">
|
||||||
|
Notification that the pointer lock of the seat's pointer is no longer
|
||||||
|
active. If this is a oneshot pointer lock (see
|
||||||
|
wp_pointer_constraints.lifetime) this object is now defunct and should
|
||||||
|
be destroyed. If this is a persistent pointer lock (see
|
||||||
|
wp_pointer_constraints.lifetime) this pointer lock may again
|
||||||
|
reactivate in the future.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zwp_confined_pointer_v1" version="1">
|
||||||
|
<description summary="confined pointer object">
|
||||||
|
The wp_confined_pointer interface represents a confined pointer state.
|
||||||
|
|
||||||
|
This object will send the event 'confined' when the confinement is
|
||||||
|
activated. Whenever the confinement is activated, it is guaranteed that
|
||||||
|
the surface the pointer is confined to will already have received pointer
|
||||||
|
focus and that the pointer will be within the region passed to the request
|
||||||
|
creating this object. It is up to the compositor to decide whether this
|
||||||
|
requires some user interaction and if the pointer will warp to within the
|
||||||
|
passed region if outside.
|
||||||
|
|
||||||
|
To unconfine the pointer, send the destroy request. This will also destroy
|
||||||
|
the wp_confined_pointer object.
|
||||||
|
|
||||||
|
If the compositor decides to unconfine the pointer the unconfined event is
|
||||||
|
sent. The wp_confined_pointer object is at this point defunct and should
|
||||||
|
be destroyed.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the confined pointer object">
|
||||||
|
Destroy the confined pointer object. If applicable, the compositor will
|
||||||
|
unconfine the pointer.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_region">
|
||||||
|
<description summary="set a new confine region">
|
||||||
|
Set a new region used to confine the pointer.
|
||||||
|
|
||||||
|
The new confine region is double-buffered, see wl_surface.commit.
|
||||||
|
|
||||||
|
If the confinement is active when the new confinement region is applied
|
||||||
|
and the pointer ends up outside of newly applied region, the pointer may
|
||||||
|
warped to a position within the new confinement region. If warped, a
|
||||||
|
wl_pointer.motion event will be emitted, but no
|
||||||
|
wp_relative_pointer.relative_motion event.
|
||||||
|
|
||||||
|
The compositor may also, instead of using the new region, unconfine the
|
||||||
|
pointer.
|
||||||
|
|
||||||
|
For details about the confine region, see wp_confined_pointer.
|
||||||
|
</description>
|
||||||
|
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||||
|
summary="region of surface"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="confined">
|
||||||
|
<description summary="pointer confined">
|
||||||
|
Notification that the pointer confinement of the seat's pointer is
|
||||||
|
activated.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="unconfined">
|
||||||
|
<description summary="pointer unconfined">
|
||||||
|
Notification that the pointer confinement of the seat's pointer is no
|
||||||
|
longer active. If this is a oneshot pointer confinement (see
|
||||||
|
wp_pointer_constraints.lifetime) this object is now defunct and should
|
||||||
|
be destroyed. If this is a persistent pointer confinement (see
|
||||||
|
wp_pointer_constraints.lifetime) this pointer confinement may again
|
||||||
|
reactivate in the future.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
</protocol>
|
||||||
72
libraries/raylib/raylib/src/external/RGFW/deps/wayland/pointer-warp-v1.xml
vendored
Normal file
72
libraries/raylib/raylib/src/external/RGFW/deps/wayland/pointer-warp-v1.xml
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="pointer_warp_v1">
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2024 Neal Gompa
|
||||||
|
Copyright © 2024 Xaver Hugl
|
||||||
|
Copyright © 2024 Matthias Klumpp
|
||||||
|
Copyright © 2024 Vlad Zahorodnii
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<interface name="wp_pointer_warp_v1" version="1">
|
||||||
|
<description summary="reposition the pointer to a location on a surface">
|
||||||
|
This global interface allows applications to request the pointer to be
|
||||||
|
moved to a position relative to a wl_surface.
|
||||||
|
|
||||||
|
Note that if the desired behavior is to constrain the pointer to an area
|
||||||
|
or lock it to a position, this protocol does not provide a reliable way
|
||||||
|
to do that. The pointer constraint and pointer lock protocols should be
|
||||||
|
used for those use cases instead.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is currently in the testing
|
||||||
|
phase. Backward compatible changes may be added together with the
|
||||||
|
corresponding interface version bump. Backward incompatible changes can
|
||||||
|
only be done by creating a new major version of the extension.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the warp manager">
|
||||||
|
Destroy the pointer warp manager.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="warp_pointer">
|
||||||
|
<description summary="reposition the pointer">
|
||||||
|
Request the compositor to move the pointer to a surface-local position.
|
||||||
|
Whether or not the compositor honors the request is implementation defined,
|
||||||
|
but it should
|
||||||
|
- honor it if the surface has pointer focus, including
|
||||||
|
when it has an implicit pointer grab
|
||||||
|
- reject it if the enter serial is incorrect
|
||||||
|
- reject it if the requested position is outside of the surface
|
||||||
|
|
||||||
|
Note that the enter serial is valid for any surface of the client,
|
||||||
|
and does not have to be from the surface the pointer is warped to.
|
||||||
|
|
||||||
|
</description>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="surface to position the pointer on"/>
|
||||||
|
<arg name="pointer" type="object" interface="wl_pointer"
|
||||||
|
summary="the pointer that should be repositioned"/>
|
||||||
|
<arg name="x" type="fixed"/>
|
||||||
|
<arg name="y" type="fixed"/>
|
||||||
|
<arg name="serial" type="uint" summary="serial number of the enter event"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
||||||
136
libraries/raylib/raylib/src/external/RGFW/deps/wayland/relative-pointer-unstable-v1.xml
vendored
Normal file
136
libraries/raylib/raylib/src/external/RGFW/deps/wayland/relative-pointer-unstable-v1.xml
vendored
Normal file
|
|
@ -0,0 +1,136 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="relative_pointer_unstable_v1">
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2014 Jonas Ådahl
|
||||||
|
Copyright © 2015 Red Hat Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<description summary="protocol for relative pointer motion events">
|
||||||
|
This protocol specifies a set of interfaces used for making clients able to
|
||||||
|
receive relative pointer events not obstructed by barriers (such as the
|
||||||
|
monitor edge or other pointer barriers).
|
||||||
|
|
||||||
|
To start receiving relative pointer events, a client must first bind the
|
||||||
|
global interface "wp_relative_pointer_manager" which, if a compositor
|
||||||
|
supports relative pointer motion events, is exposed by the registry. After
|
||||||
|
having created the relative pointer manager proxy object, the client uses
|
||||||
|
it to create the actual relative pointer object using the
|
||||||
|
"get_relative_pointer" request given a wl_pointer. The relative pointer
|
||||||
|
motion events will then, when applicable, be transmitted via the proxy of
|
||||||
|
the newly created relative pointer object. See the documentation of the
|
||||||
|
relative pointer interface for more details.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is experimental and backward
|
||||||
|
incompatible changes may be made. Backward compatible changes may be added
|
||||||
|
together with the corresponding interface version bump. Backward
|
||||||
|
incompatible changes are done by bumping the version number in the protocol
|
||||||
|
and interface names and resetting the interface version. Once the protocol
|
||||||
|
is to be declared stable, the 'z' prefix and the version number in the
|
||||||
|
protocol and interface names are removed and the interface version number is
|
||||||
|
reset.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<interface name="zwp_relative_pointer_manager_v1" version="1">
|
||||||
|
<description summary="get relative pointer objects">
|
||||||
|
A global interface used for getting the relative pointer object for a
|
||||||
|
given pointer.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the relative pointer manager object">
|
||||||
|
Used by the client to notify the server that it will no longer use this
|
||||||
|
relative pointer manager object.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="get_relative_pointer">
|
||||||
|
<description summary="get a relative pointer object">
|
||||||
|
Create a relative pointer interface given a wl_pointer object. See the
|
||||||
|
wp_relative_pointer interface for more details.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zwp_relative_pointer_v1"/>
|
||||||
|
<arg name="pointer" type="object" interface="wl_pointer"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zwp_relative_pointer_v1" version="1">
|
||||||
|
<description summary="relative pointer object">
|
||||||
|
A wp_relative_pointer object is an extension to the wl_pointer interface
|
||||||
|
used for emitting relative pointer events. It shares the same focus as
|
||||||
|
wl_pointer objects of the same seat and will only emit events when it has
|
||||||
|
focus.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="release the relative pointer object"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="relative_motion">
|
||||||
|
<description summary="relative pointer motion">
|
||||||
|
Relative x/y pointer motion from the pointer of the seat associated with
|
||||||
|
this object.
|
||||||
|
|
||||||
|
A relative motion is in the same dimension as regular wl_pointer motion
|
||||||
|
events, except they do not represent an absolute position. For example,
|
||||||
|
moving a pointer from (x, y) to (x', y') would have the equivalent
|
||||||
|
relative motion (x' - x, y' - y). If a pointer motion caused the
|
||||||
|
absolute pointer position to be clipped by for example the edge of the
|
||||||
|
monitor, the relative motion is unaffected by the clipping and will
|
||||||
|
represent the unclipped motion.
|
||||||
|
|
||||||
|
This event also contains non-accelerated motion deltas. The
|
||||||
|
non-accelerated delta is, when applicable, the regular pointer motion
|
||||||
|
delta as it was before having applied motion acceleration and other
|
||||||
|
transformations such as normalization.
|
||||||
|
|
||||||
|
Note that the non-accelerated delta does not represent 'raw' events as
|
||||||
|
they were read from some device. Pointer motion acceleration is device-
|
||||||
|
and configuration-specific and non-accelerated deltas and accelerated
|
||||||
|
deltas may have the same value on some devices.
|
||||||
|
|
||||||
|
Relative motions are not coupled to wl_pointer.motion events, and can be
|
||||||
|
sent in combination with such events, but also independently. There may
|
||||||
|
also be scenarios where wl_pointer.motion is sent, but there is no
|
||||||
|
relative motion. The order of an absolute and relative motion event
|
||||||
|
originating from the same physical motion is not guaranteed.
|
||||||
|
|
||||||
|
If the client needs button events or focus state, it can receive them
|
||||||
|
from a wl_pointer object of the same seat that the wp_relative_pointer
|
||||||
|
object is associated with.
|
||||||
|
</description>
|
||||||
|
<arg name="utime_hi" type="uint"
|
||||||
|
summary="high 32 bits of a 64 bit timestamp with microsecond granularity"/>
|
||||||
|
<arg name="utime_lo" type="uint"
|
||||||
|
summary="low 32 bits of a 64 bit timestamp with microsecond granularity"/>
|
||||||
|
<arg name="dx" type="fixed"
|
||||||
|
summary="the x component of the motion vector"/>
|
||||||
|
<arg name="dy" type="fixed"
|
||||||
|
summary="the y component of the motion vector"/>
|
||||||
|
<arg name="dx_unaccel" type="fixed"
|
||||||
|
summary="the x component of the unaccelerated motion vector"/>
|
||||||
|
<arg name="dy_unaccel" type="fixed"
|
||||||
|
summary="the y component of the unaccelerated motion vector"/>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
</protocol>
|
||||||
160
libraries/raylib/raylib/src/external/RGFW/deps/wayland/xdg-decoration-unstable-v1.xml
vendored
Normal file
160
libraries/raylib/raylib/src/external/RGFW/deps/wayland/xdg-decoration-unstable-v1.xml
vendored
Normal file
|
|
@ -0,0 +1,160 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="xdg_decoration_unstable_v1">
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2018 Simon Ser
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<interface name="zxdg_decoration_manager_v1" version="1">
|
||||||
|
<description summary="window decoration manager">
|
||||||
|
This interface allows a compositor to announce support for server-side
|
||||||
|
decorations.
|
||||||
|
|
||||||
|
A window decoration is a set of window controls as deemed appropriate by
|
||||||
|
the party managing them, such as user interface components used to move,
|
||||||
|
resize and change a window's state.
|
||||||
|
|
||||||
|
A client can use this protocol to request being decorated by a supporting
|
||||||
|
compositor.
|
||||||
|
|
||||||
|
If compositor and client do not negotiate the use of a server-side
|
||||||
|
decoration using this protocol, clients continue to self-decorate as they
|
||||||
|
see fit.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is experimental and
|
||||||
|
backward incompatible changes may be made. Backward compatible changes
|
||||||
|
may be added together with the corresponding interface version bump.
|
||||||
|
Backward incompatible changes are done by bumping the version number in
|
||||||
|
the protocol and interface names and resetting the interface version.
|
||||||
|
Once the protocol is to be declared stable, the 'z' prefix and the
|
||||||
|
version number in the protocol and interface names are removed and the
|
||||||
|
interface version number is reset.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the decoration manager object">
|
||||||
|
Destroy the decoration manager. This doesn't destroy objects created
|
||||||
|
with the manager.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="get_toplevel_decoration">
|
||||||
|
<description summary="create a new toplevel decoration object">
|
||||||
|
Create a new decoration object associated with the given toplevel.
|
||||||
|
|
||||||
|
Creating an xdg_toplevel_decoration from an xdg_toplevel which has a
|
||||||
|
buffer attached or committed is a client error, and any attempts by a
|
||||||
|
client to attach or manipulate a buffer prior to the first
|
||||||
|
xdg_toplevel_decoration.configure event must also be treated as
|
||||||
|
errors.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zxdg_toplevel_decoration_v1"/>
|
||||||
|
<arg name="toplevel" type="object" interface="xdg_toplevel"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zxdg_toplevel_decoration_v1" version="1">
|
||||||
|
<description summary="decoration object for a toplevel surface">
|
||||||
|
The decoration object allows the compositor to toggle server-side window
|
||||||
|
decorations for a toplevel surface. The client can request to switch to
|
||||||
|
another mode.
|
||||||
|
|
||||||
|
The xdg_toplevel_decoration object must be destroyed before its
|
||||||
|
xdg_toplevel.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<entry name="unconfigured_buffer" value="0"
|
||||||
|
summary="xdg_toplevel has a buffer attached before configure"/>
|
||||||
|
<entry name="already_constructed" value="1"
|
||||||
|
summary="xdg_toplevel already has a decoration object"/>
|
||||||
|
<entry name="orphaned" value="2"
|
||||||
|
summary="xdg_toplevel destroyed before the decoration object"/>
|
||||||
|
<entry name="invalid_mode" value="3" summary="invalid mode"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the decoration object">
|
||||||
|
Switch back to a mode without any server-side decorations at the next
|
||||||
|
commit.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<enum name="mode">
|
||||||
|
<description summary="window decoration modes">
|
||||||
|
These values describe window decoration modes.
|
||||||
|
</description>
|
||||||
|
<entry name="client_side" value="1"
|
||||||
|
summary="no server-side window decoration"/>
|
||||||
|
<entry name="server_side" value="2"
|
||||||
|
summary="server-side window decoration"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="set_mode">
|
||||||
|
<description summary="set the decoration mode">
|
||||||
|
Set the toplevel surface decoration mode. This informs the compositor
|
||||||
|
that the client prefers the provided decoration mode.
|
||||||
|
|
||||||
|
After requesting a decoration mode, the compositor will respond by
|
||||||
|
emitting an xdg_surface.configure event. The client should then update
|
||||||
|
its content, drawing it without decorations if the received mode is
|
||||||
|
server-side decorations. The client must also acknowledge the configure
|
||||||
|
when committing the new content (see xdg_surface.ack_configure).
|
||||||
|
|
||||||
|
The compositor can decide not to use the client's mode and enforce a
|
||||||
|
different mode instead.
|
||||||
|
|
||||||
|
Clients whose decoration mode depend on the xdg_toplevel state may send
|
||||||
|
a set_mode request in response to an xdg_surface.configure event and wait
|
||||||
|
for the next xdg_surface.configure event to prevent unwanted state.
|
||||||
|
Such clients are responsible for preventing configure loops and must
|
||||||
|
make sure not to send multiple successive set_mode requests with the
|
||||||
|
same decoration mode.
|
||||||
|
|
||||||
|
If an invalid mode is supplied by the client, the invalid_mode protocol
|
||||||
|
error is raised by the compositor.
|
||||||
|
</description>
|
||||||
|
<arg name="mode" type="uint" enum="mode" summary="the decoration mode"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="unset_mode">
|
||||||
|
<description summary="unset the decoration mode">
|
||||||
|
Unset the toplevel surface decoration mode. This informs the compositor
|
||||||
|
that the client doesn't prefer a particular decoration mode.
|
||||||
|
|
||||||
|
This request has the same semantics as set_mode.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="configure">
|
||||||
|
<description summary="notify a decoration mode change">
|
||||||
|
The configure event configures the effective decoration mode. The
|
||||||
|
configured state should not be applied immediately. Clients must send an
|
||||||
|
ack_configure in response to this event. See xdg_surface.configure and
|
||||||
|
xdg_surface.ack_configure for details.
|
||||||
|
|
||||||
|
A configure event can be sent at any time. The specified mode must be
|
||||||
|
obeyed by the client.
|
||||||
|
</description>
|
||||||
|
<arg name="mode" type="uint" enum="mode" summary="the decoration mode"/>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
||||||
222
libraries/raylib/raylib/src/external/RGFW/deps/wayland/xdg-output-unstable-v1.xml
vendored
Normal file
222
libraries/raylib/raylib/src/external/RGFW/deps/wayland/xdg-output-unstable-v1.xml
vendored
Normal file
|
|
@ -0,0 +1,222 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="xdg_output_unstable_v1">
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2017 Red Hat Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<description summary="Protocol to describe output regions">
|
||||||
|
This protocol aims at describing outputs in a way which is more in line
|
||||||
|
with the concept of an output on desktop oriented systems.
|
||||||
|
|
||||||
|
Some information are more specific to the concept of an output for
|
||||||
|
a desktop oriented system and may not make sense in other applications,
|
||||||
|
such as IVI systems for example.
|
||||||
|
|
||||||
|
Typically, the global compositor space on a desktop system is made of
|
||||||
|
a contiguous or overlapping set of rectangular regions.
|
||||||
|
|
||||||
|
The logical_position and logical_size events defined in this protocol
|
||||||
|
might provide information identical to their counterparts already
|
||||||
|
available from wl_output, in which case the information provided by this
|
||||||
|
protocol should be preferred to their equivalent in wl_output. The goal is
|
||||||
|
to move the desktop specific concepts (such as output location within the
|
||||||
|
global compositor space, etc.) out of the core wl_output protocol.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is experimental and
|
||||||
|
backward incompatible changes may be made. Backward compatible
|
||||||
|
changes may be added together with the corresponding interface
|
||||||
|
version bump.
|
||||||
|
Backward incompatible changes are done by bumping the version
|
||||||
|
number in the protocol and interface names and resetting the
|
||||||
|
interface version. Once the protocol is to be declared stable,
|
||||||
|
the 'z' prefix and the version number in the protocol and
|
||||||
|
interface names are removed and the interface version number is
|
||||||
|
reset.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<interface name="zxdg_output_manager_v1" version="3">
|
||||||
|
<description summary="manage xdg_output objects">
|
||||||
|
A global factory interface for xdg_output objects.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the xdg_output_manager object">
|
||||||
|
Using this request a client can tell the server that it is not
|
||||||
|
going to use the xdg_output_manager object anymore.
|
||||||
|
|
||||||
|
Any objects already created through this instance are not affected.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="get_xdg_output">
|
||||||
|
<description summary="create an xdg output from a wl_output">
|
||||||
|
This creates a new xdg_output object for the given wl_output.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zxdg_output_v1"/>
|
||||||
|
<arg name="output" type="object" interface="wl_output"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zxdg_output_v1" version="3">
|
||||||
|
<description summary="compositor logical output region">
|
||||||
|
An xdg_output describes part of the compositor geometry.
|
||||||
|
|
||||||
|
This typically corresponds to a monitor that displays part of the
|
||||||
|
compositor space.
|
||||||
|
|
||||||
|
For objects version 3 onwards, after all xdg_output properties have been
|
||||||
|
sent (when the object is created and when properties are updated), a
|
||||||
|
wl_output.done event is sent. This allows changes to the output
|
||||||
|
properties to be seen as atomic, even if they happen via multiple events.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the xdg_output object">
|
||||||
|
Using this request a client can tell the server that it is not
|
||||||
|
going to use the xdg_output object anymore.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="logical_position">
|
||||||
|
<description summary="position of the output within the global compositor space">
|
||||||
|
The position event describes the location of the wl_output within
|
||||||
|
the global compositor space.
|
||||||
|
|
||||||
|
The logical_position event is sent after creating an xdg_output
|
||||||
|
(see xdg_output_manager.get_xdg_output) and whenever the location
|
||||||
|
of the output changes within the global compositor space.
|
||||||
|
</description>
|
||||||
|
<arg name="x" type="int"
|
||||||
|
summary="x position within the global compositor space"/>
|
||||||
|
<arg name="y" type="int"
|
||||||
|
summary="y position within the global compositor space"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="logical_size">
|
||||||
|
<description summary="size of the output in the global compositor space">
|
||||||
|
The logical_size event describes the size of the output in the
|
||||||
|
global compositor space.
|
||||||
|
|
||||||
|
Most regular Wayland clients should not pay attention to the
|
||||||
|
logical size and would rather rely on xdg_shell interfaces.
|
||||||
|
|
||||||
|
Some clients such as Xwayland, however, need this to configure
|
||||||
|
their surfaces in the global compositor space as the compositor
|
||||||
|
may apply a different scale from what is advertised by the output
|
||||||
|
scaling property (to achieve fractional scaling, for example).
|
||||||
|
|
||||||
|
For example, for a wl_output mode 3840×2160 and a scale factor 2:
|
||||||
|
|
||||||
|
- A compositor not scaling the monitor viewport in its compositing space
|
||||||
|
will advertise a logical size of 3840×2160,
|
||||||
|
|
||||||
|
- A compositor scaling the monitor viewport with scale factor 2 will
|
||||||
|
advertise a logical size of 1920×1080,
|
||||||
|
|
||||||
|
- A compositor scaling the monitor viewport using a fractional scale of
|
||||||
|
1.5 will advertise a logical size of 2560×1440.
|
||||||
|
|
||||||
|
For example, for a wl_output mode 1920×1080 and a 90 degree rotation,
|
||||||
|
the compositor will advertise a logical size of 1080x1920.
|
||||||
|
|
||||||
|
The logical_size event is sent after creating an xdg_output
|
||||||
|
(see xdg_output_manager.get_xdg_output) and whenever the logical
|
||||||
|
size of the output changes, either as a result of a change in the
|
||||||
|
applied scale or because of a change in the corresponding output
|
||||||
|
mode(see wl_output.mode) or transform (see wl_output.transform).
|
||||||
|
</description>
|
||||||
|
<arg name="width" type="int"
|
||||||
|
summary="width in global compositor space"/>
|
||||||
|
<arg name="height" type="int"
|
||||||
|
summary="height in global compositor space"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="done" deprecated-since="3">
|
||||||
|
<description summary="all information about the output have been sent">
|
||||||
|
This event is sent after all other properties of an xdg_output
|
||||||
|
have been sent.
|
||||||
|
|
||||||
|
This allows changes to the xdg_output properties to be seen as
|
||||||
|
atomic, even if they happen via multiple events.
|
||||||
|
|
||||||
|
For objects version 3 onwards, this event is deprecated. Compositors
|
||||||
|
are not required to send it anymore and must send wl_output.done
|
||||||
|
instead.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<!-- Version 2 additions -->
|
||||||
|
|
||||||
|
<event name="name" since="2">
|
||||||
|
<description summary="name of this output">
|
||||||
|
Many compositors will assign names to their outputs, show them to the
|
||||||
|
user, allow them to be configured by name, etc. The client may wish to
|
||||||
|
know this name as well to offer the user similar behaviors.
|
||||||
|
|
||||||
|
The naming convention is compositor defined, but limited to
|
||||||
|
alphanumeric characters and dashes (-). Each name is unique among all
|
||||||
|
wl_output globals, but if a wl_output global is destroyed the same name
|
||||||
|
may be reused later. The names will also remain consistent across
|
||||||
|
sessions with the same hardware and software configuration.
|
||||||
|
|
||||||
|
Examples of names include 'HDMI-A-1', 'WL-1', 'X11-1', etc. However, do
|
||||||
|
not assume that the name is a reflection of an underlying DRM
|
||||||
|
connector, X11 connection, etc.
|
||||||
|
|
||||||
|
The name event is sent after creating an xdg_output (see
|
||||||
|
xdg_output_manager.get_xdg_output). This event is only sent once per
|
||||||
|
xdg_output, and the name does not change over the lifetime of the
|
||||||
|
wl_output global.
|
||||||
|
|
||||||
|
This event is deprecated, instead clients should use wl_output.name.
|
||||||
|
Compositors must still support this event.
|
||||||
|
</description>
|
||||||
|
<arg name="name" type="string" summary="output name"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="description" since="2">
|
||||||
|
<description summary="human-readable description of this output">
|
||||||
|
Many compositors can produce human-readable descriptions of their
|
||||||
|
outputs. The client may wish to know this description as well, to
|
||||||
|
communicate the user for various purposes.
|
||||||
|
|
||||||
|
The description is a UTF-8 string with no convention defined for its
|
||||||
|
contents. Examples might include 'Foocorp 11" Display' or 'Virtual X11
|
||||||
|
output via :1'.
|
||||||
|
|
||||||
|
The description event is sent after creating an xdg_output (see
|
||||||
|
xdg_output_manager.get_xdg_output) and whenever the description
|
||||||
|
changes. The description is optional, and may not be sent at all.
|
||||||
|
|
||||||
|
For objects of version 2 and lower, this event is only sent once per
|
||||||
|
xdg_output, and the description does not change over the lifetime of
|
||||||
|
the wl_output global.
|
||||||
|
|
||||||
|
This event is deprecated, instead clients should use
|
||||||
|
wl_output.description. Compositors must still support this event.
|
||||||
|
</description>
|
||||||
|
<arg name="description" type="string" summary="output description"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
||||||
1418
libraries/raylib/raylib/src/external/RGFW/deps/wayland/xdg-shell.xml
vendored
Normal file
1418
libraries/raylib/raylib/src/external/RGFW/deps/wayland/xdg-shell.xml
vendored
Normal file
File diff suppressed because it is too large
Load diff
205
libraries/raylib/raylib/src/external/RGFW/deps/wayland/xdg-toplevel-icon-v1.xml
vendored
Normal file
205
libraries/raylib/raylib/src/external/RGFW/deps/wayland/xdg-toplevel-icon-v1.xml
vendored
Normal file
|
|
@ -0,0 +1,205 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="xdg_toplevel_icon_v1">
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2023-2024 Matthias Klumpp
|
||||||
|
Copyright © 2024 David Edmundson
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<description summary="protocol to assign icons to toplevels">
|
||||||
|
This protocol allows clients to set icons for their toplevel surfaces
|
||||||
|
either via the XDG icon stock (using an icon name), or from pixel data.
|
||||||
|
|
||||||
|
A toplevel icon represents the individual toplevel (unlike the application
|
||||||
|
or launcher icon, which represents the application as a whole), and may be
|
||||||
|
shown in window switchers, window overviews and taskbars that list
|
||||||
|
individual windows.
|
||||||
|
|
||||||
|
This document adheres to RFC 2119 when using words like "must",
|
||||||
|
"should", "may", etc.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is currently in the testing
|
||||||
|
phase. Backward compatible changes may be added together with the
|
||||||
|
corresponding interface version bump. Backward incompatible changes can
|
||||||
|
only be done by creating a new major version of the extension.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<interface name="xdg_toplevel_icon_manager_v1" version="1">
|
||||||
|
<description summary="interface to manage toplevel icons">
|
||||||
|
This interface allows clients to create toplevel window icons and set
|
||||||
|
them on toplevel windows to be displayed to the user.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the toplevel icon manager">
|
||||||
|
Destroy the toplevel icon manager.
|
||||||
|
This does not destroy objects created with the manager.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="create_icon">
|
||||||
|
<description summary="create a new icon instance">
|
||||||
|
Creates a new icon object. This icon can then be attached to a
|
||||||
|
xdg_toplevel via the 'set_icon' request.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="xdg_toplevel_icon_v1"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_icon">
|
||||||
|
<description summary="set an icon on a toplevel window">
|
||||||
|
This request assigns the icon 'icon' to 'toplevel', or clears the
|
||||||
|
toplevel icon if 'icon' was null.
|
||||||
|
This state is double-buffered and is applied on the next
|
||||||
|
wl_surface.commit of the toplevel.
|
||||||
|
|
||||||
|
After making this call, the xdg_toplevel_icon_v1 provided as 'icon'
|
||||||
|
can be destroyed by the client without 'toplevel' losing its icon.
|
||||||
|
The xdg_toplevel_icon_v1 is immutable from this point, and any
|
||||||
|
future attempts to change it must raise the
|
||||||
|
'xdg_toplevel_icon_v1.immutable' protocol error.
|
||||||
|
|
||||||
|
The compositor must set the toplevel icon from either the pixel data
|
||||||
|
the icon provides, or by loading a stock icon using the icon name.
|
||||||
|
See the description of 'xdg_toplevel_icon_v1' for details.
|
||||||
|
|
||||||
|
If 'icon' is set to null, the icon of the respective toplevel is reset
|
||||||
|
to its default icon (usually the icon of the application, derived from
|
||||||
|
its desktop-entry file, or a placeholder icon).
|
||||||
|
If this request is passed an icon with no pixel buffers or icon name
|
||||||
|
assigned, the icon must be reset just like if 'icon' was null.
|
||||||
|
</description>
|
||||||
|
<arg name="toplevel" type="object" interface="xdg_toplevel" summary="the toplevel to act on"/>
|
||||||
|
<arg name="icon" type="object" interface="xdg_toplevel_icon_v1" allow-null="true"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="icon_size">
|
||||||
|
<description summary="describes a supported & preferred icon size">
|
||||||
|
This event indicates an icon size the compositor prefers to be
|
||||||
|
available if the client has scalable icons and can render to any size.
|
||||||
|
|
||||||
|
When the 'xdg_toplevel_icon_manager_v1' object is created, the
|
||||||
|
compositor may send one or more 'icon_size' events to describe the list
|
||||||
|
of preferred icon sizes. If the compositor has no size preference, it
|
||||||
|
may not send any 'icon_size' event, and it is up to the client to
|
||||||
|
decide a suitable icon size.
|
||||||
|
|
||||||
|
A sequence of 'icon_size' events must be finished with a 'done' event.
|
||||||
|
If the compositor has no size preferences, it must still send the
|
||||||
|
'done' event, without any preceding 'icon_size' events.
|
||||||
|
</description>
|
||||||
|
<arg name="size" type="int"
|
||||||
|
summary="the edge size of the square icon in surface-local coordinates, e.g. 64"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="done">
|
||||||
|
<description summary="all information has been sent">
|
||||||
|
This event is sent after all 'icon_size' events have been sent.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="xdg_toplevel_icon_v1" version="1">
|
||||||
|
<description summary="a toplevel window icon">
|
||||||
|
This interface defines a toplevel icon.
|
||||||
|
An icon can have a name, and multiple buffers.
|
||||||
|
In order to be applied, the icon must have either a name, or at least
|
||||||
|
one buffer assigned. Applying an empty icon (with no buffer or name) to
|
||||||
|
a toplevel should reset its icon to the default icon.
|
||||||
|
|
||||||
|
It is up to compositor policy whether to prefer using a buffer or loading
|
||||||
|
an icon via its name. See 'set_name' and 'add_buffer' for details.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<entry name="invalid_buffer"
|
||||||
|
summary="the provided buffer does not satisfy requirements"
|
||||||
|
value="1"/>
|
||||||
|
<entry name="immutable"
|
||||||
|
summary="the icon has already been assigned to a toplevel and must not be changed"
|
||||||
|
value="2"/>
|
||||||
|
<entry name="no_buffer"
|
||||||
|
summary="the provided buffer has been destroyed before the toplevel icon"
|
||||||
|
value="3"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the icon object">
|
||||||
|
Destroys the 'xdg_toplevel_icon_v1' object.
|
||||||
|
The icon must still remain set on every toplevel it was assigned to,
|
||||||
|
until the toplevel icon is reset explicitly.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_name">
|
||||||
|
<description summary="set an icon name">
|
||||||
|
This request assigns an icon name to this icon.
|
||||||
|
Any previously set name is overridden.
|
||||||
|
|
||||||
|
The compositor must resolve 'icon_name' according to the lookup rules
|
||||||
|
described in the XDG icon theme specification[1] using the
|
||||||
|
environment's current icon theme.
|
||||||
|
|
||||||
|
If the compositor does not support icon names or cannot resolve
|
||||||
|
'icon_name' according to the XDG icon theme specification it must
|
||||||
|
fall back to using pixel buffer data instead.
|
||||||
|
|
||||||
|
If this request is made after the icon has been assigned to a toplevel
|
||||||
|
via 'set_icon', a 'immutable' error must be raised.
|
||||||
|
|
||||||
|
[1]: https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
|
||||||
|
</description>
|
||||||
|
<arg name="icon_name" type="string"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="add_buffer">
|
||||||
|
<description summary="add icon data from a pixel buffer">
|
||||||
|
This request adds pixel data supplied as wl_buffer to the icon.
|
||||||
|
|
||||||
|
The client should add pixel data for all icon sizes and scales that
|
||||||
|
it can provide, or which are explicitly requested by the compositor
|
||||||
|
via 'icon_size' events on xdg_toplevel_icon_manager_v1.
|
||||||
|
|
||||||
|
The wl_buffer supplying pixel data as 'buffer' must be backed by wl_shm
|
||||||
|
and must be a square (width and height being equal).
|
||||||
|
If any of these buffer requirements are not fulfilled, a 'invalid_buffer'
|
||||||
|
error must be raised.
|
||||||
|
|
||||||
|
If this icon instance already has a buffer of the same size and scale
|
||||||
|
from a previous 'add_buffer' request, data from the last request
|
||||||
|
overrides the preexisting pixel data.
|
||||||
|
|
||||||
|
The wl_buffer must be kept alive for as long as the xdg_toplevel_icon
|
||||||
|
it is associated with is not destroyed, otherwise a 'no_buffer' error
|
||||||
|
is raised. The buffer contents must not be modified after it was
|
||||||
|
assigned to the icon. As a result, the region of the wl_shm_pool's
|
||||||
|
backing storage used for the wl_buffer must not be modified after this
|
||||||
|
request is sent. The wl_buffer.release event is unused.
|
||||||
|
|
||||||
|
If this request is made after the icon has been assigned to a toplevel
|
||||||
|
via 'set_icon', a 'immutable' error must be raised.
|
||||||
|
</description>
|
||||||
|
<arg name="buffer" type="object" interface="wl_buffer"/>
|
||||||
|
<arg name="scale" type="int"
|
||||||
|
summary="the scaling factor of the icon, e.g. 1"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
||||||
7240
libraries/raylib/raylib/src/external/cgltf.h
vendored
Normal file
7240
libraries/raylib/raylib/src/external/cgltf.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
1565
libraries/raylib/raylib/src/external/cgltf_write.h
vendored
Normal file
1565
libraries/raylib/raylib/src/external/cgltf_write.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
183
libraries/raylib/raylib/src/external/dirent.h
vendored
Normal file
183
libraries/raylib/raylib/src/external/dirent.h
vendored
Normal file
|
|
@ -0,0 +1,183 @@
|
||||||
|
/****************************************************************************
|
||||||
|
|
||||||
|
Declaration of POSIX directory browsing functions and types for Win32.
|
||||||
|
|
||||||
|
Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com)
|
||||||
|
History: Created March 1997. Updated June 2003.
|
||||||
|
Reviewed by Ramon Santamaria for raylib on January 2020.
|
||||||
|
|
||||||
|
Copyright Kevlin Henney, 1997, 2003. All rights reserved.
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and distribute this software and its
|
||||||
|
documentation for any purpose is hereby granted without fee, provided
|
||||||
|
that this copyright and permissions notice appear in all copies and
|
||||||
|
derivatives.
|
||||||
|
|
||||||
|
This software is supplied "as is" without express or implied warranty.
|
||||||
|
|
||||||
|
But that said, if there are any problems please get in touch.
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef DIRENT_H
|
||||||
|
#define DIRENT_H
|
||||||
|
|
||||||
|
// Allow custom memory allocators
|
||||||
|
#ifndef DIRENT_MALLOC
|
||||||
|
#define DIRENT_MALLOC(sz) malloc(sz)
|
||||||
|
#endif
|
||||||
|
#ifndef DIRENT_FREE
|
||||||
|
#define DIRENT_FREE(p) free(p)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Types and Structures Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Fordward declaration of DIR, implementation below
|
||||||
|
typedef struct DIR DIR;
|
||||||
|
|
||||||
|
struct dirent {
|
||||||
|
char *d_name;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Functions Declaration
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
DIR *opendir(const char *name);
|
||||||
|
int closedir(DIR *dir);
|
||||||
|
struct dirent *readdir(DIR *dir);
|
||||||
|
void rewinddir(DIR *dir);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // DIRENT_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
|
||||||
|
Implementation of POSIX directory browsing functions and types for Win32.
|
||||||
|
|
||||||
|
Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com)
|
||||||
|
History: Created March 1997. Updated June 2003.
|
||||||
|
Reviewed by Ramon Santamaria for raylib on January 2020.
|
||||||
|
|
||||||
|
Copyright Kevlin Henney, 1997, 2003. All rights reserved.
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and distribute this software and its
|
||||||
|
documentation for any purpose is hereby granted without fee, provided
|
||||||
|
that this copyright and permissions notice appear in all copies and
|
||||||
|
derivatives.
|
||||||
|
|
||||||
|
This software is supplied "as is" without express or implied warranty.
|
||||||
|
|
||||||
|
But that said, if there are any problems please get in touch.
|
||||||
|
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <io.h> // _findfirst and _findnext set errno iff they return -1
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Types and Structures Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
typedef ptrdiff_t handle_type; // C99's intptr_t not sufficiently portable
|
||||||
|
|
||||||
|
struct DIR {
|
||||||
|
handle_type handle; // -1 for failed rewind
|
||||||
|
struct _finddata_t info;
|
||||||
|
struct dirent result; // d_name null iff first time
|
||||||
|
char *name; // null-terminated char string
|
||||||
|
};
|
||||||
|
|
||||||
|
DIR *opendir(const char *name)
|
||||||
|
{
|
||||||
|
DIR *dir = 0;
|
||||||
|
|
||||||
|
if (name && name[0])
|
||||||
|
{
|
||||||
|
size_t base_length = strlen(name);
|
||||||
|
|
||||||
|
// Search pattern must end with suitable wildcard
|
||||||
|
const char *all = strchr("/\\", name[base_length - 1]) ? "*" : "/*";
|
||||||
|
|
||||||
|
if ((dir = (DIR *)DIRENT_MALLOC(sizeof *dir)) != 0 &&
|
||||||
|
(dir->name = (char *)DIRENT_MALLOC(base_length + strlen(all) + 1)) != 0)
|
||||||
|
{
|
||||||
|
strcat(strcpy(dir->name, name), all);
|
||||||
|
|
||||||
|
if ((dir->handle = (handle_type) _findfirst(dir->name, &dir->info)) != -1)
|
||||||
|
{
|
||||||
|
dir->result.d_name = 0;
|
||||||
|
}
|
||||||
|
else // rollback
|
||||||
|
{
|
||||||
|
DIRENT_FREE(dir->name);
|
||||||
|
DIRENT_FREE(dir);
|
||||||
|
dir = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // rollback
|
||||||
|
{
|
||||||
|
DIRENT_FREE(dir);
|
||||||
|
dir = 0;
|
||||||
|
errno = ENOMEM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else errno = EINVAL;
|
||||||
|
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
int closedir(DIR *dir)
|
||||||
|
{
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
if (dir)
|
||||||
|
{
|
||||||
|
if (dir->handle != -1) result = _findclose(dir->handle);
|
||||||
|
|
||||||
|
DIRENT_FREE(dir->name);
|
||||||
|
DIRENT_FREE(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: All errors ampped to EBADF
|
||||||
|
if (result == -1) errno = EBADF;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct dirent *readdir(DIR *dir)
|
||||||
|
{
|
||||||
|
struct dirent *result = 0;
|
||||||
|
|
||||||
|
if (dir && dir->handle != -1)
|
||||||
|
{
|
||||||
|
if (!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1)
|
||||||
|
{
|
||||||
|
result = &dir->result;
|
||||||
|
result->d_name = dir->info.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else errno = EBADF;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rewinddir(DIR *dir)
|
||||||
|
{
|
||||||
|
if (dir && dir->handle != -1)
|
||||||
|
{
|
||||||
|
_findclose(dir->handle);
|
||||||
|
dir->handle = (handle_type) _findfirst(dir->name, &dir->info);
|
||||||
|
dir->result.d_name = 0;
|
||||||
|
}
|
||||||
|
else errno = EBADF;
|
||||||
|
}
|
||||||
12660
libraries/raylib/raylib/src/external/dr_flac.h
vendored
Normal file
12660
libraries/raylib/raylib/src/external/dr_flac.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
5385
libraries/raylib/raylib/src/external/dr_mp3.h
vendored
Normal file
5385
libraries/raylib/raylib/src/external/dr_mp3.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
9060
libraries/raylib/raylib/src/external/dr_wav.h
vendored
Normal file
9060
libraries/raylib/raylib/src/external/dr_wav.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
63
libraries/raylib/raylib/src/external/fix_win32_compatibility.h
vendored
Normal file
63
libraries/raylib/raylib/src/external/fix_win32_compatibility.h
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
/**********************************************************************************************
|
||||||
|
*
|
||||||
|
* fix_win32_compatibility.h Utility to help include windows.h with raylib projects
|
||||||
|
*
|
||||||
|
* Useage: #include "fix_win32_compatibility.h" any library that uses windows.h
|
||||||
|
* order is critical, this must be done before raylib
|
||||||
|
*
|
||||||
|
* LICENSE: MIT
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Jeffery Myers
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*
|
||||||
|
**********************************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// move the windows functions to new names
|
||||||
|
// note that you can't call these functions or structures from your code, but you should not neeed to
|
||||||
|
#define CloseWindow CloseWindowWin32
|
||||||
|
#define Rectangle RectangleWin32
|
||||||
|
#define ShowCursor ShowCursorWin32
|
||||||
|
#define LoadImageA LoadImageAWin32
|
||||||
|
#define LoadImageW LoadImageWin32
|
||||||
|
#define DrawTextA DrawTextAWin32
|
||||||
|
#define DrawTextW DrawTextWin32
|
||||||
|
#define DrawTextExA DrawTextExAWin32
|
||||||
|
#define DrawTextExW DrawTextExWin32
|
||||||
|
#define PlaySoundA PlaySoundAWin32
|
||||||
|
// include windows
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
// remove all our redfintions so that raylib can define them properly
|
||||||
|
#undef CloseWindow
|
||||||
|
#undef Rectangle
|
||||||
|
#undef ShowCursor
|
||||||
|
#undef LoadImage
|
||||||
|
#undef LoadImageA
|
||||||
|
#undef LoadImageW
|
||||||
|
#undef DrawText
|
||||||
|
#undef DrawTextA
|
||||||
|
#undef DrawTextW
|
||||||
|
#undef DrawTextEx
|
||||||
|
#undef DrawTextExA
|
||||||
|
#undef DrawTextExW
|
||||||
|
#undef PlaySoundA
|
||||||
8682
libraries/raylib/raylib/src/external/glad.h
vendored
Normal file
8682
libraries/raylib/raylib/src/external/glad.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
4774
libraries/raylib/raylib/src/external/glad_gles2.h
vendored
Normal file
4774
libraries/raylib/raylib/src/external/glad_gles2.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
10
libraries/raylib/raylib/src/external/glfw/.mailmap
vendored
Normal file
10
libraries/raylib/raylib/src/external/glfw/.mailmap
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
Camilla Löwy <elmindreda@glfw.org> <elmindreda@users.sourceforge.net>
|
||||||
|
Camilla Löwy <elmindreda@glfw.org> <elmindreda@elmindreda.org>
|
||||||
|
Camilla Löwy <elmindreda@glfw.org>
|
||||||
|
|
||||||
|
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
|
||||||
|
|
||||||
|
Marcus Geelnard <m@bitsnbites.eu> <marcus256@users.sourceforge.net>
|
||||||
|
Marcus Geelnard <m@bitsnbites.eu> <marcus@geelnards-pc.(none)>
|
||||||
|
Marcus Geelnard <m@bitsnbites.eu>
|
||||||
|
|
||||||
48
libraries/raylib/raylib/src/external/glfw/CMake/GenerateMappings.cmake
vendored
Normal file
48
libraries/raylib/raylib/src/external/glfw/CMake/GenerateMappings.cmake
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
# Usage:
|
||||||
|
# cmake -P GenerateMappings.cmake <path/to/mappings.h.in> <path/to/mappings.h>
|
||||||
|
|
||||||
|
set(source_url "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt")
|
||||||
|
set(source_path "${CMAKE_CURRENT_BINARY_DIR}/gamecontrollerdb.txt")
|
||||||
|
set(template_path "${CMAKE_ARGV3}")
|
||||||
|
set(target_path "${CMAKE_ARGV4}")
|
||||||
|
|
||||||
|
if (NOT EXISTS "${template_path}")
|
||||||
|
message(FATAL_ERROR "Failed to find template file ${template_path}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(DOWNLOAD "${source_url}" "${source_path}"
|
||||||
|
STATUS download_status
|
||||||
|
TLS_VERIFY on)
|
||||||
|
|
||||||
|
list(GET download_status 0 status_code)
|
||||||
|
list(GET download_status 1 status_message)
|
||||||
|
|
||||||
|
if (status_code)
|
||||||
|
message(FATAL_ERROR "Failed to download ${source_url}: ${status_message}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(STRINGS "${source_path}" lines)
|
||||||
|
foreach(line ${lines})
|
||||||
|
if (line MATCHES "^[0-9a-fA-F]")
|
||||||
|
if (line MATCHES "platform:Windows")
|
||||||
|
if (GLFW_WIN32_MAPPINGS)
|
||||||
|
string(APPEND GLFW_WIN32_MAPPINGS "\n")
|
||||||
|
endif()
|
||||||
|
string(APPEND GLFW_WIN32_MAPPINGS "\"${line}\",")
|
||||||
|
elseif (line MATCHES "platform:Mac OS X")
|
||||||
|
if (GLFW_COCOA_MAPPINGS)
|
||||||
|
string(APPEND GLFW_COCOA_MAPPINGS "\n")
|
||||||
|
endif()
|
||||||
|
string(APPEND GLFW_COCOA_MAPPINGS "\"${line}\",")
|
||||||
|
elseif (line MATCHES "platform:Linux")
|
||||||
|
if (GLFW_LINUX_MAPPINGS)
|
||||||
|
string(APPEND GLFW_LINUX_MAPPINGS "\n")
|
||||||
|
endif()
|
||||||
|
string(APPEND GLFW_LINUX_MAPPINGS "\"${line}\",")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
configure_file("${template_path}" "${target_path}" @ONLY NEWLINE_STYLE UNIX)
|
||||||
|
file(REMOVE "${source_path}")
|
||||||
|
|
||||||
38
libraries/raylib/raylib/src/external/glfw/CMake/Info.plist.in
vendored
Normal file
38
libraries/raylib/raylib/src/external/glfw/CMake/Info.plist.in
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
|
||||||
|
<key>CFBundleGetInfoString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleLongVersionString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
|
||||||
|
<key>CSResourcesFileMapped</key>
|
||||||
|
<true/>
|
||||||
|
<key>LSRequiresCarbon</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
29
libraries/raylib/raylib/src/external/glfw/CMake/cmake_uninstall.cmake.in
vendored
Normal file
29
libraries/raylib/raylib/src/external/glfw/CMake/cmake_uninstall.cmake.in
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
|
||||||
|
if (NOT EXISTS "@GLFW_BINARY_DIR@/install_manifest.txt")
|
||||||
|
message(FATAL_ERROR "Cannot find install manifest: \"@GLFW_BINARY_DIR@/install_manifest.txt\"")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(READ "@GLFW_BINARY_DIR@/install_manifest.txt" files)
|
||||||
|
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||||
|
|
||||||
|
foreach (file ${files})
|
||||||
|
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
|
||||||
|
if (EXISTS "$ENV{DESTDIR}${file}")
|
||||||
|
exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||||
|
OUTPUT_VARIABLE rm_out
|
||||||
|
RETURN_VALUE rm_retval)
|
||||||
|
if (NOT "${rm_retval}" STREQUAL 0)
|
||||||
|
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
|
||||||
|
endif()
|
||||||
|
elseif (IS_SYMLINK "$ENV{DESTDIR}${file}")
|
||||||
|
EXEC_PROGRAM("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||||
|
OUTPUT_VARIABLE rm_out
|
||||||
|
RETURN_VALUE rm_retval)
|
||||||
|
if (NOT "${rm_retval}" STREQUAL 0)
|
||||||
|
message(FATAL_ERROR "Problem when removing symlink \"$ENV{DESTDIR}${file}\"")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
13
libraries/raylib/raylib/src/external/glfw/CMake/glfw3.pc.in
vendored
Normal file
13
libraries/raylib/raylib/src/external/glfw/CMake/glfw3.pc.in
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
|
exec_prefix=${prefix}
|
||||||
|
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
||||||
|
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
||||||
|
|
||||||
|
Name: GLFW
|
||||||
|
Description: A multi-platform library for OpenGL, window and input
|
||||||
|
Version: @GLFW_VERSION@
|
||||||
|
URL: https://www.glfw.org/
|
||||||
|
Requires.private: @GLFW_PKG_CONFIG_REQUIRES_PRIVATE@
|
||||||
|
Libs: -L${libdir} -l@GLFW_LIB_NAME@@GLFW_LIB_NAME_SUFFIX@
|
||||||
|
Libs.private: @GLFW_PKG_CONFIG_LIBS_PRIVATE@
|
||||||
|
Cflags: -I${includedir}
|
||||||
3
libraries/raylib/raylib/src/external/glfw/CMake/glfw3Config.cmake.in
vendored
Normal file
3
libraries/raylib/raylib/src/external/glfw/CMake/glfw3Config.cmake.in
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
include(CMakeFindDependencyMacro)
|
||||||
|
find_dependency(Threads)
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/glfw3Targets.cmake")
|
||||||
13
libraries/raylib/raylib/src/external/glfw/CMake/i686-w64-mingw32-clang.cmake
vendored
Normal file
13
libraries/raylib/raylib/src/external/glfw/CMake/i686-w64-mingw32-clang.cmake
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Define the environment for cross-compiling with 32-bit MinGW-w64 Clang
|
||||||
|
SET(CMAKE_SYSTEM_NAME Windows) # Target system name
|
||||||
|
SET(CMAKE_SYSTEM_VERSION 1)
|
||||||
|
SET(CMAKE_C_COMPILER "i686-w64-mingw32-clang")
|
||||||
|
SET(CMAKE_CXX_COMPILER "i686-w64-mingw32-clang++")
|
||||||
|
SET(CMAKE_RC_COMPILER "i686-w64-mingw32-windres")
|
||||||
|
SET(CMAKE_RANLIB "i686-w64-mingw32-ranlib")
|
||||||
|
|
||||||
|
# Configure the behaviour of the find commands
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32")
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
13
libraries/raylib/raylib/src/external/glfw/CMake/i686-w64-mingw32.cmake
vendored
Normal file
13
libraries/raylib/raylib/src/external/glfw/CMake/i686-w64-mingw32.cmake
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Define the environment for cross-compiling with 32-bit MinGW-w64 GCC
|
||||||
|
SET(CMAKE_SYSTEM_NAME Windows) # Target system name
|
||||||
|
SET(CMAKE_SYSTEM_VERSION 1)
|
||||||
|
SET(CMAKE_C_COMPILER "i686-w64-mingw32-gcc")
|
||||||
|
SET(CMAKE_CXX_COMPILER "i686-w64-mingw32-g++")
|
||||||
|
SET(CMAKE_RC_COMPILER "i686-w64-mingw32-windres")
|
||||||
|
SET(CMAKE_RANLIB "i686-w64-mingw32-ranlib")
|
||||||
|
|
||||||
|
# Configure the behaviour of the find commands
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32")
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
17
libraries/raylib/raylib/src/external/glfw/CMake/modules/FindEpollShim.cmake
vendored
Normal file
17
libraries/raylib/raylib/src/external/glfw/CMake/modules/FindEpollShim.cmake
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Find EpollShim
|
||||||
|
# Once done, this will define
|
||||||
|
#
|
||||||
|
# EPOLLSHIM_FOUND - System has EpollShim
|
||||||
|
# EPOLLSHIM_INCLUDE_DIRS - The EpollShim include directories
|
||||||
|
# EPOLLSHIM_LIBRARIES - The libraries needed to use EpollShim
|
||||||
|
|
||||||
|
find_path(EPOLLSHIM_INCLUDE_DIRS NAMES sys/epoll.h sys/timerfd.h HINTS /usr/local/include/libepoll-shim)
|
||||||
|
find_library(EPOLLSHIM_LIBRARIES NAMES epoll-shim libepoll-shim HINTS /usr/local/lib)
|
||||||
|
|
||||||
|
if (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES)
|
||||||
|
set(EPOLLSHIM_FOUND TRUE)
|
||||||
|
endif (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(EpollShim DEFAULT_MSG EPOLLSHIM_LIBRARIES EPOLLSHIM_INCLUDE_DIRS)
|
||||||
|
mark_as_advanced(EPOLLSHIM_INCLUDE_DIRS EPOLLSHIM_LIBRARIES)
|
||||||
18
libraries/raylib/raylib/src/external/glfw/CMake/modules/FindOSMesa.cmake
vendored
Normal file
18
libraries/raylib/raylib/src/external/glfw/CMake/modules/FindOSMesa.cmake
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Try to find OSMesa on a Unix system
|
||||||
|
#
|
||||||
|
# This will define:
|
||||||
|
#
|
||||||
|
# OSMESA_LIBRARIES - Link these to use OSMesa
|
||||||
|
# OSMESA_INCLUDE_DIR - Include directory for OSMesa
|
||||||
|
#
|
||||||
|
# Copyright (c) 2014 Brandon Schaefer <brandon.schaefer@canonical.com>
|
||||||
|
|
||||||
|
if (NOT WIN32)
|
||||||
|
|
||||||
|
find_package (PkgConfig)
|
||||||
|
pkg_check_modules (PKG_OSMESA QUIET osmesa)
|
||||||
|
|
||||||
|
set (OSMESA_INCLUDE_DIR ${PKG_OSMESA_INCLUDE_DIRS})
|
||||||
|
set (OSMESA_LIBRARIES ${PKG_OSMESA_LIBRARIES})
|
||||||
|
|
||||||
|
endif ()
|
||||||
13
libraries/raylib/raylib/src/external/glfw/CMake/x86_64-w64-mingw32-clang.cmake
vendored
Normal file
13
libraries/raylib/raylib/src/external/glfw/CMake/x86_64-w64-mingw32-clang.cmake
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Define the environment for cross-compiling with 64-bit MinGW-w64 Clang
|
||||||
|
SET(CMAKE_SYSTEM_NAME Windows) # Target system name
|
||||||
|
SET(CMAKE_SYSTEM_VERSION 1)
|
||||||
|
SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-clang")
|
||||||
|
SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-clang++")
|
||||||
|
SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres")
|
||||||
|
SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib")
|
||||||
|
|
||||||
|
# Configure the behaviour of the find commands
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32")
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
13
libraries/raylib/raylib/src/external/glfw/CMake/x86_64-w64-mingw32.cmake
vendored
Normal file
13
libraries/raylib/raylib/src/external/glfw/CMake/x86_64-w64-mingw32.cmake
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Define the environment for cross-compiling with 64-bit MinGW-w64 GCC
|
||||||
|
SET(CMAKE_SYSTEM_NAME Windows) # Target system name
|
||||||
|
SET(CMAKE_SYSTEM_VERSION 1)
|
||||||
|
SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-gcc")
|
||||||
|
SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-g++")
|
||||||
|
SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres")
|
||||||
|
SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib")
|
||||||
|
|
||||||
|
# Configure the behaviour of the find commands
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32")
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
|
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
165
libraries/raylib/raylib/src/external/glfw/CMakeLists.txt
vendored
Normal file
165
libraries/raylib/raylib/src/external/glfw/CMakeLists.txt
vendored
Normal file
|
|
@ -0,0 +1,165 @@
|
||||||
|
cmake_minimum_required(VERSION 3.4...3.28 FATAL_ERROR)
|
||||||
|
|
||||||
|
project(GLFW VERSION 3.4.0 LANGUAGES C)
|
||||||
|
|
||||||
|
if (POLICY CMP0069)
|
||||||
|
cmake_policy(SET CMP0069 NEW)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (POLICY CMP0077)
|
||||||
|
cmake_policy(SET CMP0077 NEW)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
|
string(COMPARE EQUAL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}" GLFW_STANDALONE)
|
||||||
|
|
||||||
|
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||||
|
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ${GLFW_STANDALONE})
|
||||||
|
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ${GLFW_STANDALONE})
|
||||||
|
option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON)
|
||||||
|
option(GLFW_INSTALL "Generate installation target" ON)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
include(CMakeDependentOption)
|
||||||
|
|
||||||
|
if (GLFW_USE_OSMESA)
|
||||||
|
message(FATAL_ERROR "GLFW_USE_OSMESA has been removed; set the GLFW_PLATFORM init hint")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (DEFINED GLFW_USE_WAYLAND AND UNIX AND NOT APPLE)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"GLFW_USE_WAYLAND has been removed; delete the CMake cache and set GLFW_BUILD_WAYLAND and GLFW_BUILD_X11 instead")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
cmake_dependent_option(GLFW_BUILD_WIN32 "Build support for Win32" ON "WIN32" OFF)
|
||||||
|
cmake_dependent_option(GLFW_BUILD_COCOA "Build support for Cocoa" ON "APPLE" OFF)
|
||||||
|
cmake_dependent_option(GLFW_BUILD_X11 "Build support for X11" ON "UNIX;NOT APPLE" OFF)
|
||||||
|
cmake_dependent_option(GLFW_BUILD_WAYLAND "Build support for Wayland" ON "UNIX;NOT APPLE" OFF)
|
||||||
|
|
||||||
|
cmake_dependent_option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF
|
||||||
|
"WIN32" OFF)
|
||||||
|
cmake_dependent_option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON
|
||||||
|
"MSVC" OFF)
|
||||||
|
|
||||||
|
set(GLFW_LIBRARY_TYPE "${GLFW_LIBRARY_TYPE}" CACHE STRING
|
||||||
|
"Library type override for GLFW (SHARED, STATIC, OBJECT, or empty to follow BUILD_SHARED_LIBS)")
|
||||||
|
|
||||||
|
if (GLFW_LIBRARY_TYPE)
|
||||||
|
if (GLFW_LIBRARY_TYPE STREQUAL "SHARED")
|
||||||
|
set(GLFW_BUILD_SHARED_LIBRARY TRUE)
|
||||||
|
else()
|
||||||
|
set(GLFW_BUILD_SHARED_LIBRARY FALSE)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(GLFW_BUILD_SHARED_LIBRARY ${BUILD_SHARED_LIBS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules")
|
||||||
|
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Report backend selection
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
if (GLFW_BUILD_WIN32)
|
||||||
|
message(STATUS "Including Win32 support")
|
||||||
|
endif()
|
||||||
|
if (GLFW_BUILD_COCOA)
|
||||||
|
message(STATUS "Including Cocoa support")
|
||||||
|
endif()
|
||||||
|
if (GLFW_BUILD_WAYLAND)
|
||||||
|
message(STATUS "Including Wayland support")
|
||||||
|
endif()
|
||||||
|
if (GLFW_BUILD_X11)
|
||||||
|
message(STATUS "Including X11 support")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Apply Microsoft C runtime library option
|
||||||
|
# This is here because it also applies to tests and examples
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
|
||||||
|
if (CMAKE_VERSION VERSION_LESS 3.15)
|
||||||
|
foreach (flag CMAKE_C_FLAGS
|
||||||
|
CMAKE_C_FLAGS_DEBUG
|
||||||
|
CMAKE_C_FLAGS_RELEASE
|
||||||
|
CMAKE_C_FLAGS_MINSIZEREL
|
||||||
|
CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||||
|
|
||||||
|
if (flag MATCHES "/MD")
|
||||||
|
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
|
||||||
|
endif()
|
||||||
|
if (flag MATCHES "/MDd")
|
||||||
|
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endforeach()
|
||||||
|
else()
|
||||||
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Create generated files
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
|
set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_LIBDIR}/cmake/glfw3")
|
||||||
|
|
||||||
|
configure_package_config_file(CMake/glfw3Config.cmake.in
|
||||||
|
src/glfw3Config.cmake
|
||||||
|
INSTALL_DESTINATION "${GLFW_CONFIG_PATH}"
|
||||||
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
||||||
|
|
||||||
|
write_basic_package_version_file(src/glfw3ConfigVersion.cmake
|
||||||
|
VERSION ${GLFW_VERSION}
|
||||||
|
COMPATIBILITY SameMajorVersion)
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Add subdirectories
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
add_subdirectory(src)
|
||||||
|
|
||||||
|
if (GLFW_BUILD_EXAMPLES)
|
||||||
|
add_subdirectory(examples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GLFW_BUILD_TESTS)
|
||||||
|
add_subdirectory(tests)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GLFW_BUILD_DOCS)
|
||||||
|
add_subdirectory(docs)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Install files other than the library
|
||||||
|
# The library is installed by src/CMakeLists.txt
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
if (GLFW_INSTALL)
|
||||||
|
install(DIRECTORY include/GLFW DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h)
|
||||||
|
|
||||||
|
install(FILES "${GLFW_BINARY_DIR}/src/glfw3Config.cmake"
|
||||||
|
"${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake"
|
||||||
|
DESTINATION "${GLFW_CONFIG_PATH}")
|
||||||
|
|
||||||
|
install(EXPORT glfwTargets FILE glfw3Targets.cmake
|
||||||
|
EXPORT_LINK_INTERFACE_LIBRARIES
|
||||||
|
DESTINATION "${GLFW_CONFIG_PATH}")
|
||||||
|
install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||||
|
|
||||||
|
# Only generate this target if no higher-level project already has
|
||||||
|
if (NOT TARGET uninstall)
|
||||||
|
configure_file(CMake/cmake_uninstall.cmake.in
|
||||||
|
cmake_uninstall.cmake IMMEDIATE @ONLY)
|
||||||
|
|
||||||
|
add_custom_target(uninstall
|
||||||
|
"${CMAKE_COMMAND}" -P
|
||||||
|
"${GLFW_BINARY_DIR}/cmake_uninstall.cmake")
|
||||||
|
set_target_properties(uninstall PROPERTIES FOLDER "GLFW3")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
297
libraries/raylib/raylib/src/external/glfw/CONTRIBUTORS.md
vendored
Normal file
297
libraries/raylib/raylib/src/external/glfw/CONTRIBUTORS.md
vendored
Normal file
|
|
@ -0,0 +1,297 @@
|
||||||
|
# Acknowledgements
|
||||||
|
|
||||||
|
GLFW exists because people around the world donated their time and lent their
|
||||||
|
skills. This list only includes contributions to the main repository and
|
||||||
|
excludes other invaluable contributions like language bindings and text and
|
||||||
|
video tutorials.
|
||||||
|
|
||||||
|
- Bobyshev Alexander
|
||||||
|
- Laurent Aphecetche
|
||||||
|
- Matt Arsenault
|
||||||
|
- Takuro Ashie
|
||||||
|
- ashishgamedev
|
||||||
|
- David Avedissian
|
||||||
|
- Luca Bacci
|
||||||
|
- Keith Bauer
|
||||||
|
- John Bartholomew
|
||||||
|
- Coşku Baş
|
||||||
|
- Bayemite
|
||||||
|
- Niklas Behrens
|
||||||
|
- Andrew Belt
|
||||||
|
- Nevyn Bengtsson
|
||||||
|
- Niklas Bergström
|
||||||
|
- Denis Bernard
|
||||||
|
- BiBi
|
||||||
|
- Doug Binks
|
||||||
|
- blanco
|
||||||
|
- Waris Boonyasiriwat
|
||||||
|
- Kyle Brenneman
|
||||||
|
- Rok Breulj
|
||||||
|
- TheBrokenRail
|
||||||
|
- Kai Burjack
|
||||||
|
- Martin Capitanio
|
||||||
|
- Nicolas Caramelli
|
||||||
|
- David Carlier
|
||||||
|
- Arturo Castro
|
||||||
|
- Chi-kwan Chan
|
||||||
|
- Victor Chernyakin
|
||||||
|
- TheChocolateOre
|
||||||
|
- Ali Chraghi
|
||||||
|
- Joseph Chua
|
||||||
|
- Ian Clarkson
|
||||||
|
- Michał Cichoń
|
||||||
|
- Lambert Clara
|
||||||
|
- Anna Clarke
|
||||||
|
- Josh Codd
|
||||||
|
- Yaron Cohen-Tal
|
||||||
|
- Omar Cornut
|
||||||
|
- Andrew Corrigan
|
||||||
|
- Bailey Cosier
|
||||||
|
- Noel Cower
|
||||||
|
- CuriouserThing
|
||||||
|
- Bill Currie
|
||||||
|
- Jason Daly
|
||||||
|
- danhambleton
|
||||||
|
- Jarrod Davis
|
||||||
|
- Olivier Delannoy
|
||||||
|
- Paul R. Deppe
|
||||||
|
- Michael Dickens
|
||||||
|
- Роман Донченко
|
||||||
|
- Mario Dorn
|
||||||
|
- Wolfgang Draxinger
|
||||||
|
- Jonathan Dummer
|
||||||
|
- Ralph Eastwood
|
||||||
|
- Fredrik Ehnbom
|
||||||
|
- Robin Eklind
|
||||||
|
- Jan Ekström
|
||||||
|
- Siavash Eliasi
|
||||||
|
- Ahmad Fatoum
|
||||||
|
- Nikita Fediuchin
|
||||||
|
- Felipe Ferreira
|
||||||
|
- Michael Fogleman
|
||||||
|
- forworldm
|
||||||
|
- Jason Francis
|
||||||
|
- Gerald Franz
|
||||||
|
- Mário Freitas
|
||||||
|
- GeO4d
|
||||||
|
- Marcus Geelnard
|
||||||
|
- Gegy
|
||||||
|
- ghuser404
|
||||||
|
- Charles Giessen
|
||||||
|
- Ryan C. Gordon
|
||||||
|
- Stephen Gowen
|
||||||
|
- Kovid Goyal
|
||||||
|
- Kevin Grandemange
|
||||||
|
- Eloi Marín Gratacós
|
||||||
|
- Grzesiek11
|
||||||
|
- Stefan Gustavson
|
||||||
|
- Andrew Gutekanst
|
||||||
|
- Stephen Gutekanst
|
||||||
|
- Jonathan Hale
|
||||||
|
- Daniel Hauser
|
||||||
|
- hdf89shfdfs
|
||||||
|
- Moritz Heinemann
|
||||||
|
- Sylvain Hellegouarch
|
||||||
|
- Björn Hempel
|
||||||
|
- Matthew Henry
|
||||||
|
- heromyth
|
||||||
|
- Lucas Hinderberger
|
||||||
|
- Paul Holden
|
||||||
|
- Hajime Hoshi
|
||||||
|
- Warren Hu
|
||||||
|
- Charles Huber
|
||||||
|
- Brent Huisman
|
||||||
|
- Florian Hülsmann
|
||||||
|
- illustris
|
||||||
|
- InKryption
|
||||||
|
- IntellectualKitty
|
||||||
|
- Aaron Jacobs
|
||||||
|
- JannikGM
|
||||||
|
- Erik S. V. Jansson
|
||||||
|
- jjYBdx4IL
|
||||||
|
- Peter Johnson
|
||||||
|
- Toni Jovanoski
|
||||||
|
- Arseny Kapoulkine
|
||||||
|
- Cem Karan
|
||||||
|
- Osman Keskin
|
||||||
|
- Koray Kilinc
|
||||||
|
- Josh Kilmer
|
||||||
|
- Byunghoon Kim
|
||||||
|
- Cameron King
|
||||||
|
- Peter Knut
|
||||||
|
- Christoph Kubisch
|
||||||
|
- Yuri Kunde Schlesner
|
||||||
|
- Rokas Kupstys
|
||||||
|
- Konstantin Käfer
|
||||||
|
- Eric Larson
|
||||||
|
- Guillaume Lebrun
|
||||||
|
- Francis Lecavalier
|
||||||
|
- Jong Won Lee
|
||||||
|
- Robin Leffmann
|
||||||
|
- Glenn Lewis
|
||||||
|
- Shane Liesegang
|
||||||
|
- Anders Lindqvist
|
||||||
|
- Leon Linhart
|
||||||
|
- Marco Lizza
|
||||||
|
- lo-v-ol
|
||||||
|
- Eyal Lotem
|
||||||
|
- Aaron Loucks
|
||||||
|
- Ned Loynd
|
||||||
|
- Luflosi
|
||||||
|
- lukect
|
||||||
|
- Tristam MacDonald
|
||||||
|
- Jean-Luc Mackail
|
||||||
|
- Hans Mackowiak
|
||||||
|
- Ramiro Magno
|
||||||
|
- Дмитри Малышев
|
||||||
|
- Zbigniew Mandziejewicz
|
||||||
|
- Adam Marcus
|
||||||
|
- Célestin Marot
|
||||||
|
- Kyle McDonald
|
||||||
|
- David V. McKay
|
||||||
|
- David Medlock
|
||||||
|
- Bryce Mehring
|
||||||
|
- Jonathan Mercier
|
||||||
|
- Marcel Metz
|
||||||
|
- Liam Middlebrook
|
||||||
|
- mightgoyardstill
|
||||||
|
- Ave Milia
|
||||||
|
- Icyllis Milica
|
||||||
|
- Jonathan Miller
|
||||||
|
- Kenneth Miller
|
||||||
|
- Bruce Mitchener
|
||||||
|
- Jack Moffitt
|
||||||
|
- Ravi Mohan
|
||||||
|
- Jeff Molofee
|
||||||
|
- Alexander Monakov
|
||||||
|
- Pierre Morel
|
||||||
|
- Jon Morton
|
||||||
|
- Pierre Moulon
|
||||||
|
- Martins Mozeiko
|
||||||
|
- Pascal Muetschard
|
||||||
|
- James Murphy
|
||||||
|
- Julian Møller
|
||||||
|
- Julius Häger
|
||||||
|
- Nat!
|
||||||
|
- NateIsStalling
|
||||||
|
- ndogxj
|
||||||
|
- F. Nedelec
|
||||||
|
- n3rdopolis
|
||||||
|
- Kristian Nielsen
|
||||||
|
- Joel Niemelä
|
||||||
|
- Victor Nova
|
||||||
|
- Kamil Nowakowski
|
||||||
|
- onox
|
||||||
|
- Denis Ovod
|
||||||
|
- Ozzy
|
||||||
|
- Andri Pálsson
|
||||||
|
- luz paz
|
||||||
|
- Peoro
|
||||||
|
- Braden Pellett
|
||||||
|
- Christopher Pelloux
|
||||||
|
- Michael Pennington
|
||||||
|
- Arturo J. Pérez
|
||||||
|
- Vladimir Perminov
|
||||||
|
- Olivier Perret
|
||||||
|
- Anthony Pesch
|
||||||
|
- Orson Peters
|
||||||
|
- Emmanuel Gil Peyrot
|
||||||
|
- Cyril Pichard
|
||||||
|
- Pilzschaf
|
||||||
|
- Keith Pitt
|
||||||
|
- Stanislav Podgorskiy
|
||||||
|
- Konstantin Podsvirov
|
||||||
|
- Nathan Poirier
|
||||||
|
- Pokechu22
|
||||||
|
- Alexandre Pretyman
|
||||||
|
- Pablo Prietz
|
||||||
|
- przemekmirek
|
||||||
|
- pthom
|
||||||
|
- Martin Pulec
|
||||||
|
- Guillaume Racicot
|
||||||
|
- Juan Ramos
|
||||||
|
- Christian Rauch
|
||||||
|
- Philip Rideout
|
||||||
|
- Eddie Ringle
|
||||||
|
- Max Risuhin
|
||||||
|
- Joe Roback
|
||||||
|
- Jorge Rodriguez
|
||||||
|
- Jari Ronkainen
|
||||||
|
- Luca Rood
|
||||||
|
- Ed Ropple
|
||||||
|
- Aleksey Rybalkin
|
||||||
|
- Mikko Rytkönen
|
||||||
|
- Riku Salminen
|
||||||
|
- Yoshinori Sano
|
||||||
|
- Brandon Schaefer
|
||||||
|
- Sebastian Schuberth
|
||||||
|
- Scr3amer
|
||||||
|
- Jan Schuerkamp
|
||||||
|
- Christian Sdunek
|
||||||
|
- Matt Sealey
|
||||||
|
- Steve Sexton
|
||||||
|
- Arkady Shapkin
|
||||||
|
- Mingjie Shen
|
||||||
|
- Ali Sherief
|
||||||
|
- Yoshiki Shibukawa
|
||||||
|
- Dmitri Shuralyov
|
||||||
|
- Joao da Silva
|
||||||
|
- Daniel Sieger
|
||||||
|
- Daljit Singh
|
||||||
|
- Michael Skec
|
||||||
|
- Daniel Skorupski
|
||||||
|
- Slemmie
|
||||||
|
- Anthony Smith
|
||||||
|
- Bradley Smith
|
||||||
|
- Cliff Smolinsky
|
||||||
|
- Patrick Snape
|
||||||
|
- Erlend Sogge Heggen
|
||||||
|
- Olivier Sohn
|
||||||
|
- Julian Squires
|
||||||
|
- Johannes Stein
|
||||||
|
- Pontus Stenetorp
|
||||||
|
- Michael Stocker
|
||||||
|
- Justin Stoecker
|
||||||
|
- Elviss Strazdins
|
||||||
|
- Paul Sultana
|
||||||
|
- Nathan Sweet
|
||||||
|
- TTK-Bandit
|
||||||
|
- Nuno Teixeira
|
||||||
|
- Jared Tiala
|
||||||
|
- Sergey Tikhomirov
|
||||||
|
- Arthur Tombs
|
||||||
|
- TronicLabs
|
||||||
|
- Ioannis Tsakpinis
|
||||||
|
- Samuli Tuomola
|
||||||
|
- Matthew Turner
|
||||||
|
- urraka
|
||||||
|
- Elias Vanderstuyft
|
||||||
|
- Stef Velzel
|
||||||
|
- Jari Vetoniemi
|
||||||
|
- Ricardo Vieira
|
||||||
|
- Nicholas Vitovitch
|
||||||
|
- Vladimír Vondruš
|
||||||
|
- Simon Voordouw
|
||||||
|
- Corentin Wallez
|
||||||
|
- Torsten Walluhn
|
||||||
|
- Patrick Walton
|
||||||
|
- Jim Wang
|
||||||
|
- Xo Wang
|
||||||
|
- Andre Weissflog
|
||||||
|
- Jay Weisskopf
|
||||||
|
- Frank Wille
|
||||||
|
- Andy Williams
|
||||||
|
- Joel Winarske
|
||||||
|
- Richard A. Wilkes
|
||||||
|
- Tatsuya Yatagawa
|
||||||
|
- Ryogo Yoshimura
|
||||||
|
- Lukas Zanner
|
||||||
|
- Andrey Zholos
|
||||||
|
- Aihui Zhu
|
||||||
|
- Santi Zupancic
|
||||||
|
- Jonas Ådahl
|
||||||
|
- Lasse Öörni
|
||||||
|
- Leonard König
|
||||||
|
- All the unmentioned and anonymous contributors in the GLFW community, for bug
|
||||||
|
reports, patches, feedback, testing and encouragement
|
||||||
|
|
||||||
23
libraries/raylib/raylib/src/external/glfw/LICENSE.md
vendored
Normal file
23
libraries/raylib/raylib/src/external/glfw/LICENSE.md
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
|
|
||||||
|
Copyright (c) 2006-2019 Camilla Löwy
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
18
libraries/raylib/raylib/src/external/glfw/README.md
vendored
Normal file
18
libraries/raylib/raylib/src/external/glfw/README.md
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# GLFW (modified for raylib)
|
||||||
|
|
||||||
|
This directory contains a modification of GLFW, whose official website and
|
||||||
|
upstream repository are https://glfw.org and https://github.com/glfw/glfw,
|
||||||
|
respectively.
|
||||||
|
|
||||||
|
In this modification, some static functions sharing the same name in different
|
||||||
|
platforms have been renamed so all of GLFW's source files can be combined into
|
||||||
|
one (as done by ``rglfw.c``). Also, the Null platform, which is not used by
|
||||||
|
raylib, has been disabled. The renamed functions are:
|
||||||
|
|
||||||
|
``
|
||||||
|
createKeyTables()
|
||||||
|
translateKey()
|
||||||
|
acquireMonitor()
|
||||||
|
releaseMonitor()
|
||||||
|
``
|
||||||
|
|
||||||
230
libraries/raylib/raylib/src/external/glfw/deps/getopt.c
vendored
Normal file
230
libraries/raylib/raylib/src/external/glfw/deps/getopt.c
vendored
Normal file
|
|
@ -0,0 +1,230 @@
|
||||||
|
/* Copyright (c) 2012, Kim Gräsman
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Kim Gräsman nor the names of contributors may be used
|
||||||
|
* to endorse or promote products derived from this software without specific
|
||||||
|
* prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL KIM GRÄSMAN BE LIABLE FOR ANY DIRECT,
|
||||||
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "getopt.h"
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
const int no_argument = 0;
|
||||||
|
const int required_argument = 1;
|
||||||
|
const int optional_argument = 2;
|
||||||
|
|
||||||
|
char* optarg;
|
||||||
|
int optopt;
|
||||||
|
/* The variable optind [...] shall be initialized to 1 by the system. */
|
||||||
|
int optind = 1;
|
||||||
|
int opterr;
|
||||||
|
|
||||||
|
static char* optcursor = NULL;
|
||||||
|
|
||||||
|
/* Implemented based on [1] and [2] for optional arguments.
|
||||||
|
optopt is handled FreeBSD-style, per [3].
|
||||||
|
Other GNU and FreeBSD extensions are purely accidental.
|
||||||
|
|
||||||
|
[1] http://pubs.opengroup.org/onlinepubs/000095399/functions/getopt.html
|
||||||
|
[2] http://www.kernel.org/doc/man-pages/online/pages/man3/getopt.3.html
|
||||||
|
[3] http://www.freebsd.org/cgi/man.cgi?query=getopt&sektion=3&manpath=FreeBSD+9.0-RELEASE
|
||||||
|
*/
|
||||||
|
int getopt(int argc, char* const argv[], const char* optstring) {
|
||||||
|
int optchar = -1;
|
||||||
|
const char* optdecl = NULL;
|
||||||
|
|
||||||
|
optarg = NULL;
|
||||||
|
opterr = 0;
|
||||||
|
optopt = 0;
|
||||||
|
|
||||||
|
/* Unspecified, but we need it to avoid overrunning the argv bounds. */
|
||||||
|
if (optind >= argc)
|
||||||
|
goto no_more_optchars;
|
||||||
|
|
||||||
|
/* If, when getopt() is called argv[optind] is a null pointer, getopt()
|
||||||
|
shall return -1 without changing optind. */
|
||||||
|
if (argv[optind] == NULL)
|
||||||
|
goto no_more_optchars;
|
||||||
|
|
||||||
|
/* If, when getopt() is called *argv[optind] is not the character '-',
|
||||||
|
getopt() shall return -1 without changing optind. */
|
||||||
|
if (*argv[optind] != '-')
|
||||||
|
goto no_more_optchars;
|
||||||
|
|
||||||
|
/* If, when getopt() is called argv[optind] points to the string "-",
|
||||||
|
getopt() shall return -1 without changing optind. */
|
||||||
|
if (strcmp(argv[optind], "-") == 0)
|
||||||
|
goto no_more_optchars;
|
||||||
|
|
||||||
|
/* If, when getopt() is called argv[optind] points to the string "--",
|
||||||
|
getopt() shall return -1 after incrementing optind. */
|
||||||
|
if (strcmp(argv[optind], "--") == 0) {
|
||||||
|
++optind;
|
||||||
|
goto no_more_optchars;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optcursor == NULL || *optcursor == '\0')
|
||||||
|
optcursor = argv[optind] + 1;
|
||||||
|
|
||||||
|
optchar = *optcursor;
|
||||||
|
|
||||||
|
/* FreeBSD: The variable optopt saves the last known option character
|
||||||
|
returned by getopt(). */
|
||||||
|
optopt = optchar;
|
||||||
|
|
||||||
|
/* The getopt() function shall return the next option character (if one is
|
||||||
|
found) from argv that matches a character in optstring, if there is
|
||||||
|
one that matches. */
|
||||||
|
optdecl = strchr(optstring, optchar);
|
||||||
|
if (optdecl) {
|
||||||
|
/* [I]f a character is followed by a colon, the option takes an
|
||||||
|
argument. */
|
||||||
|
if (optdecl[1] == ':') {
|
||||||
|
optarg = ++optcursor;
|
||||||
|
if (*optarg == '\0') {
|
||||||
|
/* GNU extension: Two colons mean an option takes an
|
||||||
|
optional arg; if there is text in the current argv-element
|
||||||
|
(i.e., in the same word as the option name itself, for example,
|
||||||
|
"-oarg"), then it is returned in optarg, otherwise optarg is set
|
||||||
|
to zero. */
|
||||||
|
if (optdecl[2] != ':') {
|
||||||
|
/* If the option was the last character in the string pointed to by
|
||||||
|
an element of argv, then optarg shall contain the next element
|
||||||
|
of argv, and optind shall be incremented by 2. If the resulting
|
||||||
|
value of optind is greater than argc, this indicates a missing
|
||||||
|
option-argument, and getopt() shall return an error indication.
|
||||||
|
|
||||||
|
Otherwise, optarg shall point to the string following the
|
||||||
|
option character in that element of argv, and optind shall be
|
||||||
|
incremented by 1.
|
||||||
|
*/
|
||||||
|
if (++optind < argc) {
|
||||||
|
optarg = argv[optind];
|
||||||
|
} else {
|
||||||
|
/* If it detects a missing option-argument, it shall return the
|
||||||
|
colon character ( ':' ) if the first character of optstring
|
||||||
|
was a colon, or a question-mark character ( '?' ) otherwise.
|
||||||
|
*/
|
||||||
|
optarg = NULL;
|
||||||
|
optchar = (optstring[0] == ':') ? ':' : '?';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
optarg = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
optcursor = NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* If getopt() encounters an option character that is not contained in
|
||||||
|
optstring, it shall return the question-mark ( '?' ) character. */
|
||||||
|
optchar = '?';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optcursor == NULL || *++optcursor == '\0')
|
||||||
|
++optind;
|
||||||
|
|
||||||
|
return optchar;
|
||||||
|
|
||||||
|
no_more_optchars:
|
||||||
|
optcursor = NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Implementation based on [1].
|
||||||
|
|
||||||
|
[1] http://www.kernel.org/doc/man-pages/online/pages/man3/getopt.3.html
|
||||||
|
*/
|
||||||
|
int getopt_long(int argc, char* const argv[], const char* optstring,
|
||||||
|
const struct option* longopts, int* longindex) {
|
||||||
|
const struct option* o = longopts;
|
||||||
|
const struct option* match = NULL;
|
||||||
|
int num_matches = 0;
|
||||||
|
size_t argument_name_length = 0;
|
||||||
|
const char* current_argument = NULL;
|
||||||
|
int retval = -1;
|
||||||
|
|
||||||
|
optarg = NULL;
|
||||||
|
optopt = 0;
|
||||||
|
|
||||||
|
if (optind >= argc)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (strlen(argv[optind]) < 3 || strncmp(argv[optind], "--", 2) != 0)
|
||||||
|
return getopt(argc, argv, optstring);
|
||||||
|
|
||||||
|
/* It's an option; starts with -- and is longer than two chars. */
|
||||||
|
current_argument = argv[optind] + 2;
|
||||||
|
argument_name_length = strcspn(current_argument, "=");
|
||||||
|
for (; o->name; ++o) {
|
||||||
|
if (strncmp(o->name, current_argument, argument_name_length) == 0) {
|
||||||
|
match = o;
|
||||||
|
++num_matches;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (num_matches == 1) {
|
||||||
|
/* If longindex is not NULL, it points to a variable which is set to the
|
||||||
|
index of the long option relative to longopts. */
|
||||||
|
if (longindex)
|
||||||
|
*longindex = (int) (match - longopts);
|
||||||
|
|
||||||
|
/* If flag is NULL, then getopt_long() shall return val.
|
||||||
|
Otherwise, getopt_long() returns 0, and flag shall point to a variable
|
||||||
|
which shall be set to val if the option is found, but left unchanged if
|
||||||
|
the option is not found. */
|
||||||
|
if (match->flag)
|
||||||
|
*(match->flag) = match->val;
|
||||||
|
|
||||||
|
retval = match->flag ? 0 : match->val;
|
||||||
|
|
||||||
|
if (match->has_arg != no_argument) {
|
||||||
|
optarg = strchr(argv[optind], '=');
|
||||||
|
if (optarg != NULL)
|
||||||
|
++optarg;
|
||||||
|
|
||||||
|
if (match->has_arg == required_argument) {
|
||||||
|
/* Only scan the next argv for required arguments. Behavior is not
|
||||||
|
specified, but has been observed with Ubuntu and Mac OSX. */
|
||||||
|
if (optarg == NULL && ++optind < argc) {
|
||||||
|
optarg = argv[optind];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optarg == NULL)
|
||||||
|
retval = ':';
|
||||||
|
}
|
||||||
|
} else if (strchr(argv[optind], '=')) {
|
||||||
|
/* An argument was provided to a non-argument option.
|
||||||
|
I haven't seen this specified explicitly, but both GNU and BSD-based
|
||||||
|
implementations show this behavior.
|
||||||
|
*/
|
||||||
|
retval = '?';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Unknown option or ambiguous match. */
|
||||||
|
retval = '?';
|
||||||
|
}
|
||||||
|
|
||||||
|
++optind;
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
57
libraries/raylib/raylib/src/external/glfw/deps/getopt.h
vendored
Normal file
57
libraries/raylib/raylib/src/external/glfw/deps/getopt.h
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
/* Copyright (c) 2012, Kim Gräsman
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of Kim Gräsman nor the names of contributors may be used
|
||||||
|
* to endorse or promote products derived from this software without specific
|
||||||
|
* prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL KIM GRÄSMAN BE LIABLE FOR ANY DIRECT,
|
||||||
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INCLUDED_GETOPT_PORT_H
|
||||||
|
#define INCLUDED_GETOPT_PORT_H
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern const int no_argument;
|
||||||
|
extern const int required_argument;
|
||||||
|
extern const int optional_argument;
|
||||||
|
|
||||||
|
extern char* optarg;
|
||||||
|
extern int optind, opterr, optopt;
|
||||||
|
|
||||||
|
struct option {
|
||||||
|
const char* name;
|
||||||
|
int has_arg;
|
||||||
|
int* flag;
|
||||||
|
int val;
|
||||||
|
};
|
||||||
|
|
||||||
|
int getopt(int argc, char* const argv[], const char* optstring);
|
||||||
|
|
||||||
|
int getopt_long(int argc, char* const argv[],
|
||||||
|
const char* optstring, const struct option* longopts, int* longindex);
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // INCLUDED_GETOPT_PORT_H
|
||||||
5996
libraries/raylib/raylib/src/external/glfw/deps/glad/gl.h
vendored
Normal file
5996
libraries/raylib/raylib/src/external/glfw/deps/glad/gl.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
1805
libraries/raylib/raylib/src/external/glfw/deps/glad/gles2.h
vendored
Normal file
1805
libraries/raylib/raylib/src/external/glfw/deps/glad/gles2.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
6330
libraries/raylib/raylib/src/external/glfw/deps/glad/vulkan.h
vendored
Normal file
6330
libraries/raylib/raylib/src/external/glfw/deps/glad/vulkan.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
117
libraries/raylib/raylib/src/external/glfw/deps/mingw/_mingw_dxhelper.h
vendored
Normal file
117
libraries/raylib/raylib/src/external/glfw/deps/mingw/_mingw_dxhelper.h
vendored
Normal file
|
|
@ -0,0 +1,117 @@
|
||||||
|
/**
|
||||||
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
|
* This file is part of the mingw-w64 runtime package.
|
||||||
|
* No warranty is given; refer to the file DISCLAIMER within this package.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
|
||||||
|
#define NONAMELESSUNION 1
|
||||||
|
#endif
|
||||||
|
#if defined(NONAMELESSSTRUCT) && \
|
||||||
|
!defined(NONAMELESSUNION)
|
||||||
|
#define NONAMELESSUNION 1
|
||||||
|
#endif
|
||||||
|
#if defined(NONAMELESSUNION) && \
|
||||||
|
!defined(NONAMELESSSTRUCT)
|
||||||
|
#define NONAMELESSSTRUCT 1
|
||||||
|
#endif
|
||||||
|
#if !defined(__GNU_EXTENSION)
|
||||||
|
#if defined(__GNUC__) || defined(__GNUG__)
|
||||||
|
#define __GNU_EXTENSION __extension__
|
||||||
|
#else
|
||||||
|
#define __GNU_EXTENSION
|
||||||
|
#endif
|
||||||
|
#endif /* __extension__ */
|
||||||
|
|
||||||
|
#ifndef __ANONYMOUS_DEFINED
|
||||||
|
#define __ANONYMOUS_DEFINED
|
||||||
|
#if defined(__GNUC__) || defined(__GNUG__)
|
||||||
|
#define _ANONYMOUS_UNION __extension__
|
||||||
|
#define _ANONYMOUS_STRUCT __extension__
|
||||||
|
#else
|
||||||
|
#define _ANONYMOUS_UNION
|
||||||
|
#define _ANONYMOUS_STRUCT
|
||||||
|
#endif
|
||||||
|
#ifndef NONAMELESSUNION
|
||||||
|
#define _UNION_NAME(x)
|
||||||
|
#define _STRUCT_NAME(x)
|
||||||
|
#else /* NONAMELESSUNION */
|
||||||
|
#define _UNION_NAME(x) x
|
||||||
|
#define _STRUCT_NAME(x) x
|
||||||
|
#endif
|
||||||
|
#endif /* __ANONYMOUS_DEFINED */
|
||||||
|
|
||||||
|
#ifndef DUMMYUNIONNAME
|
||||||
|
# ifdef NONAMELESSUNION
|
||||||
|
# define DUMMYUNIONNAME u
|
||||||
|
# define DUMMYUNIONNAME1 u1 /* Wine uses this variant */
|
||||||
|
# define DUMMYUNIONNAME2 u2
|
||||||
|
# define DUMMYUNIONNAME3 u3
|
||||||
|
# define DUMMYUNIONNAME4 u4
|
||||||
|
# define DUMMYUNIONNAME5 u5
|
||||||
|
# define DUMMYUNIONNAME6 u6
|
||||||
|
# define DUMMYUNIONNAME7 u7
|
||||||
|
# define DUMMYUNIONNAME8 u8
|
||||||
|
# define DUMMYUNIONNAME9 u9
|
||||||
|
# else /* NONAMELESSUNION */
|
||||||
|
# define DUMMYUNIONNAME
|
||||||
|
# define DUMMYUNIONNAME1 /* Wine uses this variant */
|
||||||
|
# define DUMMYUNIONNAME2
|
||||||
|
# define DUMMYUNIONNAME3
|
||||||
|
# define DUMMYUNIONNAME4
|
||||||
|
# define DUMMYUNIONNAME5
|
||||||
|
# define DUMMYUNIONNAME6
|
||||||
|
# define DUMMYUNIONNAME7
|
||||||
|
# define DUMMYUNIONNAME8
|
||||||
|
# define DUMMYUNIONNAME9
|
||||||
|
# endif
|
||||||
|
#endif /* DUMMYUNIONNAME */
|
||||||
|
|
||||||
|
#if !defined(DUMMYUNIONNAME1) /* MinGW does not define this one */
|
||||||
|
# ifdef NONAMELESSUNION
|
||||||
|
# define DUMMYUNIONNAME1 u1 /* Wine uses this variant */
|
||||||
|
# else
|
||||||
|
# define DUMMYUNIONNAME1 /* Wine uses this variant */
|
||||||
|
# endif
|
||||||
|
#endif /* DUMMYUNIONNAME1 */
|
||||||
|
|
||||||
|
#ifndef DUMMYSTRUCTNAME
|
||||||
|
# ifdef NONAMELESSUNION
|
||||||
|
# define DUMMYSTRUCTNAME s
|
||||||
|
# define DUMMYSTRUCTNAME1 s1 /* Wine uses this variant */
|
||||||
|
# define DUMMYSTRUCTNAME2 s2
|
||||||
|
# define DUMMYSTRUCTNAME3 s3
|
||||||
|
# define DUMMYSTRUCTNAME4 s4
|
||||||
|
# define DUMMYSTRUCTNAME5 s5
|
||||||
|
# else
|
||||||
|
# define DUMMYSTRUCTNAME
|
||||||
|
# define DUMMYSTRUCTNAME1 /* Wine uses this variant */
|
||||||
|
# define DUMMYSTRUCTNAME2
|
||||||
|
# define DUMMYSTRUCTNAME3
|
||||||
|
# define DUMMYSTRUCTNAME4
|
||||||
|
# define DUMMYSTRUCTNAME5
|
||||||
|
# endif
|
||||||
|
#endif /* DUMMYSTRUCTNAME */
|
||||||
|
|
||||||
|
/* These are for compatibility with the Wine source tree */
|
||||||
|
|
||||||
|
#ifndef WINELIB_NAME_AW
|
||||||
|
# ifdef __MINGW_NAME_AW
|
||||||
|
# define WINELIB_NAME_AW __MINGW_NAME_AW
|
||||||
|
# else
|
||||||
|
# ifdef UNICODE
|
||||||
|
# define WINELIB_NAME_AW(func) func##W
|
||||||
|
# else
|
||||||
|
# define WINELIB_NAME_AW(func) func##A
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif /* WINELIB_NAME_AW */
|
||||||
|
|
||||||
|
#ifndef DECL_WINELIB_TYPE_AW
|
||||||
|
# ifdef __MINGW_TYPEDEF_AW
|
||||||
|
# define DECL_WINELIB_TYPE_AW __MINGW_TYPEDEF_AW
|
||||||
|
# else
|
||||||
|
# define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
|
||||||
|
# endif
|
||||||
|
#endif /* DECL_WINELIB_TYPE_AW */
|
||||||
|
|
||||||
2467
libraries/raylib/raylib/src/external/glfw/deps/mingw/dinput.h
vendored
Normal file
2467
libraries/raylib/raylib/src/external/glfw/deps/mingw/dinput.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
239
libraries/raylib/raylib/src/external/glfw/deps/mingw/xinput.h
vendored
Normal file
239
libraries/raylib/raylib/src/external/glfw/deps/mingw/xinput.h
vendored
Normal file
|
|
@ -0,0 +1,239 @@
|
||||||
|
/*
|
||||||
|
* The Wine project - Xinput Joystick Library
|
||||||
|
* Copyright 2008 Andrew Fenn
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __WINE_XINPUT_H
|
||||||
|
#define __WINE_XINPUT_H
|
||||||
|
|
||||||
|
#include <windef.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Bitmasks for the joysticks buttons, determines what has
|
||||||
|
* been pressed on the joystick, these need to be mapped
|
||||||
|
* to whatever device you're using instead of an xbox 360
|
||||||
|
* joystick
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define XINPUT_GAMEPAD_DPAD_UP 0x0001
|
||||||
|
#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
|
||||||
|
#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
|
||||||
|
#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
|
||||||
|
#define XINPUT_GAMEPAD_START 0x0010
|
||||||
|
#define XINPUT_GAMEPAD_BACK 0x0020
|
||||||
|
#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
|
||||||
|
#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
|
||||||
|
#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
|
||||||
|
#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
|
||||||
|
#define XINPUT_GAMEPAD_A 0x1000
|
||||||
|
#define XINPUT_GAMEPAD_B 0x2000
|
||||||
|
#define XINPUT_GAMEPAD_X 0x4000
|
||||||
|
#define XINPUT_GAMEPAD_Y 0x8000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines the flags used to determine if the user is pushing
|
||||||
|
* down on a button, not holding a button, etc
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define XINPUT_KEYSTROKE_KEYDOWN 0x0001
|
||||||
|
#define XINPUT_KEYSTROKE_KEYUP 0x0002
|
||||||
|
#define XINPUT_KEYSTROKE_REPEAT 0x0004
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines the codes which are returned by XInputGetKeystroke
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define VK_PAD_A 0x5800
|
||||||
|
#define VK_PAD_B 0x5801
|
||||||
|
#define VK_PAD_X 0x5802
|
||||||
|
#define VK_PAD_Y 0x5803
|
||||||
|
#define VK_PAD_RSHOULDER 0x5804
|
||||||
|
#define VK_PAD_LSHOULDER 0x5805
|
||||||
|
#define VK_PAD_LTRIGGER 0x5806
|
||||||
|
#define VK_PAD_RTRIGGER 0x5807
|
||||||
|
#define VK_PAD_DPAD_UP 0x5810
|
||||||
|
#define VK_PAD_DPAD_DOWN 0x5811
|
||||||
|
#define VK_PAD_DPAD_LEFT 0x5812
|
||||||
|
#define VK_PAD_DPAD_RIGHT 0x5813
|
||||||
|
#define VK_PAD_START 0x5814
|
||||||
|
#define VK_PAD_BACK 0x5815
|
||||||
|
#define VK_PAD_LTHUMB_PRESS 0x5816
|
||||||
|
#define VK_PAD_RTHUMB_PRESS 0x5817
|
||||||
|
#define VK_PAD_LTHUMB_UP 0x5820
|
||||||
|
#define VK_PAD_LTHUMB_DOWN 0x5821
|
||||||
|
#define VK_PAD_LTHUMB_RIGHT 0x5822
|
||||||
|
#define VK_PAD_LTHUMB_LEFT 0x5823
|
||||||
|
#define VK_PAD_LTHUMB_UPLEFT 0x5824
|
||||||
|
#define VK_PAD_LTHUMB_UPRIGHT 0x5825
|
||||||
|
#define VK_PAD_LTHUMB_DOWNRIGHT 0x5826
|
||||||
|
#define VK_PAD_LTHUMB_DOWNLEFT 0x5827
|
||||||
|
#define VK_PAD_RTHUMB_UP 0x5830
|
||||||
|
#define VK_PAD_RTHUMB_DOWN 0x5831
|
||||||
|
#define VK_PAD_RTHUMB_RIGHT 0x5832
|
||||||
|
#define VK_PAD_RTHUMB_LEFT 0x5833
|
||||||
|
#define VK_PAD_RTHUMB_UPLEFT 0x5834
|
||||||
|
#define VK_PAD_RTHUMB_UPRIGHT 0x5835
|
||||||
|
#define VK_PAD_RTHUMB_DOWNRIGHT 0x5836
|
||||||
|
#define VK_PAD_RTHUMB_DOWNLEFT 0x5837
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Deadzones are for analogue joystick controls on the joypad
|
||||||
|
* which determine when input should be assumed to be in the
|
||||||
|
* middle of the pad. This is a threshold to stop a joypad
|
||||||
|
* controlling the game when the player isn't touching the
|
||||||
|
* controls.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849
|
||||||
|
#define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689
|
||||||
|
#define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines what type of abilities the type of joystick has
|
||||||
|
* DEVTYPE_GAMEPAD is available for all joysticks, however
|
||||||
|
* there may be more specific identifiers for other joysticks
|
||||||
|
* which are being used.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define XINPUT_DEVTYPE_GAMEPAD 0x01
|
||||||
|
#define XINPUT_DEVSUBTYPE_GAMEPAD 0x01
|
||||||
|
#define XINPUT_DEVSUBTYPE_WHEEL 0x02
|
||||||
|
#define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03
|
||||||
|
#define XINPUT_DEVSUBTYPE_FLIGHT_SICK 0x04
|
||||||
|
#define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05
|
||||||
|
#define XINPUT_DEVSUBTYPE_GUITAR 0x06
|
||||||
|
#define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These are used with the XInputGetCapabilities function to
|
||||||
|
* determine the abilities to the joystick which has been
|
||||||
|
* plugged in.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define XINPUT_CAPS_VOICE_SUPPORTED 0x0004
|
||||||
|
#define XINPUT_FLAG_GAMEPAD 0x00000001
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines the status of the battery if one is used in the
|
||||||
|
* attached joystick. The first two define if the joystick
|
||||||
|
* supports a battery. Disconnected means that the joystick
|
||||||
|
* isn't connected. Wired shows that the joystick is a wired
|
||||||
|
* joystick.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BATTERY_DEVTYPE_GAMEPAD 0x00
|
||||||
|
#define BATTERY_DEVTYPE_HEADSET 0x01
|
||||||
|
#define BATTERY_TYPE_DISCONNECTED 0x00
|
||||||
|
#define BATTERY_TYPE_WIRED 0x01
|
||||||
|
#define BATTERY_TYPE_ALKALINE 0x02
|
||||||
|
#define BATTERY_TYPE_NIMH 0x03
|
||||||
|
#define BATTERY_TYPE_UNKNOWN 0xFF
|
||||||
|
#define BATTERY_LEVEL_EMPTY 0x00
|
||||||
|
#define BATTERY_LEVEL_LOW 0x01
|
||||||
|
#define BATTERY_LEVEL_MEDIUM 0x02
|
||||||
|
#define BATTERY_LEVEL_FULL 0x03
|
||||||
|
|
||||||
|
/*
|
||||||
|
* How many joysticks can be used with this library. Games that
|
||||||
|
* use the xinput library will not go over this number.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define XUSER_MAX_COUNT 4
|
||||||
|
#define XUSER_INDEX_ANY 0x000000FF
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines the structure of an xbox 360 joystick.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct _XINPUT_GAMEPAD {
|
||||||
|
WORD wButtons;
|
||||||
|
BYTE bLeftTrigger;
|
||||||
|
BYTE bRightTrigger;
|
||||||
|
SHORT sThumbLX;
|
||||||
|
SHORT sThumbLY;
|
||||||
|
SHORT sThumbRX;
|
||||||
|
SHORT sThumbRY;
|
||||||
|
} XINPUT_GAMEPAD, *PXINPUT_GAMEPAD;
|
||||||
|
|
||||||
|
typedef struct _XINPUT_STATE {
|
||||||
|
DWORD dwPacketNumber;
|
||||||
|
XINPUT_GAMEPAD Gamepad;
|
||||||
|
} XINPUT_STATE, *PXINPUT_STATE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines the structure of how much vibration is set on both the
|
||||||
|
* right and left motors in a joystick. If you're not using a 360
|
||||||
|
* joystick you will have to map these to your device.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct _XINPUT_VIBRATION {
|
||||||
|
WORD wLeftMotorSpeed;
|
||||||
|
WORD wRightMotorSpeed;
|
||||||
|
} XINPUT_VIBRATION, *PXINPUT_VIBRATION;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines the structure for what kind of abilities the joystick has
|
||||||
|
* such abilities are things such as if the joystick has the ability
|
||||||
|
* to send and receive audio, if the joystick is in fact a driving
|
||||||
|
* wheel or perhaps if the joystick is some kind of dance pad or
|
||||||
|
* guitar.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct _XINPUT_CAPABILITIES {
|
||||||
|
BYTE Type;
|
||||||
|
BYTE SubType;
|
||||||
|
WORD Flags;
|
||||||
|
XINPUT_GAMEPAD Gamepad;
|
||||||
|
XINPUT_VIBRATION Vibration;
|
||||||
|
} XINPUT_CAPABILITIES, *PXINPUT_CAPABILITIES;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines the structure for a joystick input event which is
|
||||||
|
* retrieved using the function XInputGetKeystroke
|
||||||
|
*/
|
||||||
|
typedef struct _XINPUT_KEYSTROKE {
|
||||||
|
WORD VirtualKey;
|
||||||
|
WCHAR Unicode;
|
||||||
|
WORD Flags;
|
||||||
|
BYTE UserIndex;
|
||||||
|
BYTE HidCode;
|
||||||
|
} XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE;
|
||||||
|
|
||||||
|
typedef struct _XINPUT_BATTERY_INFORMATION
|
||||||
|
{
|
||||||
|
BYTE BatteryType;
|
||||||
|
BYTE BatteryLevel;
|
||||||
|
} XINPUT_BATTERY_INFORMATION, *PXINPUT_BATTERY_INFORMATION;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void WINAPI XInputEnable(WINBOOL);
|
||||||
|
DWORD WINAPI XInputSetState(DWORD, XINPUT_VIBRATION*);
|
||||||
|
DWORD WINAPI XInputGetState(DWORD, XINPUT_STATE*);
|
||||||
|
DWORD WINAPI XInputGetKeystroke(DWORD, DWORD, PXINPUT_KEYSTROKE);
|
||||||
|
DWORD WINAPI XInputGetCapabilities(DWORD, DWORD, XINPUT_CAPABILITIES*);
|
||||||
|
DWORD WINAPI XInputGetDSoundAudioDeviceGuids(DWORD, GUID*, GUID*);
|
||||||
|
DWORD WINAPI XInputGetBatteryInformation(DWORD, BYTE, XINPUT_BATTERY_INFORMATION*);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __WINE_XINPUT_H */
|
||||||
102
libraries/raylib/raylib/src/external/glfw/deps/wayland/fractional-scale-v1.xml
vendored
Normal file
102
libraries/raylib/raylib/src/external/glfw/deps/wayland/fractional-scale-v1.xml
vendored
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="fractional_scale_v1">
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2022 Kenny Levinsen
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<description summary="Protocol for requesting fractional surface scales">
|
||||||
|
This protocol allows a compositor to suggest for surfaces to render at
|
||||||
|
fractional scales.
|
||||||
|
|
||||||
|
A client can submit scaled content by utilizing wp_viewport. This is done by
|
||||||
|
creating a wp_viewport object for the surface and setting the destination
|
||||||
|
rectangle to the surface size before the scale factor is applied.
|
||||||
|
|
||||||
|
The buffer size is calculated by multiplying the surface size by the
|
||||||
|
intended scale.
|
||||||
|
|
||||||
|
The wl_surface buffer scale should remain set to 1.
|
||||||
|
|
||||||
|
If a surface has a surface-local size of 100 px by 50 px and wishes to
|
||||||
|
submit buffers with a scale of 1.5, then a buffer of 150px by 75 px should
|
||||||
|
be used and the wp_viewport destination rectangle should be 100 px by 50 px.
|
||||||
|
|
||||||
|
For toplevel surfaces, the size is rounded halfway away from zero. The
|
||||||
|
rounding algorithm for subsurface position and size is not defined.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<interface name="wp_fractional_scale_manager_v1" version="1">
|
||||||
|
<description summary="fractional surface scale information">
|
||||||
|
A global interface for requesting surfaces to use fractional scales.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="unbind the fractional surface scale interface">
|
||||||
|
Informs the server that the client will not be using this protocol
|
||||||
|
object anymore. This does not affect any other objects,
|
||||||
|
wp_fractional_scale_v1 objects included.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<entry name="fractional_scale_exists" value="0"
|
||||||
|
summary="the surface already has a fractional_scale object associated"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="get_fractional_scale">
|
||||||
|
<description summary="extend surface interface for scale information">
|
||||||
|
Create an add-on object for the the wl_surface to let the compositor
|
||||||
|
request fractional scales. If the given wl_surface already has a
|
||||||
|
wp_fractional_scale_v1 object associated, the fractional_scale_exists
|
||||||
|
protocol error is raised.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="wp_fractional_scale_v1"
|
||||||
|
summary="the new surface scale info interface id"/>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="the surface"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="wp_fractional_scale_v1" version="1">
|
||||||
|
<description summary="fractional scale interface to a wl_surface">
|
||||||
|
An additional interface to a wl_surface object which allows the compositor
|
||||||
|
to inform the client of the preferred scale.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="remove surface scale information for surface">
|
||||||
|
Destroy the fractional scale object. When this object is destroyed,
|
||||||
|
preferred_scale events will no longer be sent.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="preferred_scale">
|
||||||
|
<description summary="notify of new preferred scale">
|
||||||
|
Notification of a new preferred scale for this surface that the
|
||||||
|
compositor suggests that the client should use.
|
||||||
|
|
||||||
|
The sent scale is the numerator of a fraction with a denominator of 120.
|
||||||
|
</description>
|
||||||
|
<arg name="scale" type="uint" summary="the new preferred scale"/>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
||||||
83
libraries/raylib/raylib/src/external/glfw/deps/wayland/idle-inhibit-unstable-v1.xml
vendored
Normal file
83
libraries/raylib/raylib/src/external/glfw/deps/wayland/idle-inhibit-unstable-v1.xml
vendored
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="idle_inhibit_unstable_v1">
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2015 Samsung Electronics Co., Ltd
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<interface name="zwp_idle_inhibit_manager_v1" version="1">
|
||||||
|
<description summary="control behavior when display idles">
|
||||||
|
This interface permits inhibiting the idle behavior such as screen
|
||||||
|
blanking, locking, and screensaving. The client binds the idle manager
|
||||||
|
globally, then creates idle-inhibitor objects for each surface.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is experimental and
|
||||||
|
backward incompatible changes may be made. Backward compatible changes
|
||||||
|
may be added together with the corresponding interface version bump.
|
||||||
|
Backward incompatible changes are done by bumping the version number in
|
||||||
|
the protocol and interface names and resetting the interface version.
|
||||||
|
Once the protocol is to be declared stable, the 'z' prefix and the
|
||||||
|
version number in the protocol and interface names are removed and the
|
||||||
|
interface version number is reset.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the idle inhibitor object">
|
||||||
|
Destroy the inhibit manager.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="create_inhibitor">
|
||||||
|
<description summary="create a new inhibitor object">
|
||||||
|
Create a new inhibitor object associated with the given surface.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zwp_idle_inhibitor_v1"/>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="the surface that inhibits the idle behavior"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zwp_idle_inhibitor_v1" version="1">
|
||||||
|
<description summary="context object for inhibiting idle behavior">
|
||||||
|
An idle inhibitor prevents the output that the associated surface is
|
||||||
|
visible on from being set to a state where it is not visually usable due
|
||||||
|
to lack of user interaction (e.g. blanked, dimmed, locked, set to power
|
||||||
|
save, etc.) Any screensaver processes are also blocked from displaying.
|
||||||
|
|
||||||
|
If the surface is destroyed, unmapped, becomes occluded, loses
|
||||||
|
visibility, or otherwise becomes not visually relevant for the user, the
|
||||||
|
idle inhibitor will not be honored by the compositor; if the surface
|
||||||
|
subsequently regains visibility the inhibitor takes effect once again.
|
||||||
|
Likewise, the inhibitor isn't honored if the system was already idled at
|
||||||
|
the time the inhibitor was established, although if the system later
|
||||||
|
de-idles and re-idles the inhibitor will take effect.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the idle inhibitor object">
|
||||||
|
Remove the inhibitor effect from the associated wl_surface.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
||||||
339
libraries/raylib/raylib/src/external/glfw/deps/wayland/pointer-constraints-unstable-v1.xml
vendored
Normal file
339
libraries/raylib/raylib/src/external/glfw/deps/wayland/pointer-constraints-unstable-v1.xml
vendored
Normal file
|
|
@ -0,0 +1,339 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="pointer_constraints_unstable_v1">
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2014 Jonas Ådahl
|
||||||
|
Copyright © 2015 Red Hat Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<description summary="protocol for constraining pointer motions">
|
||||||
|
This protocol specifies a set of interfaces used for adding constraints to
|
||||||
|
the motion of a pointer. Possible constraints include confining pointer
|
||||||
|
motions to a given region, or locking it to its current position.
|
||||||
|
|
||||||
|
In order to constrain the pointer, a client must first bind the global
|
||||||
|
interface "wp_pointer_constraints" which, if a compositor supports pointer
|
||||||
|
constraints, is exposed by the registry. Using the bound global object, the
|
||||||
|
client uses the request that corresponds to the type of constraint it wants
|
||||||
|
to make. See wp_pointer_constraints for more details.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is experimental and backward
|
||||||
|
incompatible changes may be made. Backward compatible changes may be added
|
||||||
|
together with the corresponding interface version bump. Backward
|
||||||
|
incompatible changes are done by bumping the version number in the protocol
|
||||||
|
and interface names and resetting the interface version. Once the protocol
|
||||||
|
is to be declared stable, the 'z' prefix and the version number in the
|
||||||
|
protocol and interface names are removed and the interface version number is
|
||||||
|
reset.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<interface name="zwp_pointer_constraints_v1" version="1">
|
||||||
|
<description summary="constrain the movement of a pointer">
|
||||||
|
The global interface exposing pointer constraining functionality. It
|
||||||
|
exposes two requests: lock_pointer for locking the pointer to its
|
||||||
|
position, and confine_pointer for locking the pointer to a region.
|
||||||
|
|
||||||
|
The lock_pointer and confine_pointer requests create the objects
|
||||||
|
wp_locked_pointer and wp_confined_pointer respectively, and the client can
|
||||||
|
use these objects to interact with the lock.
|
||||||
|
|
||||||
|
For any surface, only one lock or confinement may be active across all
|
||||||
|
wl_pointer objects of the same seat. If a lock or confinement is requested
|
||||||
|
when another lock or confinement is active or requested on the same surface
|
||||||
|
and with any of the wl_pointer objects of the same seat, an
|
||||||
|
'already_constrained' error will be raised.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<description summary="wp_pointer_constraints error values">
|
||||||
|
These errors can be emitted in response to wp_pointer_constraints
|
||||||
|
requests.
|
||||||
|
</description>
|
||||||
|
<entry name="already_constrained" value="1"
|
||||||
|
summary="pointer constraint already requested on that surface"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<enum name="lifetime">
|
||||||
|
<description summary="constraint lifetime">
|
||||||
|
These values represent different lifetime semantics. They are passed
|
||||||
|
as arguments to the factory requests to specify how the constraint
|
||||||
|
lifetimes should be managed.
|
||||||
|
</description>
|
||||||
|
<entry name="oneshot" value="1">
|
||||||
|
<description summary="the pointer constraint is defunct once deactivated">
|
||||||
|
A oneshot pointer constraint will never reactivate once it has been
|
||||||
|
deactivated. See the corresponding deactivation event
|
||||||
|
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
|
||||||
|
details.
|
||||||
|
</description>
|
||||||
|
</entry>
|
||||||
|
<entry name="persistent" value="2">
|
||||||
|
<description summary="the pointer constraint may reactivate">
|
||||||
|
A persistent pointer constraint may again reactivate once it has
|
||||||
|
been deactivated. See the corresponding deactivation event
|
||||||
|
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
|
||||||
|
details.
|
||||||
|
</description>
|
||||||
|
</entry>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the pointer constraints manager object">
|
||||||
|
Used by the client to notify the server that it will no longer use this
|
||||||
|
pointer constraints object.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="lock_pointer">
|
||||||
|
<description summary="lock pointer to a position">
|
||||||
|
The lock_pointer request lets the client request to disable movements of
|
||||||
|
the virtual pointer (i.e. the cursor), effectively locking the pointer
|
||||||
|
to a position. This request may not take effect immediately; in the
|
||||||
|
future, when the compositor deems implementation-specific constraints
|
||||||
|
are satisfied, the pointer lock will be activated and the compositor
|
||||||
|
sends a locked event.
|
||||||
|
|
||||||
|
The protocol provides no guarantee that the constraints are ever
|
||||||
|
satisfied, and does not require the compositor to send an error if the
|
||||||
|
constraints cannot ever be satisfied. It is thus possible to request a
|
||||||
|
lock that will never activate.
|
||||||
|
|
||||||
|
There may not be another pointer constraint of any kind requested or
|
||||||
|
active on the surface for any of the wl_pointer objects of the seat of
|
||||||
|
the passed pointer when requesting a lock. If there is, an error will be
|
||||||
|
raised. See general pointer lock documentation for more details.
|
||||||
|
|
||||||
|
The intersection of the region passed with this request and the input
|
||||||
|
region of the surface is used to determine where the pointer must be
|
||||||
|
in order for the lock to activate. It is up to the compositor whether to
|
||||||
|
warp the pointer or require some kind of user interaction for the lock
|
||||||
|
to activate. If the region is null the surface input region is used.
|
||||||
|
|
||||||
|
A surface may receive pointer focus without the lock being activated.
|
||||||
|
|
||||||
|
The request creates a new object wp_locked_pointer which is used to
|
||||||
|
interact with the lock as well as receive updates about its state. See
|
||||||
|
the the description of wp_locked_pointer for further information.
|
||||||
|
|
||||||
|
Note that while a pointer is locked, the wl_pointer objects of the
|
||||||
|
corresponding seat will not emit any wl_pointer.motion events, but
|
||||||
|
relative motion events will still be emitted via wp_relative_pointer
|
||||||
|
objects of the same seat. wl_pointer.axis and wl_pointer.button events
|
||||||
|
are unaffected.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zwp_locked_pointer_v1"/>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="surface to lock pointer to"/>
|
||||||
|
<arg name="pointer" type="object" interface="wl_pointer"
|
||||||
|
summary="the pointer that should be locked"/>
|
||||||
|
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||||
|
summary="region of surface"/>
|
||||||
|
<arg name="lifetime" type="uint" enum="lifetime" summary="lock lifetime"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="confine_pointer">
|
||||||
|
<description summary="confine pointer to a region">
|
||||||
|
The confine_pointer request lets the client request to confine the
|
||||||
|
pointer cursor to a given region. This request may not take effect
|
||||||
|
immediately; in the future, when the compositor deems implementation-
|
||||||
|
specific constraints are satisfied, the pointer confinement will be
|
||||||
|
activated and the compositor sends a confined event.
|
||||||
|
|
||||||
|
The intersection of the region passed with this request and the input
|
||||||
|
region of the surface is used to determine where the pointer must be
|
||||||
|
in order for the confinement to activate. It is up to the compositor
|
||||||
|
whether to warp the pointer or require some kind of user interaction for
|
||||||
|
the confinement to activate. If the region is null the surface input
|
||||||
|
region is used.
|
||||||
|
|
||||||
|
The request will create a new object wp_confined_pointer which is used
|
||||||
|
to interact with the confinement as well as receive updates about its
|
||||||
|
state. See the the description of wp_confined_pointer for further
|
||||||
|
information.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zwp_confined_pointer_v1"/>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="surface to lock pointer to"/>
|
||||||
|
<arg name="pointer" type="object" interface="wl_pointer"
|
||||||
|
summary="the pointer that should be confined"/>
|
||||||
|
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||||
|
summary="region of surface"/>
|
||||||
|
<arg name="lifetime" type="uint" enum="lifetime" summary="confinement lifetime"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zwp_locked_pointer_v1" version="1">
|
||||||
|
<description summary="receive relative pointer motion events">
|
||||||
|
The wp_locked_pointer interface represents a locked pointer state.
|
||||||
|
|
||||||
|
While the lock of this object is active, the wl_pointer objects of the
|
||||||
|
associated seat will not emit any wl_pointer.motion events.
|
||||||
|
|
||||||
|
This object will send the event 'locked' when the lock is activated.
|
||||||
|
Whenever the lock is activated, it is guaranteed that the locked surface
|
||||||
|
will already have received pointer focus and that the pointer will be
|
||||||
|
within the region passed to the request creating this object.
|
||||||
|
|
||||||
|
To unlock the pointer, send the destroy request. This will also destroy
|
||||||
|
the wp_locked_pointer object.
|
||||||
|
|
||||||
|
If the compositor decides to unlock the pointer the unlocked event is
|
||||||
|
sent. See wp_locked_pointer.unlock for details.
|
||||||
|
|
||||||
|
When unlocking, the compositor may warp the cursor position to the set
|
||||||
|
cursor position hint. If it does, it will not result in any relative
|
||||||
|
motion events emitted via wp_relative_pointer.
|
||||||
|
|
||||||
|
If the surface the lock was requested on is destroyed and the lock is not
|
||||||
|
yet activated, the wp_locked_pointer object is now defunct and must be
|
||||||
|
destroyed.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the locked pointer object">
|
||||||
|
Destroy the locked pointer object. If applicable, the compositor will
|
||||||
|
unlock the pointer.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_cursor_position_hint">
|
||||||
|
<description summary="set the pointer cursor position hint">
|
||||||
|
Set the cursor position hint relative to the top left corner of the
|
||||||
|
surface.
|
||||||
|
|
||||||
|
If the client is drawing its own cursor, it should update the position
|
||||||
|
hint to the position of its own cursor. A compositor may use this
|
||||||
|
information to warp the pointer upon unlock in order to avoid pointer
|
||||||
|
jumps.
|
||||||
|
|
||||||
|
The cursor position hint is double buffered. The new hint will only take
|
||||||
|
effect when the associated surface gets it pending state applied. See
|
||||||
|
wl_surface.commit for details.
|
||||||
|
</description>
|
||||||
|
<arg name="surface_x" type="fixed"
|
||||||
|
summary="surface-local x coordinate"/>
|
||||||
|
<arg name="surface_y" type="fixed"
|
||||||
|
summary="surface-local y coordinate"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_region">
|
||||||
|
<description summary="set a new lock region">
|
||||||
|
Set a new region used to lock the pointer.
|
||||||
|
|
||||||
|
The new lock region is double-buffered. The new lock region will
|
||||||
|
only take effect when the associated surface gets its pending state
|
||||||
|
applied. See wl_surface.commit for details.
|
||||||
|
|
||||||
|
For details about the lock region, see wp_locked_pointer.
|
||||||
|
</description>
|
||||||
|
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||||
|
summary="region of surface"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="locked">
|
||||||
|
<description summary="lock activation event">
|
||||||
|
Notification that the pointer lock of the seat's pointer is activated.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="unlocked">
|
||||||
|
<description summary="lock deactivation event">
|
||||||
|
Notification that the pointer lock of the seat's pointer is no longer
|
||||||
|
active. If this is a oneshot pointer lock (see
|
||||||
|
wp_pointer_constraints.lifetime) this object is now defunct and should
|
||||||
|
be destroyed. If this is a persistent pointer lock (see
|
||||||
|
wp_pointer_constraints.lifetime) this pointer lock may again
|
||||||
|
reactivate in the future.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zwp_confined_pointer_v1" version="1">
|
||||||
|
<description summary="confined pointer object">
|
||||||
|
The wp_confined_pointer interface represents a confined pointer state.
|
||||||
|
|
||||||
|
This object will send the event 'confined' when the confinement is
|
||||||
|
activated. Whenever the confinement is activated, it is guaranteed that
|
||||||
|
the surface the pointer is confined to will already have received pointer
|
||||||
|
focus and that the pointer will be within the region passed to the request
|
||||||
|
creating this object. It is up to the compositor to decide whether this
|
||||||
|
requires some user interaction and if the pointer will warp to within the
|
||||||
|
passed region if outside.
|
||||||
|
|
||||||
|
To unconfine the pointer, send the destroy request. This will also destroy
|
||||||
|
the wp_confined_pointer object.
|
||||||
|
|
||||||
|
If the compositor decides to unconfine the pointer the unconfined event is
|
||||||
|
sent. The wp_confined_pointer object is at this point defunct and should
|
||||||
|
be destroyed.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the confined pointer object">
|
||||||
|
Destroy the confined pointer object. If applicable, the compositor will
|
||||||
|
unconfine the pointer.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_region">
|
||||||
|
<description summary="set a new confine region">
|
||||||
|
Set a new region used to confine the pointer.
|
||||||
|
|
||||||
|
The new confine region is double-buffered. The new confine region will
|
||||||
|
only take effect when the associated surface gets its pending state
|
||||||
|
applied. See wl_surface.commit for details.
|
||||||
|
|
||||||
|
If the confinement is active when the new confinement region is applied
|
||||||
|
and the pointer ends up outside of newly applied region, the pointer may
|
||||||
|
warped to a position within the new confinement region. If warped, a
|
||||||
|
wl_pointer.motion event will be emitted, but no
|
||||||
|
wp_relative_pointer.relative_motion event.
|
||||||
|
|
||||||
|
The compositor may also, instead of using the new region, unconfine the
|
||||||
|
pointer.
|
||||||
|
|
||||||
|
For details about the confine region, see wp_confined_pointer.
|
||||||
|
</description>
|
||||||
|
<arg name="region" type="object" interface="wl_region" allow-null="true"
|
||||||
|
summary="region of surface"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="confined">
|
||||||
|
<description summary="pointer confined">
|
||||||
|
Notification that the pointer confinement of the seat's pointer is
|
||||||
|
activated.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="unconfined">
|
||||||
|
<description summary="pointer unconfined">
|
||||||
|
Notification that the pointer confinement of the seat's pointer is no
|
||||||
|
longer active. If this is a oneshot pointer confinement (see
|
||||||
|
wp_pointer_constraints.lifetime) this object is now defunct and should
|
||||||
|
be destroyed. If this is a persistent pointer confinement (see
|
||||||
|
wp_pointer_constraints.lifetime) this pointer confinement may again
|
||||||
|
reactivate in the future.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
</protocol>
|
||||||
136
libraries/raylib/raylib/src/external/glfw/deps/wayland/relative-pointer-unstable-v1.xml
vendored
Normal file
136
libraries/raylib/raylib/src/external/glfw/deps/wayland/relative-pointer-unstable-v1.xml
vendored
Normal file
|
|
@ -0,0 +1,136 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="relative_pointer_unstable_v1">
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2014 Jonas Ådahl
|
||||||
|
Copyright © 2015 Red Hat Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<description summary="protocol for relative pointer motion events">
|
||||||
|
This protocol specifies a set of interfaces used for making clients able to
|
||||||
|
receive relative pointer events not obstructed by barriers (such as the
|
||||||
|
monitor edge or other pointer barriers).
|
||||||
|
|
||||||
|
To start receiving relative pointer events, a client must first bind the
|
||||||
|
global interface "wp_relative_pointer_manager" which, if a compositor
|
||||||
|
supports relative pointer motion events, is exposed by the registry. After
|
||||||
|
having created the relative pointer manager proxy object, the client uses
|
||||||
|
it to create the actual relative pointer object using the
|
||||||
|
"get_relative_pointer" request given a wl_pointer. The relative pointer
|
||||||
|
motion events will then, when applicable, be transmitted via the proxy of
|
||||||
|
the newly created relative pointer object. See the documentation of the
|
||||||
|
relative pointer interface for more details.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is experimental and backward
|
||||||
|
incompatible changes may be made. Backward compatible changes may be added
|
||||||
|
together with the corresponding interface version bump. Backward
|
||||||
|
incompatible changes are done by bumping the version number in the protocol
|
||||||
|
and interface names and resetting the interface version. Once the protocol
|
||||||
|
is to be declared stable, the 'z' prefix and the version number in the
|
||||||
|
protocol and interface names are removed and the interface version number is
|
||||||
|
reset.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<interface name="zwp_relative_pointer_manager_v1" version="1">
|
||||||
|
<description summary="get relative pointer objects">
|
||||||
|
A global interface used for getting the relative pointer object for a
|
||||||
|
given pointer.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the relative pointer manager object">
|
||||||
|
Used by the client to notify the server that it will no longer use this
|
||||||
|
relative pointer manager object.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="get_relative_pointer">
|
||||||
|
<description summary="get a relative pointer object">
|
||||||
|
Create a relative pointer interface given a wl_pointer object. See the
|
||||||
|
wp_relative_pointer interface for more details.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zwp_relative_pointer_v1"/>
|
||||||
|
<arg name="pointer" type="object" interface="wl_pointer"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zwp_relative_pointer_v1" version="1">
|
||||||
|
<description summary="relative pointer object">
|
||||||
|
A wp_relative_pointer object is an extension to the wl_pointer interface
|
||||||
|
used for emitting relative pointer events. It shares the same focus as
|
||||||
|
wl_pointer objects of the same seat and will only emit events when it has
|
||||||
|
focus.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="release the relative pointer object"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="relative_motion">
|
||||||
|
<description summary="relative pointer motion">
|
||||||
|
Relative x/y pointer motion from the pointer of the seat associated with
|
||||||
|
this object.
|
||||||
|
|
||||||
|
A relative motion is in the same dimension as regular wl_pointer motion
|
||||||
|
events, except they do not represent an absolute position. For example,
|
||||||
|
moving a pointer from (x, y) to (x', y') would have the equivalent
|
||||||
|
relative motion (x' - x, y' - y). If a pointer motion caused the
|
||||||
|
absolute pointer position to be clipped by for example the edge of the
|
||||||
|
monitor, the relative motion is unaffected by the clipping and will
|
||||||
|
represent the unclipped motion.
|
||||||
|
|
||||||
|
This event also contains non-accelerated motion deltas. The
|
||||||
|
non-accelerated delta is, when applicable, the regular pointer motion
|
||||||
|
delta as it was before having applied motion acceleration and other
|
||||||
|
transformations such as normalization.
|
||||||
|
|
||||||
|
Note that the non-accelerated delta does not represent 'raw' events as
|
||||||
|
they were read from some device. Pointer motion acceleration is device-
|
||||||
|
and configuration-specific and non-accelerated deltas and accelerated
|
||||||
|
deltas may have the same value on some devices.
|
||||||
|
|
||||||
|
Relative motions are not coupled to wl_pointer.motion events, and can be
|
||||||
|
sent in combination with such events, but also independently. There may
|
||||||
|
also be scenarios where wl_pointer.motion is sent, but there is no
|
||||||
|
relative motion. The order of an absolute and relative motion event
|
||||||
|
originating from the same physical motion is not guaranteed.
|
||||||
|
|
||||||
|
If the client needs button events or focus state, it can receive them
|
||||||
|
from a wl_pointer object of the same seat that the wp_relative_pointer
|
||||||
|
object is associated with.
|
||||||
|
</description>
|
||||||
|
<arg name="utime_hi" type="uint"
|
||||||
|
summary="high 32 bits of a 64 bit timestamp with microsecond granularity"/>
|
||||||
|
<arg name="utime_lo" type="uint"
|
||||||
|
summary="low 32 bits of a 64 bit timestamp with microsecond granularity"/>
|
||||||
|
<arg name="dx" type="fixed"
|
||||||
|
summary="the x component of the motion vector"/>
|
||||||
|
<arg name="dy" type="fixed"
|
||||||
|
summary="the y component of the motion vector"/>
|
||||||
|
<arg name="dx_unaccel" type="fixed"
|
||||||
|
summary="the x component of the unaccelerated motion vector"/>
|
||||||
|
<arg name="dy_unaccel" type="fixed"
|
||||||
|
summary="the y component of the unaccelerated motion vector"/>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
</protocol>
|
||||||
180
libraries/raylib/raylib/src/external/glfw/deps/wayland/viewporter.xml
vendored
Normal file
180
libraries/raylib/raylib/src/external/glfw/deps/wayland/viewporter.xml
vendored
Normal file
|
|
@ -0,0 +1,180 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="viewporter">
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2013-2016 Collabora, Ltd.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<interface name="wp_viewporter" version="1">
|
||||||
|
<description summary="surface cropping and scaling">
|
||||||
|
The global interface exposing surface cropping and scaling
|
||||||
|
capabilities is used to instantiate an interface extension for a
|
||||||
|
wl_surface object. This extended interface will then allow
|
||||||
|
cropping and scaling the surface contents, effectively
|
||||||
|
disconnecting the direct relationship between the buffer and the
|
||||||
|
surface size.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="unbind from the cropping and scaling interface">
|
||||||
|
Informs the server that the client will not be using this
|
||||||
|
protocol object anymore. This does not affect any other objects,
|
||||||
|
wp_viewport objects included.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<entry name="viewport_exists" value="0"
|
||||||
|
summary="the surface already has a viewport object associated"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="get_viewport">
|
||||||
|
<description summary="extend surface interface for crop and scale">
|
||||||
|
Instantiate an interface extension for the given wl_surface to
|
||||||
|
crop and scale its content. If the given wl_surface already has
|
||||||
|
a wp_viewport object associated, the viewport_exists
|
||||||
|
protocol error is raised.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="wp_viewport"
|
||||||
|
summary="the new viewport interface id"/>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="the surface"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="wp_viewport" version="1">
|
||||||
|
<description summary="crop and scale interface to a wl_surface">
|
||||||
|
An additional interface to a wl_surface object, which allows the
|
||||||
|
client to specify the cropping and scaling of the surface
|
||||||
|
contents.
|
||||||
|
|
||||||
|
This interface works with two concepts: the source rectangle (src_x,
|
||||||
|
src_y, src_width, src_height), and the destination size (dst_width,
|
||||||
|
dst_height). The contents of the source rectangle are scaled to the
|
||||||
|
destination size, and content outside the source rectangle is ignored.
|
||||||
|
This state is double-buffered, and is applied on the next
|
||||||
|
wl_surface.commit.
|
||||||
|
|
||||||
|
The two parts of crop and scale state are independent: the source
|
||||||
|
rectangle, and the destination size. Initially both are unset, that
|
||||||
|
is, no scaling is applied. The whole of the current wl_buffer is
|
||||||
|
used as the source, and the surface size is as defined in
|
||||||
|
wl_surface.attach.
|
||||||
|
|
||||||
|
If the destination size is set, it causes the surface size to become
|
||||||
|
dst_width, dst_height. The source (rectangle) is scaled to exactly
|
||||||
|
this size. This overrides whatever the attached wl_buffer size is,
|
||||||
|
unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
|
||||||
|
has no content and therefore no size. Otherwise, the size is always
|
||||||
|
at least 1x1 in surface local coordinates.
|
||||||
|
|
||||||
|
If the source rectangle is set, it defines what area of the wl_buffer is
|
||||||
|
taken as the source. If the source rectangle is set and the destination
|
||||||
|
size is not set, then src_width and src_height must be integers, and the
|
||||||
|
surface size becomes the source rectangle size. This results in cropping
|
||||||
|
without scaling. If src_width or src_height are not integers and
|
||||||
|
destination size is not set, the bad_size protocol error is raised when
|
||||||
|
the surface state is applied.
|
||||||
|
|
||||||
|
The coordinate transformations from buffer pixel coordinates up to
|
||||||
|
the surface-local coordinates happen in the following order:
|
||||||
|
1. buffer_transform (wl_surface.set_buffer_transform)
|
||||||
|
2. buffer_scale (wl_surface.set_buffer_scale)
|
||||||
|
3. crop and scale (wp_viewport.set*)
|
||||||
|
This means, that the source rectangle coordinates of crop and scale
|
||||||
|
are given in the coordinates after the buffer transform and scale,
|
||||||
|
i.e. in the coordinates that would be the surface-local coordinates
|
||||||
|
if the crop and scale was not applied.
|
||||||
|
|
||||||
|
If src_x or src_y are negative, the bad_value protocol error is raised.
|
||||||
|
Otherwise, if the source rectangle is partially or completely outside of
|
||||||
|
the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
|
||||||
|
when the surface state is applied. A NULL wl_buffer does not raise the
|
||||||
|
out_of_buffer error.
|
||||||
|
|
||||||
|
If the wl_surface associated with the wp_viewport is destroyed,
|
||||||
|
all wp_viewport requests except 'destroy' raise the protocol error
|
||||||
|
no_surface.
|
||||||
|
|
||||||
|
If the wp_viewport object is destroyed, the crop and scale
|
||||||
|
state is removed from the wl_surface. The change will be applied
|
||||||
|
on the next wl_surface.commit.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="remove scaling and cropping from the surface">
|
||||||
|
The associated wl_surface's crop and scale state is removed.
|
||||||
|
The change is applied on the next wl_surface.commit.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<entry name="bad_value" value="0"
|
||||||
|
summary="negative or zero values in width or height"/>
|
||||||
|
<entry name="bad_size" value="1"
|
||||||
|
summary="destination size is not integer"/>
|
||||||
|
<entry name="out_of_buffer" value="2"
|
||||||
|
summary="source rectangle extends outside of the content area"/>
|
||||||
|
<entry name="no_surface" value="3"
|
||||||
|
summary="the wl_surface was destroyed"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="set_source">
|
||||||
|
<description summary="set the source rectangle for cropping">
|
||||||
|
Set the source rectangle of the associated wl_surface. See
|
||||||
|
wp_viewport for the description, and relation to the wl_buffer
|
||||||
|
size.
|
||||||
|
|
||||||
|
If all of x, y, width and height are -1.0, the source rectangle is
|
||||||
|
unset instead. Any other set of values where width or height are zero
|
||||||
|
or negative, or x or y are negative, raise the bad_value protocol
|
||||||
|
error.
|
||||||
|
|
||||||
|
The crop and scale state is double-buffered state, and will be
|
||||||
|
applied on the next wl_surface.commit.
|
||||||
|
</description>
|
||||||
|
<arg name="x" type="fixed" summary="source rectangle x"/>
|
||||||
|
<arg name="y" type="fixed" summary="source rectangle y"/>
|
||||||
|
<arg name="width" type="fixed" summary="source rectangle width"/>
|
||||||
|
<arg name="height" type="fixed" summary="source rectangle height"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_destination">
|
||||||
|
<description summary="set the surface size for scaling">
|
||||||
|
Set the destination size of the associated wl_surface. See
|
||||||
|
wp_viewport for the description, and relation to the wl_buffer
|
||||||
|
size.
|
||||||
|
|
||||||
|
If width is -1 and height is -1, the destination size is unset
|
||||||
|
instead. Any other pair of values for width and height that
|
||||||
|
contains zero or negative values raises the bad_value protocol
|
||||||
|
error.
|
||||||
|
|
||||||
|
The crop and scale state is double-buffered state, and will be
|
||||||
|
applied on the next wl_surface.commit.
|
||||||
|
</description>
|
||||||
|
<arg name="width" type="int" summary="surface width"/>
|
||||||
|
<arg name="height" type="int" summary="surface height"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
</protocol>
|
||||||
3151
libraries/raylib/raylib/src/external/glfw/deps/wayland/wayland.xml
vendored
Normal file
3151
libraries/raylib/raylib/src/external/glfw/deps/wayland/wayland.xml
vendored
Normal file
File diff suppressed because it is too large
Load diff
200
libraries/raylib/raylib/src/external/glfw/deps/wayland/xdg-activation-v1.xml
vendored
Normal file
200
libraries/raylib/raylib/src/external/glfw/deps/wayland/xdg-activation-v1.xml
vendored
Normal file
|
|
@ -0,0 +1,200 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="xdg_activation_v1">
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||||
|
Copyright © 2020 Carlos Garnacho <carlosg@gnome.org>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<description summary="Protocol for requesting activation of surfaces">
|
||||||
|
The way for a client to pass focus to another toplevel is as follows.
|
||||||
|
|
||||||
|
The client that intends to activate another toplevel uses the
|
||||||
|
xdg_activation_v1.get_activation_token request to get an activation token.
|
||||||
|
This token is then forwarded to the client, which is supposed to activate
|
||||||
|
one of its surfaces, through a separate band of communication.
|
||||||
|
|
||||||
|
One established way of doing this is through the XDG_ACTIVATION_TOKEN
|
||||||
|
environment variable of a newly launched child process. The child process
|
||||||
|
should unset the environment variable again right after reading it out in
|
||||||
|
order to avoid propagating it to other child processes.
|
||||||
|
|
||||||
|
Another established way exists for Applications implementing the D-Bus
|
||||||
|
interface org.freedesktop.Application, which should get their token under
|
||||||
|
activation-token on their platform_data.
|
||||||
|
|
||||||
|
In general activation tokens may be transferred across clients through
|
||||||
|
means not described in this protocol.
|
||||||
|
|
||||||
|
The client to be activated will then pass the token
|
||||||
|
it received to the xdg_activation_v1.activate request. The compositor can
|
||||||
|
then use this token to decide how to react to the activation request.
|
||||||
|
|
||||||
|
The token the activating client gets may be ineffective either already at
|
||||||
|
the time it receives it, for example if it was not focused, for focus
|
||||||
|
stealing prevention. The activating client will have no way to discover
|
||||||
|
the validity of the token, and may still forward it to the to be activated
|
||||||
|
client.
|
||||||
|
|
||||||
|
The created activation token may optionally get information attached to it
|
||||||
|
that can be used by the compositor to identify the application that we
|
||||||
|
intend to activate. This can for example be used to display a visual hint
|
||||||
|
about what application is being started.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is currently in the testing
|
||||||
|
phase. Backward compatible changes may be added together with the
|
||||||
|
corresponding interface version bump. Backward incompatible changes can
|
||||||
|
only be done by creating a new major version of the extension.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<interface name="xdg_activation_v1" version="1">
|
||||||
|
<description summary="interface for activating surfaces">
|
||||||
|
A global interface used for informing the compositor about applications
|
||||||
|
being activated or started, or for applications to request to be
|
||||||
|
activated.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the xdg_activation object">
|
||||||
|
Notify the compositor that the xdg_activation object will no longer be
|
||||||
|
used.
|
||||||
|
|
||||||
|
The child objects created via this interface are unaffected and should
|
||||||
|
be destroyed separately.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="get_activation_token">
|
||||||
|
<description summary="requests a token">
|
||||||
|
Creates an xdg_activation_token_v1 object that will provide
|
||||||
|
the initiating client with a unique token for this activation. This
|
||||||
|
token should be offered to the clients to be activated.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<arg name="id" type="new_id" interface="xdg_activation_token_v1"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="activate">
|
||||||
|
<description summary="notify new interaction being available">
|
||||||
|
Requests surface activation. It's up to the compositor to display
|
||||||
|
this information as desired, for example by placing the surface above
|
||||||
|
the rest.
|
||||||
|
|
||||||
|
The compositor may know who requested this by checking the activation
|
||||||
|
token and might decide not to follow through with the activation if it's
|
||||||
|
considered unwanted.
|
||||||
|
|
||||||
|
Compositors can ignore unknown activation tokens when an invalid
|
||||||
|
token is passed.
|
||||||
|
</description>
|
||||||
|
<arg name="token" type="string" summary="the activation token of the initiating client"/>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="the wl_surface to activate"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="xdg_activation_token_v1" version="1">
|
||||||
|
<description summary="an exported activation handle">
|
||||||
|
An object for setting up a token and receiving a token handle that can
|
||||||
|
be passed as an activation token to another client.
|
||||||
|
|
||||||
|
The object is created using the xdg_activation_v1.get_activation_token
|
||||||
|
request. This object should then be populated with the app_id, surface
|
||||||
|
and serial information and committed. The compositor shall then issue a
|
||||||
|
done event with the token. In case the request's parameters are invalid,
|
||||||
|
the compositor will provide an invalid token.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<entry name="already_used" value="0"
|
||||||
|
summary="The token has already been used previously"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="set_serial">
|
||||||
|
<description summary="specifies the seat and serial of the activating event">
|
||||||
|
Provides information about the seat and serial event that requested the
|
||||||
|
token.
|
||||||
|
|
||||||
|
The serial can come from an input or focus event. For instance, if a
|
||||||
|
click triggers the launch of a third-party client, the launcher client
|
||||||
|
should send a set_serial request with the serial and seat from the
|
||||||
|
wl_pointer.button event.
|
||||||
|
|
||||||
|
Some compositors might refuse to activate toplevels when the token
|
||||||
|
doesn't have a valid and recent enough event serial.
|
||||||
|
|
||||||
|
Must be sent before commit. This information is optional.
|
||||||
|
</description>
|
||||||
|
<arg name="serial" type="uint"
|
||||||
|
summary="the serial of the event that triggered the activation"/>
|
||||||
|
<arg name="seat" type="object" interface="wl_seat"
|
||||||
|
summary="the wl_seat of the event"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_app_id">
|
||||||
|
<description summary="specifies the application being activated">
|
||||||
|
The requesting client can specify an app_id to associate the token
|
||||||
|
being created with it.
|
||||||
|
|
||||||
|
Must be sent before commit. This information is optional.
|
||||||
|
</description>
|
||||||
|
<arg name="app_id" type="string"
|
||||||
|
summary="the application id of the client being activated."/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_surface">
|
||||||
|
<description summary="specifies the surface requesting activation">
|
||||||
|
This request sets the surface requesting the activation. Note, this is
|
||||||
|
different from the surface that will be activated.
|
||||||
|
|
||||||
|
Some compositors might refuse to activate toplevels when the token
|
||||||
|
doesn't have a requesting surface.
|
||||||
|
|
||||||
|
Must be sent before commit. This information is optional.
|
||||||
|
</description>
|
||||||
|
<arg name="surface" type="object" interface="wl_surface"
|
||||||
|
summary="the requesting surface"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="commit">
|
||||||
|
<description summary="issues the token request">
|
||||||
|
Requests an activation token based on the different parameters that
|
||||||
|
have been offered through set_serial, set_surface and set_app_id.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="done">
|
||||||
|
<description summary="the exported activation token">
|
||||||
|
The 'done' event contains the unique token of this activation request
|
||||||
|
and notifies that the provider is done.
|
||||||
|
</description>
|
||||||
|
<arg name="token" type="string" summary="the exported activation token"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the xdg_activation_token_v1 object">
|
||||||
|
Notify the compositor that the xdg_activation_token_v1 object will no
|
||||||
|
longer be used. The received token stays valid.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
||||||
156
libraries/raylib/raylib/src/external/glfw/deps/wayland/xdg-decoration-unstable-v1.xml
vendored
Normal file
156
libraries/raylib/raylib/src/external/glfw/deps/wayland/xdg-decoration-unstable-v1.xml
vendored
Normal file
|
|
@ -0,0 +1,156 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="xdg_decoration_unstable_v1">
|
||||||
|
<copyright>
|
||||||
|
Copyright © 2018 Simon Ser
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<interface name="zxdg_decoration_manager_v1" version="1">
|
||||||
|
<description summary="window decoration manager">
|
||||||
|
This interface allows a compositor to announce support for server-side
|
||||||
|
decorations.
|
||||||
|
|
||||||
|
A window decoration is a set of window controls as deemed appropriate by
|
||||||
|
the party managing them, such as user interface components used to move,
|
||||||
|
resize and change a window's state.
|
||||||
|
|
||||||
|
A client can use this protocol to request being decorated by a supporting
|
||||||
|
compositor.
|
||||||
|
|
||||||
|
If compositor and client do not negotiate the use of a server-side
|
||||||
|
decoration using this protocol, clients continue to self-decorate as they
|
||||||
|
see fit.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is experimental and
|
||||||
|
backward incompatible changes may be made. Backward compatible changes
|
||||||
|
may be added together with the corresponding interface version bump.
|
||||||
|
Backward incompatible changes are done by bumping the version number in
|
||||||
|
the protocol and interface names and resetting the interface version.
|
||||||
|
Once the protocol is to be declared stable, the 'z' prefix and the
|
||||||
|
version number in the protocol and interface names are removed and the
|
||||||
|
interface version number is reset.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the decoration manager object">
|
||||||
|
Destroy the decoration manager. This doesn't destroy objects created
|
||||||
|
with the manager.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="get_toplevel_decoration">
|
||||||
|
<description summary="create a new toplevel decoration object">
|
||||||
|
Create a new decoration object associated with the given toplevel.
|
||||||
|
|
||||||
|
Creating an xdg_toplevel_decoration from an xdg_toplevel which has a
|
||||||
|
buffer attached or committed is a client error, and any attempts by a
|
||||||
|
client to attach or manipulate a buffer prior to the first
|
||||||
|
xdg_toplevel_decoration.configure event must also be treated as
|
||||||
|
errors.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zxdg_toplevel_decoration_v1"/>
|
||||||
|
<arg name="toplevel" type="object" interface="xdg_toplevel"/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zxdg_toplevel_decoration_v1" version="1">
|
||||||
|
<description summary="decoration object for a toplevel surface">
|
||||||
|
The decoration object allows the compositor to toggle server-side window
|
||||||
|
decorations for a toplevel surface. The client can request to switch to
|
||||||
|
another mode.
|
||||||
|
|
||||||
|
The xdg_toplevel_decoration object must be destroyed before its
|
||||||
|
xdg_toplevel.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<enum name="error">
|
||||||
|
<entry name="unconfigured_buffer" value="0"
|
||||||
|
summary="xdg_toplevel has a buffer attached before configure"/>
|
||||||
|
<entry name="already_constructed" value="1"
|
||||||
|
summary="xdg_toplevel already has a decoration object"/>
|
||||||
|
<entry name="orphaned" value="2"
|
||||||
|
summary="xdg_toplevel destroyed before the decoration object"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="destroy" type="destructor">
|
||||||
|
<description summary="destroy the decoration object">
|
||||||
|
Switch back to a mode without any server-side decorations at the next
|
||||||
|
commit.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<enum name="mode">
|
||||||
|
<description summary="window decoration modes">
|
||||||
|
These values describe window decoration modes.
|
||||||
|
</description>
|
||||||
|
<entry name="client_side" value="1"
|
||||||
|
summary="no server-side window decoration"/>
|
||||||
|
<entry name="server_side" value="2"
|
||||||
|
summary="server-side window decoration"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="set_mode">
|
||||||
|
<description summary="set the decoration mode">
|
||||||
|
Set the toplevel surface decoration mode. This informs the compositor
|
||||||
|
that the client prefers the provided decoration mode.
|
||||||
|
|
||||||
|
After requesting a decoration mode, the compositor will respond by
|
||||||
|
emitting an xdg_surface.configure event. The client should then update
|
||||||
|
its content, drawing it without decorations if the received mode is
|
||||||
|
server-side decorations. The client must also acknowledge the configure
|
||||||
|
when committing the new content (see xdg_surface.ack_configure).
|
||||||
|
|
||||||
|
The compositor can decide not to use the client's mode and enforce a
|
||||||
|
different mode instead.
|
||||||
|
|
||||||
|
Clients whose decoration mode depend on the xdg_toplevel state may send
|
||||||
|
a set_mode request in response to an xdg_surface.configure event and wait
|
||||||
|
for the next xdg_surface.configure event to prevent unwanted state.
|
||||||
|
Such clients are responsible for preventing configure loops and must
|
||||||
|
make sure not to send multiple successive set_mode requests with the
|
||||||
|
same decoration mode.
|
||||||
|
</description>
|
||||||
|
<arg name="mode" type="uint" enum="mode" summary="the decoration mode"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="unset_mode">
|
||||||
|
<description summary="unset the decoration mode">
|
||||||
|
Unset the toplevel surface decoration mode. This informs the compositor
|
||||||
|
that the client doesn't prefer a particular decoration mode.
|
||||||
|
|
||||||
|
This request has the same semantics as set_mode.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="configure">
|
||||||
|
<description summary="suggest a surface change">
|
||||||
|
The configure event asks the client to change its decoration mode. The
|
||||||
|
configured state should not be applied immediately. Clients must send an
|
||||||
|
ack_configure in response to this event. See xdg_surface.configure and
|
||||||
|
xdg_surface.ack_configure for details.
|
||||||
|
|
||||||
|
A configure event can be sent at any time. The specified mode must be
|
||||||
|
obeyed by the client.
|
||||||
|
</description>
|
||||||
|
<arg name="mode" type="uint" enum="mode" summary="the decoration mode"/>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
||||||
1370
libraries/raylib/raylib/src/external/glfw/deps/wayland/xdg-shell.xml
vendored
Normal file
1370
libraries/raylib/raylib/src/external/glfw/deps/wayland/xdg-shell.xml
vendored
Normal file
File diff suppressed because it is too large
Load diff
6547
libraries/raylib/raylib/src/external/glfw/include/GLFW/glfw3.h
vendored
Normal file
6547
libraries/raylib/raylib/src/external/glfw/include/GLFW/glfw3.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
663
libraries/raylib/raylib/src/external/glfw/include/GLFW/glfw3native.h
vendored
Normal file
663
libraries/raylib/raylib/src/external/glfw/include/GLFW/glfw3native.h
vendored
Normal file
|
|
@ -0,0 +1,663 @@
|
||||||
|
/*************************************************************************
|
||||||
|
* GLFW 3.4 - www.glfw.org
|
||||||
|
* A library for OpenGL, window and input
|
||||||
|
*------------------------------------------------------------------------
|
||||||
|
* Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
|
* Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.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, 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.
|
||||||
|
*
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _glfw3_native_h_
|
||||||
|
#define _glfw3_native_h_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* Doxygen documentation
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
/*! @file glfw3native.h
|
||||||
|
* @brief The header of the native access functions.
|
||||||
|
*
|
||||||
|
* This is the header file of the native access functions. See @ref native for
|
||||||
|
* more information.
|
||||||
|
*/
|
||||||
|
/*! @defgroup native Native access
|
||||||
|
* @brief Functions related to accessing native handles.
|
||||||
|
*
|
||||||
|
* **By using the native access functions you assert that you know what you're
|
||||||
|
* doing and how to fix problems caused by using them. If you don't, you
|
||||||
|
* shouldn't be using them.**
|
||||||
|
*
|
||||||
|
* Before the inclusion of @ref glfw3native.h, you may define zero or more
|
||||||
|
* window system API macro and zero or more context creation API macros.
|
||||||
|
*
|
||||||
|
* The chosen backends must match those the library was compiled for. Failure
|
||||||
|
* to do this will cause a link-time error.
|
||||||
|
*
|
||||||
|
* The available window API macros are:
|
||||||
|
* * `GLFW_EXPOSE_NATIVE_WIN32`
|
||||||
|
* * `GLFW_EXPOSE_NATIVE_COCOA`
|
||||||
|
* * `GLFW_EXPOSE_NATIVE_X11`
|
||||||
|
* * `GLFW_EXPOSE_NATIVE_WAYLAND`
|
||||||
|
*
|
||||||
|
* The available context API macros are:
|
||||||
|
* * `GLFW_EXPOSE_NATIVE_WGL`
|
||||||
|
* * `GLFW_EXPOSE_NATIVE_NSGL`
|
||||||
|
* * `GLFW_EXPOSE_NATIVE_GLX`
|
||||||
|
* * `GLFW_EXPOSE_NATIVE_EGL`
|
||||||
|
* * `GLFW_EXPOSE_NATIVE_OSMESA`
|
||||||
|
*
|
||||||
|
* These macros select which of the native access functions that are declared
|
||||||
|
* and which platform-specific headers to include. It is then up your (by
|
||||||
|
* definition platform-specific) code to handle which of these should be
|
||||||
|
* defined.
|
||||||
|
*
|
||||||
|
* If you do not want the platform-specific headers to be included, define
|
||||||
|
* `GLFW_NATIVE_INCLUDE_NONE` before including the @ref glfw3native.h header.
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* #define GLFW_EXPOSE_NATIVE_WIN32
|
||||||
|
* #define GLFW_EXPOSE_NATIVE_WGL
|
||||||
|
* #define GLFW_NATIVE_INCLUDE_NONE
|
||||||
|
* #include <GLFW/glfw3native.h>
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* System headers and types
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#if !defined(GLFW_NATIVE_INCLUDE_NONE)
|
||||||
|
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
|
||||||
|
/* This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
||||||
|
* example to allow applications to correctly declare a GL_KHR_debug callback)
|
||||||
|
* but windows.h assumes no one will define APIENTRY before it does
|
||||||
|
*/
|
||||||
|
#if defined(GLFW_APIENTRY_DEFINED)
|
||||||
|
#undef APIENTRY
|
||||||
|
#undef GLFW_APIENTRY_DEFINED
|
||||||
|
#endif
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
|
||||||
|
#if defined(__OBJC__)
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#else
|
||||||
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
|
#include <objc/objc.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/extensions/Xrandr.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
|
||||||
|
#include <wayland-client.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_WGL)
|
||||||
|
/* WGL is declared by windows.h */
|
||||||
|
#endif
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
|
||||||
|
/* NSGL is declared by Cocoa.h */
|
||||||
|
#endif
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_GLX)
|
||||||
|
/* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by
|
||||||
|
* default it also acts as an OpenGL header
|
||||||
|
* However, glx.h will include gl.h, which will define it unconditionally
|
||||||
|
*/
|
||||||
|
#if defined(GLFW_GLAPIENTRY_DEFINED)
|
||||||
|
#undef GLAPIENTRY
|
||||||
|
#undef GLFW_GLAPIENTRY_DEFINED
|
||||||
|
#endif
|
||||||
|
#include <GL/glx.h>
|
||||||
|
#endif
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_EGL)
|
||||||
|
#include <EGL/egl.h>
|
||||||
|
#endif
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
|
||||||
|
/* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by
|
||||||
|
* default it also acts as an OpenGL header
|
||||||
|
* However, osmesa.h will include gl.h, which will define it unconditionally
|
||||||
|
*/
|
||||||
|
#if defined(GLFW_GLAPIENTRY_DEFINED)
|
||||||
|
#undef GLAPIENTRY
|
||||||
|
#undef GLFW_GLAPIENTRY_DEFINED
|
||||||
|
#endif
|
||||||
|
#include <GL/osmesa.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /*GLFW_NATIVE_INCLUDE_NONE*/
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
* Functions
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_WIN32)
|
||||||
|
/*! @brief Returns the adapter device name of the specified monitor.
|
||||||
|
*
|
||||||
|
* @return The UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`)
|
||||||
|
* of the specified monitor, or `NULL` if an [error](@ref error_handling)
|
||||||
|
* occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_PLATFORM_UNAVAILABLE.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.1.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
|
||||||
|
|
||||||
|
/*! @brief Returns the display device name of the specified monitor.
|
||||||
|
*
|
||||||
|
* @return The UTF-8 encoded display device name (for example
|
||||||
|
* `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_PLATFORM_UNAVAILABLE.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.1.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
|
||||||
|
|
||||||
|
/*! @brief Returns the `HWND` of the specified window.
|
||||||
|
*
|
||||||
|
* @return The `HWND` of the specified window, or `NULL` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_PLATFORM_UNAVAILABLE.
|
||||||
|
*
|
||||||
|
* @remark The `HDC` associated with the window can be queried with the
|
||||||
|
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
|
||||||
|
* function.
|
||||||
|
* @code
|
||||||
|
* HDC dc = GetDC(glfwGetWin32Window(window));
|
||||||
|
* @endcode
|
||||||
|
* This DC is private and does not need to be released.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.0.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_WGL)
|
||||||
|
/*! @brief Returns the `HGLRC` of the specified window.
|
||||||
|
*
|
||||||
|
* @return The `HGLRC` of the specified window, or `NULL` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||||
|
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
|
||||||
|
*
|
||||||
|
* @remark The `HDC` associated with the window can be queried with the
|
||||||
|
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
|
||||||
|
* function.
|
||||||
|
* @code
|
||||||
|
* HDC dc = GetDC(glfwGetWin32Window(window));
|
||||||
|
* @endcode
|
||||||
|
* This DC is private and does not need to be released.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.0.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_COCOA)
|
||||||
|
/*! @brief Returns the `CGDirectDisplayID` of the specified monitor.
|
||||||
|
*
|
||||||
|
* @return The `CGDirectDisplayID` of the specified monitor, or
|
||||||
|
* `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_PLATFORM_UNAVAILABLE.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.1.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
|
||||||
|
|
||||||
|
/*! @brief Returns the `NSWindow` of the specified window.
|
||||||
|
*
|
||||||
|
* @return The `NSWindow` of the specified window, or `nil` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_PLATFORM_UNAVAILABLE.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.0.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
|
||||||
|
|
||||||
|
/*! @brief Returns the `NSView` of the specified window.
|
||||||
|
*
|
||||||
|
* @return The `NSView` of the specified window, or `nil` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_PLATFORM_UNAVAILABLE.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.4.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI id glfwGetCocoaView(GLFWwindow* window);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
|
||||||
|
/*! @brief Returns the `NSOpenGLContext` of the specified window.
|
||||||
|
*
|
||||||
|
* @return The `NSOpenGLContext` of the specified window, or `nil` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||||
|
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.0.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_X11)
|
||||||
|
/*! @brief Returns the `Display` used by GLFW.
|
||||||
|
*
|
||||||
|
* @return The `Display` used by GLFW, or `NULL` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_PLATFORM_UNAVAILABLE.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.0.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI Display* glfwGetX11Display(void);
|
||||||
|
|
||||||
|
/*! @brief Returns the `RRCrtc` of the specified monitor.
|
||||||
|
*
|
||||||
|
* @return The `RRCrtc` of the specified monitor, or `None` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_PLATFORM_UNAVAILABLE.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.1.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
|
||||||
|
|
||||||
|
/*! @brief Returns the `RROutput` of the specified monitor.
|
||||||
|
*
|
||||||
|
* @return The `RROutput` of the specified monitor, or `None` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_PLATFORM_UNAVAILABLE.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.1.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
|
||||||
|
|
||||||
|
/*! @brief Returns the `Window` of the specified window.
|
||||||
|
*
|
||||||
|
* @return The `Window` of the specified window, or `None` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_PLATFORM_UNAVAILABLE.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.0.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
|
||||||
|
|
||||||
|
/*! @brief Sets the current primary selection to the specified string.
|
||||||
|
*
|
||||||
|
* @param[in] string A UTF-8 encoded string.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||||
|
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
|
||||||
|
*
|
||||||
|
* @pointer_lifetime The specified string is copied before this function
|
||||||
|
* returns.
|
||||||
|
*
|
||||||
|
* @thread_safety This function must only be called from the main thread.
|
||||||
|
*
|
||||||
|
* @sa @ref clipboard
|
||||||
|
* @sa glfwGetX11SelectionString
|
||||||
|
* @sa glfwSetClipboardString
|
||||||
|
*
|
||||||
|
* @since Added in version 3.3.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI void glfwSetX11SelectionString(const char* string);
|
||||||
|
|
||||||
|
/*! @brief Returns the contents of the current primary selection as a string.
|
||||||
|
*
|
||||||
|
* If the selection is empty or if its contents cannot be converted, `NULL`
|
||||||
|
* is returned and a @ref GLFW_FORMAT_UNAVAILABLE error is generated.
|
||||||
|
*
|
||||||
|
* @return The contents of the selection as a UTF-8 encoded string, or `NULL`
|
||||||
|
* if an [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||||
|
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
|
||||||
|
*
|
||||||
|
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
||||||
|
* should not free it yourself. It is valid until the next call to @ref
|
||||||
|
* glfwGetX11SelectionString or @ref glfwSetX11SelectionString, or until the
|
||||||
|
* library is terminated.
|
||||||
|
*
|
||||||
|
* @thread_safety This function must only be called from the main thread.
|
||||||
|
*
|
||||||
|
* @sa @ref clipboard
|
||||||
|
* @sa glfwSetX11SelectionString
|
||||||
|
* @sa glfwGetClipboardString
|
||||||
|
*
|
||||||
|
* @since Added in version 3.3.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI const char* glfwGetX11SelectionString(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_GLX)
|
||||||
|
/*! @brief Returns the `GLXContext` of the specified window.
|
||||||
|
*
|
||||||
|
* @return The `GLXContext` of the specified window, or `NULL` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||||
|
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.0.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
|
||||||
|
|
||||||
|
/*! @brief Returns the `GLXWindow` of the specified window.
|
||||||
|
*
|
||||||
|
* @return The `GLXWindow` of the specified window, or `None` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||||
|
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.2.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
|
||||||
|
/*! @brief Returns the `struct wl_display*` used by GLFW.
|
||||||
|
*
|
||||||
|
* @return The `struct wl_display*` used by GLFW, or `NULL` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_PLATFORM_UNAVAILABLE.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.2.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
|
||||||
|
|
||||||
|
/*! @brief Returns the `struct wl_output*` of the specified monitor.
|
||||||
|
*
|
||||||
|
* @return The `struct wl_output*` of the specified monitor, or `NULL` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_PLATFORM_UNAVAILABLE.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.2.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
|
||||||
|
|
||||||
|
/*! @brief Returns the main `struct wl_surface*` of the specified window.
|
||||||
|
*
|
||||||
|
* @return The main `struct wl_surface*` of the specified window, or `NULL` if
|
||||||
|
* an [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_PLATFORM_UNAVAILABLE.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.2.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_EGL)
|
||||||
|
/*! @brief Returns the `EGLDisplay` used by GLFW.
|
||||||
|
*
|
||||||
|
* @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||||
|
*
|
||||||
|
* @remark Because EGL is initialized on demand, this function will return
|
||||||
|
* `EGL_NO_DISPLAY` until the first context has been created via EGL.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.0.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
|
||||||
|
|
||||||
|
/*! @brief Returns the `EGLContext` of the specified window.
|
||||||
|
*
|
||||||
|
* @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_NO_WINDOW_CONTEXT.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.0.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
|
||||||
|
|
||||||
|
/*! @brief Returns the `EGLSurface` of the specified window.
|
||||||
|
*
|
||||||
|
* @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_NO_WINDOW_CONTEXT.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.0.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
|
||||||
|
/*! @brief Retrieves the color buffer associated with the specified window.
|
||||||
|
*
|
||||||
|
* @param[in] window The window whose color buffer to retrieve.
|
||||||
|
* @param[out] width Where to store the width of the color buffer, or `NULL`.
|
||||||
|
* @param[out] height Where to store the height of the color buffer, or `NULL`.
|
||||||
|
* @param[out] format Where to store the OSMesa pixel format of the color
|
||||||
|
* buffer, or `NULL`.
|
||||||
|
* @param[out] buffer Where to store the address of the color buffer, or
|
||||||
|
* `NULL`.
|
||||||
|
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_NO_WINDOW_CONTEXT.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.3.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height, int* format, void** buffer);
|
||||||
|
|
||||||
|
/*! @brief Retrieves the depth buffer associated with the specified window.
|
||||||
|
*
|
||||||
|
* @param[in] window The window whose depth buffer to retrieve.
|
||||||
|
* @param[out] width Where to store the width of the depth buffer, or `NULL`.
|
||||||
|
* @param[out] height Where to store the height of the depth buffer, or `NULL`.
|
||||||
|
* @param[out] bytesPerValue Where to store the number of bytes per depth
|
||||||
|
* buffer element, or `NULL`.
|
||||||
|
* @param[out] buffer Where to store the address of the depth buffer, or
|
||||||
|
* `NULL`.
|
||||||
|
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_NO_WINDOW_CONTEXT.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.3.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height, int* bytesPerValue, void** buffer);
|
||||||
|
|
||||||
|
/*! @brief Returns the `OSMesaContext` of the specified window.
|
||||||
|
*
|
||||||
|
* @return The `OSMesaContext` of the specified window, or `NULL` if an
|
||||||
|
* [error](@ref error_handling) occurred.
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
|
* GLFW_NO_WINDOW_CONTEXT.
|
||||||
|
*
|
||||||
|
* @thread_safety This function may be called from any thread. Access is not
|
||||||
|
* synchronized.
|
||||||
|
*
|
||||||
|
* @since Added in version 3.3.
|
||||||
|
*
|
||||||
|
* @ingroup native
|
||||||
|
*/
|
||||||
|
GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* window);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _glfw3_native_h_ */
|
||||||
|
|
||||||
368
libraries/raylib/raylib/src/external/glfw/src/CMakeLists.txt
vendored
Normal file
368
libraries/raylib/raylib/src/external/glfw/src/CMakeLists.txt
vendored
Normal file
|
|
@ -0,0 +1,368 @@
|
||||||
|
|
||||||
|
add_library(glfw ${GLFW_LIBRARY_TYPE}
|
||||||
|
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h"
|
||||||
|
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h"
|
||||||
|
internal.h platform.h mappings.h
|
||||||
|
context.c init.c input.c monitor.c platform.c vulkan.c window.c
|
||||||
|
egl_context.c osmesa_context.c null_platform.h null_joystick.h
|
||||||
|
null_init.c null_monitor.c null_window.c null_joystick.c)
|
||||||
|
|
||||||
|
# The time, thread and module code is shared between all backends on a given OS,
|
||||||
|
# including the null backend, which still needs those bits to be functional
|
||||||
|
if (APPLE)
|
||||||
|
target_sources(glfw PRIVATE cocoa_time.h cocoa_time.c posix_thread.h
|
||||||
|
posix_module.c posix_thread.c)
|
||||||
|
elseif (WIN32)
|
||||||
|
target_sources(glfw PRIVATE win32_time.h win32_thread.h win32_module.c
|
||||||
|
win32_time.c win32_thread.c)
|
||||||
|
else()
|
||||||
|
target_sources(glfw PRIVATE posix_time.h posix_thread.h posix_module.c
|
||||||
|
posix_time.c posix_thread.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_target(update_mappings
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -P "${GLFW_SOURCE_DIR}/CMake/GenerateMappings.cmake" mappings.h.in mappings.h
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
COMMENT "Updating gamepad mappings from upstream repository"
|
||||||
|
SOURCES mappings.h.in "${GLFW_SOURCE_DIR}/CMake/GenerateMappings.cmake"
|
||||||
|
VERBATIM)
|
||||||
|
|
||||||
|
set_target_properties(update_mappings PROPERTIES FOLDER "GLFW3")
|
||||||
|
|
||||||
|
if (GLFW_BUILD_COCOA)
|
||||||
|
target_compile_definitions(glfw PRIVATE _GLFW_COCOA)
|
||||||
|
target_sources(glfw PRIVATE cocoa_platform.h cocoa_joystick.h cocoa_init.m
|
||||||
|
cocoa_joystick.m cocoa_monitor.m cocoa_window.m
|
||||||
|
nsgl_context.m)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GLFW_BUILD_WIN32)
|
||||||
|
target_compile_definitions(glfw PRIVATE _GLFW_WIN32)
|
||||||
|
target_sources(glfw PRIVATE win32_platform.h win32_joystick.h win32_init.c
|
||||||
|
win32_joystick.c win32_monitor.c win32_window.c
|
||||||
|
wgl_context.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GLFW_BUILD_X11)
|
||||||
|
target_compile_definitions(glfw PRIVATE _GLFW_X11)
|
||||||
|
target_sources(glfw PRIVATE x11_platform.h xkb_unicode.h x11_init.c
|
||||||
|
x11_monitor.c x11_window.c xkb_unicode.c
|
||||||
|
glx_context.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GLFW_BUILD_WAYLAND)
|
||||||
|
target_compile_definitions(glfw PRIVATE _GLFW_WAYLAND)
|
||||||
|
target_sources(glfw PRIVATE wl_platform.h xkb_unicode.h wl_init.c
|
||||||
|
wl_monitor.c wl_window.c xkb_unicode.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GLFW_BUILD_X11 OR GLFW_BUILD_WAYLAND)
|
||||||
|
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
target_sources(glfw PRIVATE linux_joystick.h linux_joystick.c)
|
||||||
|
endif()
|
||||||
|
target_sources(glfw PRIVATE posix_poll.h posix_poll.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GLFW_BUILD_WAYLAND)
|
||||||
|
include(CheckIncludeFiles)
|
||||||
|
include(CheckFunctionExists)
|
||||||
|
check_function_exists(memfd_create HAVE_MEMFD_CREATE)
|
||||||
|
if (HAVE_MEMFD_CREATE)
|
||||||
|
target_compile_definitions(glfw PRIVATE HAVE_MEMFD_CREATE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
|
||||||
|
if (NOT WAYLAND_SCANNER_EXECUTABLE)
|
||||||
|
message(FATAL_ERROR "Failed to find wayland-scanner")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
macro(generate_wayland_protocol protocol_file)
|
||||||
|
set(protocol_path "${GLFW_SOURCE_DIR}/deps/wayland/${protocol_file}")
|
||||||
|
|
||||||
|
string(REGEX REPLACE "\\.xml$" "-client-protocol.h" header_file ${protocol_file})
|
||||||
|
string(REGEX REPLACE "\\.xml$" "-client-protocol-code.h" code_file ${protocol_file})
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT ${header_file}
|
||||||
|
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${protocol_path}" ${header_file}
|
||||||
|
DEPENDS "${protocol_path}"
|
||||||
|
VERBATIM)
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT ${code_file}
|
||||||
|
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${protocol_path}" ${code_file}
|
||||||
|
DEPENDS "${protocol_path}"
|
||||||
|
VERBATIM)
|
||||||
|
|
||||||
|
target_sources(glfw PRIVATE ${header_file} ${code_file})
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
generate_wayland_protocol("wayland.xml")
|
||||||
|
generate_wayland_protocol("viewporter.xml")
|
||||||
|
generate_wayland_protocol("xdg-shell.xml")
|
||||||
|
generate_wayland_protocol("idle-inhibit-unstable-v1.xml")
|
||||||
|
generate_wayland_protocol("pointer-constraints-unstable-v1.xml")
|
||||||
|
generate_wayland_protocol("relative-pointer-unstable-v1.xml")
|
||||||
|
generate_wayland_protocol("fractional-scale-v1.xml")
|
||||||
|
generate_wayland_protocol("xdg-activation-v1.xml")
|
||||||
|
generate_wayland_protocol("xdg-decoration-unstable-v1.xml")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (WIN32 AND GLFW_BUILD_SHARED_LIBRARY)
|
||||||
|
configure_file(glfw.rc.in glfw.rc @ONLY)
|
||||||
|
target_sources(glfw PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/glfw.rc")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (UNIX AND GLFW_BUILD_SHARED_LIBRARY)
|
||||||
|
# On Unix-like systems, shared libraries can use the soname system.
|
||||||
|
set(GLFW_LIB_NAME glfw)
|
||||||
|
else()
|
||||||
|
set(GLFW_LIB_NAME glfw3)
|
||||||
|
endif()
|
||||||
|
set(GLFW_LIB_NAME_SUFFIX "")
|
||||||
|
|
||||||
|
set_target_properties(glfw PROPERTIES
|
||||||
|
OUTPUT_NAME ${GLFW_LIB_NAME}
|
||||||
|
VERSION ${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}
|
||||||
|
SOVERSION ${GLFW_VERSION_MAJOR}
|
||||||
|
POSITION_INDEPENDENT_CODE ON
|
||||||
|
C_STANDARD 99
|
||||||
|
C_EXTENSIONS OFF
|
||||||
|
DEFINE_SYMBOL _GLFW_BUILD_DLL
|
||||||
|
FOLDER "GLFW3")
|
||||||
|
|
||||||
|
target_include_directories(glfw PUBLIC
|
||||||
|
"$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>"
|
||||||
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
|
||||||
|
target_include_directories(glfw PRIVATE
|
||||||
|
"${GLFW_SOURCE_DIR}/src"
|
||||||
|
"${GLFW_BINARY_DIR}/src")
|
||||||
|
target_link_libraries(glfw PRIVATE Threads::Threads)
|
||||||
|
|
||||||
|
# Workaround for CMake not knowing about .m files before version 3.16
|
||||||
|
if (CMAKE_VERSION VERSION_LESS "3.16" AND APPLE)
|
||||||
|
set_source_files_properties(cocoa_init.m cocoa_joystick.m cocoa_monitor.m
|
||||||
|
cocoa_window.m nsgl_context.m PROPERTIES
|
||||||
|
LANGUAGE C)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GLFW_BUILD_WIN32)
|
||||||
|
list(APPEND glfw_PKG_LIBS "-lgdi32")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GLFW_BUILD_COCOA)
|
||||||
|
target_link_libraries(glfw PRIVATE "-framework Cocoa"
|
||||||
|
"-framework IOKit"
|
||||||
|
"-framework CoreFoundation")
|
||||||
|
|
||||||
|
set(glfw_PKG_DEPS "")
|
||||||
|
set(glfw_PKG_LIBS "-framework Cocoa -framework IOKit -framework CoreFoundation")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GLFW_BUILD_WAYLAND)
|
||||||
|
include(FindPkgConfig)
|
||||||
|
|
||||||
|
pkg_check_modules(Wayland REQUIRED
|
||||||
|
wayland-client>=0.2.7
|
||||||
|
wayland-cursor>=0.2.7
|
||||||
|
wayland-egl>=0.2.7
|
||||||
|
xkbcommon>=0.5.0)
|
||||||
|
|
||||||
|
target_include_directories(glfw PRIVATE ${Wayland_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
find_package(EpollShim)
|
||||||
|
if (EPOLLSHIM_FOUND)
|
||||||
|
target_include_directories(glfw PRIVATE ${EPOLLSHIM_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(glfw PRIVATE ${EPOLLSHIM_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GLFW_BUILD_X11)
|
||||||
|
find_package(X11 REQUIRED)
|
||||||
|
target_include_directories(glfw PRIVATE "${X11_X11_INCLUDE_PATH}")
|
||||||
|
|
||||||
|
# Check for XRandR (modern resolution switching and gamma control)
|
||||||
|
if (NOT X11_Xrandr_INCLUDE_PATH)
|
||||||
|
message(FATAL_ERROR "RandR headers not found; install libxrandr development package")
|
||||||
|
endif()
|
||||||
|
target_include_directories(glfw PRIVATE "${X11_Xrandr_INCLUDE_PATH}")
|
||||||
|
|
||||||
|
# Check for Xinerama (legacy multi-monitor support)
|
||||||
|
if (NOT X11_Xinerama_INCLUDE_PATH)
|
||||||
|
message(FATAL_ERROR "Xinerama headers not found; install libxinerama development package")
|
||||||
|
endif()
|
||||||
|
target_include_directories(glfw PRIVATE "${X11_Xinerama_INCLUDE_PATH}")
|
||||||
|
|
||||||
|
# Check for Xkb (X keyboard extension)
|
||||||
|
if (NOT X11_Xkb_INCLUDE_PATH)
|
||||||
|
message(FATAL_ERROR "XKB headers not found; install X11 development package")
|
||||||
|
endif()
|
||||||
|
target_include_directories(glfw PRIVATE "${X11_Xkb_INCLUDE_PATH}")
|
||||||
|
|
||||||
|
# Check for Xcursor (cursor creation from RGBA images)
|
||||||
|
if (NOT X11_Xcursor_INCLUDE_PATH)
|
||||||
|
message(FATAL_ERROR "Xcursor headers not found; install libxcursor development package")
|
||||||
|
endif()
|
||||||
|
target_include_directories(glfw PRIVATE "${X11_Xcursor_INCLUDE_PATH}")
|
||||||
|
|
||||||
|
# Check for XInput (modern HID input)
|
||||||
|
if (NOT X11_Xi_INCLUDE_PATH)
|
||||||
|
message(FATAL_ERROR "XInput headers not found; install libxi development package")
|
||||||
|
endif()
|
||||||
|
target_include_directories(glfw PRIVATE "${X11_Xi_INCLUDE_PATH}")
|
||||||
|
|
||||||
|
# Check for X Shape (custom window input shape)
|
||||||
|
if (NOT X11_Xshape_INCLUDE_PATH)
|
||||||
|
message(FATAL_ERROR "X Shape headers not found; install libxext development package")
|
||||||
|
endif()
|
||||||
|
target_include_directories(glfw PRIVATE "${X11_Xshape_INCLUDE_PATH}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (UNIX AND NOT APPLE)
|
||||||
|
find_library(RT_LIBRARY rt)
|
||||||
|
mark_as_advanced(RT_LIBRARY)
|
||||||
|
if (RT_LIBRARY)
|
||||||
|
target_link_libraries(glfw PRIVATE "${RT_LIBRARY}")
|
||||||
|
list(APPEND glfw_PKG_LIBS "-lrt")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_library(MATH_LIBRARY m)
|
||||||
|
mark_as_advanced(MATH_LIBRARY)
|
||||||
|
if (MATH_LIBRARY)
|
||||||
|
target_link_libraries(glfw PRIVATE "${MATH_LIBRARY}")
|
||||||
|
list(APPEND glfw_PKG_LIBS "-lm")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_DL_LIBS)
|
||||||
|
target_link_libraries(glfw PRIVATE "${CMAKE_DL_LIBS}")
|
||||||
|
list(APPEND glfw_PKG_LIBS "-l${CMAKE_DL_LIBS}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
if (GLFW_USE_HYBRID_HPG)
|
||||||
|
target_compile_definitions(glfw PRIVATE _GLFW_USE_HYBRID_HPG)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Enable a reasonable set of warnings
|
||||||
|
# NOTE: The order matters here, Clang-CL matches both MSVC and Clang
|
||||||
|
if (MSVC)
|
||||||
|
target_compile_options(glfw PRIVATE "/W3")
|
||||||
|
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
|
||||||
|
CMAKE_C_COMPILER_ID STREQUAL "Clang" OR
|
||||||
|
CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
|
||||||
|
|
||||||
|
target_compile_options(glfw PRIVATE "-Wall")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GLFW_BUILD_WIN32)
|
||||||
|
target_compile_definitions(glfw PRIVATE UNICODE _UNICODE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# HACK: When building on MinGW, WINVER and UNICODE need to be defined before
|
||||||
|
# the inclusion of stddef.h (by glfw3.h), which is itself included before
|
||||||
|
# win32_platform.h. We define them here until a saner solution can be found
|
||||||
|
# NOTE: MinGW-w64 and Visual C++ do /not/ need this hack.
|
||||||
|
if (MINGW)
|
||||||
|
target_compile_definitions(glfw PRIVATE WINVER=0x0501)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Workaround for legacy MinGW not providing XInput and DirectInput
|
||||||
|
if (MINGW)
|
||||||
|
include(CheckIncludeFile)
|
||||||
|
check_include_file(dinput.h DINPUT_H_FOUND)
|
||||||
|
check_include_file(xinput.h XINPUT_H_FOUND)
|
||||||
|
if (NOT DINPUT_H_FOUND OR NOT XINPUT_H_FOUND)
|
||||||
|
target_include_directories(glfw PRIVATE "${GLFW_SOURCE_DIR}/deps/mingw")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Workaround for the MS CRT deprecating parts of the standard library
|
||||||
|
if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
|
||||||
|
target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Workaround for -std=c99 on Linux disabling _DEFAULT_SOURCE (POSIX 2008 and more)
|
||||||
|
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
target_compile_definitions(glfw PRIVATE _DEFAULT_SOURCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GLFW_BUILD_SHARED_LIBRARY)
|
||||||
|
if (WIN32)
|
||||||
|
if (MINGW)
|
||||||
|
# Remove the dependency on the shared version of libgcc
|
||||||
|
# NOTE: MinGW-w64 has the correct default but MinGW needs this
|
||||||
|
target_link_libraries(glfw PRIVATE "-static-libgcc")
|
||||||
|
|
||||||
|
# Remove the lib prefix on the DLL (but not the import library)
|
||||||
|
set_target_properties(glfw PROPERTIES PREFIX "")
|
||||||
|
|
||||||
|
# Add a suffix to the import library to avoid naming conflicts
|
||||||
|
set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.a")
|
||||||
|
else()
|
||||||
|
# Add a suffix to the import library to avoid naming conflicts
|
||||||
|
set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.lib")
|
||||||
|
endif()
|
||||||
|
set (GLFW_LIB_NAME_SUFFIX "dll")
|
||||||
|
|
||||||
|
target_compile_definitions(glfw INTERFACE GLFW_DLL)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (MINGW)
|
||||||
|
# Enable link-time exploit mitigation features enabled by default on MSVC
|
||||||
|
include(CheckCCompilerFlag)
|
||||||
|
|
||||||
|
# Compatibility with data execution prevention (DEP)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat")
|
||||||
|
check_c_compiler_flag("" _GLFW_HAS_DEP)
|
||||||
|
if (_GLFW_HAS_DEP)
|
||||||
|
target_link_libraries(glfw PRIVATE "-Wl,--nxcompat")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Compatibility with address space layout randomization (ASLR)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "-Wl,--dynamicbase")
|
||||||
|
check_c_compiler_flag("" _GLFW_HAS_ASLR)
|
||||||
|
if (_GLFW_HAS_ASLR)
|
||||||
|
target_link_libraries(glfw PRIVATE "-Wl,--dynamicbase")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Compatibility with 64-bit address space layout randomization (ASLR)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "-Wl,--high-entropy-va")
|
||||||
|
check_c_compiler_flag("" _GLFW_HAS_64ASLR)
|
||||||
|
if (_GLFW_HAS_64ASLR)
|
||||||
|
target_link_libraries(glfw PRIVATE "-Wl,--high-entropy-va")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Clear flags again to avoid breaking later tests
|
||||||
|
set(CMAKE_REQUIRED_FLAGS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (UNIX)
|
||||||
|
# Hide symbols not explicitly tagged for export from the shared library
|
||||||
|
target_compile_options(glfw PRIVATE "-fvisibility=hidden")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(arg ${glfw_PKG_DEPS})
|
||||||
|
string(APPEND deps " ${arg}")
|
||||||
|
endforeach()
|
||||||
|
foreach(arg ${glfw_PKG_LIBS})
|
||||||
|
string(APPEND libs " ${arg}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(GLFW_PKG_CONFIG_REQUIRES_PRIVATE "${deps}" CACHE INTERNAL
|
||||||
|
"GLFW pkg-config Requires.private")
|
||||||
|
set(GLFW_PKG_CONFIG_LIBS_PRIVATE "${libs}" CACHE INTERNAL
|
||||||
|
"GLFW pkg-config Libs.private")
|
||||||
|
|
||||||
|
configure_file("${GLFW_SOURCE_DIR}/CMake/glfw3.pc.in" glfw3.pc @ONLY)
|
||||||
|
|
||||||
|
if (GLFW_INSTALL)
|
||||||
|
install(TARGETS glfw
|
||||||
|
EXPORT glfwTargets
|
||||||
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||||
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||||
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
696
libraries/raylib/raylib/src/external/glfw/src/cocoa_init.m
vendored
Normal file
696
libraries/raylib/raylib/src/external/glfw/src/cocoa_init.m
vendored
Normal file
|
|
@ -0,0 +1,696 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 macOS (modified for raylib) - www.glfw.org; www.raylib.com
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
|
// Copyright (c) 2024 M374LX <wilsalx@gmail.com>
|
||||||
|
//
|
||||||
|
// 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_COCOA)
|
||||||
|
|
||||||
|
#include <sys/param.h> // For MAXPATHLEN
|
||||||
|
|
||||||
|
// Needed for _NSGetProgname
|
||||||
|
#include <crt_externs.h>
|
||||||
|
|
||||||
|
// Change to our application bundle's resources directory, if present
|
||||||
|
//
|
||||||
|
static void changeToResourcesDirectory(void)
|
||||||
|
{
|
||||||
|
char resourcesPath[MAXPATHLEN];
|
||||||
|
|
||||||
|
CFBundleRef bundle = CFBundleGetMainBundle();
|
||||||
|
if (!bundle)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(bundle);
|
||||||
|
|
||||||
|
CFStringRef last = CFURLCopyLastPathComponent(resourcesURL);
|
||||||
|
if (CFStringCompare(CFSTR("Resources"), last, 0) != kCFCompareEqualTo)
|
||||||
|
{
|
||||||
|
CFRelease(last);
|
||||||
|
CFRelease(resourcesURL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFRelease(last);
|
||||||
|
|
||||||
|
if (!CFURLGetFileSystemRepresentation(resourcesURL,
|
||||||
|
true,
|
||||||
|
(UInt8*) resourcesPath,
|
||||||
|
MAXPATHLEN))
|
||||||
|
{
|
||||||
|
CFRelease(resourcesURL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFRelease(resourcesURL);
|
||||||
|
|
||||||
|
chdir(resourcesPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up the menu bar (manually)
|
||||||
|
// This is nasty, nasty stuff -- calls to undocumented semi-private APIs that
|
||||||
|
// could go away at any moment, lots of stuff that really should be
|
||||||
|
// localize(d|able), etc. Add a nib to save us this horror.
|
||||||
|
//
|
||||||
|
static void createMenuBar(void)
|
||||||
|
{
|
||||||
|
NSString* appName = nil;
|
||||||
|
NSDictionary* bundleInfo = [[NSBundle mainBundle] infoDictionary];
|
||||||
|
NSString* nameKeys[] =
|
||||||
|
{
|
||||||
|
@"CFBundleDisplayName",
|
||||||
|
@"CFBundleName",
|
||||||
|
@"CFBundleExecutable",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Try to figure out what the calling application is called
|
||||||
|
|
||||||
|
for (size_t i = 0; i < sizeof(nameKeys) / sizeof(nameKeys[0]); i++)
|
||||||
|
{
|
||||||
|
id name = bundleInfo[nameKeys[i]];
|
||||||
|
if (name &&
|
||||||
|
[name isKindOfClass:[NSString class]] &&
|
||||||
|
![name isEqualToString:@""])
|
||||||
|
{
|
||||||
|
appName = name;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!appName)
|
||||||
|
{
|
||||||
|
char** progname = _NSGetProgname();
|
||||||
|
if (progname && *progname)
|
||||||
|
appName = @(*progname);
|
||||||
|
else
|
||||||
|
appName = @"GLFW Application";
|
||||||
|
}
|
||||||
|
|
||||||
|
NSMenu* bar = [[NSMenu alloc] init];
|
||||||
|
[NSApp setMainMenu:bar];
|
||||||
|
|
||||||
|
NSMenuItem* appMenuItem =
|
||||||
|
[bar addItemWithTitle:@"" action:NULL keyEquivalent:@""];
|
||||||
|
NSMenu* appMenu = [[NSMenu alloc] init];
|
||||||
|
[appMenuItem setSubmenu:appMenu];
|
||||||
|
|
||||||
|
[appMenu addItemWithTitle:[NSString stringWithFormat:@"About %@", appName]
|
||||||
|
action:@selector(orderFrontStandardAboutPanel:)
|
||||||
|
keyEquivalent:@""];
|
||||||
|
[appMenu addItem:[NSMenuItem separatorItem]];
|
||||||
|
NSMenu* servicesMenu = [[NSMenu alloc] init];
|
||||||
|
[NSApp setServicesMenu:servicesMenu];
|
||||||
|
[[appMenu addItemWithTitle:@"Services"
|
||||||
|
action:NULL
|
||||||
|
keyEquivalent:@""] setSubmenu:servicesMenu];
|
||||||
|
[servicesMenu release];
|
||||||
|
[appMenu addItem:[NSMenuItem separatorItem]];
|
||||||
|
[appMenu addItemWithTitle:[NSString stringWithFormat:@"Hide %@", appName]
|
||||||
|
action:@selector(hide:)
|
||||||
|
keyEquivalent:@"h"];
|
||||||
|
[[appMenu addItemWithTitle:@"Hide Others"
|
||||||
|
action:@selector(hideOtherApplications:)
|
||||||
|
keyEquivalent:@"h"]
|
||||||
|
setKeyEquivalentModifierMask:NSEventModifierFlagOption | NSEventModifierFlagCommand];
|
||||||
|
[appMenu addItemWithTitle:@"Show All"
|
||||||
|
action:@selector(unhideAllApplications:)
|
||||||
|
keyEquivalent:@""];
|
||||||
|
[appMenu addItem:[NSMenuItem separatorItem]];
|
||||||
|
[appMenu addItemWithTitle:[NSString stringWithFormat:@"Quit %@", appName]
|
||||||
|
action:@selector(terminate:)
|
||||||
|
keyEquivalent:@"q"];
|
||||||
|
|
||||||
|
NSMenuItem* windowMenuItem =
|
||||||
|
[bar addItemWithTitle:@"" action:NULL keyEquivalent:@""];
|
||||||
|
[bar release];
|
||||||
|
NSMenu* windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
|
||||||
|
[NSApp setWindowsMenu:windowMenu];
|
||||||
|
[windowMenuItem setSubmenu:windowMenu];
|
||||||
|
|
||||||
|
[windowMenu addItemWithTitle:@"Minimize"
|
||||||
|
action:@selector(performMiniaturize:)
|
||||||
|
keyEquivalent:@"m"];
|
||||||
|
[windowMenu addItemWithTitle:@"Zoom"
|
||||||
|
action:@selector(performZoom:)
|
||||||
|
keyEquivalent:@""];
|
||||||
|
[windowMenu addItem:[NSMenuItem separatorItem]];
|
||||||
|
[windowMenu addItemWithTitle:@"Bring All to Front"
|
||||||
|
action:@selector(arrangeInFront:)
|
||||||
|
keyEquivalent:@""];
|
||||||
|
|
||||||
|
// TODO: Make this appear at the bottom of the menu (for consistency)
|
||||||
|
[windowMenu addItem:[NSMenuItem separatorItem]];
|
||||||
|
[[windowMenu addItemWithTitle:@"Enter Full Screen"
|
||||||
|
action:@selector(toggleFullScreen:)
|
||||||
|
keyEquivalent:@"f"]
|
||||||
|
setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand];
|
||||||
|
|
||||||
|
// Prior to Snow Leopard, we need to use this oddly-named semi-private API
|
||||||
|
// to get the application menu working properly.
|
||||||
|
SEL setAppleMenuSelector = NSSelectorFromString(@"setAppleMenu:");
|
||||||
|
[NSApp performSelector:setAppleMenuSelector withObject:appMenu];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create key code translation tables
|
||||||
|
//
|
||||||
|
static void createKeyTablesCocoa(void)
|
||||||
|
{
|
||||||
|
memset(_glfw.ns.keycodes, -1, sizeof(_glfw.ns.keycodes));
|
||||||
|
memset(_glfw.ns.scancodes, -1, sizeof(_glfw.ns.scancodes));
|
||||||
|
|
||||||
|
_glfw.ns.keycodes[0x1D] = GLFW_KEY_0;
|
||||||
|
_glfw.ns.keycodes[0x12] = GLFW_KEY_1;
|
||||||
|
_glfw.ns.keycodes[0x13] = GLFW_KEY_2;
|
||||||
|
_glfw.ns.keycodes[0x14] = GLFW_KEY_3;
|
||||||
|
_glfw.ns.keycodes[0x15] = GLFW_KEY_4;
|
||||||
|
_glfw.ns.keycodes[0x17] = GLFW_KEY_5;
|
||||||
|
_glfw.ns.keycodes[0x16] = GLFW_KEY_6;
|
||||||
|
_glfw.ns.keycodes[0x1A] = GLFW_KEY_7;
|
||||||
|
_glfw.ns.keycodes[0x1C] = GLFW_KEY_8;
|
||||||
|
_glfw.ns.keycodes[0x19] = GLFW_KEY_9;
|
||||||
|
_glfw.ns.keycodes[0x00] = GLFW_KEY_A;
|
||||||
|
_glfw.ns.keycodes[0x0B] = GLFW_KEY_B;
|
||||||
|
_glfw.ns.keycodes[0x08] = GLFW_KEY_C;
|
||||||
|
_glfw.ns.keycodes[0x02] = GLFW_KEY_D;
|
||||||
|
_glfw.ns.keycodes[0x0E] = GLFW_KEY_E;
|
||||||
|
_glfw.ns.keycodes[0x03] = GLFW_KEY_F;
|
||||||
|
_glfw.ns.keycodes[0x05] = GLFW_KEY_G;
|
||||||
|
_glfw.ns.keycodes[0x04] = GLFW_KEY_H;
|
||||||
|
_glfw.ns.keycodes[0x22] = GLFW_KEY_I;
|
||||||
|
_glfw.ns.keycodes[0x26] = GLFW_KEY_J;
|
||||||
|
_glfw.ns.keycodes[0x28] = GLFW_KEY_K;
|
||||||
|
_glfw.ns.keycodes[0x25] = GLFW_KEY_L;
|
||||||
|
_glfw.ns.keycodes[0x2E] = GLFW_KEY_M;
|
||||||
|
_glfw.ns.keycodes[0x2D] = GLFW_KEY_N;
|
||||||
|
_glfw.ns.keycodes[0x1F] = GLFW_KEY_O;
|
||||||
|
_glfw.ns.keycodes[0x23] = GLFW_KEY_P;
|
||||||
|
_glfw.ns.keycodes[0x0C] = GLFW_KEY_Q;
|
||||||
|
_glfw.ns.keycodes[0x0F] = GLFW_KEY_R;
|
||||||
|
_glfw.ns.keycodes[0x01] = GLFW_KEY_S;
|
||||||
|
_glfw.ns.keycodes[0x11] = GLFW_KEY_T;
|
||||||
|
_glfw.ns.keycodes[0x20] = GLFW_KEY_U;
|
||||||
|
_glfw.ns.keycodes[0x09] = GLFW_KEY_V;
|
||||||
|
_glfw.ns.keycodes[0x0D] = GLFW_KEY_W;
|
||||||
|
_glfw.ns.keycodes[0x07] = GLFW_KEY_X;
|
||||||
|
_glfw.ns.keycodes[0x10] = GLFW_KEY_Y;
|
||||||
|
_glfw.ns.keycodes[0x06] = GLFW_KEY_Z;
|
||||||
|
|
||||||
|
_glfw.ns.keycodes[0x27] = GLFW_KEY_APOSTROPHE;
|
||||||
|
_glfw.ns.keycodes[0x2A] = GLFW_KEY_BACKSLASH;
|
||||||
|
_glfw.ns.keycodes[0x2B] = GLFW_KEY_COMMA;
|
||||||
|
_glfw.ns.keycodes[0x18] = GLFW_KEY_EQUAL;
|
||||||
|
_glfw.ns.keycodes[0x32] = GLFW_KEY_GRAVE_ACCENT;
|
||||||
|
_glfw.ns.keycodes[0x21] = GLFW_KEY_LEFT_BRACKET;
|
||||||
|
_glfw.ns.keycodes[0x1B] = GLFW_KEY_MINUS;
|
||||||
|
_glfw.ns.keycodes[0x2F] = GLFW_KEY_PERIOD;
|
||||||
|
_glfw.ns.keycodes[0x1E] = GLFW_KEY_RIGHT_BRACKET;
|
||||||
|
_glfw.ns.keycodes[0x29] = GLFW_KEY_SEMICOLON;
|
||||||
|
_glfw.ns.keycodes[0x2C] = GLFW_KEY_SLASH;
|
||||||
|
_glfw.ns.keycodes[0x0A] = GLFW_KEY_WORLD_1;
|
||||||
|
|
||||||
|
_glfw.ns.keycodes[0x33] = GLFW_KEY_BACKSPACE;
|
||||||
|
_glfw.ns.keycodes[0x39] = GLFW_KEY_CAPS_LOCK;
|
||||||
|
_glfw.ns.keycodes[0x75] = GLFW_KEY_DELETE;
|
||||||
|
_glfw.ns.keycodes[0x7D] = GLFW_KEY_DOWN;
|
||||||
|
_glfw.ns.keycodes[0x77] = GLFW_KEY_END;
|
||||||
|
_glfw.ns.keycodes[0x24] = GLFW_KEY_ENTER;
|
||||||
|
_glfw.ns.keycodes[0x35] = GLFW_KEY_ESCAPE;
|
||||||
|
_glfw.ns.keycodes[0x7A] = GLFW_KEY_F1;
|
||||||
|
_glfw.ns.keycodes[0x78] = GLFW_KEY_F2;
|
||||||
|
_glfw.ns.keycodes[0x63] = GLFW_KEY_F3;
|
||||||
|
_glfw.ns.keycodes[0x76] = GLFW_KEY_F4;
|
||||||
|
_glfw.ns.keycodes[0x60] = GLFW_KEY_F5;
|
||||||
|
_glfw.ns.keycodes[0x61] = GLFW_KEY_F6;
|
||||||
|
_glfw.ns.keycodes[0x62] = GLFW_KEY_F7;
|
||||||
|
_glfw.ns.keycodes[0x64] = GLFW_KEY_F8;
|
||||||
|
_glfw.ns.keycodes[0x65] = GLFW_KEY_F9;
|
||||||
|
_glfw.ns.keycodes[0x6D] = GLFW_KEY_F10;
|
||||||
|
_glfw.ns.keycodes[0x67] = GLFW_KEY_F11;
|
||||||
|
_glfw.ns.keycodes[0x6F] = GLFW_KEY_F12;
|
||||||
|
_glfw.ns.keycodes[0x69] = GLFW_KEY_PRINT_SCREEN;
|
||||||
|
_glfw.ns.keycodes[0x6B] = GLFW_KEY_F14;
|
||||||
|
_glfw.ns.keycodes[0x71] = GLFW_KEY_F15;
|
||||||
|
_glfw.ns.keycodes[0x6A] = GLFW_KEY_F16;
|
||||||
|
_glfw.ns.keycodes[0x40] = GLFW_KEY_F17;
|
||||||
|
_glfw.ns.keycodes[0x4F] = GLFW_KEY_F18;
|
||||||
|
_glfw.ns.keycodes[0x50] = GLFW_KEY_F19;
|
||||||
|
_glfw.ns.keycodes[0x5A] = GLFW_KEY_F20;
|
||||||
|
_glfw.ns.keycodes[0x73] = GLFW_KEY_HOME;
|
||||||
|
_glfw.ns.keycodes[0x72] = GLFW_KEY_INSERT;
|
||||||
|
_glfw.ns.keycodes[0x7B] = GLFW_KEY_LEFT;
|
||||||
|
_glfw.ns.keycodes[0x3A] = GLFW_KEY_LEFT_ALT;
|
||||||
|
_glfw.ns.keycodes[0x3B] = GLFW_KEY_LEFT_CONTROL;
|
||||||
|
_glfw.ns.keycodes[0x38] = GLFW_KEY_LEFT_SHIFT;
|
||||||
|
_glfw.ns.keycodes[0x37] = GLFW_KEY_LEFT_SUPER;
|
||||||
|
_glfw.ns.keycodes[0x6E] = GLFW_KEY_MENU;
|
||||||
|
_glfw.ns.keycodes[0x47] = GLFW_KEY_NUM_LOCK;
|
||||||
|
_glfw.ns.keycodes[0x79] = GLFW_KEY_PAGE_DOWN;
|
||||||
|
_glfw.ns.keycodes[0x74] = GLFW_KEY_PAGE_UP;
|
||||||
|
_glfw.ns.keycodes[0x7C] = GLFW_KEY_RIGHT;
|
||||||
|
_glfw.ns.keycodes[0x3D] = GLFW_KEY_RIGHT_ALT;
|
||||||
|
_glfw.ns.keycodes[0x3E] = GLFW_KEY_RIGHT_CONTROL;
|
||||||
|
_glfw.ns.keycodes[0x3C] = GLFW_KEY_RIGHT_SHIFT;
|
||||||
|
_glfw.ns.keycodes[0x36] = GLFW_KEY_RIGHT_SUPER;
|
||||||
|
_glfw.ns.keycodes[0x31] = GLFW_KEY_SPACE;
|
||||||
|
_glfw.ns.keycodes[0x30] = GLFW_KEY_TAB;
|
||||||
|
_glfw.ns.keycodes[0x7E] = GLFW_KEY_UP;
|
||||||
|
|
||||||
|
_glfw.ns.keycodes[0x52] = GLFW_KEY_KP_0;
|
||||||
|
_glfw.ns.keycodes[0x53] = GLFW_KEY_KP_1;
|
||||||
|
_glfw.ns.keycodes[0x54] = GLFW_KEY_KP_2;
|
||||||
|
_glfw.ns.keycodes[0x55] = GLFW_KEY_KP_3;
|
||||||
|
_glfw.ns.keycodes[0x56] = GLFW_KEY_KP_4;
|
||||||
|
_glfw.ns.keycodes[0x57] = GLFW_KEY_KP_5;
|
||||||
|
_glfw.ns.keycodes[0x58] = GLFW_KEY_KP_6;
|
||||||
|
_glfw.ns.keycodes[0x59] = GLFW_KEY_KP_7;
|
||||||
|
_glfw.ns.keycodes[0x5B] = GLFW_KEY_KP_8;
|
||||||
|
_glfw.ns.keycodes[0x5C] = GLFW_KEY_KP_9;
|
||||||
|
_glfw.ns.keycodes[0x45] = GLFW_KEY_KP_ADD;
|
||||||
|
_glfw.ns.keycodes[0x41] = GLFW_KEY_KP_DECIMAL;
|
||||||
|
_glfw.ns.keycodes[0x4B] = GLFW_KEY_KP_DIVIDE;
|
||||||
|
_glfw.ns.keycodes[0x4C] = GLFW_KEY_KP_ENTER;
|
||||||
|
_glfw.ns.keycodes[0x51] = GLFW_KEY_KP_EQUAL;
|
||||||
|
_glfw.ns.keycodes[0x43] = GLFW_KEY_KP_MULTIPLY;
|
||||||
|
_glfw.ns.keycodes[0x4E] = GLFW_KEY_KP_SUBTRACT;
|
||||||
|
|
||||||
|
for (int scancode = 0; scancode < 256; scancode++)
|
||||||
|
{
|
||||||
|
// Store the reverse translation for faster key name lookup
|
||||||
|
if (_glfw.ns.keycodes[scancode] >= 0)
|
||||||
|
_glfw.ns.scancodes[_glfw.ns.keycodes[scancode]] = scancode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve Unicode data for the current keyboard layout
|
||||||
|
//
|
||||||
|
static GLFWbool updateUnicodeData(void)
|
||||||
|
{
|
||||||
|
if (_glfw.ns.inputSource)
|
||||||
|
{
|
||||||
|
CFRelease(_glfw.ns.inputSource);
|
||||||
|
_glfw.ns.inputSource = NULL;
|
||||||
|
_glfw.ns.unicodeData = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfw.ns.inputSource = TISCopyCurrentKeyboardLayoutInputSource();
|
||||||
|
if (!_glfw.ns.inputSource)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Cocoa: Failed to retrieve keyboard layout input source");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfw.ns.unicodeData =
|
||||||
|
TISGetInputSourceProperty(_glfw.ns.inputSource,
|
||||||
|
kTISPropertyUnicodeKeyLayoutData);
|
||||||
|
if (!_glfw.ns.unicodeData)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Cocoa: Failed to retrieve keyboard layout Unicode data");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load HIToolbox.framework and the TIS symbols we need from it
|
||||||
|
//
|
||||||
|
static GLFWbool initializeTIS(void)
|
||||||
|
{
|
||||||
|
// This works only because Cocoa has already loaded it properly
|
||||||
|
_glfw.ns.tis.bundle =
|
||||||
|
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.HIToolbox"));
|
||||||
|
if (!_glfw.ns.tis.bundle)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Cocoa: Failed to load HIToolbox.framework");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFStringRef* kPropertyUnicodeKeyLayoutData =
|
||||||
|
CFBundleGetDataPointerForName(_glfw.ns.tis.bundle,
|
||||||
|
CFSTR("kTISPropertyUnicodeKeyLayoutData"));
|
||||||
|
_glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource =
|
||||||
|
CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle,
|
||||||
|
CFSTR("TISCopyCurrentKeyboardLayoutInputSource"));
|
||||||
|
_glfw.ns.tis.GetInputSourceProperty =
|
||||||
|
CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle,
|
||||||
|
CFSTR("TISGetInputSourceProperty"));
|
||||||
|
_glfw.ns.tis.GetKbdType =
|
||||||
|
CFBundleGetFunctionPointerForName(_glfw.ns.tis.bundle,
|
||||||
|
CFSTR("LMGetKbdType"));
|
||||||
|
|
||||||
|
if (!kPropertyUnicodeKeyLayoutData ||
|
||||||
|
!TISCopyCurrentKeyboardLayoutInputSource ||
|
||||||
|
!TISGetInputSourceProperty ||
|
||||||
|
!LMGetKbdType)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Cocoa: Failed to load TIS API symbols");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfw.ns.tis.kPropertyUnicodeKeyLayoutData =
|
||||||
|
*kPropertyUnicodeKeyLayoutData;
|
||||||
|
|
||||||
|
return updateUnicodeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@interface GLFWHelper : NSObject
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation GLFWHelper
|
||||||
|
|
||||||
|
- (void)selectedKeyboardInputSourceChanged:(NSObject* )object
|
||||||
|
{
|
||||||
|
updateUnicodeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)doNothing:(id)object
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@end // GLFWHelper
|
||||||
|
|
||||||
|
@interface GLFWApplicationDelegate : NSObject <NSApplicationDelegate>
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation GLFWApplicationDelegate
|
||||||
|
|
||||||
|
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
||||||
|
{
|
||||||
|
for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next)
|
||||||
|
_glfwInputWindowCloseRequest(window);
|
||||||
|
|
||||||
|
return NSTerminateCancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationDidChangeScreenParameters:(NSNotification *) notification
|
||||||
|
{
|
||||||
|
for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next)
|
||||||
|
{
|
||||||
|
if (window->context.client != GLFW_NO_API)
|
||||||
|
[window->context.nsgl.object update];
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwPollMonitorsCocoa();
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationWillFinishLaunching:(NSNotification *)notification
|
||||||
|
{
|
||||||
|
if (_glfw.hints.init.ns.menubar)
|
||||||
|
{
|
||||||
|
// Menu bar setup must go between sharedApplication and finishLaunching
|
||||||
|
// in order to properly emulate the behavior of NSApplicationMain
|
||||||
|
|
||||||
|
if ([[NSBundle mainBundle] pathForResource:@"MainMenu" ofType:@"nib"])
|
||||||
|
{
|
||||||
|
[[NSBundle mainBundle] loadNibNamed:@"MainMenu"
|
||||||
|
owner:NSApp
|
||||||
|
topLevelObjects:&_glfw.ns.nibObjects];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
createMenuBar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
||||||
|
{
|
||||||
|
_glfwPostEmptyEventCocoa();
|
||||||
|
[NSApp stop:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationDidHide:(NSNotification *)notification
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _glfw.monitorCount; i++)
|
||||||
|
_glfwRestoreVideoModeCocoa(_glfw.monitors[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@end // GLFWApplicationDelegate
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW internal API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void* _glfwLoadLocalVulkanLoaderCocoa(void)
|
||||||
|
{
|
||||||
|
CFBundleRef bundle = CFBundleGetMainBundle();
|
||||||
|
if (!bundle)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CFURLRef frameworksUrl = CFBundleCopyPrivateFrameworksURL(bundle);
|
||||||
|
if (!frameworksUrl)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CFURLRef loaderUrl = CFURLCreateCopyAppendingPathComponent(
|
||||||
|
kCFAllocatorDefault, frameworksUrl, CFSTR("libvulkan.1.dylib"), false);
|
||||||
|
if (!loaderUrl)
|
||||||
|
{
|
||||||
|
CFRelease(frameworksUrl);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
char path[PATH_MAX];
|
||||||
|
void* handle = NULL;
|
||||||
|
|
||||||
|
if (CFURLGetFileSystemRepresentation(loaderUrl, true, (UInt8*) path, sizeof(path) - 1))
|
||||||
|
handle = _glfwPlatformLoadModule(path);
|
||||||
|
|
||||||
|
CFRelease(loaderUrl);
|
||||||
|
CFRelease(frameworksUrl);
|
||||||
|
return handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW platform API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GLFWbool _glfwConnectCocoa(int platformID, _GLFWplatform* platform)
|
||||||
|
{
|
||||||
|
const _GLFWplatform cocoa =
|
||||||
|
{
|
||||||
|
.platformID = GLFW_PLATFORM_COCOA,
|
||||||
|
.init = _glfwInitCocoa,
|
||||||
|
.terminate = _glfwTerminateCocoa,
|
||||||
|
.getCursorPos = _glfwGetCursorPosCocoa,
|
||||||
|
.setCursorPos = _glfwSetCursorPosCocoa,
|
||||||
|
.setCursorMode = _glfwSetCursorModeCocoa,
|
||||||
|
.setRawMouseMotion = _glfwSetRawMouseMotionCocoa,
|
||||||
|
.rawMouseMotionSupported = _glfwRawMouseMotionSupportedCocoa,
|
||||||
|
.createCursor = _glfwCreateCursorCocoa,
|
||||||
|
.createStandardCursor = _glfwCreateStandardCursorCocoa,
|
||||||
|
.destroyCursor = _glfwDestroyCursorCocoa,
|
||||||
|
.setCursor = _glfwSetCursorCocoa,
|
||||||
|
.getScancodeName = _glfwGetScancodeNameCocoa,
|
||||||
|
.getKeyScancode = _glfwGetKeyScancodeCocoa,
|
||||||
|
.setClipboardString = _glfwSetClipboardStringCocoa,
|
||||||
|
.getClipboardString = _glfwGetClipboardStringCocoa,
|
||||||
|
.initJoysticks = _glfwInitJoysticksCocoa,
|
||||||
|
.terminateJoysticks = _glfwTerminateJoysticksCocoa,
|
||||||
|
.pollJoystick = _glfwPollJoystickCocoa,
|
||||||
|
.getMappingName = _glfwGetMappingNameCocoa,
|
||||||
|
.updateGamepadGUID = _glfwUpdateGamepadGUIDCocoa,
|
||||||
|
.freeMonitor = _glfwFreeMonitorCocoa,
|
||||||
|
.getMonitorPos = _glfwGetMonitorPosCocoa,
|
||||||
|
.getMonitorContentScale = _glfwGetMonitorContentScaleCocoa,
|
||||||
|
.getMonitorWorkarea = _glfwGetMonitorWorkareaCocoa,
|
||||||
|
.getVideoModes = _glfwGetVideoModesCocoa,
|
||||||
|
.getVideoMode = _glfwGetVideoModeCocoa,
|
||||||
|
.getGammaRamp = _glfwGetGammaRampCocoa,
|
||||||
|
.setGammaRamp = _glfwSetGammaRampCocoa,
|
||||||
|
.createWindow = _glfwCreateWindowCocoa,
|
||||||
|
.destroyWindow = _glfwDestroyWindowCocoa,
|
||||||
|
.setWindowTitle = _glfwSetWindowTitleCocoa,
|
||||||
|
.setWindowIcon = _glfwSetWindowIconCocoa,
|
||||||
|
.getWindowPos = _glfwGetWindowPosCocoa,
|
||||||
|
.setWindowPos = _glfwSetWindowPosCocoa,
|
||||||
|
.getWindowSize = _glfwGetWindowSizeCocoa,
|
||||||
|
.setWindowSize = _glfwSetWindowSizeCocoa,
|
||||||
|
.setWindowSizeLimits = _glfwSetWindowSizeLimitsCocoa,
|
||||||
|
.setWindowAspectRatio = _glfwSetWindowAspectRatioCocoa,
|
||||||
|
.getFramebufferSize = _glfwGetFramebufferSizeCocoa,
|
||||||
|
.getWindowFrameSize = _glfwGetWindowFrameSizeCocoa,
|
||||||
|
.getWindowContentScale = _glfwGetWindowContentScaleCocoa,
|
||||||
|
.iconifyWindow = _glfwIconifyWindowCocoa,
|
||||||
|
.restoreWindow = _glfwRestoreWindowCocoa,
|
||||||
|
.maximizeWindow = _glfwMaximizeWindowCocoa,
|
||||||
|
.showWindow = _glfwShowWindowCocoa,
|
||||||
|
.hideWindow = _glfwHideWindowCocoa,
|
||||||
|
.requestWindowAttention = _glfwRequestWindowAttentionCocoa,
|
||||||
|
.focusWindow = _glfwFocusWindowCocoa,
|
||||||
|
.setWindowMonitor = _glfwSetWindowMonitorCocoa,
|
||||||
|
.windowFocused = _glfwWindowFocusedCocoa,
|
||||||
|
.windowIconified = _glfwWindowIconifiedCocoa,
|
||||||
|
.windowVisible = _glfwWindowVisibleCocoa,
|
||||||
|
.windowMaximized = _glfwWindowMaximizedCocoa,
|
||||||
|
.windowHovered = _glfwWindowHoveredCocoa,
|
||||||
|
.framebufferTransparent = _glfwFramebufferTransparentCocoa,
|
||||||
|
.getWindowOpacity = _glfwGetWindowOpacityCocoa,
|
||||||
|
.setWindowResizable = _glfwSetWindowResizableCocoa,
|
||||||
|
.setWindowDecorated = _glfwSetWindowDecoratedCocoa,
|
||||||
|
.setWindowFloating = _glfwSetWindowFloatingCocoa,
|
||||||
|
.setWindowOpacity = _glfwSetWindowOpacityCocoa,
|
||||||
|
.setWindowMousePassthrough = _glfwSetWindowMousePassthroughCocoa,
|
||||||
|
.pollEvents = _glfwPollEventsCocoa,
|
||||||
|
.waitEvents = _glfwWaitEventsCocoa,
|
||||||
|
.waitEventsTimeout = _glfwWaitEventsTimeoutCocoa,
|
||||||
|
.postEmptyEvent = _glfwPostEmptyEventCocoa,
|
||||||
|
.getEGLPlatform = _glfwGetEGLPlatformCocoa,
|
||||||
|
.getEGLNativeDisplay = _glfwGetEGLNativeDisplayCocoa,
|
||||||
|
.getEGLNativeWindow = _glfwGetEGLNativeWindowCocoa,
|
||||||
|
.getRequiredInstanceExtensions = _glfwGetRequiredInstanceExtensionsCocoa,
|
||||||
|
.getPhysicalDevicePresentationSupport = _glfwGetPhysicalDevicePresentationSupportCocoa,
|
||||||
|
.createWindowSurface = _glfwCreateWindowSurfaceCocoa
|
||||||
|
};
|
||||||
|
|
||||||
|
*platform = cocoa;
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _glfwInitCocoa(void)
|
||||||
|
{
|
||||||
|
@autoreleasepool {
|
||||||
|
|
||||||
|
_glfw.ns.helper = [[GLFWHelper alloc] init];
|
||||||
|
|
||||||
|
[NSThread detachNewThreadSelector:@selector(doNothing:)
|
||||||
|
toTarget:_glfw.ns.helper
|
||||||
|
withObject:nil];
|
||||||
|
|
||||||
|
[NSApplication sharedApplication];
|
||||||
|
|
||||||
|
_glfw.ns.delegate = [[GLFWApplicationDelegate alloc] init];
|
||||||
|
if (_glfw.ns.delegate == nil)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Cocoa: Failed to create application delegate");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
[NSApp setDelegate:_glfw.ns.delegate];
|
||||||
|
|
||||||
|
NSEvent* (^block)(NSEvent*) = ^ NSEvent* (NSEvent* event)
|
||||||
|
{
|
||||||
|
if ([event modifierFlags] & NSEventModifierFlagCommand)
|
||||||
|
[[NSApp keyWindow] sendEvent:event];
|
||||||
|
|
||||||
|
return event;
|
||||||
|
};
|
||||||
|
|
||||||
|
_glfw.ns.keyUpMonitor =
|
||||||
|
[NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskKeyUp
|
||||||
|
handler:block];
|
||||||
|
|
||||||
|
if (_glfw.hints.init.ns.chdir)
|
||||||
|
changeToResourcesDirectory();
|
||||||
|
|
||||||
|
// Press and Hold prevents some keys from emitting repeated characters
|
||||||
|
NSDictionary* defaults = @{@"ApplePressAndHoldEnabled":@NO};
|
||||||
|
[[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
addObserver:_glfw.ns.helper
|
||||||
|
selector:@selector(selectedKeyboardInputSourceChanged:)
|
||||||
|
name:NSTextInputContextKeyboardSelectionDidChangeNotification
|
||||||
|
object:nil];
|
||||||
|
|
||||||
|
createKeyTablesCocoa();
|
||||||
|
|
||||||
|
_glfw.ns.eventSource = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
|
||||||
|
if (!_glfw.ns.eventSource)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
CGEventSourceSetLocalEventsSuppressionInterval(_glfw.ns.eventSource, 0.0);
|
||||||
|
|
||||||
|
if (!initializeTIS())
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
_glfwPollMonitorsCocoa();
|
||||||
|
|
||||||
|
if (![[NSRunningApplication currentApplication] isFinishedLaunching])
|
||||||
|
[NSApp run];
|
||||||
|
|
||||||
|
// In case we are unbundled, make us a proper UI application
|
||||||
|
if (_glfw.hints.init.ns.menubar)
|
||||||
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
|
||||||
|
} // autoreleasepool
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwTerminateCocoa(void)
|
||||||
|
{
|
||||||
|
@autoreleasepool {
|
||||||
|
|
||||||
|
if (_glfw.ns.inputSource)
|
||||||
|
{
|
||||||
|
CFRelease(_glfw.ns.inputSource);
|
||||||
|
_glfw.ns.inputSource = NULL;
|
||||||
|
_glfw.ns.unicodeData = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.ns.eventSource)
|
||||||
|
{
|
||||||
|
CFRelease(_glfw.ns.eventSource);
|
||||||
|
_glfw.ns.eventSource = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.ns.delegate)
|
||||||
|
{
|
||||||
|
[NSApp setDelegate:nil];
|
||||||
|
[_glfw.ns.delegate release];
|
||||||
|
_glfw.ns.delegate = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.ns.helper)
|
||||||
|
{
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
removeObserver:_glfw.ns.helper
|
||||||
|
name:NSTextInputContextKeyboardSelectionDidChangeNotification
|
||||||
|
object:nil];
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
removeObserver:_glfw.ns.helper];
|
||||||
|
[_glfw.ns.helper release];
|
||||||
|
_glfw.ns.helper = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.ns.keyUpMonitor)
|
||||||
|
[NSEvent removeMonitor:_glfw.ns.keyUpMonitor];
|
||||||
|
|
||||||
|
_glfw_free(_glfw.ns.clipboardString);
|
||||||
|
|
||||||
|
_glfwTerminateNSGL();
|
||||||
|
_glfwTerminateEGL();
|
||||||
|
_glfwTerminateOSMesa();
|
||||||
|
|
||||||
|
} // autoreleasepool
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // _GLFW_COCOA
|
||||||
|
|
||||||
49
libraries/raylib/raylib/src/external/glfw/src/cocoa_joystick.h
vendored
Normal file
49
libraries/raylib/raylib/src/external/glfw/src/cocoa_joystick.h
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 Cocoa - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.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, 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 <IOKit/IOKitLib.h>
|
||||||
|
#include <IOKit/IOCFPlugIn.h>
|
||||||
|
#include <IOKit/hid/IOHIDKeys.h>
|
||||||
|
|
||||||
|
#define GLFW_COCOA_JOYSTICK_STATE _GLFWjoystickNS ns;
|
||||||
|
#define GLFW_COCOA_LIBRARY_JOYSTICK_STATE
|
||||||
|
|
||||||
|
// Cocoa-specific per-joystick data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWjoystickNS
|
||||||
|
{
|
||||||
|
IOHIDDeviceRef device;
|
||||||
|
CFMutableArrayRef axes;
|
||||||
|
CFMutableArrayRef buttons;
|
||||||
|
CFMutableArrayRef hats;
|
||||||
|
} _GLFWjoystickNS;
|
||||||
|
|
||||||
|
GLFWbool _glfwInitJoysticksCocoa(void);
|
||||||
|
void _glfwTerminateJoysticksCocoa(void);
|
||||||
|
GLFWbool _glfwPollJoystickCocoa(_GLFWjoystick* js, int mode);
|
||||||
|
const char* _glfwGetMappingNameCocoa(void);
|
||||||
|
void _glfwUpdateGamepadGUIDCocoa(char* guid);
|
||||||
|
|
||||||
485
libraries/raylib/raylib/src/external/glfw/src/cocoa_joystick.m
vendored
Normal file
485
libraries/raylib/raylib/src/external/glfw/src/cocoa_joystick.m
vendored
Normal file
|
|
@ -0,0 +1,485 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 Cocoa - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
|
// Copyright (c) 2012 Torsten Walluhn <tw@mad-cad.net>
|
||||||
|
//
|
||||||
|
// 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_COCOA)
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <mach/mach.h>
|
||||||
|
#include <mach/mach_error.h>
|
||||||
|
|
||||||
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
#include <Kernel/IOKit/hidsystem/IOHIDUsageTables.h>
|
||||||
|
|
||||||
|
|
||||||
|
// Joystick element information
|
||||||
|
//
|
||||||
|
typedef struct _GLFWjoyelementNS
|
||||||
|
{
|
||||||
|
IOHIDElementRef native;
|
||||||
|
uint32_t usage;
|
||||||
|
int index;
|
||||||
|
long minimum;
|
||||||
|
long maximum;
|
||||||
|
|
||||||
|
} _GLFWjoyelementNS;
|
||||||
|
|
||||||
|
|
||||||
|
// Returns the value of the specified element of the specified joystick
|
||||||
|
//
|
||||||
|
static long getElementValue(_GLFWjoystick* js, _GLFWjoyelementNS* element)
|
||||||
|
{
|
||||||
|
IOHIDValueRef valueRef;
|
||||||
|
long value = 0;
|
||||||
|
|
||||||
|
if (js->ns.device)
|
||||||
|
{
|
||||||
|
if (IOHIDDeviceGetValue(js->ns.device,
|
||||||
|
element->native,
|
||||||
|
&valueRef) == kIOReturnSuccess)
|
||||||
|
{
|
||||||
|
value = IOHIDValueGetIntegerValue(valueRef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Comparison function for matching the SDL element order
|
||||||
|
//
|
||||||
|
static CFComparisonResult compareElements(const void* fp,
|
||||||
|
const void* sp,
|
||||||
|
void* user)
|
||||||
|
{
|
||||||
|
const _GLFWjoyelementNS* fe = fp;
|
||||||
|
const _GLFWjoyelementNS* se = sp;
|
||||||
|
if (fe->usage < se->usage)
|
||||||
|
return kCFCompareLessThan;
|
||||||
|
if (fe->usage > se->usage)
|
||||||
|
return kCFCompareGreaterThan;
|
||||||
|
if (fe->index < se->index)
|
||||||
|
return kCFCompareLessThan;
|
||||||
|
if (fe->index > se->index)
|
||||||
|
return kCFCompareGreaterThan;
|
||||||
|
return kCFCompareEqualTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Removes the specified joystick
|
||||||
|
//
|
||||||
|
static void closeJoystick(_GLFWjoystick* js)
|
||||||
|
{
|
||||||
|
_glfwInputJoystick(js, GLFW_DISCONNECTED);
|
||||||
|
|
||||||
|
for (int i = 0; i < CFArrayGetCount(js->ns.axes); i++)
|
||||||
|
_glfw_free((void*) CFArrayGetValueAtIndex(js->ns.axes, i));
|
||||||
|
CFRelease(js->ns.axes);
|
||||||
|
|
||||||
|
for (int i = 0; i < CFArrayGetCount(js->ns.buttons); i++)
|
||||||
|
_glfw_free((void*) CFArrayGetValueAtIndex(js->ns.buttons, i));
|
||||||
|
CFRelease(js->ns.buttons);
|
||||||
|
|
||||||
|
for (int i = 0; i < CFArrayGetCount(js->ns.hats); i++)
|
||||||
|
_glfw_free((void*) CFArrayGetValueAtIndex(js->ns.hats, i));
|
||||||
|
CFRelease(js->ns.hats);
|
||||||
|
|
||||||
|
_glfwFreeJoystick(js);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Callback for user-initiated joystick addition
|
||||||
|
//
|
||||||
|
static void matchCallback(void* context,
|
||||||
|
IOReturn result,
|
||||||
|
void* sender,
|
||||||
|
IOHIDDeviceRef device)
|
||||||
|
{
|
||||||
|
int jid;
|
||||||
|
char name[256];
|
||||||
|
char guid[33];
|
||||||
|
CFTypeRef property;
|
||||||
|
uint32_t vendor = 0, product = 0, version = 0;
|
||||||
|
_GLFWjoystick* js;
|
||||||
|
CFMutableArrayRef axes, buttons, hats;
|
||||||
|
|
||||||
|
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
|
{
|
||||||
|
if (_glfw.joysticks[jid].ns.device == device)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFArrayRef elements =
|
||||||
|
IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone);
|
||||||
|
|
||||||
|
// It is reportedly possible for this to fail on macOS 13 Ventura
|
||||||
|
// if the application does not have input monitoring permissions
|
||||||
|
if (!elements)
|
||||||
|
return;
|
||||||
|
|
||||||
|
axes = CFArrayCreateMutable(NULL, 0, NULL);
|
||||||
|
buttons = CFArrayCreateMutable(NULL, 0, NULL);
|
||||||
|
hats = CFArrayCreateMutable(NULL, 0, NULL);
|
||||||
|
|
||||||
|
property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductKey));
|
||||||
|
if (property)
|
||||||
|
{
|
||||||
|
CFStringGetCString(property,
|
||||||
|
name,
|
||||||
|
sizeof(name),
|
||||||
|
kCFStringEncodingUTF8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
strncpy(name, "Unknown", sizeof(name));
|
||||||
|
|
||||||
|
property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVendorIDKey));
|
||||||
|
if (property)
|
||||||
|
CFNumberGetValue(property, kCFNumberSInt32Type, &vendor);
|
||||||
|
|
||||||
|
property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductIDKey));
|
||||||
|
if (property)
|
||||||
|
CFNumberGetValue(property, kCFNumberSInt32Type, &product);
|
||||||
|
|
||||||
|
property = IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVersionNumberKey));
|
||||||
|
if (property)
|
||||||
|
CFNumberGetValue(property, kCFNumberSInt32Type, &version);
|
||||||
|
|
||||||
|
// Generate a joystick GUID that matches the SDL 2.0.5+ one
|
||||||
|
if (vendor && product)
|
||||||
|
{
|
||||||
|
sprintf(guid, "03000000%02x%02x0000%02x%02x0000%02x%02x0000",
|
||||||
|
(uint8_t) vendor, (uint8_t) (vendor >> 8),
|
||||||
|
(uint8_t) product, (uint8_t) (product >> 8),
|
||||||
|
(uint8_t) version, (uint8_t) (version >> 8));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(guid, "05000000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00",
|
||||||
|
name[0], name[1], name[2], name[3],
|
||||||
|
name[4], name[5], name[6], name[7],
|
||||||
|
name[8], name[9], name[10]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (CFIndex i = 0; i < CFArrayGetCount(elements); i++)
|
||||||
|
{
|
||||||
|
IOHIDElementRef native = (IOHIDElementRef)
|
||||||
|
CFArrayGetValueAtIndex(elements, i);
|
||||||
|
if (CFGetTypeID(native) != IOHIDElementGetTypeID())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const IOHIDElementType type = IOHIDElementGetType(native);
|
||||||
|
if ((type != kIOHIDElementTypeInput_Axis) &&
|
||||||
|
(type != kIOHIDElementTypeInput_Button) &&
|
||||||
|
(type != kIOHIDElementTypeInput_Misc))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFMutableArrayRef target = NULL;
|
||||||
|
|
||||||
|
const uint32_t usage = IOHIDElementGetUsage(native);
|
||||||
|
const uint32_t page = IOHIDElementGetUsagePage(native);
|
||||||
|
if (page == kHIDPage_GenericDesktop)
|
||||||
|
{
|
||||||
|
switch (usage)
|
||||||
|
{
|
||||||
|
case kHIDUsage_GD_X:
|
||||||
|
case kHIDUsage_GD_Y:
|
||||||
|
case kHIDUsage_GD_Z:
|
||||||
|
case kHIDUsage_GD_Rx:
|
||||||
|
case kHIDUsage_GD_Ry:
|
||||||
|
case kHIDUsage_GD_Rz:
|
||||||
|
case kHIDUsage_GD_Slider:
|
||||||
|
case kHIDUsage_GD_Dial:
|
||||||
|
case kHIDUsage_GD_Wheel:
|
||||||
|
target = axes;
|
||||||
|
break;
|
||||||
|
case kHIDUsage_GD_Hatswitch:
|
||||||
|
target = hats;
|
||||||
|
break;
|
||||||
|
case kHIDUsage_GD_DPadUp:
|
||||||
|
case kHIDUsage_GD_DPadRight:
|
||||||
|
case kHIDUsage_GD_DPadDown:
|
||||||
|
case kHIDUsage_GD_DPadLeft:
|
||||||
|
case kHIDUsage_GD_SystemMainMenu:
|
||||||
|
case kHIDUsage_GD_Select:
|
||||||
|
case kHIDUsage_GD_Start:
|
||||||
|
target = buttons;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (page == kHIDPage_Simulation)
|
||||||
|
{
|
||||||
|
switch (usage)
|
||||||
|
{
|
||||||
|
case kHIDUsage_Sim_Accelerator:
|
||||||
|
case kHIDUsage_Sim_Brake:
|
||||||
|
case kHIDUsage_Sim_Throttle:
|
||||||
|
case kHIDUsage_Sim_Rudder:
|
||||||
|
case kHIDUsage_Sim_Steering:
|
||||||
|
target = axes;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (page == kHIDPage_Button || page == kHIDPage_Consumer)
|
||||||
|
target = buttons;
|
||||||
|
|
||||||
|
if (target)
|
||||||
|
{
|
||||||
|
_GLFWjoyelementNS* element = _glfw_calloc(1, sizeof(_GLFWjoyelementNS));
|
||||||
|
element->native = native;
|
||||||
|
element->usage = usage;
|
||||||
|
element->index = (int) CFArrayGetCount(target);
|
||||||
|
element->minimum = IOHIDElementGetLogicalMin(native);
|
||||||
|
element->maximum = IOHIDElementGetLogicalMax(native);
|
||||||
|
CFArrayAppendValue(target, element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CFRelease(elements);
|
||||||
|
|
||||||
|
CFArraySortValues(axes, CFRangeMake(0, CFArrayGetCount(axes)),
|
||||||
|
compareElements, NULL);
|
||||||
|
CFArraySortValues(buttons, CFRangeMake(0, CFArrayGetCount(buttons)),
|
||||||
|
compareElements, NULL);
|
||||||
|
CFArraySortValues(hats, CFRangeMake(0, CFArrayGetCount(hats)),
|
||||||
|
compareElements, NULL);
|
||||||
|
|
||||||
|
js = _glfwAllocJoystick(name, guid,
|
||||||
|
(int) CFArrayGetCount(axes),
|
||||||
|
(int) CFArrayGetCount(buttons),
|
||||||
|
(int) CFArrayGetCount(hats));
|
||||||
|
|
||||||
|
js->ns.device = device;
|
||||||
|
js->ns.axes = axes;
|
||||||
|
js->ns.buttons = buttons;
|
||||||
|
js->ns.hats = hats;
|
||||||
|
|
||||||
|
_glfwInputJoystick(js, GLFW_CONNECTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Callback for user-initiated joystick removal
|
||||||
|
//
|
||||||
|
static void removeCallback(void* context,
|
||||||
|
IOReturn result,
|
||||||
|
void* sender,
|
||||||
|
IOHIDDeviceRef device)
|
||||||
|
{
|
||||||
|
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
|
{
|
||||||
|
if (_glfw.joysticks[jid].connected && _glfw.joysticks[jid].ns.device == device)
|
||||||
|
{
|
||||||
|
closeJoystick(&_glfw.joysticks[jid]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW platform API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GLFWbool _glfwInitJoysticksCocoa(void)
|
||||||
|
{
|
||||||
|
CFMutableArrayRef matching;
|
||||||
|
const long usages[] =
|
||||||
|
{
|
||||||
|
kHIDUsage_GD_Joystick,
|
||||||
|
kHIDUsage_GD_GamePad,
|
||||||
|
kHIDUsage_GD_MultiAxisController
|
||||||
|
};
|
||||||
|
|
||||||
|
_glfw.ns.hidManager = IOHIDManagerCreate(kCFAllocatorDefault,
|
||||||
|
kIOHIDOptionsTypeNone);
|
||||||
|
|
||||||
|
matching = CFArrayCreateMutable(kCFAllocatorDefault,
|
||||||
|
0,
|
||||||
|
&kCFTypeArrayCallBacks);
|
||||||
|
if (!matching)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to create array");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < sizeof(usages) / sizeof(long); i++)
|
||||||
|
{
|
||||||
|
const long page = kHIDPage_GenericDesktop;
|
||||||
|
|
||||||
|
CFMutableDictionaryRef dict =
|
||||||
|
CFDictionaryCreateMutable(kCFAllocatorDefault,
|
||||||
|
0,
|
||||||
|
&kCFTypeDictionaryKeyCallBacks,
|
||||||
|
&kCFTypeDictionaryValueCallBacks);
|
||||||
|
if (!dict)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
CFNumberRef pageRef = CFNumberCreate(kCFAllocatorDefault,
|
||||||
|
kCFNumberLongType,
|
||||||
|
&page);
|
||||||
|
CFNumberRef usageRef = CFNumberCreate(kCFAllocatorDefault,
|
||||||
|
kCFNumberLongType,
|
||||||
|
&usages[i]);
|
||||||
|
if (pageRef && usageRef)
|
||||||
|
{
|
||||||
|
CFDictionarySetValue(dict,
|
||||||
|
CFSTR(kIOHIDDeviceUsagePageKey),
|
||||||
|
pageRef);
|
||||||
|
CFDictionarySetValue(dict,
|
||||||
|
CFSTR(kIOHIDDeviceUsageKey),
|
||||||
|
usageRef);
|
||||||
|
CFArrayAppendValue(matching, dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pageRef)
|
||||||
|
CFRelease(pageRef);
|
||||||
|
if (usageRef)
|
||||||
|
CFRelease(usageRef);
|
||||||
|
|
||||||
|
CFRelease(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
IOHIDManagerSetDeviceMatchingMultiple(_glfw.ns.hidManager, matching);
|
||||||
|
CFRelease(matching);
|
||||||
|
|
||||||
|
IOHIDManagerRegisterDeviceMatchingCallback(_glfw.ns.hidManager,
|
||||||
|
&matchCallback, NULL);
|
||||||
|
IOHIDManagerRegisterDeviceRemovalCallback(_glfw.ns.hidManager,
|
||||||
|
&removeCallback, NULL);
|
||||||
|
IOHIDManagerScheduleWithRunLoop(_glfw.ns.hidManager,
|
||||||
|
CFRunLoopGetMain(),
|
||||||
|
kCFRunLoopDefaultMode);
|
||||||
|
IOHIDManagerOpen(_glfw.ns.hidManager, kIOHIDOptionsTypeNone);
|
||||||
|
|
||||||
|
// Execute the run loop once in order to register any initially-attached
|
||||||
|
// joysticks
|
||||||
|
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false);
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwTerminateJoysticksCocoa(void)
|
||||||
|
{
|
||||||
|
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
|
{
|
||||||
|
if (_glfw.joysticks[jid].connected)
|
||||||
|
closeJoystick(&_glfw.joysticks[jid]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.ns.hidManager)
|
||||||
|
{
|
||||||
|
CFRelease(_glfw.ns.hidManager);
|
||||||
|
_glfw.ns.hidManager = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GLFWbool _glfwPollJoystickCocoa(_GLFWjoystick* js, int mode)
|
||||||
|
{
|
||||||
|
if (mode & _GLFW_POLL_AXES)
|
||||||
|
{
|
||||||
|
for (CFIndex i = 0; i < CFArrayGetCount(js->ns.axes); i++)
|
||||||
|
{
|
||||||
|
_GLFWjoyelementNS* axis = (_GLFWjoyelementNS*)
|
||||||
|
CFArrayGetValueAtIndex(js->ns.axes, i);
|
||||||
|
|
||||||
|
const long raw = getElementValue(js, axis);
|
||||||
|
// Perform auto calibration
|
||||||
|
if (raw < axis->minimum)
|
||||||
|
axis->minimum = raw;
|
||||||
|
if (raw > axis->maximum)
|
||||||
|
axis->maximum = raw;
|
||||||
|
|
||||||
|
const long size = axis->maximum - axis->minimum;
|
||||||
|
if (size == 0)
|
||||||
|
_glfwInputJoystickAxis(js, (int) i, 0.f);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const float value = (2.f * (raw - axis->minimum) / size) - 1.f;
|
||||||
|
_glfwInputJoystickAxis(js, (int) i, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode & _GLFW_POLL_BUTTONS)
|
||||||
|
{
|
||||||
|
for (CFIndex i = 0; i < CFArrayGetCount(js->ns.buttons); i++)
|
||||||
|
{
|
||||||
|
_GLFWjoyelementNS* button = (_GLFWjoyelementNS*)
|
||||||
|
CFArrayGetValueAtIndex(js->ns.buttons, i);
|
||||||
|
const char value = getElementValue(js, button) - button->minimum;
|
||||||
|
const int state = (value > 0) ? GLFW_PRESS : GLFW_RELEASE;
|
||||||
|
_glfwInputJoystickButton(js, (int) i, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (CFIndex i = 0; i < CFArrayGetCount(js->ns.hats); i++)
|
||||||
|
{
|
||||||
|
const int states[9] =
|
||||||
|
{
|
||||||
|
GLFW_HAT_UP,
|
||||||
|
GLFW_HAT_RIGHT_UP,
|
||||||
|
GLFW_HAT_RIGHT,
|
||||||
|
GLFW_HAT_RIGHT_DOWN,
|
||||||
|
GLFW_HAT_DOWN,
|
||||||
|
GLFW_HAT_LEFT_DOWN,
|
||||||
|
GLFW_HAT_LEFT,
|
||||||
|
GLFW_HAT_LEFT_UP,
|
||||||
|
GLFW_HAT_CENTERED
|
||||||
|
};
|
||||||
|
|
||||||
|
_GLFWjoyelementNS* hat = (_GLFWjoyelementNS*)
|
||||||
|
CFArrayGetValueAtIndex(js->ns.hats, i);
|
||||||
|
long state = getElementValue(js, hat) - hat->minimum;
|
||||||
|
if (state < 0 || state > 8)
|
||||||
|
state = 8;
|
||||||
|
|
||||||
|
_glfwInputJoystickHat(js, (int) i, states[state]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return js->connected;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* _glfwGetMappingNameCocoa(void)
|
||||||
|
{
|
||||||
|
return "Mac OS X";
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwUpdateGamepadGUIDCocoa(char* guid)
|
||||||
|
{
|
||||||
|
if ((strncmp(guid + 4, "000000000000", 12) == 0) &&
|
||||||
|
(strncmp(guid + 20, "000000000000", 12) == 0))
|
||||||
|
{
|
||||||
|
char original[33];
|
||||||
|
strncpy(original, guid, sizeof(original) - 1);
|
||||||
|
sprintf(guid, "03000000%.4s0000%.4s000000000000",
|
||||||
|
original, original + 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // _GLFW_COCOA
|
||||||
|
|
||||||
644
libraries/raylib/raylib/src/external/glfw/src/cocoa_monitor.m
vendored
Normal file
644
libraries/raylib/raylib/src/external/glfw/src/cocoa_monitor.m
vendored
Normal file
|
|
@ -0,0 +1,644 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 macOS (modified for raylib) - www.glfw.org; www.raylib.com
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
|
||||||
|
// Copyright (c) 2024 M374LX <wilsalx@gmail.com>
|
||||||
|
//
|
||||||
|
// 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_COCOA)
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <IOKit/graphics/IOGraphicsLib.h>
|
||||||
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
|
|
||||||
|
|
||||||
|
// Get the name of the specified display, or NULL
|
||||||
|
//
|
||||||
|
static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
|
||||||
|
{
|
||||||
|
// IOKit doesn't work on Apple Silicon anymore
|
||||||
|
// Luckily, 10.15 introduced -[NSScreen localizedName].
|
||||||
|
// Use it if available, and fall back to IOKit otherwise.
|
||||||
|
if (screen)
|
||||||
|
{
|
||||||
|
if ([screen respondsToSelector:@selector(localizedName)])
|
||||||
|
{
|
||||||
|
NSString* name = [screen valueForKey:@"localizedName"];
|
||||||
|
if (name)
|
||||||
|
return _glfw_strdup([name UTF8String]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
io_iterator_t it;
|
||||||
|
io_service_t service;
|
||||||
|
CFDictionaryRef info;
|
||||||
|
|
||||||
|
if (IOServiceGetMatchingServices(MACH_PORT_NULL,
|
||||||
|
IOServiceMatching("IODisplayConnect"),
|
||||||
|
&it) != 0)
|
||||||
|
{
|
||||||
|
// This may happen if a desktop Mac is running headless
|
||||||
|
return _glfw_strdup("Display");
|
||||||
|
}
|
||||||
|
|
||||||
|
while ((service = IOIteratorNext(it)) != 0)
|
||||||
|
{
|
||||||
|
info = IODisplayCreateInfoDictionary(service,
|
||||||
|
kIODisplayOnlyPreferredName);
|
||||||
|
|
||||||
|
CFNumberRef vendorIDRef =
|
||||||
|
CFDictionaryGetValue(info, CFSTR(kDisplayVendorID));
|
||||||
|
CFNumberRef productIDRef =
|
||||||
|
CFDictionaryGetValue(info, CFSTR(kDisplayProductID));
|
||||||
|
if (!vendorIDRef || !productIDRef)
|
||||||
|
{
|
||||||
|
CFRelease(info);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int vendorID, productID;
|
||||||
|
CFNumberGetValue(vendorIDRef, kCFNumberIntType, &vendorID);
|
||||||
|
CFNumberGetValue(productIDRef, kCFNumberIntType, &productID);
|
||||||
|
|
||||||
|
if (CGDisplayVendorNumber(displayID) == vendorID &&
|
||||||
|
CGDisplayModelNumber(displayID) == productID)
|
||||||
|
{
|
||||||
|
// Info dictionary is used and freed below
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFRelease(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
IOObjectRelease(it);
|
||||||
|
|
||||||
|
if (!service)
|
||||||
|
return _glfw_strdup("Display");
|
||||||
|
|
||||||
|
CFDictionaryRef names =
|
||||||
|
CFDictionaryGetValue(info, CFSTR(kDisplayProductName));
|
||||||
|
|
||||||
|
CFStringRef nameRef;
|
||||||
|
|
||||||
|
if (!names || !CFDictionaryGetValueIfPresent(names, CFSTR("en_US"),
|
||||||
|
(const void**) &nameRef))
|
||||||
|
{
|
||||||
|
// This may happen if a desktop Mac is running headless
|
||||||
|
CFRelease(info);
|
||||||
|
return _glfw_strdup("Display");
|
||||||
|
}
|
||||||
|
|
||||||
|
const CFIndex size =
|
||||||
|
CFStringGetMaximumSizeForEncoding(CFStringGetLength(nameRef),
|
||||||
|
kCFStringEncodingUTF8);
|
||||||
|
char* name = _glfw_calloc(size + 1, 1);
|
||||||
|
CFStringGetCString(nameRef, name, size, kCFStringEncodingUTF8);
|
||||||
|
|
||||||
|
CFRelease(info);
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check whether the display mode should be included in enumeration
|
||||||
|
//
|
||||||
|
static GLFWbool modeIsGood(CGDisplayModeRef mode)
|
||||||
|
{
|
||||||
|
uint32_t flags = CGDisplayModeGetIOFlags(mode);
|
||||||
|
|
||||||
|
if (!(flags & kDisplayModeValidFlag) || !(flags & kDisplayModeSafeFlag))
|
||||||
|
return GLFW_FALSE;
|
||||||
|
if (flags & kDisplayModeInterlacedFlag)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
if (flags & kDisplayModeStretchedFlag)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED <= 101100
|
||||||
|
CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
|
||||||
|
if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) &&
|
||||||
|
CFStringCompare(format, CFSTR(IO32BitDirectPixels), 0))
|
||||||
|
{
|
||||||
|
CFRelease(format);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFRelease(format);
|
||||||
|
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert Core Graphics display mode to GLFW video mode
|
||||||
|
//
|
||||||
|
static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode,
|
||||||
|
double fallbackRefreshRate)
|
||||||
|
{
|
||||||
|
GLFWvidmode result;
|
||||||
|
result.width = (int) CGDisplayModeGetWidth(mode);
|
||||||
|
result.height = (int) CGDisplayModeGetHeight(mode);
|
||||||
|
result.refreshRate = (int) round(CGDisplayModeGetRefreshRate(mode));
|
||||||
|
|
||||||
|
if (result.refreshRate == 0)
|
||||||
|
result.refreshRate = (int) round(fallbackRefreshRate);
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED <= 101100
|
||||||
|
CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
|
||||||
|
if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) == 0)
|
||||||
|
{
|
||||||
|
result.redBits = 5;
|
||||||
|
result.greenBits = 5;
|
||||||
|
result.blueBits = 5;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
|
||||||
|
{
|
||||||
|
result.redBits = 8;
|
||||||
|
result.greenBits = 8;
|
||||||
|
result.blueBits = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED <= 101100
|
||||||
|
CFRelease(format);
|
||||||
|
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Starts reservation for display fading
|
||||||
|
//
|
||||||
|
static CGDisplayFadeReservationToken beginFadeReservation(void)
|
||||||
|
{
|
||||||
|
CGDisplayFadeReservationToken token = kCGDisplayFadeReservationInvalidToken;
|
||||||
|
|
||||||
|
if (CGAcquireDisplayFadeReservation(5, &token) == kCGErrorSuccess)
|
||||||
|
{
|
||||||
|
CGDisplayFade(token, 0.3,
|
||||||
|
kCGDisplayBlendNormal,
|
||||||
|
kCGDisplayBlendSolidColor,
|
||||||
|
0.0, 0.0, 0.0,
|
||||||
|
TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ends reservation for display fading
|
||||||
|
//
|
||||||
|
static void endFadeReservation(CGDisplayFadeReservationToken token)
|
||||||
|
{
|
||||||
|
if (token != kCGDisplayFadeReservationInvalidToken)
|
||||||
|
{
|
||||||
|
CGDisplayFade(token, 0.5,
|
||||||
|
kCGDisplayBlendSolidColor,
|
||||||
|
kCGDisplayBlendNormal,
|
||||||
|
0.0, 0.0, 0.0,
|
||||||
|
FALSE);
|
||||||
|
CGReleaseDisplayFadeReservation(token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the display refresh rate queried from the I/O registry
|
||||||
|
//
|
||||||
|
static double getFallbackRefreshRate(CGDirectDisplayID displayID)
|
||||||
|
{
|
||||||
|
double refreshRate = 60.0;
|
||||||
|
|
||||||
|
io_iterator_t it;
|
||||||
|
io_service_t service;
|
||||||
|
|
||||||
|
if (IOServiceGetMatchingServices(MACH_PORT_NULL,
|
||||||
|
IOServiceMatching("IOFramebuffer"),
|
||||||
|
&it) != 0)
|
||||||
|
{
|
||||||
|
return refreshRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ((service = IOIteratorNext(it)) != 0)
|
||||||
|
{
|
||||||
|
const CFNumberRef indexRef =
|
||||||
|
IORegistryEntryCreateCFProperty(service,
|
||||||
|
CFSTR("IOFramebufferOpenGLIndex"),
|
||||||
|
kCFAllocatorDefault,
|
||||||
|
kNilOptions);
|
||||||
|
if (!indexRef)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
uint32_t index = 0;
|
||||||
|
CFNumberGetValue(indexRef, kCFNumberIntType, &index);
|
||||||
|
CFRelease(indexRef);
|
||||||
|
|
||||||
|
if (CGOpenGLDisplayMaskToDisplayID(1 << index) != displayID)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const CFNumberRef clockRef =
|
||||||
|
IORegistryEntryCreateCFProperty(service,
|
||||||
|
CFSTR("IOFBCurrentPixelClock"),
|
||||||
|
kCFAllocatorDefault,
|
||||||
|
kNilOptions);
|
||||||
|
const CFNumberRef countRef =
|
||||||
|
IORegistryEntryCreateCFProperty(service,
|
||||||
|
CFSTR("IOFBCurrentPixelCount"),
|
||||||
|
kCFAllocatorDefault,
|
||||||
|
kNilOptions);
|
||||||
|
|
||||||
|
uint32_t clock = 0, count = 0;
|
||||||
|
|
||||||
|
if (clockRef)
|
||||||
|
{
|
||||||
|
CFNumberGetValue(clockRef, kCFNumberIntType, &clock);
|
||||||
|
CFRelease(clockRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (countRef)
|
||||||
|
{
|
||||||
|
CFNumberGetValue(countRef, kCFNumberIntType, &count);
|
||||||
|
CFRelease(countRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clock > 0 && count > 0)
|
||||||
|
refreshRate = clock / (double) count;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
IOObjectRelease(it);
|
||||||
|
return refreshRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW internal API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Poll for changes in the set of connected monitors
|
||||||
|
//
|
||||||
|
void _glfwPollMonitorsCocoa(void)
|
||||||
|
{
|
||||||
|
uint32_t displayCount;
|
||||||
|
CGGetOnlineDisplayList(0, NULL, &displayCount);
|
||||||
|
CGDirectDisplayID* displays = _glfw_calloc(displayCount, sizeof(CGDirectDisplayID));
|
||||||
|
CGGetOnlineDisplayList(displayCount, displays, &displayCount);
|
||||||
|
|
||||||
|
for (int i = 0; i < _glfw.monitorCount; i++)
|
||||||
|
_glfw.monitors[i]->ns.screen = nil;
|
||||||
|
|
||||||
|
_GLFWmonitor** disconnected = NULL;
|
||||||
|
uint32_t disconnectedCount = _glfw.monitorCount;
|
||||||
|
if (disconnectedCount)
|
||||||
|
{
|
||||||
|
disconnected = _glfw_calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
|
||||||
|
memcpy(disconnected,
|
||||||
|
_glfw.monitors,
|
||||||
|
_glfw.monitorCount * sizeof(_GLFWmonitor*));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < displayCount; i++)
|
||||||
|
{
|
||||||
|
if (CGDisplayIsAsleep(displays[i]))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
|
||||||
|
NSScreen* screen = nil;
|
||||||
|
|
||||||
|
for (screen in [NSScreen screens])
|
||||||
|
{
|
||||||
|
NSNumber* screenNumber = [screen deviceDescription][@"NSScreenNumber"];
|
||||||
|
|
||||||
|
// HACK: Compare unit numbers instead of display IDs to work around
|
||||||
|
// display replacement on machines with automatic graphics
|
||||||
|
// switching
|
||||||
|
if (CGDisplayUnitNumber([screenNumber unsignedIntValue]) == unitNumber)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// HACK: Compare unit numbers instead of display IDs to work around
|
||||||
|
// display replacement on machines with automatic graphics
|
||||||
|
// switching
|
||||||
|
uint32_t j;
|
||||||
|
for (j = 0; j < disconnectedCount; j++)
|
||||||
|
{
|
||||||
|
if (disconnected[j] && disconnected[j]->ns.unitNumber == unitNumber)
|
||||||
|
{
|
||||||
|
disconnected[j]->ns.screen = screen;
|
||||||
|
disconnected[j] = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (j < disconnectedCount)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const CGSize size = CGDisplayScreenSize(displays[i]);
|
||||||
|
char* name = getMonitorName(displays[i], screen);
|
||||||
|
if (!name)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
_GLFWmonitor* monitor = _glfwAllocMonitor(name, size.width, size.height);
|
||||||
|
monitor->ns.displayID = displays[i];
|
||||||
|
monitor->ns.unitNumber = unitNumber;
|
||||||
|
monitor->ns.screen = screen;
|
||||||
|
|
||||||
|
_glfw_free(name);
|
||||||
|
|
||||||
|
CGDisplayModeRef mode = CGDisplayCopyDisplayMode(displays[i]);
|
||||||
|
if (CGDisplayModeGetRefreshRate(mode) == 0.0)
|
||||||
|
monitor->ns.fallbackRefreshRate = getFallbackRefreshRate(displays[i]);
|
||||||
|
CGDisplayModeRelease(mode);
|
||||||
|
|
||||||
|
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < disconnectedCount; i++)
|
||||||
|
{
|
||||||
|
if (disconnected[i])
|
||||||
|
_glfwInputMonitor(disconnected[i], GLFW_DISCONNECTED, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfw_free(disconnected);
|
||||||
|
_glfw_free(displays);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change the current video mode
|
||||||
|
//
|
||||||
|
void _glfwSetVideoModeCocoa(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
||||||
|
{
|
||||||
|
GLFWvidmode current;
|
||||||
|
_glfwGetVideoModeCocoa(monitor, ¤t);
|
||||||
|
|
||||||
|
const GLFWvidmode* best = _glfwChooseVideoMode(monitor, desired);
|
||||||
|
if (_glfwCompareVideoModes(¤t, best) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CFArrayRef modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
|
||||||
|
const CFIndex count = CFArrayGetCount(modes);
|
||||||
|
CGDisplayModeRef native = NULL;
|
||||||
|
|
||||||
|
for (CFIndex i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
|
||||||
|
if (!modeIsGood(dm))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const GLFWvidmode mode =
|
||||||
|
vidmodeFromCGDisplayMode(dm, monitor->ns.fallbackRefreshRate);
|
||||||
|
if (_glfwCompareVideoModes(best, &mode) == 0)
|
||||||
|
{
|
||||||
|
native = dm;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (native)
|
||||||
|
{
|
||||||
|
if (monitor->ns.previousMode == NULL)
|
||||||
|
monitor->ns.previousMode = CGDisplayCopyDisplayMode(monitor->ns.displayID);
|
||||||
|
|
||||||
|
CGDisplayFadeReservationToken token = beginFadeReservation();
|
||||||
|
CGDisplaySetDisplayMode(monitor->ns.displayID, native, NULL);
|
||||||
|
endFadeReservation(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
CFRelease(modes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restore the previously saved (original) video mode
|
||||||
|
//
|
||||||
|
void _glfwRestoreVideoModeCocoa(_GLFWmonitor* monitor)
|
||||||
|
{
|
||||||
|
if (monitor->ns.previousMode)
|
||||||
|
{
|
||||||
|
CGDisplayFadeReservationToken token = beginFadeReservation();
|
||||||
|
CGDisplaySetDisplayMode(monitor->ns.displayID,
|
||||||
|
monitor->ns.previousMode, NULL);
|
||||||
|
endFadeReservation(token);
|
||||||
|
|
||||||
|
CGDisplayModeRelease(monitor->ns.previousMode);
|
||||||
|
monitor->ns.previousMode = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW platform API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void _glfwFreeMonitorCocoa(_GLFWmonitor* monitor)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwGetMonitorPosCocoa(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
||||||
|
{
|
||||||
|
@autoreleasepool {
|
||||||
|
|
||||||
|
const CGRect bounds = CGDisplayBounds(monitor->ns.displayID);
|
||||||
|
|
||||||
|
if (xpos)
|
||||||
|
*xpos = (int) bounds.origin.x;
|
||||||
|
if (ypos)
|
||||||
|
*ypos = (int) bounds.origin.y;
|
||||||
|
|
||||||
|
} // autoreleasepool
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwGetMonitorContentScaleCocoa(_GLFWmonitor* monitor,
|
||||||
|
float* xscale, float* yscale)
|
||||||
|
{
|
||||||
|
@autoreleasepool {
|
||||||
|
|
||||||
|
if (!monitor->ns.screen)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Cocoa: Cannot query content scale without screen");
|
||||||
|
}
|
||||||
|
|
||||||
|
const NSRect points = [monitor->ns.screen frame];
|
||||||
|
const NSRect pixels = [monitor->ns.screen convertRectToBacking:points];
|
||||||
|
|
||||||
|
if (xscale)
|
||||||
|
*xscale = (float) (pixels.size.width / points.size.width);
|
||||||
|
if (yscale)
|
||||||
|
*yscale = (float) (pixels.size.height / points.size.height);
|
||||||
|
|
||||||
|
} // autoreleasepool
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwGetMonitorWorkareaCocoa(_GLFWmonitor* monitor,
|
||||||
|
int* xpos, int* ypos,
|
||||||
|
int* width, int* height)
|
||||||
|
{
|
||||||
|
@autoreleasepool {
|
||||||
|
|
||||||
|
if (!monitor->ns.screen)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Cocoa: Cannot query workarea without screen");
|
||||||
|
}
|
||||||
|
|
||||||
|
const NSRect frameRect = [monitor->ns.screen visibleFrame];
|
||||||
|
|
||||||
|
if (xpos)
|
||||||
|
*xpos = frameRect.origin.x;
|
||||||
|
if (ypos)
|
||||||
|
*ypos = _glfwTransformYCocoa(frameRect.origin.y + frameRect.size.height - 1);
|
||||||
|
if (width)
|
||||||
|
*width = frameRect.size.width;
|
||||||
|
if (height)
|
||||||
|
*height = frameRect.size.height;
|
||||||
|
|
||||||
|
} // autoreleasepool
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWvidmode* _glfwGetVideoModesCocoa(_GLFWmonitor* monitor, int* count)
|
||||||
|
{
|
||||||
|
@autoreleasepool {
|
||||||
|
|
||||||
|
*count = 0;
|
||||||
|
|
||||||
|
CFArrayRef modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
|
||||||
|
const CFIndex found = CFArrayGetCount(modes);
|
||||||
|
GLFWvidmode* result = _glfw_calloc(found, sizeof(GLFWvidmode));
|
||||||
|
|
||||||
|
for (CFIndex i = 0; i < found; i++)
|
||||||
|
{
|
||||||
|
CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
|
||||||
|
if (!modeIsGood(dm))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const GLFWvidmode mode =
|
||||||
|
vidmodeFromCGDisplayMode(dm, monitor->ns.fallbackRefreshRate);
|
||||||
|
CFIndex j;
|
||||||
|
|
||||||
|
for (j = 0; j < *count; j++)
|
||||||
|
{
|
||||||
|
if (_glfwCompareVideoModes(result + j, &mode) == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip duplicate modes
|
||||||
|
if (j < *count)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
(*count)++;
|
||||||
|
result[*count - 1] = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFRelease(modes);
|
||||||
|
return result;
|
||||||
|
|
||||||
|
} // autoreleasepool
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWbool _glfwGetVideoModeCocoa(_GLFWmonitor* monitor, GLFWvidmode *mode)
|
||||||
|
{
|
||||||
|
@autoreleasepool {
|
||||||
|
|
||||||
|
CGDisplayModeRef native = CGDisplayCopyDisplayMode(monitor->ns.displayID);
|
||||||
|
if (!native)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to query display mode");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*mode = vidmodeFromCGDisplayMode(native, monitor->ns.fallbackRefreshRate);
|
||||||
|
CGDisplayModeRelease(native);
|
||||||
|
return GLFW_TRUE;
|
||||||
|
|
||||||
|
} // autoreleasepool
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWbool _glfwGetGammaRampCocoa(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||||
|
{
|
||||||
|
@autoreleasepool {
|
||||||
|
|
||||||
|
uint32_t size = CGDisplayGammaTableCapacity(monitor->ns.displayID);
|
||||||
|
CGGammaValue* values = _glfw_calloc(size * 3, sizeof(CGGammaValue));
|
||||||
|
|
||||||
|
CGGetDisplayTransferByTable(monitor->ns.displayID,
|
||||||
|
size,
|
||||||
|
values,
|
||||||
|
values + size,
|
||||||
|
values + size * 2,
|
||||||
|
&size);
|
||||||
|
|
||||||
|
_glfwAllocGammaArrays(ramp, size);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
ramp->red[i] = (unsigned short) (values[i] * 65535);
|
||||||
|
ramp->green[i] = (unsigned short) (values[i + size] * 65535);
|
||||||
|
ramp->blue[i] = (unsigned short) (values[i + size * 2] * 65535);
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfw_free(values);
|
||||||
|
return GLFW_TRUE;
|
||||||
|
|
||||||
|
} // autoreleasepool
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwSetGammaRampCocoa(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
||||||
|
{
|
||||||
|
@autoreleasepool {
|
||||||
|
|
||||||
|
CGGammaValue* values = _glfw_calloc(ramp->size * 3, sizeof(CGGammaValue));
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < ramp->size; i++)
|
||||||
|
{
|
||||||
|
values[i] = ramp->red[i] / 65535.f;
|
||||||
|
values[i + ramp->size] = ramp->green[i] / 65535.f;
|
||||||
|
values[i + ramp->size * 2] = ramp->blue[i] / 65535.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGSetDisplayTransferByTable(monitor->ns.displayID,
|
||||||
|
ramp->size,
|
||||||
|
values,
|
||||||
|
values + ramp->size,
|
||||||
|
values + ramp->size * 2);
|
||||||
|
|
||||||
|
_glfw_free(values);
|
||||||
|
|
||||||
|
} // autoreleasepool
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW native API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* handle)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(kCGNullDirectDisplay);
|
||||||
|
|
||||||
|
if (_glfw.platform.platformID != GLFW_PLATFORM_COCOA)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "Cocoa: Platform not initialized");
|
||||||
|
return kCGNullDirectDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
|
return monitor->ns.displayID;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // _GLFW_COCOA
|
||||||
|
|
||||||
302
libraries/raylib/raylib/src/external/glfw/src/cocoa_platform.h
vendored
Normal file
302
libraries/raylib/raylib/src/external/glfw/src/cocoa_platform.h
vendored
Normal file
|
|
@ -0,0 +1,302 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 macOS - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.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, 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 <stdint.h>
|
||||||
|
|
||||||
|
#include <Carbon/Carbon.h>
|
||||||
|
#include <IOKit/hid/IOHIDLib.h>
|
||||||
|
|
||||||
|
// NOTE: All of NSGL was deprecated in the 10.14 SDK
|
||||||
|
// This disables the pointless warnings for every symbol we use
|
||||||
|
#ifndef GL_SILENCE_DEPRECATION
|
||||||
|
#define GL_SILENCE_DEPRECATION
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__OBJC__)
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#else
|
||||||
|
typedef void* id;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// NOTE: Many Cocoa enum values have been renamed and we need to build across
|
||||||
|
// SDK versions where one is unavailable or deprecated.
|
||||||
|
// We use the newer names in code and replace them with the older names if
|
||||||
|
// the base SDK does not provide the newer names.
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101400
|
||||||
|
#define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval
|
||||||
|
#define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
|
||||||
|
#define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat
|
||||||
|
#define NSEventMaskAny NSAnyEventMask
|
||||||
|
#define NSEventMaskKeyUp NSKeyUpMask
|
||||||
|
#define NSEventModifierFlagCapsLock NSAlphaShiftKeyMask
|
||||||
|
#define NSEventModifierFlagCommand NSCommandKeyMask
|
||||||
|
#define NSEventModifierFlagControl NSControlKeyMask
|
||||||
|
#define NSEventModifierFlagDeviceIndependentFlagsMask NSDeviceIndependentModifierFlagsMask
|
||||||
|
#define NSEventModifierFlagOption NSAlternateKeyMask
|
||||||
|
#define NSEventModifierFlagShift NSShiftKeyMask
|
||||||
|
#define NSEventTypeApplicationDefined NSApplicationDefined
|
||||||
|
#define NSWindowStyleMaskBorderless NSBorderlessWindowMask
|
||||||
|
#define NSWindowStyleMaskClosable NSClosableWindowMask
|
||||||
|
#define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask
|
||||||
|
#define NSWindowStyleMaskResizable NSResizableWindowMask
|
||||||
|
#define NSWindowStyleMaskTitled NSTitledWindowMask
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// NOTE: Many Cocoa dynamically linked constants have been renamed and we need
|
||||||
|
// to build across SDK versions where one is unavailable or deprecated.
|
||||||
|
// We use the newer names in code and replace them with the older names if
|
||||||
|
// the deployment target is older than the newer names.
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101300
|
||||||
|
#define NSPasteboardTypeURL NSURLPboardType
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef VkFlags VkMacOSSurfaceCreateFlagsMVK;
|
||||||
|
typedef VkFlags VkMetalSurfaceCreateFlagsEXT;
|
||||||
|
|
||||||
|
typedef struct VkMacOSSurfaceCreateInfoMVK
|
||||||
|
{
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkMacOSSurfaceCreateFlagsMVK flags;
|
||||||
|
const void* pView;
|
||||||
|
} VkMacOSSurfaceCreateInfoMVK;
|
||||||
|
|
||||||
|
typedef struct VkMetalSurfaceCreateInfoEXT
|
||||||
|
{
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkMetalSurfaceCreateFlagsEXT flags;
|
||||||
|
const void* pLayer;
|
||||||
|
} VkMetalSurfaceCreateInfoEXT;
|
||||||
|
|
||||||
|
typedef VkResult (APIENTRY *PFN_vkCreateMacOSSurfaceMVK)(VkInstance,const VkMacOSSurfaceCreateInfoMVK*,const VkAllocationCallbacks*,VkSurfaceKHR*);
|
||||||
|
typedef VkResult (APIENTRY *PFN_vkCreateMetalSurfaceEXT)(VkInstance,const VkMetalSurfaceCreateInfoEXT*,const VkAllocationCallbacks*,VkSurfaceKHR*);
|
||||||
|
|
||||||
|
#define GLFW_COCOA_WINDOW_STATE _GLFWwindowNS ns;
|
||||||
|
#define GLFW_COCOA_LIBRARY_WINDOW_STATE _GLFWlibraryNS ns;
|
||||||
|
#define GLFW_COCOA_MONITOR_STATE _GLFWmonitorNS ns;
|
||||||
|
#define GLFW_COCOA_CURSOR_STATE _GLFWcursorNS ns;
|
||||||
|
|
||||||
|
#define GLFW_NSGL_CONTEXT_STATE _GLFWcontextNSGL nsgl;
|
||||||
|
#define GLFW_NSGL_LIBRARY_CONTEXT_STATE _GLFWlibraryNSGL nsgl;
|
||||||
|
|
||||||
|
// HIToolbox.framework pointer typedefs
|
||||||
|
#define kTISPropertyUnicodeKeyLayoutData _glfw.ns.tis.kPropertyUnicodeKeyLayoutData
|
||||||
|
typedef TISInputSourceRef (*PFN_TISCopyCurrentKeyboardLayoutInputSource)(void);
|
||||||
|
#define TISCopyCurrentKeyboardLayoutInputSource _glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource
|
||||||
|
typedef void* (*PFN_TISGetInputSourceProperty)(TISInputSourceRef,CFStringRef);
|
||||||
|
#define TISGetInputSourceProperty _glfw.ns.tis.GetInputSourceProperty
|
||||||
|
typedef UInt8 (*PFN_LMGetKbdType)(void);
|
||||||
|
#define LMGetKbdType _glfw.ns.tis.GetKbdType
|
||||||
|
|
||||||
|
|
||||||
|
// NSGL-specific per-context data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWcontextNSGL
|
||||||
|
{
|
||||||
|
id pixelFormat;
|
||||||
|
id object;
|
||||||
|
} _GLFWcontextNSGL;
|
||||||
|
|
||||||
|
// NSGL-specific global data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWlibraryNSGL
|
||||||
|
{
|
||||||
|
// dlopen handle for OpenGL.framework (for glfwGetProcAddress)
|
||||||
|
CFBundleRef framework;
|
||||||
|
} _GLFWlibraryNSGL;
|
||||||
|
|
||||||
|
// Cocoa-specific per-window data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWwindowNS
|
||||||
|
{
|
||||||
|
id object;
|
||||||
|
id delegate;
|
||||||
|
id view;
|
||||||
|
id layer;
|
||||||
|
|
||||||
|
GLFWbool maximized;
|
||||||
|
GLFWbool occluded;
|
||||||
|
GLFWbool scaleFramebuffer;
|
||||||
|
|
||||||
|
// Cached window properties to filter out duplicate events
|
||||||
|
int width, height;
|
||||||
|
int fbWidth, fbHeight;
|
||||||
|
float xscale, yscale;
|
||||||
|
|
||||||
|
// The total sum of the distances the cursor has been warped
|
||||||
|
// since the last cursor motion event was processed
|
||||||
|
// This is kept to counteract Cocoa doing the same internally
|
||||||
|
double cursorWarpDeltaX, cursorWarpDeltaY;
|
||||||
|
} _GLFWwindowNS;
|
||||||
|
|
||||||
|
// Cocoa-specific global data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWlibraryNS
|
||||||
|
{
|
||||||
|
CGEventSourceRef eventSource;
|
||||||
|
id delegate;
|
||||||
|
GLFWbool cursorHidden;
|
||||||
|
TISInputSourceRef inputSource;
|
||||||
|
IOHIDManagerRef hidManager;
|
||||||
|
id unicodeData;
|
||||||
|
id helper;
|
||||||
|
id keyUpMonitor;
|
||||||
|
id nibObjects;
|
||||||
|
|
||||||
|
char keynames[GLFW_KEY_LAST + 1][17];
|
||||||
|
short int keycodes[256];
|
||||||
|
short int scancodes[GLFW_KEY_LAST + 1];
|
||||||
|
char* clipboardString;
|
||||||
|
CGPoint cascadePoint;
|
||||||
|
// Where to place the cursor when re-enabled
|
||||||
|
double restoreCursorPosX, restoreCursorPosY;
|
||||||
|
// The window whose disabled cursor mode is active
|
||||||
|
_GLFWwindow* disabledCursorWindow;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
CFBundleRef bundle;
|
||||||
|
PFN_TISCopyCurrentKeyboardLayoutInputSource CopyCurrentKeyboardLayoutInputSource;
|
||||||
|
PFN_TISGetInputSourceProperty GetInputSourceProperty;
|
||||||
|
PFN_LMGetKbdType GetKbdType;
|
||||||
|
CFStringRef kPropertyUnicodeKeyLayoutData;
|
||||||
|
} tis;
|
||||||
|
} _GLFWlibraryNS;
|
||||||
|
|
||||||
|
// Cocoa-specific per-monitor data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWmonitorNS
|
||||||
|
{
|
||||||
|
CGDirectDisplayID displayID;
|
||||||
|
CGDisplayModeRef previousMode;
|
||||||
|
uint32_t unitNumber;
|
||||||
|
id screen;
|
||||||
|
double fallbackRefreshRate;
|
||||||
|
} _GLFWmonitorNS;
|
||||||
|
|
||||||
|
// Cocoa-specific per-cursor data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWcursorNS
|
||||||
|
{
|
||||||
|
id object;
|
||||||
|
} _GLFWcursorNS;
|
||||||
|
|
||||||
|
|
||||||
|
GLFWbool _glfwConnectCocoa(int platformID, _GLFWplatform* platform);
|
||||||
|
int _glfwInitCocoa(void);
|
||||||
|
void _glfwTerminateCocoa(void);
|
||||||
|
|
||||||
|
GLFWbool _glfwCreateWindowCocoa(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig);
|
||||||
|
void _glfwDestroyWindowCocoa(_GLFWwindow* window);
|
||||||
|
void _glfwSetWindowTitleCocoa(_GLFWwindow* window, const char* title);
|
||||||
|
void _glfwSetWindowIconCocoa(_GLFWwindow* window, int count, const GLFWimage* images);
|
||||||
|
void _glfwGetWindowPosCocoa(_GLFWwindow* window, int* xpos, int* ypos);
|
||||||
|
void _glfwSetWindowPosCocoa(_GLFWwindow* window, int xpos, int ypos);
|
||||||
|
void _glfwGetWindowSizeCocoa(_GLFWwindow* window, int* width, int* height);
|
||||||
|
void _glfwSetWindowSizeCocoa(_GLFWwindow* window, int width, int height);
|
||||||
|
void _glfwSetWindowSizeLimitsCocoa(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
|
||||||
|
void _glfwSetWindowAspectRatioCocoa(_GLFWwindow* window, int numer, int denom);
|
||||||
|
void _glfwGetFramebufferSizeCocoa(_GLFWwindow* window, int* width, int* height);
|
||||||
|
void _glfwGetWindowFrameSizeCocoa(_GLFWwindow* window, int* left, int* top, int* right, int* bottom);
|
||||||
|
void _glfwGetWindowContentScaleCocoa(_GLFWwindow* window, float* xscale, float* yscale);
|
||||||
|
void _glfwIconifyWindowCocoa(_GLFWwindow* window);
|
||||||
|
void _glfwRestoreWindowCocoa(_GLFWwindow* window);
|
||||||
|
void _glfwMaximizeWindowCocoa(_GLFWwindow* window);
|
||||||
|
void _glfwShowWindowCocoa(_GLFWwindow* window);
|
||||||
|
void _glfwHideWindowCocoa(_GLFWwindow* window);
|
||||||
|
void _glfwRequestWindowAttentionCocoa(_GLFWwindow* window);
|
||||||
|
void _glfwFocusWindowCocoa(_GLFWwindow* window);
|
||||||
|
void _glfwSetWindowMonitorCocoa(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
|
||||||
|
GLFWbool _glfwWindowFocusedCocoa(_GLFWwindow* window);
|
||||||
|
GLFWbool _glfwWindowIconifiedCocoa(_GLFWwindow* window);
|
||||||
|
GLFWbool _glfwWindowVisibleCocoa(_GLFWwindow* window);
|
||||||
|
GLFWbool _glfwWindowMaximizedCocoa(_GLFWwindow* window);
|
||||||
|
GLFWbool _glfwWindowHoveredCocoa(_GLFWwindow* window);
|
||||||
|
GLFWbool _glfwFramebufferTransparentCocoa(_GLFWwindow* window);
|
||||||
|
void _glfwSetWindowResizableCocoa(_GLFWwindow* window, GLFWbool enabled);
|
||||||
|
void _glfwSetWindowDecoratedCocoa(_GLFWwindow* window, GLFWbool enabled);
|
||||||
|
void _glfwSetWindowFloatingCocoa(_GLFWwindow* window, GLFWbool enabled);
|
||||||
|
float _glfwGetWindowOpacityCocoa(_GLFWwindow* window);
|
||||||
|
void _glfwSetWindowOpacityCocoa(_GLFWwindow* window, float opacity);
|
||||||
|
void _glfwSetWindowMousePassthroughCocoa(_GLFWwindow* window, GLFWbool enabled);
|
||||||
|
|
||||||
|
void _glfwSetRawMouseMotionCocoa(_GLFWwindow *window, GLFWbool enabled);
|
||||||
|
GLFWbool _glfwRawMouseMotionSupportedCocoa(void);
|
||||||
|
|
||||||
|
void _glfwPollEventsCocoa(void);
|
||||||
|
void _glfwWaitEventsCocoa(void);
|
||||||
|
void _glfwWaitEventsTimeoutCocoa(double timeout);
|
||||||
|
void _glfwPostEmptyEventCocoa(void);
|
||||||
|
|
||||||
|
void _glfwGetCursorPosCocoa(_GLFWwindow* window, double* xpos, double* ypos);
|
||||||
|
void _glfwSetCursorPosCocoa(_GLFWwindow* window, double xpos, double ypos);
|
||||||
|
void _glfwSetCursorModeCocoa(_GLFWwindow* window, int mode);
|
||||||
|
const char* _glfwGetScancodeNameCocoa(int scancode);
|
||||||
|
int _glfwGetKeyScancodeCocoa(int key);
|
||||||
|
GLFWbool _glfwCreateCursorCocoa(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot);
|
||||||
|
GLFWbool _glfwCreateStandardCursorCocoa(_GLFWcursor* cursor, int shape);
|
||||||
|
void _glfwDestroyCursorCocoa(_GLFWcursor* cursor);
|
||||||
|
void _glfwSetCursorCocoa(_GLFWwindow* window, _GLFWcursor* cursor);
|
||||||
|
void _glfwSetClipboardStringCocoa(const char* string);
|
||||||
|
const char* _glfwGetClipboardStringCocoa(void);
|
||||||
|
|
||||||
|
EGLenum _glfwGetEGLPlatformCocoa(EGLint** attribs);
|
||||||
|
EGLNativeDisplayType _glfwGetEGLNativeDisplayCocoa(void);
|
||||||
|
EGLNativeWindowType _glfwGetEGLNativeWindowCocoa(_GLFWwindow* window);
|
||||||
|
|
||||||
|
void _glfwGetRequiredInstanceExtensionsCocoa(char** extensions);
|
||||||
|
GLFWbool _glfwGetPhysicalDevicePresentationSupportCocoa(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
|
||||||
|
VkResult _glfwCreateWindowSurfaceCocoa(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
|
||||||
|
|
||||||
|
void _glfwFreeMonitorCocoa(_GLFWmonitor* monitor);
|
||||||
|
void _glfwGetMonitorPosCocoa(_GLFWmonitor* monitor, int* xpos, int* ypos);
|
||||||
|
void _glfwGetMonitorContentScaleCocoa(_GLFWmonitor* monitor, float* xscale, float* yscale);
|
||||||
|
void _glfwGetMonitorWorkareaCocoa(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
|
||||||
|
GLFWvidmode* _glfwGetVideoModesCocoa(_GLFWmonitor* monitor, int* count);
|
||||||
|
GLFWbool _glfwGetVideoModeCocoa(_GLFWmonitor* monitor, GLFWvidmode* mode);
|
||||||
|
GLFWbool _glfwGetGammaRampCocoa(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
|
||||||
|
void _glfwSetGammaRampCocoa(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
|
||||||
|
|
||||||
|
void _glfwPollMonitorsCocoa(void);
|
||||||
|
void _glfwSetVideoModeCocoa(_GLFWmonitor* monitor, const GLFWvidmode* desired);
|
||||||
|
void _glfwRestoreVideoModeCocoa(_GLFWmonitor* monitor);
|
||||||
|
|
||||||
|
float _glfwTransformYCocoa(float y);
|
||||||
|
|
||||||
|
void* _glfwLoadLocalVulkanLoaderCocoa(void);
|
||||||
|
|
||||||
|
GLFWbool _glfwInitNSGL(void);
|
||||||
|
void _glfwTerminateNSGL(void);
|
||||||
|
GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
||||||
|
const _GLFWctxconfig* ctxconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig);
|
||||||
|
void _glfwDestroyContextNSGL(_GLFWwindow* window);
|
||||||
|
|
||||||
57
libraries/raylib/raylib/src/external/glfw/src/cocoa_time.c
vendored
Normal file
57
libraries/raylib/raylib/src/external/glfw/src/cocoa_time.c
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 macOS - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2009-2016 Camilla Löwy <elmindreda@glfw.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, 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_BUILD_COCOA_TIMER)
|
||||||
|
|
||||||
|
#include <mach/mach_time.h>
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW platform API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void _glfwPlatformInitTimer(void)
|
||||||
|
{
|
||||||
|
mach_timebase_info_data_t info;
|
||||||
|
mach_timebase_info(&info);
|
||||||
|
|
||||||
|
_glfw.timer.ns.frequency = (info.denom * 1e9) / info.numer;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t _glfwPlatformGetTimerValue(void)
|
||||||
|
{
|
||||||
|
return mach_absolute_time();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t _glfwPlatformGetTimerFrequency(void)
|
||||||
|
{
|
||||||
|
return _glfw.timer.ns.frequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // GLFW_BUILD_COCOA_TIMER
|
||||||
|
|
||||||
35
libraries/raylib/raylib/src/external/glfw/src/cocoa_time.h
vendored
Normal file
35
libraries/raylib/raylib/src/external/glfw/src/cocoa_time.h
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 macOS - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2009-2021 Camilla Löwy <elmindreda@glfw.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, 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.
|
||||||
|
//
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
#define GLFW_COCOA_LIBRARY_TIMER_STATE _GLFWtimerNS ns;
|
||||||
|
|
||||||
|
// Cocoa-specific global timer data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWtimerNS
|
||||||
|
{
|
||||||
|
uint64_t frequency;
|
||||||
|
} _GLFWtimerNS;
|
||||||
|
|
||||||
2072
libraries/raylib/raylib/src/external/glfw/src/cocoa_window.m
vendored
Normal file
2072
libraries/raylib/raylib/src/external/glfw/src/cocoa_window.m
vendored
Normal file
File diff suppressed because it is too large
Load diff
764
libraries/raylib/raylib/src/external/glfw/src/context.c
vendored
Normal file
764
libraries/raylib/raylib/src/external/glfw/src/context.c
vendored
Normal file
|
|
@ -0,0 +1,764 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
|
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.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, 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"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW internal API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Checks whether the desired context attributes are valid
|
||||||
|
//
|
||||||
|
// This function checks things like whether the specified client API version
|
||||||
|
// exists and whether all relevant options have supported and non-conflicting
|
||||||
|
// values
|
||||||
|
//
|
||||||
|
GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
|
||||||
|
{
|
||||||
|
if (ctxconfig->source != GLFW_NATIVE_CONTEXT_API &&
|
||||||
|
ctxconfig->source != GLFW_EGL_CONTEXT_API &&
|
||||||
|
ctxconfig->source != GLFW_OSMESA_CONTEXT_API)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
|
"Invalid context creation API 0x%08X",
|
||||||
|
ctxconfig->source);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->client != GLFW_NO_API &&
|
||||||
|
ctxconfig->client != GLFW_OPENGL_API &&
|
||||||
|
ctxconfig->client != GLFW_OPENGL_ES_API)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
|
"Invalid client API 0x%08X",
|
||||||
|
ctxconfig->client);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->share)
|
||||||
|
{
|
||||||
|
if (ctxconfig->client == GLFW_NO_API ||
|
||||||
|
ctxconfig->share->context.client == GLFW_NO_API)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->source != ctxconfig->share->context.source)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
|
"Context creation APIs do not match between contexts");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->client == GLFW_OPENGL_API)
|
||||||
|
{
|
||||||
|
if ((ctxconfig->major < 1 || ctxconfig->minor < 0) ||
|
||||||
|
(ctxconfig->major == 1 && ctxconfig->minor > 5) ||
|
||||||
|
(ctxconfig->major == 2 && ctxconfig->minor > 1) ||
|
||||||
|
(ctxconfig->major == 3 && ctxconfig->minor > 3))
|
||||||
|
{
|
||||||
|
// OpenGL 1.0 is the smallest valid version
|
||||||
|
// OpenGL 1.x series ended with version 1.5
|
||||||
|
// OpenGL 2.x series ended with version 2.1
|
||||||
|
// OpenGL 3.x series ended with version 3.3
|
||||||
|
// For now, let everything else through
|
||||||
|
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
|
"Invalid OpenGL version %i.%i",
|
||||||
|
ctxconfig->major, ctxconfig->minor);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->profile)
|
||||||
|
{
|
||||||
|
if (ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE &&
|
||||||
|
ctxconfig->profile != GLFW_OPENGL_COMPAT_PROFILE)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
|
"Invalid OpenGL profile 0x%08X",
|
||||||
|
ctxconfig->profile);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->major <= 2 ||
|
||||||
|
(ctxconfig->major == 3 && ctxconfig->minor < 2))
|
||||||
|
{
|
||||||
|
// Desktop OpenGL context profiles are only defined for version 3.2
|
||||||
|
// and above
|
||||||
|
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
|
"Context profiles are only defined for OpenGL version 3.2 and above");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->forward && ctxconfig->major <= 2)
|
||||||
|
{
|
||||||
|
// Forward-compatible contexts are only defined for OpenGL version 3.0 and above
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
|
"Forward-compatibility is only defined for OpenGL version 3.0 and above");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ctxconfig->client == GLFW_OPENGL_ES_API)
|
||||||
|
{
|
||||||
|
if (ctxconfig->major < 1 || ctxconfig->minor < 0 ||
|
||||||
|
(ctxconfig->major == 1 && ctxconfig->minor > 1) ||
|
||||||
|
(ctxconfig->major == 2 && ctxconfig->minor > 0))
|
||||||
|
{
|
||||||
|
// OpenGL ES 1.0 is the smallest valid version
|
||||||
|
// OpenGL ES 1.x series ended with version 1.1
|
||||||
|
// OpenGL ES 2.x series ended with version 2.0
|
||||||
|
// For now, let everything else through
|
||||||
|
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
|
"Invalid OpenGL ES version %i.%i",
|
||||||
|
ctxconfig->major, ctxconfig->minor);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->robustness)
|
||||||
|
{
|
||||||
|
if (ctxconfig->robustness != GLFW_NO_RESET_NOTIFICATION &&
|
||||||
|
ctxconfig->robustness != GLFW_LOSE_CONTEXT_ON_RESET)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
|
"Invalid context robustness mode 0x%08X",
|
||||||
|
ctxconfig->robustness);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->release)
|
||||||
|
{
|
||||||
|
if (ctxconfig->release != GLFW_RELEASE_BEHAVIOR_NONE &&
|
||||||
|
ctxconfig->release != GLFW_RELEASE_BEHAVIOR_FLUSH)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
|
"Invalid context release behavior 0x%08X",
|
||||||
|
ctxconfig->release);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Chooses the framebuffer config that best matches the desired one
|
||||||
|
//
|
||||||
|
const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
||||||
|
const _GLFWfbconfig* alternatives,
|
||||||
|
unsigned int count)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
unsigned int missing, leastMissing = UINT_MAX;
|
||||||
|
unsigned int colorDiff, leastColorDiff = UINT_MAX;
|
||||||
|
unsigned int extraDiff, leastExtraDiff = UINT_MAX;
|
||||||
|
const _GLFWfbconfig* current;
|
||||||
|
const _GLFWfbconfig* closest = NULL;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
current = alternatives + i;
|
||||||
|
|
||||||
|
if (desired->stereo > 0 && current->stereo == 0)
|
||||||
|
{
|
||||||
|
// Stereo is a hard constraint
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count number of missing buffers
|
||||||
|
{
|
||||||
|
missing = 0;
|
||||||
|
|
||||||
|
if (desired->alphaBits > 0 && current->alphaBits == 0)
|
||||||
|
missing++;
|
||||||
|
|
||||||
|
if (desired->depthBits > 0 && current->depthBits == 0)
|
||||||
|
missing++;
|
||||||
|
|
||||||
|
if (desired->stencilBits > 0 && current->stencilBits == 0)
|
||||||
|
missing++;
|
||||||
|
|
||||||
|
if (desired->auxBuffers > 0 &&
|
||||||
|
current->auxBuffers < desired->auxBuffers)
|
||||||
|
{
|
||||||
|
missing += desired->auxBuffers - current->auxBuffers;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (desired->samples > 0 && current->samples == 0)
|
||||||
|
{
|
||||||
|
// Technically, several multisampling buffers could be
|
||||||
|
// involved, but that's a lower level implementation detail and
|
||||||
|
// not important to us here, so we count them as one
|
||||||
|
missing++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (desired->transparent != current->transparent)
|
||||||
|
missing++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// These polynomials make many small channel size differences matter
|
||||||
|
// less than one large channel size difference
|
||||||
|
|
||||||
|
// Calculate color channel size difference value
|
||||||
|
{
|
||||||
|
colorDiff = 0;
|
||||||
|
|
||||||
|
if (desired->redBits != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
colorDiff += (desired->redBits - current->redBits) *
|
||||||
|
(desired->redBits - current->redBits);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (desired->greenBits != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
colorDiff += (desired->greenBits - current->greenBits) *
|
||||||
|
(desired->greenBits - current->greenBits);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (desired->blueBits != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
colorDiff += (desired->blueBits - current->blueBits) *
|
||||||
|
(desired->blueBits - current->blueBits);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate non-color channel size difference value
|
||||||
|
{
|
||||||
|
extraDiff = 0;
|
||||||
|
|
||||||
|
if (desired->alphaBits != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
extraDiff += (desired->alphaBits - current->alphaBits) *
|
||||||
|
(desired->alphaBits - current->alphaBits);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (desired->depthBits != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
extraDiff += (desired->depthBits - current->depthBits) *
|
||||||
|
(desired->depthBits - current->depthBits);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (desired->stencilBits != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
extraDiff += (desired->stencilBits - current->stencilBits) *
|
||||||
|
(desired->stencilBits - current->stencilBits);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (desired->accumRedBits != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
extraDiff += (desired->accumRedBits - current->accumRedBits) *
|
||||||
|
(desired->accumRedBits - current->accumRedBits);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (desired->accumGreenBits != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
extraDiff += (desired->accumGreenBits - current->accumGreenBits) *
|
||||||
|
(desired->accumGreenBits - current->accumGreenBits);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (desired->accumBlueBits != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
extraDiff += (desired->accumBlueBits - current->accumBlueBits) *
|
||||||
|
(desired->accumBlueBits - current->accumBlueBits);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (desired->accumAlphaBits != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
extraDiff += (desired->accumAlphaBits - current->accumAlphaBits) *
|
||||||
|
(desired->accumAlphaBits - current->accumAlphaBits);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (desired->samples != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
extraDiff += (desired->samples - current->samples) *
|
||||||
|
(desired->samples - current->samples);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (desired->sRGB && !current->sRGB)
|
||||||
|
extraDiff++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Figure out if the current one is better than the best one found so far
|
||||||
|
// Least number of missing buffers is the most important heuristic,
|
||||||
|
// then color buffer size match and lastly size match for other buffers
|
||||||
|
|
||||||
|
if (missing < leastMissing)
|
||||||
|
closest = current;
|
||||||
|
else if (missing == leastMissing)
|
||||||
|
{
|
||||||
|
if ((colorDiff < leastColorDiff) ||
|
||||||
|
(colorDiff == leastColorDiff && extraDiff < leastExtraDiff))
|
||||||
|
{
|
||||||
|
closest = current;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (current == closest)
|
||||||
|
{
|
||||||
|
leastMissing = missing;
|
||||||
|
leastColorDiff = colorDiff;
|
||||||
|
leastExtraDiff = extraDiff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return closest;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieves the attributes of the current context
|
||||||
|
//
|
||||||
|
GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
|
||||||
|
const _GLFWctxconfig* ctxconfig)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
_GLFWwindow* previous;
|
||||||
|
const char* version;
|
||||||
|
const char* prefixes[] =
|
||||||
|
{
|
||||||
|
"OpenGL ES-CM ",
|
||||||
|
"OpenGL ES-CL ",
|
||||||
|
"OpenGL ES ",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
window->context.source = ctxconfig->source;
|
||||||
|
window->context.client = GLFW_OPENGL_API;
|
||||||
|
|
||||||
|
previous = (_GLFWwindow *)_glfwPlatformGetTls(&_glfw.contextSlot);
|
||||||
|
glfwMakeContextCurrent((GLFWwindow*) window);
|
||||||
|
if (_glfwPlatformGetTls(&_glfw.contextSlot) != window)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
window->context.GetIntegerv = (PFNGLGETINTEGERVPROC)
|
||||||
|
window->context.getProcAddress("glGetIntegerv");
|
||||||
|
window->context.GetString = (PFNGLGETSTRINGPROC)
|
||||||
|
window->context.getProcAddress("glGetString");
|
||||||
|
if (!window->context.GetIntegerv || !window->context.GetString)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Entry point retrieval is broken");
|
||||||
|
glfwMakeContextCurrent((GLFWwindow*) previous);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
version = (const char*) window->context.GetString(GL_VERSION);
|
||||||
|
if (!version)
|
||||||
|
{
|
||||||
|
if (ctxconfig->client == GLFW_OPENGL_API)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"OpenGL version string retrieval is broken");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"OpenGL ES version string retrieval is broken");
|
||||||
|
}
|
||||||
|
|
||||||
|
glfwMakeContextCurrent((GLFWwindow*) previous);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; prefixes[i]; i++)
|
||||||
|
{
|
||||||
|
const size_t length = strlen(prefixes[i]);
|
||||||
|
|
||||||
|
if (strncmp(version, prefixes[i], length) == 0)
|
||||||
|
{
|
||||||
|
version += length;
|
||||||
|
window->context.client = GLFW_OPENGL_ES_API;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sscanf(version, "%d.%d.%d",
|
||||||
|
&window->context.major,
|
||||||
|
&window->context.minor,
|
||||||
|
&window->context.revision))
|
||||||
|
{
|
||||||
|
if (window->context.client == GLFW_OPENGL_API)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"No version found in OpenGL version string");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"No version found in OpenGL ES version string");
|
||||||
|
}
|
||||||
|
|
||||||
|
glfwMakeContextCurrent((GLFWwindow*) previous);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->context.major < ctxconfig->major ||
|
||||||
|
(window->context.major == ctxconfig->major &&
|
||||||
|
window->context.minor < ctxconfig->minor))
|
||||||
|
{
|
||||||
|
// The desired OpenGL version is greater than the actual version
|
||||||
|
// This only happens if the machine lacks {GLX|WGL}_ARB_create_context
|
||||||
|
// /and/ the user has requested an OpenGL version greater than 1.0
|
||||||
|
|
||||||
|
// For API consistency, we emulate the behavior of the
|
||||||
|
// {GLX|WGL}_ARB_create_context extension and fail here
|
||||||
|
|
||||||
|
if (window->context.client == GLFW_OPENGL_API)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
|
"Requested OpenGL version %i.%i, got version %i.%i",
|
||||||
|
ctxconfig->major, ctxconfig->minor,
|
||||||
|
window->context.major, window->context.minor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
|
"Requested OpenGL ES version %i.%i, got version %i.%i",
|
||||||
|
ctxconfig->major, ctxconfig->minor,
|
||||||
|
window->context.major, window->context.minor);
|
||||||
|
}
|
||||||
|
|
||||||
|
glfwMakeContextCurrent((GLFWwindow*) previous);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->context.major >= 3)
|
||||||
|
{
|
||||||
|
// OpenGL 3.0+ uses a different function for extension string retrieval
|
||||||
|
// We cache it here instead of in glfwExtensionSupported mostly to alert
|
||||||
|
// users as early as possible that their build may be broken
|
||||||
|
|
||||||
|
window->context.GetStringi = (PFNGLGETSTRINGIPROC)
|
||||||
|
window->context.getProcAddress("glGetStringi");
|
||||||
|
if (!window->context.GetStringi)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Entry point retrieval is broken");
|
||||||
|
glfwMakeContextCurrent((GLFWwindow*) previous);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->context.client == GLFW_OPENGL_API)
|
||||||
|
{
|
||||||
|
// Read back context flags (OpenGL 3.0 and above)
|
||||||
|
if (window->context.major >= 3)
|
||||||
|
{
|
||||||
|
GLint flags;
|
||||||
|
window->context.GetIntegerv(GL_CONTEXT_FLAGS, &flags);
|
||||||
|
|
||||||
|
if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
|
||||||
|
window->context.forward = GLFW_TRUE;
|
||||||
|
|
||||||
|
if (flags & GL_CONTEXT_FLAG_DEBUG_BIT)
|
||||||
|
window->context.debug = GLFW_TRUE;
|
||||||
|
else if (glfwExtensionSupported("GL_ARB_debug_output") &&
|
||||||
|
ctxconfig->debug)
|
||||||
|
{
|
||||||
|
// HACK: This is a workaround for older drivers (pre KHR_debug)
|
||||||
|
// not setting the debug bit in the context flags for
|
||||||
|
// debug contexts
|
||||||
|
window->context.debug = GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags & GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR)
|
||||||
|
window->context.noerror = GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read back OpenGL context profile (OpenGL 3.2 and above)
|
||||||
|
if (window->context.major >= 4 ||
|
||||||
|
(window->context.major == 3 && window->context.minor >= 2))
|
||||||
|
{
|
||||||
|
GLint mask;
|
||||||
|
window->context.GetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
|
||||||
|
|
||||||
|
if (mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
|
||||||
|
window->context.profile = GLFW_OPENGL_COMPAT_PROFILE;
|
||||||
|
else if (mask & GL_CONTEXT_CORE_PROFILE_BIT)
|
||||||
|
window->context.profile = GLFW_OPENGL_CORE_PROFILE;
|
||||||
|
else if (glfwExtensionSupported("GL_ARB_compatibility"))
|
||||||
|
{
|
||||||
|
// HACK: This is a workaround for the compatibility profile bit
|
||||||
|
// not being set in the context flags if an OpenGL 3.2+
|
||||||
|
// context was created without having requested a specific
|
||||||
|
// version
|
||||||
|
window->context.profile = GLFW_OPENGL_COMPAT_PROFILE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read back robustness strategy
|
||||||
|
if (glfwExtensionSupported("GL_ARB_robustness"))
|
||||||
|
{
|
||||||
|
// NOTE: We avoid using the context flags for detection, as they are
|
||||||
|
// only present from 3.0 while the extension applies from 1.1
|
||||||
|
|
||||||
|
GLint strategy;
|
||||||
|
window->context.GetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB,
|
||||||
|
&strategy);
|
||||||
|
|
||||||
|
if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
|
||||||
|
window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET;
|
||||||
|
else if (strategy == GL_NO_RESET_NOTIFICATION_ARB)
|
||||||
|
window->context.robustness = GLFW_NO_RESET_NOTIFICATION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Read back robustness strategy
|
||||||
|
if (glfwExtensionSupported("GL_EXT_robustness"))
|
||||||
|
{
|
||||||
|
// NOTE: The values of these constants match those of the OpenGL ARB
|
||||||
|
// one, so we can reuse them here
|
||||||
|
|
||||||
|
GLint strategy;
|
||||||
|
window->context.GetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB,
|
||||||
|
&strategy);
|
||||||
|
|
||||||
|
if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
|
||||||
|
window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET;
|
||||||
|
else if (strategy == GL_NO_RESET_NOTIFICATION_ARB)
|
||||||
|
window->context.robustness = GLFW_NO_RESET_NOTIFICATION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (glfwExtensionSupported("GL_KHR_context_flush_control"))
|
||||||
|
{
|
||||||
|
GLint behavior;
|
||||||
|
window->context.GetIntegerv(GL_CONTEXT_RELEASE_BEHAVIOR, &behavior);
|
||||||
|
|
||||||
|
if (behavior == GL_NONE)
|
||||||
|
window->context.release = GLFW_RELEASE_BEHAVIOR_NONE;
|
||||||
|
else if (behavior == GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH)
|
||||||
|
window->context.release = GLFW_RELEASE_BEHAVIOR_FLUSH;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clearing the front buffer to black to avoid garbage pixels left over from
|
||||||
|
// previous uses of our bit of VRAM
|
||||||
|
{
|
||||||
|
PFNGLCLEARPROC glClear = (PFNGLCLEARPROC)
|
||||||
|
window->context.getProcAddress("glClear");
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
if (window->doublebuffer)
|
||||||
|
window->context.swapBuffers(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
glfwMakeContextCurrent((GLFWwindow*) previous);
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Searches an extension string for the specified extension
|
||||||
|
//
|
||||||
|
GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions)
|
||||||
|
{
|
||||||
|
const char* start = extensions;
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
const char* where;
|
||||||
|
const char* terminator;
|
||||||
|
|
||||||
|
where = strstr(start, string);
|
||||||
|
if (!where)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
terminator = where + strlen(string);
|
||||||
|
if (where == start || *(where - 1) == ' ')
|
||||||
|
{
|
||||||
|
if (*terminator == ' ' || *terminator == '\0')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
start = terminator;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW public API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow *) handle;
|
||||||
|
_GLFWwindow* previous;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
previous = (_GLFWwindow *)_glfwPlatformGetTls(&_glfw.contextSlot);
|
||||||
|
|
||||||
|
if (window && window->context.client == GLFW_NO_API)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT,
|
||||||
|
"Cannot make current with a window that has no OpenGL or OpenGL ES context");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (previous)
|
||||||
|
{
|
||||||
|
if (!window || window->context.source != previous->context.source)
|
||||||
|
previous->context.makeCurrent(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window)
|
||||||
|
window->context.makeCurrent(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI GLFWwindow* glfwGetCurrentContext(void)
|
||||||
|
{
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
return (GLFWwindow *)_glfwPlatformGetTls(&_glfw.contextSlot);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwSwapBuffers(GLFWwindow* handle)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow *) handle;
|
||||||
|
assert(window != NULL);
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
if (window->context.client == GLFW_NO_API)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT,
|
||||||
|
"Cannot swap buffers of a window that has no OpenGL or OpenGL ES context");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window->context.swapBuffers(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwSwapInterval(int interval)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
window = (_GLFWwindow *)_glfwPlatformGetTls(&_glfw.contextSlot);
|
||||||
|
if (!window)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_NO_CURRENT_CONTEXT,
|
||||||
|
"Cannot set swap interval without a current OpenGL or OpenGL ES context");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window->context.swapInterval(interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI int glfwExtensionSupported(const char* extension)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window;
|
||||||
|
assert(extension != NULL);
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
||||||
|
|
||||||
|
window = (_GLFWwindow *)_glfwPlatformGetTls(&_glfw.contextSlot);
|
||||||
|
if (!window)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_NO_CURRENT_CONTEXT,
|
||||||
|
"Cannot query extension without a current OpenGL or OpenGL ES context");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*extension == '\0')
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE, "Extension name cannot be an empty string");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->context.major >= 3)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
GLint count;
|
||||||
|
|
||||||
|
// Check if extension is in the modern OpenGL extensions string list
|
||||||
|
|
||||||
|
window->context.GetIntegerv(GL_NUM_EXTENSIONS, &count);
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
const char* en = (const char*)
|
||||||
|
window->context.GetStringi(GL_EXTENSIONS, i);
|
||||||
|
if (!en)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Extension string retrieval is broken");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(en, extension) == 0)
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Check if extension is in the old style OpenGL extensions string
|
||||||
|
|
||||||
|
const char* extensions = (const char*)
|
||||||
|
window->context.GetString(GL_EXTENSIONS);
|
||||||
|
if (!extensions)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Extension string retrieval is broken");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfwStringInExtensionString(extension, extensions))
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if extension is in the platform-specific string
|
||||||
|
return window->context.extensionSupported(extension);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window;
|
||||||
|
assert(procname != NULL);
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
|
window = (_GLFWwindow *)_glfwPlatformGetTls(&_glfw.contextSlot);
|
||||||
|
if (!window)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_NO_CURRENT_CONTEXT,
|
||||||
|
"Cannot query entry point without a current OpenGL or OpenGL ES context");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return window->context.getProcAddress(procname);
|
||||||
|
}
|
||||||
910
libraries/raylib/raylib/src/external/glfw/src/egl_context.c
vendored
Normal file
910
libraries/raylib/raylib/src/external/glfw/src/egl_context.c
vendored
Normal file
|
|
@ -0,0 +1,910 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 EGL - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.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, 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"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
|
// Return a description of the specified EGL error
|
||||||
|
//
|
||||||
|
static const char* getEGLErrorString(EGLint error)
|
||||||
|
{
|
||||||
|
switch (error)
|
||||||
|
{
|
||||||
|
case EGL_SUCCESS:
|
||||||
|
return "Success";
|
||||||
|
case EGL_NOT_INITIALIZED:
|
||||||
|
return "EGL is not or could not be initialized";
|
||||||
|
case EGL_BAD_ACCESS:
|
||||||
|
return "EGL cannot access a requested resource";
|
||||||
|
case EGL_BAD_ALLOC:
|
||||||
|
return "EGL failed to allocate resources for the requested operation";
|
||||||
|
case EGL_BAD_ATTRIBUTE:
|
||||||
|
return "An unrecognized attribute or attribute value was passed in the attribute list";
|
||||||
|
case EGL_BAD_CONTEXT:
|
||||||
|
return "An EGLContext argument does not name a valid EGL rendering context";
|
||||||
|
case EGL_BAD_CONFIG:
|
||||||
|
return "An EGLConfig argument does not name a valid EGL frame buffer configuration";
|
||||||
|
case EGL_BAD_CURRENT_SURFACE:
|
||||||
|
return "The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid";
|
||||||
|
case EGL_BAD_DISPLAY:
|
||||||
|
return "An EGLDisplay argument does not name a valid EGL display connection";
|
||||||
|
case EGL_BAD_SURFACE:
|
||||||
|
return "An EGLSurface argument does not name a valid surface configured for GL rendering";
|
||||||
|
case EGL_BAD_MATCH:
|
||||||
|
return "Arguments are inconsistent";
|
||||||
|
case EGL_BAD_PARAMETER:
|
||||||
|
return "One or more argument values are invalid";
|
||||||
|
case EGL_BAD_NATIVE_PIXMAP:
|
||||||
|
return "A NativePixmapType argument does not refer to a valid native pixmap";
|
||||||
|
case EGL_BAD_NATIVE_WINDOW:
|
||||||
|
return "A NativeWindowType argument does not refer to a valid native window";
|
||||||
|
case EGL_CONTEXT_LOST:
|
||||||
|
return "The application must destroy all contexts and reinitialise";
|
||||||
|
default:
|
||||||
|
return "ERROR: UNKNOWN EGL ERROR";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the specified attribute of the specified EGLConfig
|
||||||
|
//
|
||||||
|
static int getEGLConfigAttrib(EGLConfig config, int attrib)
|
||||||
|
{
|
||||||
|
int value;
|
||||||
|
eglGetConfigAttrib(_glfw.egl.display, config, attrib, &value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the EGLConfig most closely matching the specified hints
|
||||||
|
//
|
||||||
|
static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig,
|
||||||
|
EGLConfig* result)
|
||||||
|
{
|
||||||
|
EGLConfig* nativeConfigs;
|
||||||
|
_GLFWfbconfig* usableConfigs;
|
||||||
|
const _GLFWfbconfig* closest;
|
||||||
|
int i, nativeCount, usableCount, apiBit;
|
||||||
|
GLFWbool wrongApiAvailable = GLFW_FALSE;
|
||||||
|
|
||||||
|
if (ctxconfig->client == GLFW_OPENGL_ES_API)
|
||||||
|
{
|
||||||
|
if (ctxconfig->major == 1)
|
||||||
|
apiBit = EGL_OPENGL_ES_BIT;
|
||||||
|
else
|
||||||
|
apiBit = EGL_OPENGL_ES2_BIT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
apiBit = EGL_OPENGL_BIT;
|
||||||
|
|
||||||
|
if (fbconfig->stereo)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE, "EGL: Stereo rendering not supported");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
eglGetConfigs(_glfw.egl.display, NULL, 0, &nativeCount);
|
||||||
|
if (!nativeCount)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE, "EGL: No EGLConfigs returned");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
nativeConfigs = (EGLConfig *)_glfw_calloc(nativeCount, sizeof(EGLConfig));
|
||||||
|
eglGetConfigs(_glfw.egl.display, nativeConfigs, nativeCount, &nativeCount);
|
||||||
|
|
||||||
|
usableConfigs = (_GLFWfbconfig *)_glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||||
|
usableCount = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < nativeCount; i++)
|
||||||
|
{
|
||||||
|
const EGLConfig n = nativeConfigs[i];
|
||||||
|
_GLFWfbconfig* u = usableConfigs + usableCount;
|
||||||
|
|
||||||
|
// Only consider RGB(A) EGLConfigs
|
||||||
|
if (getEGLConfigAttrib(n, EGL_COLOR_BUFFER_TYPE) != EGL_RGB_BUFFER)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Only consider window EGLConfigs
|
||||||
|
if (!(getEGLConfigAttrib(n, EGL_SURFACE_TYPE) & EGL_WINDOW_BIT))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
#if defined(_GLFW_X11)
|
||||||
|
if (_glfw.platform.platformID == GLFW_PLATFORM_X11)
|
||||||
|
{
|
||||||
|
XVisualInfo vi = {0};
|
||||||
|
|
||||||
|
// Only consider EGLConfigs with associated Visuals
|
||||||
|
vi.visualid = getEGLConfigAttrib(n, EGL_NATIVE_VISUAL_ID);
|
||||||
|
if (!vi.visualid)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (fbconfig->transparent)
|
||||||
|
{
|
||||||
|
int count;
|
||||||
|
XVisualInfo* vis =
|
||||||
|
XGetVisualInfo(_glfw.x11.display, VisualIDMask, &vi, &count);
|
||||||
|
if (vis)
|
||||||
|
{
|
||||||
|
u->transparent = _glfwIsVisualTransparentX11(vis[0].visual);
|
||||||
|
XFree(vis);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // _GLFW_X11
|
||||||
|
|
||||||
|
if (!(getEGLConfigAttrib(n, EGL_RENDERABLE_TYPE) & apiBit))
|
||||||
|
{
|
||||||
|
wrongApiAvailable = GLFW_TRUE;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
u->redBits = getEGLConfigAttrib(n, EGL_RED_SIZE);
|
||||||
|
u->greenBits = getEGLConfigAttrib(n, EGL_GREEN_SIZE);
|
||||||
|
u->blueBits = getEGLConfigAttrib(n, EGL_BLUE_SIZE);
|
||||||
|
|
||||||
|
u->alphaBits = getEGLConfigAttrib(n, EGL_ALPHA_SIZE);
|
||||||
|
u->depthBits = getEGLConfigAttrib(n, EGL_DEPTH_SIZE);
|
||||||
|
u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE);
|
||||||
|
|
||||||
|
#if defined(_GLFW_WAYLAND)
|
||||||
|
if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND)
|
||||||
|
{
|
||||||
|
// NOTE: The wl_surface opaque region is no guarantee that its buffer
|
||||||
|
// is presented as opaque, if it also has an alpha channel
|
||||||
|
// HACK: If EGL_EXT_present_opaque is unavailable, ignore any config
|
||||||
|
// with an alpha channel to ensure the buffer is opaque
|
||||||
|
if (!_glfw.egl.EXT_present_opaque)
|
||||||
|
{
|
||||||
|
if (!fbconfig->transparent && u->alphaBits > 0)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // _GLFW_WAYLAND
|
||||||
|
|
||||||
|
u->samples = getEGLConfigAttrib(n, EGL_SAMPLES);
|
||||||
|
u->doublebuffer = fbconfig->doublebuffer;
|
||||||
|
|
||||||
|
u->handle = (uintptr_t) n;
|
||||||
|
usableCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
closest = _glfwChooseFBConfig(fbconfig, usableConfigs, usableCount);
|
||||||
|
if (closest)
|
||||||
|
*result = (EGLConfig) closest->handle;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (wrongApiAvailable)
|
||||||
|
{
|
||||||
|
if (ctxconfig->client == GLFW_OPENGL_ES_API)
|
||||||
|
{
|
||||||
|
if (ctxconfig->major == 1)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"EGL: Failed to find support for OpenGL ES 1.x");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"EGL: Failed to find support for OpenGL ES 2 or later");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"EGL: Failed to find support for OpenGL");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
||||||
|
"EGL: Failed to find a suitable EGLConfig");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfw_free(nativeConfigs);
|
||||||
|
_glfw_free(usableConfigs);
|
||||||
|
|
||||||
|
return closest != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void makeContextCurrentEGL(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
if (window)
|
||||||
|
{
|
||||||
|
if (!eglMakeCurrent(_glfw.egl.display,
|
||||||
|
window->context.egl.surface,
|
||||||
|
window->context.egl.surface,
|
||||||
|
window->context.egl.handle))
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"EGL: Failed to make context current: %s",
|
||||||
|
getEGLErrorString(eglGetError()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!eglMakeCurrent(_glfw.egl.display,
|
||||||
|
EGL_NO_SURFACE,
|
||||||
|
EGL_NO_SURFACE,
|
||||||
|
EGL_NO_CONTEXT))
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"EGL: Failed to clear current context: %s",
|
||||||
|
getEGLErrorString(eglGetError()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwPlatformSetTls(&_glfw.contextSlot, window);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void swapBuffersEGL(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
if (window != _glfwPlatformGetTls(&_glfw.contextSlot))
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"EGL: The context must be current on the calling thread when swapping buffers");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(_GLFW_WAYLAND)
|
||||||
|
if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND)
|
||||||
|
{
|
||||||
|
// NOTE: Swapping buffers on a hidden window on Wayland makes it visible
|
||||||
|
if (!window->wl.visible)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
eglSwapBuffers(_glfw.egl.display, window->context.egl.surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void swapIntervalEGL(int interval)
|
||||||
|
{
|
||||||
|
eglSwapInterval(_glfw.egl.display, interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int extensionSupportedEGL(const char* extension)
|
||||||
|
{
|
||||||
|
const char* extensions = eglQueryString(_glfw.egl.display, EGL_EXTENSIONS);
|
||||||
|
if (extensions)
|
||||||
|
{
|
||||||
|
if (_glfwStringInExtensionString(extension, extensions))
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GLFWglproc getProcAddressEGL(const char* procname)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow *)_glfwPlatformGetTls(&_glfw.contextSlot);
|
||||||
|
assert(window != NULL);
|
||||||
|
|
||||||
|
if (window->context.egl.client)
|
||||||
|
{
|
||||||
|
GLFWglproc proc = (GLFWglproc)
|
||||||
|
_glfwPlatformGetModuleSymbol(window->context.egl.client, procname);
|
||||||
|
if (proc)
|
||||||
|
return proc;
|
||||||
|
}
|
||||||
|
|
||||||
|
return eglGetProcAddress(procname);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void destroyContextEGL(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
// NOTE: Do not unload libGL.so.1 while the X11 display is still open,
|
||||||
|
// as it will make XCloseDisplay segfault
|
||||||
|
if (_glfw.platform.platformID != GLFW_PLATFORM_X11 ||
|
||||||
|
window->context.client != GLFW_OPENGL_API)
|
||||||
|
{
|
||||||
|
if (window->context.egl.client)
|
||||||
|
{
|
||||||
|
_glfwPlatformFreeModule(window->context.egl.client);
|
||||||
|
window->context.egl.client = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->context.egl.surface)
|
||||||
|
{
|
||||||
|
eglDestroySurface(_glfw.egl.display, window->context.egl.surface);
|
||||||
|
window->context.egl.surface = EGL_NO_SURFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->context.egl.handle)
|
||||||
|
{
|
||||||
|
eglDestroyContext(_glfw.egl.display, window->context.egl.handle);
|
||||||
|
window->context.egl.handle = EGL_NO_CONTEXT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW internal API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Initialize EGL
|
||||||
|
//
|
||||||
|
GLFWbool _glfwInitEGL(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
EGLint* attribs = NULL;
|
||||||
|
const char* extensions;
|
||||||
|
const char* sonames[] =
|
||||||
|
{
|
||||||
|
#if defined(_GLFW_EGL_LIBRARY)
|
||||||
|
_GLFW_EGL_LIBRARY,
|
||||||
|
#elif defined(_GLFW_WIN32)
|
||||||
|
"libEGL.dll",
|
||||||
|
"EGL.dll",
|
||||||
|
#elif defined(_GLFW_COCOA)
|
||||||
|
"libEGL.dylib",
|
||||||
|
#elif defined(__CYGWIN__)
|
||||||
|
"libEGL-1.so",
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
"libEGL.so",
|
||||||
|
#else
|
||||||
|
"libEGL.so.1",
|
||||||
|
#endif
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_glfw.egl.handle)
|
||||||
|
return GLFW_TRUE;
|
||||||
|
|
||||||
|
for (i = 0; sonames[i]; i++)
|
||||||
|
{
|
||||||
|
_glfw.egl.handle = _glfwPlatformLoadModule(sonames[i]);
|
||||||
|
if (_glfw.egl.handle)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_glfw.egl.handle)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Library not found");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfw.egl.prefix = (strncmp(sonames[i], "lib", 3) == 0);
|
||||||
|
|
||||||
|
_glfw.egl.GetConfigAttrib = (PFN_eglGetConfigAttrib)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglGetConfigAttrib");
|
||||||
|
_glfw.egl.GetConfigs = (PFN_eglGetConfigs)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglGetConfigs");
|
||||||
|
_glfw.egl.GetDisplay = (PFN_eglGetDisplay)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglGetDisplay");
|
||||||
|
_glfw.egl.GetError = (PFN_eglGetError)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglGetError");
|
||||||
|
_glfw.egl.Initialize = (PFN_eglInitialize)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglInitialize");
|
||||||
|
_glfw.egl.Terminate = (PFN_eglTerminate)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglTerminate");
|
||||||
|
_glfw.egl.BindAPI = (PFN_eglBindAPI)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglBindAPI");
|
||||||
|
_glfw.egl.CreateContext = (PFN_eglCreateContext)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglCreateContext");
|
||||||
|
_glfw.egl.DestroySurface = (PFN_eglDestroySurface)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglDestroySurface");
|
||||||
|
_glfw.egl.DestroyContext = (PFN_eglDestroyContext)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglDestroyContext");
|
||||||
|
_glfw.egl.CreateWindowSurface = (PFN_eglCreateWindowSurface)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglCreateWindowSurface");
|
||||||
|
_glfw.egl.MakeCurrent = (PFN_eglMakeCurrent)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglMakeCurrent");
|
||||||
|
_glfw.egl.SwapBuffers = (PFN_eglSwapBuffers)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglSwapBuffers");
|
||||||
|
_glfw.egl.SwapInterval = (PFN_eglSwapInterval)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglSwapInterval");
|
||||||
|
_glfw.egl.QueryString = (PFN_eglQueryString)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglQueryString");
|
||||||
|
_glfw.egl.GetProcAddress = (PFN_eglGetProcAddress)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglGetProcAddress");
|
||||||
|
|
||||||
|
if (!_glfw.egl.GetConfigAttrib ||
|
||||||
|
!_glfw.egl.GetConfigs ||
|
||||||
|
!_glfw.egl.GetDisplay ||
|
||||||
|
!_glfw.egl.GetError ||
|
||||||
|
!_glfw.egl.Initialize ||
|
||||||
|
!_glfw.egl.Terminate ||
|
||||||
|
!_glfw.egl.BindAPI ||
|
||||||
|
!_glfw.egl.CreateContext ||
|
||||||
|
!_glfw.egl.DestroySurface ||
|
||||||
|
!_glfw.egl.DestroyContext ||
|
||||||
|
!_glfw.egl.CreateWindowSurface ||
|
||||||
|
!_glfw.egl.MakeCurrent ||
|
||||||
|
!_glfw.egl.SwapBuffers ||
|
||||||
|
!_glfw.egl.SwapInterval ||
|
||||||
|
!_glfw.egl.QueryString ||
|
||||||
|
!_glfw.egl.GetProcAddress)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"EGL: Failed to load required entry points");
|
||||||
|
|
||||||
|
_glfwTerminateEGL();
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
|
||||||
|
if (extensions && eglGetError() == EGL_SUCCESS)
|
||||||
|
_glfw.egl.EXT_client_extensions = GLFW_TRUE;
|
||||||
|
|
||||||
|
if (_glfw.egl.EXT_client_extensions)
|
||||||
|
{
|
||||||
|
_glfw.egl.EXT_platform_base =
|
||||||
|
_glfwStringInExtensionString("EGL_EXT_platform_base", extensions);
|
||||||
|
_glfw.egl.EXT_platform_x11 =
|
||||||
|
_glfwStringInExtensionString("EGL_EXT_platform_x11", extensions);
|
||||||
|
_glfw.egl.EXT_platform_wayland =
|
||||||
|
_glfwStringInExtensionString("EGL_EXT_platform_wayland", extensions);
|
||||||
|
_glfw.egl.ANGLE_platform_angle =
|
||||||
|
_glfwStringInExtensionString("EGL_ANGLE_platform_angle", extensions);
|
||||||
|
_glfw.egl.ANGLE_platform_angle_opengl =
|
||||||
|
_glfwStringInExtensionString("EGL_ANGLE_platform_angle_opengl", extensions);
|
||||||
|
_glfw.egl.ANGLE_platform_angle_d3d =
|
||||||
|
_glfwStringInExtensionString("EGL_ANGLE_platform_angle_d3d", extensions);
|
||||||
|
_glfw.egl.ANGLE_platform_angle_vulkan =
|
||||||
|
_glfwStringInExtensionString("EGL_ANGLE_platform_angle_vulkan", extensions);
|
||||||
|
_glfw.egl.ANGLE_platform_angle_metal =
|
||||||
|
_glfwStringInExtensionString("EGL_ANGLE_platform_angle_metal", extensions);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.egl.EXT_platform_base)
|
||||||
|
{
|
||||||
|
_glfw.egl.GetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)
|
||||||
|
eglGetProcAddress("eglGetPlatformDisplayEXT");
|
||||||
|
_glfw.egl.CreatePlatformWindowSurfaceEXT = (PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)
|
||||||
|
eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfw.egl.platform = _glfw.platform.getEGLPlatform(&attribs);
|
||||||
|
if (_glfw.egl.platform)
|
||||||
|
{
|
||||||
|
_glfw.egl.display =
|
||||||
|
eglGetPlatformDisplayEXT(_glfw.egl.platform,
|
||||||
|
_glfw.platform.getEGLNativeDisplay(),
|
||||||
|
attribs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_glfw.egl.display = eglGetDisplay(_glfw.platform.getEGLNativeDisplay());
|
||||||
|
|
||||||
|
_glfw_free(attribs);
|
||||||
|
|
||||||
|
if (_glfw.egl.display == EGL_NO_DISPLAY)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"EGL: Failed to get EGL display: %s",
|
||||||
|
getEGLErrorString(eglGetError()));
|
||||||
|
|
||||||
|
_glfwTerminateEGL();
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!eglInitialize(_glfw.egl.display, &_glfw.egl.major, &_glfw.egl.minor))
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"EGL: Failed to initialize EGL: %s",
|
||||||
|
getEGLErrorString(eglGetError()));
|
||||||
|
|
||||||
|
_glfwTerminateEGL();
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfw.egl.KHR_create_context =
|
||||||
|
extensionSupportedEGL("EGL_KHR_create_context");
|
||||||
|
_glfw.egl.KHR_create_context_no_error =
|
||||||
|
extensionSupportedEGL("EGL_KHR_create_context_no_error");
|
||||||
|
_glfw.egl.KHR_gl_colorspace =
|
||||||
|
extensionSupportedEGL("EGL_KHR_gl_colorspace");
|
||||||
|
_glfw.egl.KHR_get_all_proc_addresses =
|
||||||
|
extensionSupportedEGL("EGL_KHR_get_all_proc_addresses");
|
||||||
|
_glfw.egl.KHR_context_flush_control =
|
||||||
|
extensionSupportedEGL("EGL_KHR_context_flush_control");
|
||||||
|
_glfw.egl.EXT_present_opaque =
|
||||||
|
extensionSupportedEGL("EGL_EXT_present_opaque");
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Terminate EGL
|
||||||
|
//
|
||||||
|
void _glfwTerminateEGL(void)
|
||||||
|
{
|
||||||
|
if (_glfw.egl.display)
|
||||||
|
{
|
||||||
|
eglTerminate(_glfw.egl.display);
|
||||||
|
_glfw.egl.display = EGL_NO_DISPLAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.egl.handle)
|
||||||
|
{
|
||||||
|
_glfwPlatformFreeModule(_glfw.egl.handle);
|
||||||
|
_glfw.egl.handle = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SET_ATTRIB(a, v) \
|
||||||
|
{ \
|
||||||
|
assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \
|
||||||
|
attribs[index++] = a; \
|
||||||
|
attribs[index++] = v; \
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the OpenGL or OpenGL ES context
|
||||||
|
//
|
||||||
|
GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
||||||
|
const _GLFWctxconfig* ctxconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig)
|
||||||
|
{
|
||||||
|
EGLint attribs[40];
|
||||||
|
EGLConfig config;
|
||||||
|
EGLContext share = NULL;
|
||||||
|
EGLNativeWindowType native;
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
if (!_glfw.egl.display)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE, "EGL: API not available");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->share)
|
||||||
|
share = ctxconfig->share->context.egl.handle;
|
||||||
|
|
||||||
|
if (!chooseEGLConfig(ctxconfig, fbconfig, &config))
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
if (ctxconfig->client == GLFW_OPENGL_ES_API)
|
||||||
|
{
|
||||||
|
if (!eglBindAPI(EGL_OPENGL_ES_API))
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"EGL: Failed to bind OpenGL ES: %s",
|
||||||
|
getEGLErrorString(eglGetError()));
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!eglBindAPI(EGL_OPENGL_API))
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"EGL: Failed to bind OpenGL: %s",
|
||||||
|
getEGLErrorString(eglGetError()));
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.egl.KHR_create_context)
|
||||||
|
{
|
||||||
|
int mask = 0, flags = 0;
|
||||||
|
|
||||||
|
if (ctxconfig->client == GLFW_OPENGL_API)
|
||||||
|
{
|
||||||
|
if (ctxconfig->forward)
|
||||||
|
flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
|
||||||
|
|
||||||
|
if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE)
|
||||||
|
mask |= EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
|
||||||
|
else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
|
||||||
|
mask |= EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->debug)
|
||||||
|
flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
|
||||||
|
|
||||||
|
if (ctxconfig->robustness)
|
||||||
|
{
|
||||||
|
if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION)
|
||||||
|
{
|
||||||
|
SET_ATTRIB(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR,
|
||||||
|
EGL_NO_RESET_NOTIFICATION_KHR);
|
||||||
|
}
|
||||||
|
else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET)
|
||||||
|
{
|
||||||
|
SET_ATTRIB(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR,
|
||||||
|
EGL_LOSE_CONTEXT_ON_RESET_KHR);
|
||||||
|
}
|
||||||
|
|
||||||
|
flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->major != 1 || ctxconfig->minor != 0)
|
||||||
|
{
|
||||||
|
SET_ATTRIB(EGL_CONTEXT_MAJOR_VERSION_KHR, ctxconfig->major);
|
||||||
|
SET_ATTRIB(EGL_CONTEXT_MINOR_VERSION_KHR, ctxconfig->minor);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->noerror)
|
||||||
|
{
|
||||||
|
if (_glfw.egl.KHR_create_context_no_error)
|
||||||
|
SET_ATTRIB(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, GLFW_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask)
|
||||||
|
SET_ATTRIB(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, mask);
|
||||||
|
|
||||||
|
if (flags)
|
||||||
|
SET_ATTRIB(EGL_CONTEXT_FLAGS_KHR, flags);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ctxconfig->client == GLFW_OPENGL_ES_API)
|
||||||
|
SET_ATTRIB(EGL_CONTEXT_CLIENT_VERSION, ctxconfig->major);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.egl.KHR_context_flush_control)
|
||||||
|
{
|
||||||
|
if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_NONE)
|
||||||
|
{
|
||||||
|
SET_ATTRIB(EGL_CONTEXT_RELEASE_BEHAVIOR_KHR,
|
||||||
|
EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR);
|
||||||
|
}
|
||||||
|
else if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_FLUSH)
|
||||||
|
{
|
||||||
|
SET_ATTRIB(EGL_CONTEXT_RELEASE_BEHAVIOR_KHR,
|
||||||
|
EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_ATTRIB(EGL_NONE, EGL_NONE);
|
||||||
|
|
||||||
|
window->context.egl.handle = eglCreateContext(_glfw.egl.display,
|
||||||
|
config, share, attribs);
|
||||||
|
|
||||||
|
if (window->context.egl.handle == EGL_NO_CONTEXT)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
|
"EGL: Failed to create context: %s",
|
||||||
|
getEGLErrorString(eglGetError()));
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up attributes for surface creation
|
||||||
|
index = 0;
|
||||||
|
|
||||||
|
if (fbconfig->sRGB)
|
||||||
|
{
|
||||||
|
if (_glfw.egl.KHR_gl_colorspace)
|
||||||
|
SET_ATTRIB(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fbconfig->doublebuffer)
|
||||||
|
SET_ATTRIB(EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER);
|
||||||
|
|
||||||
|
if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND)
|
||||||
|
{
|
||||||
|
if (_glfw.egl.EXT_present_opaque)
|
||||||
|
SET_ATTRIB(EGL_PRESENT_OPAQUE_EXT, !fbconfig->transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_ATTRIB(EGL_NONE, EGL_NONE);
|
||||||
|
|
||||||
|
native = _glfw.platform.getEGLNativeWindow(window);
|
||||||
|
// HACK: ANGLE does not implement eglCreatePlatformWindowSurfaceEXT
|
||||||
|
// despite reporting EGL_EXT_platform_base
|
||||||
|
if (_glfw.egl.platform && _glfw.egl.platform != EGL_PLATFORM_ANGLE_ANGLE)
|
||||||
|
{
|
||||||
|
window->context.egl.surface =
|
||||||
|
eglCreatePlatformWindowSurfaceEXT(_glfw.egl.display, config, native, attribs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window->context.egl.surface =
|
||||||
|
eglCreateWindowSurface(_glfw.egl.display, config, native, attribs);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->context.egl.surface == EGL_NO_SURFACE)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"EGL: Failed to create window surface: %s",
|
||||||
|
getEGLErrorString(eglGetError()));
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
window->context.egl.config = config;
|
||||||
|
|
||||||
|
// Load the appropriate client library
|
||||||
|
if (!_glfw.egl.KHR_get_all_proc_addresses)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
const char** sonames;
|
||||||
|
const char* es1sonames[] =
|
||||||
|
{
|
||||||
|
#if defined(_GLFW_GLESV1_LIBRARY)
|
||||||
|
_GLFW_GLESV1_LIBRARY,
|
||||||
|
#elif defined(_GLFW_WIN32)
|
||||||
|
"GLESv1_CM.dll",
|
||||||
|
"libGLES_CM.dll",
|
||||||
|
#elif defined(_GLFW_COCOA)
|
||||||
|
"libGLESv1_CM.dylib",
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
"libGLESv1_CM.so",
|
||||||
|
#else
|
||||||
|
"libGLESv1_CM.so.1",
|
||||||
|
"libGLES_CM.so.1",
|
||||||
|
#endif
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
const char* es2sonames[] =
|
||||||
|
{
|
||||||
|
#if defined(_GLFW_GLESV2_LIBRARY)
|
||||||
|
_GLFW_GLESV2_LIBRARY,
|
||||||
|
#elif defined(_GLFW_WIN32)
|
||||||
|
"GLESv2.dll",
|
||||||
|
"libGLESv2.dll",
|
||||||
|
#elif defined(_GLFW_COCOA)
|
||||||
|
"libGLESv2.dylib",
|
||||||
|
#elif defined(__CYGWIN__)
|
||||||
|
"libGLESv2-2.so",
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
"libGLESv2.so",
|
||||||
|
#else
|
||||||
|
"libGLESv2.so.2",
|
||||||
|
#endif
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
const char* glsonames[] =
|
||||||
|
{
|
||||||
|
#if defined(_GLFW_OPENGL_LIBRARY)
|
||||||
|
_GLFW_OPENGL_LIBRARY,
|
||||||
|
#elif defined(_GLFW_WIN32)
|
||||||
|
#elif defined(_GLFW_COCOA)
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
"libGL.so",
|
||||||
|
#else
|
||||||
|
"libOpenGL.so.0",
|
||||||
|
"libGL.so.1",
|
||||||
|
#endif
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
if (ctxconfig->client == GLFW_OPENGL_ES_API)
|
||||||
|
{
|
||||||
|
if (ctxconfig->major == 1)
|
||||||
|
sonames = es1sonames;
|
||||||
|
else
|
||||||
|
sonames = es2sonames;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sonames = glsonames;
|
||||||
|
|
||||||
|
for (i = 0; sonames[i]; i++)
|
||||||
|
{
|
||||||
|
// HACK: Match presence of lib prefix to increase chance of finding
|
||||||
|
// a matching pair in the jungle that is Win32 EGL/GLES
|
||||||
|
if (_glfw.egl.prefix != (strncmp(sonames[i], "lib", 3) == 0))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
window->context.egl.client = _glfwPlatformLoadModule(sonames[i]);
|
||||||
|
if (window->context.egl.client)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!window->context.egl.client)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"EGL: Failed to load client library");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window->context.makeCurrent = makeContextCurrentEGL;
|
||||||
|
window->context.swapBuffers = swapBuffersEGL;
|
||||||
|
window->context.swapInterval = swapIntervalEGL;
|
||||||
|
window->context.extensionSupported = extensionSupportedEGL;
|
||||||
|
window->context.getProcAddress = getProcAddressEGL;
|
||||||
|
window->context.destroy = destroyContextEGL;
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef SET_ATTRIB
|
||||||
|
|
||||||
|
// Returns the Visual and depth of the chosen EGLConfig
|
||||||
|
//
|
||||||
|
#if defined(_GLFW_X11)
|
||||||
|
GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig,
|
||||||
|
const _GLFWctxconfig* ctxconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig,
|
||||||
|
Visual** visual, int* depth)
|
||||||
|
{
|
||||||
|
XVisualInfo* result;
|
||||||
|
XVisualInfo desired;
|
||||||
|
EGLConfig native;
|
||||||
|
EGLint visualID = 0, count = 0;
|
||||||
|
const long vimask = VisualScreenMask | VisualIDMask;
|
||||||
|
|
||||||
|
if (!chooseEGLConfig(ctxconfig, fbconfig, &native))
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
eglGetConfigAttrib(_glfw.egl.display, native,
|
||||||
|
EGL_NATIVE_VISUAL_ID, &visualID);
|
||||||
|
|
||||||
|
desired.screen = _glfw.x11.screen;
|
||||||
|
desired.visualid = visualID;
|
||||||
|
|
||||||
|
result = XGetVisualInfo(_glfw.x11.display, vimask, &desired, &count);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"EGL: Failed to retrieve Visual for EGLConfig");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*visual = result->visual;
|
||||||
|
*depth = result->depth;
|
||||||
|
|
||||||
|
XFree(result);
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
#endif // _GLFW_X11
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW native API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GLFWAPI EGLDisplay glfwGetEGLDisplay(void)
|
||||||
|
{
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_DISPLAY);
|
||||||
|
return _glfw.egl.display;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* handle)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow *) handle;
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_CONTEXT);
|
||||||
|
|
||||||
|
if (window->context.source != GLFW_EGL_CONTEXT_API)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
|
return EGL_NO_CONTEXT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return window->context.egl.handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow *) handle;
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_SURFACE);
|
||||||
|
|
||||||
|
if (window->context.source != GLFW_EGL_CONTEXT_API)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
|
return EGL_NO_SURFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return window->context.egl.surface;
|
||||||
|
}
|
||||||
30
libraries/raylib/raylib/src/external/glfw/src/glfw.rc.in
vendored
Normal file
30
libraries/raylib/raylib/src/external/glfw/src/glfw.rc.in
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
#include <winver.h>
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION @GLFW_VERSION_MAJOR@,@GLFW_VERSION_MINOR@,@GLFW_VERSION_PATCH@,0
|
||||||
|
PRODUCTVERSION @GLFW_VERSION_MAJOR@,@GLFW_VERSION_MINOR@,@GLFW_VERSION_PATCH@,0
|
||||||
|
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||||
|
FILEFLAGS 0
|
||||||
|
FILEOS VOS_NT_WINDOWS32
|
||||||
|
FILETYPE VFT_DLL
|
||||||
|
FILESUBTYPE 0
|
||||||
|
{
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
{
|
||||||
|
BLOCK "040904B0"
|
||||||
|
{
|
||||||
|
VALUE "CompanyName", "GLFW"
|
||||||
|
VALUE "FileDescription", "GLFW @GLFW_VERSION@ DLL"
|
||||||
|
VALUE "FileVersion", "@GLFW_VERSION@"
|
||||||
|
VALUE "OriginalFilename", "glfw3.dll"
|
||||||
|
VALUE "ProductName", "GLFW"
|
||||||
|
VALUE "ProductVersion", "@GLFW_VERSION@"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
{
|
||||||
|
VALUE "Translation", 0x409, 1200
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
719
libraries/raylib/raylib/src/external/glfw/src/glx_context.c
vendored
Normal file
719
libraries/raylib/raylib/src/external/glfw/src/glx_context.c
vendored
Normal file
|
|
@ -0,0 +1,719 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 GLX - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.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, 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 <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#ifndef GLXBadProfileARB
|
||||||
|
#define GLXBadProfileARB 13
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// Returns the specified attribute of the specified GLXFBConfig
|
||||||
|
//
|
||||||
|
static int getGLXFBConfigAttrib(GLXFBConfig fbconfig, int attrib)
|
||||||
|
{
|
||||||
|
int value;
|
||||||
|
glXGetFBConfigAttrib(_glfw.x11.display, fbconfig, attrib, &value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the GLXFBConfig most closely matching the specified hints
|
||||||
|
//
|
||||||
|
static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired,
|
||||||
|
GLXFBConfig* result)
|
||||||
|
{
|
||||||
|
GLXFBConfig* nativeConfigs;
|
||||||
|
_GLFWfbconfig* usableConfigs;
|
||||||
|
const _GLFWfbconfig* closest;
|
||||||
|
int nativeCount, usableCount;
|
||||||
|
const char* vendor;
|
||||||
|
GLFWbool trustWindowBit = GLFW_TRUE;
|
||||||
|
|
||||||
|
// HACK: This is a (hopefully temporary) workaround for Chromium
|
||||||
|
// (VirtualBox GL) not setting the window bit on any GLXFBConfigs
|
||||||
|
vendor = glXGetClientString(_glfw.x11.display, GLX_VENDOR);
|
||||||
|
if (vendor && strcmp(vendor, "Chromium") == 0)
|
||||||
|
trustWindowBit = GLFW_FALSE;
|
||||||
|
|
||||||
|
nativeConfigs =
|
||||||
|
glXGetFBConfigs(_glfw.x11.display, _glfw.x11.screen, &nativeCount);
|
||||||
|
if (!nativeConfigs || !nativeCount)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: No GLXFBConfigs returned");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
usableConfigs = _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||||
|
usableCount = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < nativeCount; i++)
|
||||||
|
{
|
||||||
|
const GLXFBConfig n = nativeConfigs[i];
|
||||||
|
_GLFWfbconfig* u = usableConfigs + usableCount;
|
||||||
|
|
||||||
|
// Only consider RGBA GLXFBConfigs
|
||||||
|
if (!(getGLXFBConfigAttrib(n, GLX_RENDER_TYPE) & GLX_RGBA_BIT))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Only consider window GLXFBConfigs
|
||||||
|
if (!(getGLXFBConfigAttrib(n, GLX_DRAWABLE_TYPE) & GLX_WINDOW_BIT))
|
||||||
|
{
|
||||||
|
if (trustWindowBit)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER) != desired->doublebuffer)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (desired->transparent)
|
||||||
|
{
|
||||||
|
XVisualInfo* vi = glXGetVisualFromFBConfig(_glfw.x11.display, n);
|
||||||
|
if (vi)
|
||||||
|
{
|
||||||
|
u->transparent = _glfwIsVisualTransparentX11(vi->visual);
|
||||||
|
XFree(vi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
u->redBits = getGLXFBConfigAttrib(n, GLX_RED_SIZE);
|
||||||
|
u->greenBits = getGLXFBConfigAttrib(n, GLX_GREEN_SIZE);
|
||||||
|
u->blueBits = getGLXFBConfigAttrib(n, GLX_BLUE_SIZE);
|
||||||
|
|
||||||
|
u->alphaBits = getGLXFBConfigAttrib(n, GLX_ALPHA_SIZE);
|
||||||
|
u->depthBits = getGLXFBConfigAttrib(n, GLX_DEPTH_SIZE);
|
||||||
|
u->stencilBits = getGLXFBConfigAttrib(n, GLX_STENCIL_SIZE);
|
||||||
|
|
||||||
|
u->accumRedBits = getGLXFBConfigAttrib(n, GLX_ACCUM_RED_SIZE);
|
||||||
|
u->accumGreenBits = getGLXFBConfigAttrib(n, GLX_ACCUM_GREEN_SIZE);
|
||||||
|
u->accumBlueBits = getGLXFBConfigAttrib(n, GLX_ACCUM_BLUE_SIZE);
|
||||||
|
u->accumAlphaBits = getGLXFBConfigAttrib(n, GLX_ACCUM_ALPHA_SIZE);
|
||||||
|
|
||||||
|
u->auxBuffers = getGLXFBConfigAttrib(n, GLX_AUX_BUFFERS);
|
||||||
|
|
||||||
|
if (getGLXFBConfigAttrib(n, GLX_STEREO))
|
||||||
|
u->stereo = GLFW_TRUE;
|
||||||
|
|
||||||
|
if (_glfw.glx.ARB_multisample)
|
||||||
|
u->samples = getGLXFBConfigAttrib(n, GLX_SAMPLES);
|
||||||
|
|
||||||
|
if (_glfw.glx.ARB_framebuffer_sRGB || _glfw.glx.EXT_framebuffer_sRGB)
|
||||||
|
u->sRGB = getGLXFBConfigAttrib(n, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB);
|
||||||
|
|
||||||
|
u->handle = (uintptr_t) n;
|
||||||
|
usableCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount);
|
||||||
|
if (closest)
|
||||||
|
*result = (GLXFBConfig) closest->handle;
|
||||||
|
|
||||||
|
XFree(nativeConfigs);
|
||||||
|
_glfw_free(usableConfigs);
|
||||||
|
|
||||||
|
return closest != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the OpenGL context using legacy API
|
||||||
|
//
|
||||||
|
static GLXContext createLegacyContextGLX(_GLFWwindow* window,
|
||||||
|
GLXFBConfig fbconfig,
|
||||||
|
GLXContext share)
|
||||||
|
{
|
||||||
|
return glXCreateNewContext(_glfw.x11.display,
|
||||||
|
fbconfig,
|
||||||
|
GLX_RGBA_TYPE,
|
||||||
|
share,
|
||||||
|
True);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void makeContextCurrentGLX(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
if (window)
|
||||||
|
{
|
||||||
|
if (!glXMakeCurrent(_glfw.x11.display,
|
||||||
|
window->context.glx.window,
|
||||||
|
window->context.glx.handle))
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"GLX: Failed to make context current");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!glXMakeCurrent(_glfw.x11.display, None, NULL))
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"GLX: Failed to clear current context");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwPlatformSetTls(&_glfw.contextSlot, window);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void swapBuffersGLX(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
glXSwapBuffers(_glfw.x11.display, window->context.glx.window);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void swapIntervalGLX(int interval)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
||||||
|
assert(window != NULL);
|
||||||
|
|
||||||
|
if (_glfw.glx.EXT_swap_control)
|
||||||
|
{
|
||||||
|
_glfw.glx.SwapIntervalEXT(_glfw.x11.display,
|
||||||
|
window->context.glx.window,
|
||||||
|
interval);
|
||||||
|
}
|
||||||
|
else if (_glfw.glx.MESA_swap_control)
|
||||||
|
_glfw.glx.SwapIntervalMESA(interval);
|
||||||
|
else if (_glfw.glx.SGI_swap_control)
|
||||||
|
{
|
||||||
|
if (interval > 0)
|
||||||
|
_glfw.glx.SwapIntervalSGI(interval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int extensionSupportedGLX(const char* extension)
|
||||||
|
{
|
||||||
|
const char* extensions =
|
||||||
|
glXQueryExtensionsString(_glfw.x11.display, _glfw.x11.screen);
|
||||||
|
if (extensions)
|
||||||
|
{
|
||||||
|
if (_glfwStringInExtensionString(extension, extensions))
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GLFWglproc getProcAddressGLX(const char* procname)
|
||||||
|
{
|
||||||
|
if (_glfw.glx.GetProcAddress)
|
||||||
|
return _glfw.glx.GetProcAddress((const GLubyte*) procname);
|
||||||
|
else if (_glfw.glx.GetProcAddressARB)
|
||||||
|
return _glfw.glx.GetProcAddressARB((const GLubyte*) procname);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// NOTE: glvnd provides GLX 1.4, so this can only happen with libGL
|
||||||
|
return _glfwPlatformGetModuleSymbol(_glfw.glx.handle, procname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void destroyContextGLX(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
if (window->context.glx.window)
|
||||||
|
{
|
||||||
|
glXDestroyWindow(_glfw.x11.display, window->context.glx.window);
|
||||||
|
window->context.glx.window = None;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->context.glx.handle)
|
||||||
|
{
|
||||||
|
glXDestroyContext(_glfw.x11.display, window->context.glx.handle);
|
||||||
|
window->context.glx.handle = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW internal API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Initialize GLX
|
||||||
|
//
|
||||||
|
GLFWbool _glfwInitGLX(void)
|
||||||
|
{
|
||||||
|
const char* sonames[] =
|
||||||
|
{
|
||||||
|
#if defined(_GLFW_GLX_LIBRARY)
|
||||||
|
_GLFW_GLX_LIBRARY,
|
||||||
|
#elif defined(__CYGWIN__)
|
||||||
|
"libGL-1.so",
|
||||||
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
"libGL.so",
|
||||||
|
#else
|
||||||
|
"libGLX.so.0",
|
||||||
|
"libGL.so.1",
|
||||||
|
"libGL.so",
|
||||||
|
#endif
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_glfw.glx.handle)
|
||||||
|
return GLFW_TRUE;
|
||||||
|
|
||||||
|
for (int i = 0; sonames[i]; i++)
|
||||||
|
{
|
||||||
|
_glfw.glx.handle = _glfwPlatformLoadModule(sonames[i]);
|
||||||
|
if (_glfw.glx.handle)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_glfw.glx.handle)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: Failed to load GLX");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfw.glx.GetFBConfigs = (PFNGLXGETFBCONFIGSPROC)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetFBConfigs");
|
||||||
|
_glfw.glx.GetFBConfigAttrib = (PFNGLXGETFBCONFIGATTRIBPROC)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetFBConfigAttrib");
|
||||||
|
_glfw.glx.GetClientString = (PFNGLXGETCLIENTSTRINGPROC)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetClientString");
|
||||||
|
_glfw.glx.QueryExtension = (PFNGLXQUERYEXTENSIONPROC)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXQueryExtension");
|
||||||
|
_glfw.glx.QueryVersion = (PFNGLXQUERYVERSIONPROC)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXQueryVersion");
|
||||||
|
_glfw.glx.DestroyContext = (PFNGLXDESTROYCONTEXTPROC)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXDestroyContext");
|
||||||
|
_glfw.glx.MakeCurrent = (PFNGLXMAKECURRENTPROC)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXMakeCurrent");
|
||||||
|
_glfw.glx.SwapBuffers = (PFNGLXSWAPBUFFERSPROC)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXSwapBuffers");
|
||||||
|
_glfw.glx.QueryExtensionsString = (PFNGLXQUERYEXTENSIONSSTRINGPROC)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXQueryExtensionsString");
|
||||||
|
_glfw.glx.CreateNewContext = (PFNGLXCREATENEWCONTEXTPROC)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXCreateNewContext");
|
||||||
|
_glfw.glx.CreateWindow = (PFNGLXCREATEWINDOWPROC)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXCreateWindow");
|
||||||
|
_glfw.glx.DestroyWindow = (PFNGLXDESTROYWINDOWPROC)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXDestroyWindow");
|
||||||
|
_glfw.glx.GetVisualFromFBConfig = (PFNGLXGETVISUALFROMFBCONFIGPROC)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetVisualFromFBConfig");
|
||||||
|
|
||||||
|
if (!_glfw.glx.GetFBConfigs ||
|
||||||
|
!_glfw.glx.GetFBConfigAttrib ||
|
||||||
|
!_glfw.glx.GetClientString ||
|
||||||
|
!_glfw.glx.QueryExtension ||
|
||||||
|
!_glfw.glx.QueryVersion ||
|
||||||
|
!_glfw.glx.DestroyContext ||
|
||||||
|
!_glfw.glx.MakeCurrent ||
|
||||||
|
!_glfw.glx.SwapBuffers ||
|
||||||
|
!_glfw.glx.QueryExtensionsString ||
|
||||||
|
!_glfw.glx.CreateNewContext ||
|
||||||
|
!_glfw.glx.CreateWindow ||
|
||||||
|
!_glfw.glx.DestroyWindow ||
|
||||||
|
!_glfw.glx.GetVisualFromFBConfig)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"GLX: Failed to load required entry points");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: Unlike GLX 1.3 entry points these are not required to be present
|
||||||
|
_glfw.glx.GetProcAddress = (PFNGLXGETPROCADDRESSPROC)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetProcAddress");
|
||||||
|
_glfw.glx.GetProcAddressARB = (PFNGLXGETPROCADDRESSPROC)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetProcAddressARB");
|
||||||
|
|
||||||
|
if (!glXQueryExtension(_glfw.x11.display,
|
||||||
|
&_glfw.glx.errorBase,
|
||||||
|
&_glfw.glx.eventBase))
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: GLX extension not found");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!glXQueryVersion(_glfw.x11.display, &_glfw.glx.major, &_glfw.glx.minor))
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"GLX: Failed to query GLX version");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.glx.major == 1 && _glfw.glx.minor < 3)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"GLX: GLX version 1.3 is required");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (extensionSupportedGLX("GLX_EXT_swap_control"))
|
||||||
|
{
|
||||||
|
_glfw.glx.SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)
|
||||||
|
getProcAddressGLX("glXSwapIntervalEXT");
|
||||||
|
|
||||||
|
if (_glfw.glx.SwapIntervalEXT)
|
||||||
|
_glfw.glx.EXT_swap_control = GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (extensionSupportedGLX("GLX_SGI_swap_control"))
|
||||||
|
{
|
||||||
|
_glfw.glx.SwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)
|
||||||
|
getProcAddressGLX("glXSwapIntervalSGI");
|
||||||
|
|
||||||
|
if (_glfw.glx.SwapIntervalSGI)
|
||||||
|
_glfw.glx.SGI_swap_control = GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (extensionSupportedGLX("GLX_MESA_swap_control"))
|
||||||
|
{
|
||||||
|
_glfw.glx.SwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)
|
||||||
|
getProcAddressGLX("glXSwapIntervalMESA");
|
||||||
|
|
||||||
|
if (_glfw.glx.SwapIntervalMESA)
|
||||||
|
_glfw.glx.MESA_swap_control = GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (extensionSupportedGLX("GLX_ARB_multisample"))
|
||||||
|
_glfw.glx.ARB_multisample = GLFW_TRUE;
|
||||||
|
|
||||||
|
if (extensionSupportedGLX("GLX_ARB_framebuffer_sRGB"))
|
||||||
|
_glfw.glx.ARB_framebuffer_sRGB = GLFW_TRUE;
|
||||||
|
|
||||||
|
if (extensionSupportedGLX("GLX_EXT_framebuffer_sRGB"))
|
||||||
|
_glfw.glx.EXT_framebuffer_sRGB = GLFW_TRUE;
|
||||||
|
|
||||||
|
if (extensionSupportedGLX("GLX_ARB_create_context"))
|
||||||
|
{
|
||||||
|
_glfw.glx.CreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)
|
||||||
|
getProcAddressGLX("glXCreateContextAttribsARB");
|
||||||
|
|
||||||
|
if (_glfw.glx.CreateContextAttribsARB)
|
||||||
|
_glfw.glx.ARB_create_context = GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (extensionSupportedGLX("GLX_ARB_create_context_robustness"))
|
||||||
|
_glfw.glx.ARB_create_context_robustness = GLFW_TRUE;
|
||||||
|
|
||||||
|
if (extensionSupportedGLX("GLX_ARB_create_context_profile"))
|
||||||
|
_glfw.glx.ARB_create_context_profile = GLFW_TRUE;
|
||||||
|
|
||||||
|
if (extensionSupportedGLX("GLX_EXT_create_context_es2_profile"))
|
||||||
|
_glfw.glx.EXT_create_context_es2_profile = GLFW_TRUE;
|
||||||
|
|
||||||
|
if (extensionSupportedGLX("GLX_ARB_create_context_no_error"))
|
||||||
|
_glfw.glx.ARB_create_context_no_error = GLFW_TRUE;
|
||||||
|
|
||||||
|
if (extensionSupportedGLX("GLX_ARB_context_flush_control"))
|
||||||
|
_glfw.glx.ARB_context_flush_control = GLFW_TRUE;
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Terminate GLX
|
||||||
|
//
|
||||||
|
void _glfwTerminateGLX(void)
|
||||||
|
{
|
||||||
|
// NOTE: This function must not call any X11 functions, as it is called
|
||||||
|
// after XCloseDisplay (see _glfwTerminateX11 for details)
|
||||||
|
|
||||||
|
if (_glfw.glx.handle)
|
||||||
|
{
|
||||||
|
_glfwPlatformFreeModule(_glfw.glx.handle);
|
||||||
|
_glfw.glx.handle = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SET_ATTRIB(a, v) \
|
||||||
|
{ \
|
||||||
|
assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \
|
||||||
|
attribs[index++] = a; \
|
||||||
|
attribs[index++] = v; \
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the OpenGL or OpenGL ES context
|
||||||
|
//
|
||||||
|
GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
|
||||||
|
const _GLFWctxconfig* ctxconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig)
|
||||||
|
{
|
||||||
|
int attribs[40];
|
||||||
|
GLXFBConfig native = NULL;
|
||||||
|
GLXContext share = NULL;
|
||||||
|
|
||||||
|
if (ctxconfig->share)
|
||||||
|
share = ctxconfig->share->context.glx.handle;
|
||||||
|
|
||||||
|
if (!chooseGLXFBConfig(fbconfig, &native))
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
||||||
|
"GLX: Failed to find a suitable GLXFBConfig");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->client == GLFW_OPENGL_ES_API)
|
||||||
|
{
|
||||||
|
if (!_glfw.glx.ARB_create_context ||
|
||||||
|
!_glfw.glx.ARB_create_context_profile ||
|
||||||
|
!_glfw.glx.EXT_create_context_es2_profile)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"GLX: OpenGL ES requested but GLX_EXT_create_context_es2_profile is unavailable");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->forward)
|
||||||
|
{
|
||||||
|
if (!_glfw.glx.ARB_create_context)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
|
"GLX: Forward compatibility requested but GLX_ARB_create_context_profile is unavailable");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->profile)
|
||||||
|
{
|
||||||
|
if (!_glfw.glx.ARB_create_context ||
|
||||||
|
!_glfw.glx.ARB_create_context_profile)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
|
"GLX: An OpenGL profile requested but GLX_ARB_create_context_profile is unavailable");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwGrabErrorHandlerX11();
|
||||||
|
|
||||||
|
if (_glfw.glx.ARB_create_context)
|
||||||
|
{
|
||||||
|
int index = 0, mask = 0, flags = 0;
|
||||||
|
|
||||||
|
if (ctxconfig->client == GLFW_OPENGL_API)
|
||||||
|
{
|
||||||
|
if (ctxconfig->forward)
|
||||||
|
flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
|
||||||
|
|
||||||
|
if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE)
|
||||||
|
mask |= GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||||
|
else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
|
||||||
|
mask |= GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mask |= GLX_CONTEXT_ES2_PROFILE_BIT_EXT;
|
||||||
|
|
||||||
|
if (ctxconfig->debug)
|
||||||
|
flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
|
||||||
|
|
||||||
|
if (ctxconfig->robustness)
|
||||||
|
{
|
||||||
|
if (_glfw.glx.ARB_create_context_robustness)
|
||||||
|
{
|
||||||
|
if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION)
|
||||||
|
{
|
||||||
|
SET_ATTRIB(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB,
|
||||||
|
GLX_NO_RESET_NOTIFICATION_ARB);
|
||||||
|
}
|
||||||
|
else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET)
|
||||||
|
{
|
||||||
|
SET_ATTRIB(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB,
|
||||||
|
GLX_LOSE_CONTEXT_ON_RESET_ARB);
|
||||||
|
}
|
||||||
|
|
||||||
|
flags |= GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->release)
|
||||||
|
{
|
||||||
|
if (_glfw.glx.ARB_context_flush_control)
|
||||||
|
{
|
||||||
|
if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_NONE)
|
||||||
|
{
|
||||||
|
SET_ATTRIB(GLX_CONTEXT_RELEASE_BEHAVIOR_ARB,
|
||||||
|
GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB);
|
||||||
|
}
|
||||||
|
else if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_FLUSH)
|
||||||
|
{
|
||||||
|
SET_ATTRIB(GLX_CONTEXT_RELEASE_BEHAVIOR_ARB,
|
||||||
|
GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->noerror)
|
||||||
|
{
|
||||||
|
if (_glfw.glx.ARB_create_context_no_error)
|
||||||
|
SET_ATTRIB(GLX_CONTEXT_OPENGL_NO_ERROR_ARB, GLFW_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: Only request an explicitly versioned context when necessary, as
|
||||||
|
// explicitly requesting version 1.0 does not always return the
|
||||||
|
// highest version supported by the driver
|
||||||
|
if (ctxconfig->major != 1 || ctxconfig->minor != 0)
|
||||||
|
{
|
||||||
|
SET_ATTRIB(GLX_CONTEXT_MAJOR_VERSION_ARB, ctxconfig->major);
|
||||||
|
SET_ATTRIB(GLX_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask)
|
||||||
|
SET_ATTRIB(GLX_CONTEXT_PROFILE_MASK_ARB, mask);
|
||||||
|
|
||||||
|
if (flags)
|
||||||
|
SET_ATTRIB(GLX_CONTEXT_FLAGS_ARB, flags);
|
||||||
|
|
||||||
|
SET_ATTRIB(None, None);
|
||||||
|
|
||||||
|
window->context.glx.handle =
|
||||||
|
_glfw.glx.CreateContextAttribsARB(_glfw.x11.display,
|
||||||
|
native,
|
||||||
|
share,
|
||||||
|
True,
|
||||||
|
attribs);
|
||||||
|
|
||||||
|
// HACK: This is a fallback for broken versions of the Mesa
|
||||||
|
// implementation of GLX_ARB_create_context_profile that fail
|
||||||
|
// default 1.0 context creation with a GLXBadProfileARB error in
|
||||||
|
// violation of the extension spec
|
||||||
|
if (!window->context.glx.handle)
|
||||||
|
{
|
||||||
|
if (_glfw.x11.errorCode == _glfw.glx.errorBase + GLXBadProfileARB &&
|
||||||
|
ctxconfig->client == GLFW_OPENGL_API &&
|
||||||
|
ctxconfig->profile == GLFW_OPENGL_ANY_PROFILE &&
|
||||||
|
ctxconfig->forward == GLFW_FALSE)
|
||||||
|
{
|
||||||
|
window->context.glx.handle =
|
||||||
|
createLegacyContextGLX(window, native, share);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window->context.glx.handle =
|
||||||
|
createLegacyContextGLX(window, native, share);
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwReleaseErrorHandlerX11();
|
||||||
|
|
||||||
|
if (!window->context.glx.handle)
|
||||||
|
{
|
||||||
|
_glfwInputErrorX11(GLFW_VERSION_UNAVAILABLE, "GLX: Failed to create context");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
window->context.glx.window =
|
||||||
|
glXCreateWindow(_glfw.x11.display, native, window->x11.handle, NULL);
|
||||||
|
if (!window->context.glx.window)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR, "GLX: Failed to create window");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
window->context.makeCurrent = makeContextCurrentGLX;
|
||||||
|
window->context.swapBuffers = swapBuffersGLX;
|
||||||
|
window->context.swapInterval = swapIntervalGLX;
|
||||||
|
window->context.extensionSupported = extensionSupportedGLX;
|
||||||
|
window->context.getProcAddress = getProcAddressGLX;
|
||||||
|
window->context.destroy = destroyContextGLX;
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef SET_ATTRIB
|
||||||
|
|
||||||
|
// Returns the Visual and depth of the chosen GLXFBConfig
|
||||||
|
//
|
||||||
|
GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig,
|
||||||
|
const _GLFWctxconfig* ctxconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig,
|
||||||
|
Visual** visual, int* depth)
|
||||||
|
{
|
||||||
|
GLXFBConfig native;
|
||||||
|
XVisualInfo* result;
|
||||||
|
|
||||||
|
if (!chooseGLXFBConfig(fbconfig, &native))
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
||||||
|
"GLX: Failed to find a suitable GLXFBConfig");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = glXGetVisualFromFBConfig(_glfw.x11.display, native);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"GLX: Failed to retrieve Visual for GLXFBConfig");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*visual = result->visual;
|
||||||
|
*depth = result->depth;
|
||||||
|
|
||||||
|
XFree(result);
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW native API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* handle)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
|
if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "GLX: Platform not initialized");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->context.source != GLFW_NATIVE_CONTEXT_API)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return window->context.glx.handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* handle)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(None);
|
||||||
|
|
||||||
|
if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "GLX: Platform not initialized");
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->context.source != GLFW_NATIVE_CONTEXT_API)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
return window->context.glx.window;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // _GLFW_X11
|
||||||
|
|
||||||
528
libraries/raylib/raylib/src/external/glfw/src/init.c
vendored
Normal file
528
libraries/raylib/raylib/src/external/glfw/src/init.c
vendored
Normal file
|
|
@ -0,0 +1,528 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
|
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.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, 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"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
|
// NOTE: The global variables below comprise all mutable global data in GLFW
|
||||||
|
// Any other mutable global variable is a bug
|
||||||
|
|
||||||
|
// This contains all mutable state shared between compilation units of GLFW
|
||||||
|
//
|
||||||
|
_GLFWlibrary _glfw = { GLFW_FALSE };
|
||||||
|
|
||||||
|
// These are outside of _glfw so they can be used before initialization and
|
||||||
|
// after termination without special handling when _glfw is cleared to zero
|
||||||
|
//
|
||||||
|
static _GLFWerror _glfwMainThreadError;
|
||||||
|
static GLFWerrorfun _glfwErrorCallback;
|
||||||
|
static GLFWallocator _glfwInitAllocator;
|
||||||
|
static _GLFWinitconfig _glfwInitHints =
|
||||||
|
{
|
||||||
|
.hatButtons = GLFW_TRUE,
|
||||||
|
.angleType = GLFW_ANGLE_PLATFORM_TYPE_NONE,
|
||||||
|
.platformID = GLFW_ANY_PLATFORM,
|
||||||
|
.vulkanLoader = NULL,
|
||||||
|
.ns =
|
||||||
|
{
|
||||||
|
.menubar = GLFW_TRUE,
|
||||||
|
.chdir = GLFW_TRUE
|
||||||
|
},
|
||||||
|
.x11 =
|
||||||
|
{
|
||||||
|
.xcbVulkanSurface = GLFW_TRUE,
|
||||||
|
},
|
||||||
|
.wl =
|
||||||
|
{
|
||||||
|
.libdecorMode = GLFW_WAYLAND_PREFER_LIBDECOR
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// The allocation function used when no custom allocator is set
|
||||||
|
//
|
||||||
|
static void* defaultAllocate(size_t size, void* user)
|
||||||
|
{
|
||||||
|
return malloc(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The deallocation function used when no custom allocator is set
|
||||||
|
//
|
||||||
|
static void defaultDeallocate(void* block, void* user)
|
||||||
|
{
|
||||||
|
free(block);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The reallocation function used when no custom allocator is set
|
||||||
|
//
|
||||||
|
static void* defaultReallocate(void* block, size_t size, void* user)
|
||||||
|
{
|
||||||
|
return realloc(block, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Terminate the library
|
||||||
|
//
|
||||||
|
static void terminate(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
memset(&_glfw.callbacks, 0, sizeof(_glfw.callbacks));
|
||||||
|
|
||||||
|
while (_glfw.windowListHead)
|
||||||
|
glfwDestroyWindow((GLFWwindow*) _glfw.windowListHead);
|
||||||
|
|
||||||
|
while (_glfw.cursorListHead)
|
||||||
|
glfwDestroyCursor((GLFWcursor*) _glfw.cursorListHead);
|
||||||
|
|
||||||
|
for (i = 0; i < _glfw.monitorCount; i++)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = _glfw.monitors[i];
|
||||||
|
if (monitor->originalRamp.size)
|
||||||
|
_glfw.platform.setGammaRamp(monitor, &monitor->originalRamp);
|
||||||
|
_glfwFreeMonitor(monitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfw_free(_glfw.monitors);
|
||||||
|
_glfw.monitors = NULL;
|
||||||
|
_glfw.monitorCount = 0;
|
||||||
|
|
||||||
|
_glfw_free(_glfw.mappings);
|
||||||
|
_glfw.mappings = NULL;
|
||||||
|
_glfw.mappingCount = 0;
|
||||||
|
|
||||||
|
_glfwTerminateVulkan();
|
||||||
|
_glfw.platform.terminateJoysticks();
|
||||||
|
_glfw.platform.terminate();
|
||||||
|
|
||||||
|
_glfw.initialized = GLFW_FALSE;
|
||||||
|
|
||||||
|
while (_glfw.errorListHead)
|
||||||
|
{
|
||||||
|
_GLFWerror* error = _glfw.errorListHead;
|
||||||
|
_glfw.errorListHead = error->next;
|
||||||
|
_glfw_free(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwPlatformDestroyTls(&_glfw.contextSlot);
|
||||||
|
_glfwPlatformDestroyTls(&_glfw.errorSlot);
|
||||||
|
_glfwPlatformDestroyMutex(&_glfw.errorLock);
|
||||||
|
|
||||||
|
memset(&_glfw, 0, sizeof(_glfw));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW internal API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Encode a Unicode code point to a UTF-8 stream
|
||||||
|
// Based on cutef8 by Jeff Bezanson (Public Domain)
|
||||||
|
//
|
||||||
|
size_t _glfwEncodeUTF8(char* s, uint32_t codepoint)
|
||||||
|
{
|
||||||
|
size_t count = 0;
|
||||||
|
|
||||||
|
if (codepoint < 0x80)
|
||||||
|
s[count++] = (char) codepoint;
|
||||||
|
else if (codepoint < 0x800)
|
||||||
|
{
|
||||||
|
s[count++] = (codepoint >> 6) | 0xc0;
|
||||||
|
s[count++] = (codepoint & 0x3f) | 0x80;
|
||||||
|
}
|
||||||
|
else if (codepoint < 0x10000)
|
||||||
|
{
|
||||||
|
s[count++] = (codepoint >> 12) | 0xe0;
|
||||||
|
s[count++] = ((codepoint >> 6) & 0x3f) | 0x80;
|
||||||
|
s[count++] = (codepoint & 0x3f) | 0x80;
|
||||||
|
}
|
||||||
|
else if (codepoint < 0x110000)
|
||||||
|
{
|
||||||
|
s[count++] = (codepoint >> 18) | 0xf0;
|
||||||
|
s[count++] = ((codepoint >> 12) & 0x3f) | 0x80;
|
||||||
|
s[count++] = ((codepoint >> 6) & 0x3f) | 0x80;
|
||||||
|
s[count++] = (codepoint & 0x3f) | 0x80;
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Splits and translates a text/uri-list into separate file paths
|
||||||
|
// NOTE: This function destroys the provided string
|
||||||
|
//
|
||||||
|
char** _glfwParseUriList(char* text, int* count)
|
||||||
|
{
|
||||||
|
const char* prefix = "file://";
|
||||||
|
char** paths = NULL;
|
||||||
|
char* line;
|
||||||
|
|
||||||
|
*count = 0;
|
||||||
|
|
||||||
|
while ((line = strtok(text, "\r\n")))
|
||||||
|
{
|
||||||
|
char* path;
|
||||||
|
|
||||||
|
text = NULL;
|
||||||
|
|
||||||
|
if (line[0] == '#')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (strncmp(line, prefix, strlen(prefix)) == 0)
|
||||||
|
{
|
||||||
|
line += strlen(prefix);
|
||||||
|
// TODO: Validate hostname
|
||||||
|
while (*line != '/')
|
||||||
|
line++;
|
||||||
|
}
|
||||||
|
|
||||||
|
(*count)++;
|
||||||
|
|
||||||
|
path = _glfw_calloc(strlen(line) + 1, 1);
|
||||||
|
paths = _glfw_realloc(paths, *count * sizeof(char*));
|
||||||
|
paths[*count - 1] = path;
|
||||||
|
|
||||||
|
while (*line)
|
||||||
|
{
|
||||||
|
if (line[0] == '%' && line[1] && line[2])
|
||||||
|
{
|
||||||
|
const char digits[3] = { line[1], line[2], '\0' };
|
||||||
|
*path = (char) strtol(digits, NULL, 16);
|
||||||
|
line += 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*path = *line;
|
||||||
|
|
||||||
|
path++;
|
||||||
|
line++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* _glfw_strdup(const char* source)
|
||||||
|
{
|
||||||
|
const size_t length = strlen(source);
|
||||||
|
char* result = _glfw_calloc(length + 1, 1);
|
||||||
|
strcpy(result, source);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _glfw_min(int a, int b)
|
||||||
|
{
|
||||||
|
return a < b ? a : b;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _glfw_max(int a, int b)
|
||||||
|
{
|
||||||
|
return a > b ? a : b;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* _glfw_calloc(size_t count, size_t size)
|
||||||
|
{
|
||||||
|
if (count && size)
|
||||||
|
{
|
||||||
|
void* block;
|
||||||
|
|
||||||
|
if (count > SIZE_MAX / size)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE, "Allocation size overflow");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
block = _glfw.allocator.allocate(count * size, _glfw.allocator.user);
|
||||||
|
if (block)
|
||||||
|
return memset(block, 0, count * size);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* _glfw_realloc(void* block, size_t size)
|
||||||
|
{
|
||||||
|
if (block && size)
|
||||||
|
{
|
||||||
|
void* resized = _glfw.allocator.reallocate(block, size, _glfw.allocator.user);
|
||||||
|
if (resized)
|
||||||
|
return resized;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (block)
|
||||||
|
{
|
||||||
|
_glfw_free(block);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return _glfw_calloc(1, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfw_free(void* block)
|
||||||
|
{
|
||||||
|
if (block)
|
||||||
|
_glfw.allocator.deallocate(block, _glfw.allocator.user);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW event API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Notifies shared code of an error
|
||||||
|
//
|
||||||
|
void _glfwInputError(int code, const char* format, ...)
|
||||||
|
{
|
||||||
|
_GLFWerror* error;
|
||||||
|
char description[_GLFW_MESSAGE_SIZE];
|
||||||
|
|
||||||
|
if (format)
|
||||||
|
{
|
||||||
|
va_list vl;
|
||||||
|
|
||||||
|
va_start(vl, format);
|
||||||
|
vsnprintf(description, sizeof(description), format, vl);
|
||||||
|
va_end(vl);
|
||||||
|
|
||||||
|
description[sizeof(description) - 1] = '\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (code == GLFW_NOT_INITIALIZED)
|
||||||
|
strcpy(description, "The GLFW library is not initialized");
|
||||||
|
else if (code == GLFW_NO_CURRENT_CONTEXT)
|
||||||
|
strcpy(description, "There is no current context");
|
||||||
|
else if (code == GLFW_INVALID_ENUM)
|
||||||
|
strcpy(description, "Invalid argument for enum parameter");
|
||||||
|
else if (code == GLFW_INVALID_VALUE)
|
||||||
|
strcpy(description, "Invalid value for parameter");
|
||||||
|
else if (code == GLFW_OUT_OF_MEMORY)
|
||||||
|
strcpy(description, "Out of memory");
|
||||||
|
else if (code == GLFW_API_UNAVAILABLE)
|
||||||
|
strcpy(description, "The requested API is unavailable");
|
||||||
|
else if (code == GLFW_VERSION_UNAVAILABLE)
|
||||||
|
strcpy(description, "The requested API version is unavailable");
|
||||||
|
else if (code == GLFW_PLATFORM_ERROR)
|
||||||
|
strcpy(description, "A platform-specific error occurred");
|
||||||
|
else if (code == GLFW_FORMAT_UNAVAILABLE)
|
||||||
|
strcpy(description, "The requested format is unavailable");
|
||||||
|
else if (code == GLFW_NO_WINDOW_CONTEXT)
|
||||||
|
strcpy(description, "The specified window has no context");
|
||||||
|
else if (code == GLFW_CURSOR_UNAVAILABLE)
|
||||||
|
strcpy(description, "The specified cursor shape is unavailable");
|
||||||
|
else if (code == GLFW_FEATURE_UNAVAILABLE)
|
||||||
|
strcpy(description, "The requested feature cannot be implemented for this platform");
|
||||||
|
else if (code == GLFW_FEATURE_UNIMPLEMENTED)
|
||||||
|
strcpy(description, "The requested feature has not yet been implemented for this platform");
|
||||||
|
else if (code == GLFW_PLATFORM_UNAVAILABLE)
|
||||||
|
strcpy(description, "The requested platform is unavailable");
|
||||||
|
else
|
||||||
|
strcpy(description, "ERROR: UNKNOWN GLFW ERROR");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.initialized)
|
||||||
|
{
|
||||||
|
error = _glfwPlatformGetTls(&_glfw.errorSlot);
|
||||||
|
if (!error)
|
||||||
|
{
|
||||||
|
error = _glfw_calloc(1, sizeof(_GLFWerror));
|
||||||
|
_glfwPlatformSetTls(&_glfw.errorSlot, error);
|
||||||
|
_glfwPlatformLockMutex(&_glfw.errorLock);
|
||||||
|
error->next = _glfw.errorListHead;
|
||||||
|
_glfw.errorListHead = error;
|
||||||
|
_glfwPlatformUnlockMutex(&_glfw.errorLock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
error = &_glfwMainThreadError;
|
||||||
|
|
||||||
|
error->code = code;
|
||||||
|
strcpy(error->description, description);
|
||||||
|
|
||||||
|
if (_glfwErrorCallback)
|
||||||
|
_glfwErrorCallback(code, description);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW public API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GLFWAPI int glfwInit(void)
|
||||||
|
{
|
||||||
|
if (_glfw.initialized)
|
||||||
|
return GLFW_TRUE;
|
||||||
|
|
||||||
|
memset(&_glfw, 0, sizeof(_glfw));
|
||||||
|
_glfw.hints.init = _glfwInitHints;
|
||||||
|
|
||||||
|
_glfw.allocator = _glfwInitAllocator;
|
||||||
|
if (!_glfw.allocator.allocate)
|
||||||
|
{
|
||||||
|
_glfw.allocator.allocate = defaultAllocate;
|
||||||
|
_glfw.allocator.reallocate = defaultReallocate;
|
||||||
|
_glfw.allocator.deallocate = defaultDeallocate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_glfwSelectPlatform(_glfw.hints.init.platformID, &_glfw.platform))
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
if (!_glfw.platform.init())
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_glfwPlatformCreateMutex(&_glfw.errorLock) ||
|
||||||
|
!_glfwPlatformCreateTls(&_glfw.errorSlot) ||
|
||||||
|
!_glfwPlatformCreateTls(&_glfw.contextSlot))
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwPlatformSetTls(&_glfw.errorSlot, &_glfwMainThreadError);
|
||||||
|
|
||||||
|
_glfwInitGamepadMappings();
|
||||||
|
|
||||||
|
_glfwPlatformInitTimer();
|
||||||
|
_glfw.timer.offset = _glfwPlatformGetTimerValue();
|
||||||
|
|
||||||
|
_glfw.initialized = GLFW_TRUE;
|
||||||
|
|
||||||
|
glfwDefaultWindowHints();
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwTerminate(void)
|
||||||
|
{
|
||||||
|
if (!_glfw.initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwInitHint(int hint, int value)
|
||||||
|
{
|
||||||
|
switch (hint)
|
||||||
|
{
|
||||||
|
case GLFW_JOYSTICK_HAT_BUTTONS:
|
||||||
|
_glfwInitHints.hatButtons = value;
|
||||||
|
return;
|
||||||
|
case GLFW_ANGLE_PLATFORM_TYPE:
|
||||||
|
_glfwInitHints.angleType = value;
|
||||||
|
return;
|
||||||
|
case GLFW_PLATFORM:
|
||||||
|
_glfwInitHints.platformID = value;
|
||||||
|
return;
|
||||||
|
case GLFW_COCOA_CHDIR_RESOURCES:
|
||||||
|
_glfwInitHints.ns.chdir = value;
|
||||||
|
return;
|
||||||
|
case GLFW_COCOA_MENUBAR:
|
||||||
|
_glfwInitHints.ns.menubar = value;
|
||||||
|
return;
|
||||||
|
case GLFW_X11_XCB_VULKAN_SURFACE:
|
||||||
|
_glfwInitHints.x11.xcbVulkanSurface = value;
|
||||||
|
return;
|
||||||
|
case GLFW_WAYLAND_LIBDECOR:
|
||||||
|
_glfwInitHints.wl.libdecorMode = value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
|
"Invalid init hint 0x%08X", hint);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwInitAllocator(const GLFWallocator* allocator)
|
||||||
|
{
|
||||||
|
if (allocator)
|
||||||
|
{
|
||||||
|
if (allocator->allocate && allocator->reallocate && allocator->deallocate)
|
||||||
|
_glfwInitAllocator = *allocator;
|
||||||
|
else
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE, "Missing function in allocator");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
memset(&_glfwInitAllocator, 0, sizeof(GLFWallocator));
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwInitVulkanLoader(PFN_vkGetInstanceProcAddr loader)
|
||||||
|
{
|
||||||
|
_glfwInitHints.vulkanLoader = loader;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev)
|
||||||
|
{
|
||||||
|
if (major != NULL)
|
||||||
|
*major = GLFW_VERSION_MAJOR;
|
||||||
|
if (minor != NULL)
|
||||||
|
*minor = GLFW_VERSION_MINOR;
|
||||||
|
if (rev != NULL)
|
||||||
|
*rev = GLFW_VERSION_REVISION;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI int glfwGetError(const char** description)
|
||||||
|
{
|
||||||
|
_GLFWerror* error;
|
||||||
|
int code = GLFW_NO_ERROR;
|
||||||
|
|
||||||
|
if (description)
|
||||||
|
*description = NULL;
|
||||||
|
|
||||||
|
if (_glfw.initialized)
|
||||||
|
error = _glfwPlatformGetTls(&_glfw.errorSlot);
|
||||||
|
else
|
||||||
|
error = &_glfwMainThreadError;
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
|
code = error->code;
|
||||||
|
error->code = GLFW_NO_ERROR;
|
||||||
|
if (description && code)
|
||||||
|
*description = error->description;
|
||||||
|
}
|
||||||
|
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun)
|
||||||
|
{
|
||||||
|
_GLFW_SWAP(GLFWerrorfun, _glfwErrorCallback, cbfun);
|
||||||
|
return cbfun;
|
||||||
|
}
|
||||||
|
|
||||||
1505
libraries/raylib/raylib/src/external/glfw/src/input.c
vendored
Normal file
1505
libraries/raylib/raylib/src/external/glfw/src/input.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
1009
libraries/raylib/raylib/src/external/glfw/src/internal.h
vendored
Normal file
1009
libraries/raylib/raylib/src/external/glfw/src/internal.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
436
libraries/raylib/raylib/src/external/glfw/src/linux_joystick.c
vendored
Normal file
436
libraries/raylib/raylib/src/external/glfw/src/linux_joystick.c
vendored
Normal file
|
|
@ -0,0 +1,436 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 Linux - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
|
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.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, 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_BUILD_LINUX_JOYSTICK)
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/inotify.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#ifndef SYN_DROPPED // < v2.6.39 kernel headers
|
||||||
|
// Workaround for CentOS-6, which is supported till 2020-11-30, but still on v2.6.32
|
||||||
|
#define SYN_DROPPED 3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Apply an EV_KEY event to the specified joystick
|
||||||
|
//
|
||||||
|
static void handleKeyEvent(_GLFWjoystick* js, int code, int value)
|
||||||
|
{
|
||||||
|
_glfwInputJoystickButton(js,
|
||||||
|
js->linjs.keyMap[code - BTN_MISC],
|
||||||
|
value ? GLFW_PRESS : GLFW_RELEASE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply an EV_ABS event to the specified joystick
|
||||||
|
//
|
||||||
|
static void handleAbsEvent(_GLFWjoystick* js, int code, int value)
|
||||||
|
{
|
||||||
|
const int index = js->linjs.absMap[code];
|
||||||
|
|
||||||
|
if (code >= ABS_HAT0X && code <= ABS_HAT3Y)
|
||||||
|
{
|
||||||
|
static const char stateMap[3][3] =
|
||||||
|
{
|
||||||
|
{ GLFW_HAT_CENTERED, GLFW_HAT_UP, GLFW_HAT_DOWN },
|
||||||
|
{ GLFW_HAT_LEFT, GLFW_HAT_LEFT_UP, GLFW_HAT_LEFT_DOWN },
|
||||||
|
{ GLFW_HAT_RIGHT, GLFW_HAT_RIGHT_UP, GLFW_HAT_RIGHT_DOWN },
|
||||||
|
};
|
||||||
|
|
||||||
|
const int hat = (code - ABS_HAT0X) / 2;
|
||||||
|
const int axis = (code - ABS_HAT0X) % 2;
|
||||||
|
int* state = js->linjs.hats[hat];
|
||||||
|
|
||||||
|
// NOTE: Looking at several input drivers, it seems all hat events use
|
||||||
|
// -1 for left / up, 0 for centered and 1 for right / down
|
||||||
|
if (value == 0)
|
||||||
|
state[axis] = 0;
|
||||||
|
else if (value < 0)
|
||||||
|
state[axis] = 1;
|
||||||
|
else if (value > 0)
|
||||||
|
state[axis] = 2;
|
||||||
|
|
||||||
|
_glfwInputJoystickHat(js, index, stateMap[state[0]][state[1]]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const struct input_absinfo* info = &js->linjs.absInfo[code];
|
||||||
|
float normalized = value;
|
||||||
|
|
||||||
|
const int range = info->maximum - info->minimum;
|
||||||
|
if (range)
|
||||||
|
{
|
||||||
|
// Normalize to 0.0 -> 1.0
|
||||||
|
normalized = (normalized - info->minimum) / range;
|
||||||
|
// Normalize to -1.0 -> 1.0
|
||||||
|
normalized = normalized * 2.0f - 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwInputJoystickAxis(js, index, normalized);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Poll state of absolute axes
|
||||||
|
//
|
||||||
|
static void pollAbsState(_GLFWjoystick* js)
|
||||||
|
{
|
||||||
|
for (int code = 0; code < ABS_CNT; code++)
|
||||||
|
{
|
||||||
|
if (js->linjs.absMap[code] < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
struct input_absinfo* info = &js->linjs.absInfo[code];
|
||||||
|
|
||||||
|
if (ioctl(js->linjs.fd, EVIOCGABS(code), info) < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
handleAbsEvent(js, code, info->value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define isBitSet(bit, arr) (arr[(bit) / 8] & (1 << ((bit) % 8)))
|
||||||
|
|
||||||
|
// Attempt to open the specified joystick device
|
||||||
|
//
|
||||||
|
static GLFWbool openJoystickDevice(const char* path)
|
||||||
|
{
|
||||||
|
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
|
{
|
||||||
|
if (!_glfw.joysticks[jid].connected)
|
||||||
|
continue;
|
||||||
|
if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
_GLFWjoystickLinux linjs = {0};
|
||||||
|
linjs.fd = open(path, O_RDONLY | O_NONBLOCK | O_CLOEXEC);
|
||||||
|
if (linjs.fd == -1)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
char evBits[(EV_CNT + 7) / 8] = {0};
|
||||||
|
char keyBits[(KEY_CNT + 7) / 8] = {0};
|
||||||
|
char absBits[(ABS_CNT + 7) / 8] = {0};
|
||||||
|
struct input_id id;
|
||||||
|
|
||||||
|
if (ioctl(linjs.fd, EVIOCGBIT(0, sizeof(evBits)), evBits) < 0 ||
|
||||||
|
ioctl(linjs.fd, EVIOCGBIT(EV_KEY, sizeof(keyBits)), keyBits) < 0 ||
|
||||||
|
ioctl(linjs.fd, EVIOCGBIT(EV_ABS, sizeof(absBits)), absBits) < 0 ||
|
||||||
|
ioctl(linjs.fd, EVIOCGID, &id) < 0)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Linux: Failed to query input device: %s",
|
||||||
|
strerror(errno));
|
||||||
|
close(linjs.fd);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure this device supports the events expected of a joystick
|
||||||
|
if (!isBitSet(EV_ABS, evBits))
|
||||||
|
{
|
||||||
|
close(linjs.fd);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
char name[256] = "";
|
||||||
|
|
||||||
|
if (ioctl(linjs.fd, EVIOCGNAME(sizeof(name)), name) < 0)
|
||||||
|
strncpy(name, "Unknown", sizeof(name));
|
||||||
|
|
||||||
|
char guid[33] = "";
|
||||||
|
|
||||||
|
// Generate a joystick GUID that matches the SDL 2.0.5+ one
|
||||||
|
if (id.vendor && id.product && id.version)
|
||||||
|
{
|
||||||
|
sprintf(guid, "%02x%02x0000%02x%02x0000%02x%02x0000%02x%02x0000",
|
||||||
|
id.bustype & 0xff, id.bustype >> 8,
|
||||||
|
id.vendor & 0xff, id.vendor >> 8,
|
||||||
|
id.product & 0xff, id.product >> 8,
|
||||||
|
id.version & 0xff, id.version >> 8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(guid, "%02x%02x0000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00",
|
||||||
|
id.bustype & 0xff, id.bustype >> 8,
|
||||||
|
name[0], name[1], name[2], name[3],
|
||||||
|
name[4], name[5], name[6], name[7],
|
||||||
|
name[8], name[9], name[10]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int axisCount = 0, buttonCount = 0, hatCount = 0;
|
||||||
|
|
||||||
|
for (int code = BTN_MISC; code < KEY_CNT; code++)
|
||||||
|
{
|
||||||
|
if (!isBitSet(code, keyBits))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
linjs.keyMap[code - BTN_MISC] = buttonCount;
|
||||||
|
buttonCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int code = 0; code < ABS_CNT; code++)
|
||||||
|
{
|
||||||
|
linjs.absMap[code] = -1;
|
||||||
|
if (!isBitSet(code, absBits))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (code >= ABS_HAT0X && code <= ABS_HAT3Y)
|
||||||
|
{
|
||||||
|
linjs.absMap[code] = hatCount;
|
||||||
|
hatCount++;
|
||||||
|
// Skip the Y axis
|
||||||
|
code++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ioctl(linjs.fd, EVIOCGABS(code), &linjs.absInfo[code]) < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
linjs.absMap[code] = axisCount;
|
||||||
|
axisCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_GLFWjoystick* js =
|
||||||
|
_glfwAllocJoystick(name, guid, axisCount, buttonCount, hatCount);
|
||||||
|
if (!js)
|
||||||
|
{
|
||||||
|
close(linjs.fd);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
strncpy(linjs.path, path, sizeof(linjs.path) - 1);
|
||||||
|
memcpy(&js->linjs, &linjs, sizeof(linjs));
|
||||||
|
|
||||||
|
pollAbsState(js);
|
||||||
|
|
||||||
|
_glfwInputJoystick(js, GLFW_CONNECTED);
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef isBitSet
|
||||||
|
|
||||||
|
// Frees all resources associated with the specified joystick
|
||||||
|
//
|
||||||
|
static void closeJoystick(_GLFWjoystick* js)
|
||||||
|
{
|
||||||
|
_glfwInputJoystick(js, GLFW_DISCONNECTED);
|
||||||
|
close(js->linjs.fd);
|
||||||
|
_glfwFreeJoystick(js);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lexically compare joysticks by name; used by qsort
|
||||||
|
//
|
||||||
|
static int compareJoysticks(const void* fp, const void* sp)
|
||||||
|
{
|
||||||
|
const _GLFWjoystick* fj = fp;
|
||||||
|
const _GLFWjoystick* sj = sp;
|
||||||
|
return strcmp(fj->linjs.path, sj->linjs.path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW internal API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void _glfwDetectJoystickConnectionLinux(void)
|
||||||
|
{
|
||||||
|
if (_glfw.linjs.inotify <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ssize_t offset = 0;
|
||||||
|
char buffer[16384];
|
||||||
|
const ssize_t size = read(_glfw.linjs.inotify, buffer, sizeof(buffer));
|
||||||
|
|
||||||
|
while (size > offset)
|
||||||
|
{
|
||||||
|
regmatch_t match;
|
||||||
|
const struct inotify_event* e = (struct inotify_event*) (buffer + offset);
|
||||||
|
|
||||||
|
offset += sizeof(struct inotify_event) + e->len;
|
||||||
|
|
||||||
|
if (regexec(&_glfw.linjs.regex, e->name, 1, &match, 0) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
char path[PATH_MAX];
|
||||||
|
snprintf(path, sizeof(path), "/dev/input/%s", e->name);
|
||||||
|
|
||||||
|
if (e->mask & (IN_CREATE | IN_ATTRIB))
|
||||||
|
openJoystickDevice(path);
|
||||||
|
else if (e->mask & IN_DELETE)
|
||||||
|
{
|
||||||
|
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
|
{
|
||||||
|
if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0)
|
||||||
|
{
|
||||||
|
closeJoystick(_glfw.joysticks + jid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW platform API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GLFWbool _glfwInitJoysticksLinux(void)
|
||||||
|
{
|
||||||
|
const char* dirname = "/dev/input";
|
||||||
|
|
||||||
|
_glfw.linjs.inotify = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
|
||||||
|
if (_glfw.linjs.inotify > 0)
|
||||||
|
{
|
||||||
|
// HACK: Register for IN_ATTRIB to get notified when udev is done
|
||||||
|
// This works well in practice but the true way is libudev
|
||||||
|
|
||||||
|
_glfw.linjs.watch = inotify_add_watch(_glfw.linjs.inotify,
|
||||||
|
dirname,
|
||||||
|
IN_CREATE | IN_ATTRIB | IN_DELETE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Continue without device connection notifications if inotify fails
|
||||||
|
|
||||||
|
_glfw.linjs.regexCompiled = (regcomp(&_glfw.linjs.regex, "^event[0-9]\\+$", 0) == 0);
|
||||||
|
if (!_glfw.linjs.regexCompiled)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Linux: Failed to compile regex");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
DIR* dir = opendir(dirname);
|
||||||
|
if (dir)
|
||||||
|
{
|
||||||
|
struct dirent* entry;
|
||||||
|
|
||||||
|
while ((entry = readdir(dir)))
|
||||||
|
{
|
||||||
|
regmatch_t match;
|
||||||
|
|
||||||
|
if (regexec(&_glfw.linjs.regex, entry->d_name, 1, &match, 0) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
char path[PATH_MAX];
|
||||||
|
|
||||||
|
snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name);
|
||||||
|
|
||||||
|
if (openJoystickDevice(path))
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
closedir(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Continue with no joysticks if enumeration fails
|
||||||
|
|
||||||
|
qsort(_glfw.joysticks, count, sizeof(_GLFWjoystick), compareJoysticks);
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwTerminateJoysticksLinux(void)
|
||||||
|
{
|
||||||
|
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
|
{
|
||||||
|
_GLFWjoystick* js = _glfw.joysticks + jid;
|
||||||
|
if (js->connected)
|
||||||
|
closeJoystick(js);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.linjs.inotify > 0)
|
||||||
|
{
|
||||||
|
if (_glfw.linjs.watch > 0)
|
||||||
|
inotify_rm_watch(_glfw.linjs.inotify, _glfw.linjs.watch);
|
||||||
|
|
||||||
|
close(_glfw.linjs.inotify);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.linjs.regexCompiled)
|
||||||
|
regfree(&_glfw.linjs.regex);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode)
|
||||||
|
{
|
||||||
|
// Read all queued events (non-blocking)
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
struct input_event e;
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
if (read(js->linjs.fd, &e, sizeof(e)) < 0)
|
||||||
|
{
|
||||||
|
// Reset the joystick slot if the device was disconnected
|
||||||
|
if (errno == ENODEV)
|
||||||
|
closeJoystick(js);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.type == EV_SYN)
|
||||||
|
{
|
||||||
|
if (e.code == SYN_DROPPED)
|
||||||
|
_glfw.linjs.dropped = GLFW_TRUE;
|
||||||
|
else if (e.code == SYN_REPORT)
|
||||||
|
{
|
||||||
|
_glfw.linjs.dropped = GLFW_FALSE;
|
||||||
|
pollAbsState(js);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.linjs.dropped)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (e.type == EV_KEY)
|
||||||
|
handleKeyEvent(js, e.code, e.value);
|
||||||
|
else if (e.type == EV_ABS)
|
||||||
|
handleAbsEvent(js, e.code, e.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return js->connected;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* _glfwGetMappingNameLinux(void)
|
||||||
|
{
|
||||||
|
return "Linux";
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwUpdateGamepadGUIDLinux(char* guid)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // GLFW_BUILD_LINUX_JOYSTICK
|
||||||
|
|
||||||
64
libraries/raylib/raylib/src/external/glfw/src/linux_joystick.h
vendored
Normal file
64
libraries/raylib/raylib/src/external/glfw/src/linux_joystick.h
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 Linux - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
|
||||||
|
//
|
||||||
|
// 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 <linux/input.h>
|
||||||
|
#include <linux/limits.h>
|
||||||
|
#include <regex.h>
|
||||||
|
|
||||||
|
#define GLFW_LINUX_JOYSTICK_STATE _GLFWjoystickLinux linjs;
|
||||||
|
#define GLFW_LINUX_LIBRARY_JOYSTICK_STATE _GLFWlibraryLinux linjs;
|
||||||
|
|
||||||
|
// Linux-specific joystick data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWjoystickLinux
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
char path[PATH_MAX];
|
||||||
|
int keyMap[KEY_CNT - BTN_MISC];
|
||||||
|
int absMap[ABS_CNT];
|
||||||
|
struct input_absinfo absInfo[ABS_CNT];
|
||||||
|
int hats[4][2];
|
||||||
|
} _GLFWjoystickLinux;
|
||||||
|
|
||||||
|
// Linux-specific joystick API data
|
||||||
|
//
|
||||||
|
typedef struct _GLFWlibraryLinux
|
||||||
|
{
|
||||||
|
int inotify;
|
||||||
|
int watch;
|
||||||
|
regex_t regex;
|
||||||
|
GLFWbool regexCompiled;
|
||||||
|
GLFWbool dropped;
|
||||||
|
} _GLFWlibraryLinux;
|
||||||
|
|
||||||
|
void _glfwDetectJoystickConnectionLinux(void);
|
||||||
|
|
||||||
|
GLFWbool _glfwInitJoysticksLinux(void);
|
||||||
|
void _glfwTerminateJoysticksLinux(void);
|
||||||
|
GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode);
|
||||||
|
const char* _glfwGetMappingNameLinux(void);
|
||||||
|
void _glfwUpdateGamepadGUIDLinux(char* guid);
|
||||||
|
|
||||||
1909
libraries/raylib/raylib/src/external/glfw/src/mappings.h
vendored
Normal file
1909
libraries/raylib/raylib/src/external/glfw/src/mappings.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
82
libraries/raylib/raylib/src/external/glfw/src/mappings.h.in
vendored
Normal file
82
libraries/raylib/raylib/src/external/glfw/src/mappings.h.in
vendored
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.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, 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.
|
||||||
|
//
|
||||||
|
//========================================================================
|
||||||
|
// As mappings.h.in, this file is used by CMake to produce the mappings.h
|
||||||
|
// header file. If you are adding a GLFW specific gamepad mapping, this is
|
||||||
|
// where to put it.
|
||||||
|
//========================================================================
|
||||||
|
// As mappings.h, this provides all pre-defined gamepad mappings, including
|
||||||
|
// all available in SDL_GameControllerDB. Do not edit this file. Any gamepad
|
||||||
|
// mappings not specific to GLFW should be submitted to SDL_GameControllerDB.
|
||||||
|
// This file can be re-generated from mappings.h.in and the upstream
|
||||||
|
// gamecontrollerdb.txt with the 'update_mappings' CMake target.
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
// All gamepad mappings not labeled GLFW are copied from the
|
||||||
|
// SDL_GameControllerDB project under the following license:
|
||||||
|
//
|
||||||
|
// Simple DirectMedia Layer
|
||||||
|
// Copyright (C) 1997-2013 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, 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.
|
||||||
|
|
||||||
|
const char* _glfwDefaultMappings[] =
|
||||||
|
{
|
||||||
|
#if defined(_GLFW_WIN32)
|
||||||
|
@GLFW_WIN32_MAPPINGS@
|
||||||
|
"78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
|
||||||
|
"78696e70757402000000000000000000,XInput Wheel (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
|
||||||
|
"78696e70757403000000000000000000,XInput Arcade Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
|
||||||
|
"78696e70757404000000000000000000,XInput Flight Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
|
||||||
|
"78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
|
||||||
|
"78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
|
||||||
|
"78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
|
||||||
|
#endif // _GLFW_WIN32
|
||||||
|
|
||||||
|
#if defined(_GLFW_COCOA)
|
||||||
|
@GLFW_COCOA_MAPPINGS@
|
||||||
|
#endif // _GLFW_COCOA
|
||||||
|
|
||||||
|
#if defined(GLFW_BUILD_LINUX_JOYSTICK)
|
||||||
|
@GLFW_LINUX_MAPPINGS@
|
||||||
|
#endif // GLFW_BUILD_LINUX_JOYSTICK
|
||||||
|
};
|
||||||
|
|
||||||
548
libraries/raylib/raylib/src/external/glfw/src/monitor.c
vendored
Normal file
548
libraries/raylib/raylib/src/external/glfw/src/monitor.c
vendored
Normal file
|
|
@ -0,0 +1,548 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
|
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.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, 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"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <float.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
|
||||||
|
// Lexically compare video modes, used by qsort
|
||||||
|
//
|
||||||
|
static int compareVideoModes(const void* fp, const void* sp)
|
||||||
|
{
|
||||||
|
const GLFWvidmode* fm = fp;
|
||||||
|
const GLFWvidmode* sm = sp;
|
||||||
|
const int fbpp = fm->redBits + fm->greenBits + fm->blueBits;
|
||||||
|
const int sbpp = sm->redBits + sm->greenBits + sm->blueBits;
|
||||||
|
const int farea = fm->width * fm->height;
|
||||||
|
const int sarea = sm->width * sm->height;
|
||||||
|
|
||||||
|
// First sort on color bits per pixel
|
||||||
|
if (fbpp != sbpp)
|
||||||
|
return fbpp - sbpp;
|
||||||
|
|
||||||
|
// Then sort on screen area
|
||||||
|
if (farea != sarea)
|
||||||
|
return farea - sarea;
|
||||||
|
|
||||||
|
// Then sort on width
|
||||||
|
if (fm->width != sm->width)
|
||||||
|
return fm->width - sm->width;
|
||||||
|
|
||||||
|
// Lastly sort on refresh rate
|
||||||
|
return fm->refreshRate - sm->refreshRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieves the available modes for the specified monitor
|
||||||
|
//
|
||||||
|
static GLFWbool refreshVideoModes(_GLFWmonitor* monitor)
|
||||||
|
{
|
||||||
|
int modeCount;
|
||||||
|
GLFWvidmode* modes;
|
||||||
|
|
||||||
|
if (monitor->modes)
|
||||||
|
return GLFW_TRUE;
|
||||||
|
|
||||||
|
modes = _glfw.platform.getVideoModes(monitor, &modeCount);
|
||||||
|
if (!modes)
|
||||||
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
qsort(modes, modeCount, sizeof(GLFWvidmode), compareVideoModes);
|
||||||
|
|
||||||
|
_glfw_free(monitor->modes);
|
||||||
|
monitor->modes = modes;
|
||||||
|
monitor->modeCount = modeCount;
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW event API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Notifies shared code of a monitor connection or disconnection
|
||||||
|
//
|
||||||
|
void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement)
|
||||||
|
{
|
||||||
|
assert(monitor != NULL);
|
||||||
|
assert(action == GLFW_CONNECTED || action == GLFW_DISCONNECTED);
|
||||||
|
assert(placement == _GLFW_INSERT_FIRST || placement == _GLFW_INSERT_LAST);
|
||||||
|
|
||||||
|
if (action == GLFW_CONNECTED)
|
||||||
|
{
|
||||||
|
_glfw.monitorCount++;
|
||||||
|
_glfw.monitors =
|
||||||
|
_glfw_realloc(_glfw.monitors,
|
||||||
|
sizeof(_GLFWmonitor*) * _glfw.monitorCount);
|
||||||
|
|
||||||
|
if (placement == _GLFW_INSERT_FIRST)
|
||||||
|
{
|
||||||
|
memmove(_glfw.monitors + 1,
|
||||||
|
_glfw.monitors,
|
||||||
|
((size_t) _glfw.monitorCount - 1) * sizeof(_GLFWmonitor*));
|
||||||
|
_glfw.monitors[0] = monitor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_glfw.monitors[_glfw.monitorCount - 1] = monitor;
|
||||||
|
}
|
||||||
|
else if (action == GLFW_DISCONNECTED)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
_GLFWwindow* window;
|
||||||
|
|
||||||
|
for (window = _glfw.windowListHead; window; window = window->next)
|
||||||
|
{
|
||||||
|
if (window->monitor == monitor)
|
||||||
|
{
|
||||||
|
int width, height, xoff, yoff;
|
||||||
|
_glfw.platform.getWindowSize(window, &width, &height);
|
||||||
|
_glfw.platform.setWindowMonitor(window, NULL, 0, 0, width, height, 0);
|
||||||
|
_glfw.platform.getWindowFrameSize(window, &xoff, &yoff, NULL, NULL);
|
||||||
|
_glfw.platform.setWindowPos(window, xoff, yoff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < _glfw.monitorCount; i++)
|
||||||
|
{
|
||||||
|
if (_glfw.monitors[i] == monitor)
|
||||||
|
{
|
||||||
|
_glfw.monitorCount--;
|
||||||
|
memmove(_glfw.monitors + i,
|
||||||
|
_glfw.monitors + i + 1,
|
||||||
|
((size_t) _glfw.monitorCount - i) * sizeof(_GLFWmonitor*));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.callbacks.monitor)
|
||||||
|
_glfw.callbacks.monitor((GLFWmonitor*) monitor, action);
|
||||||
|
|
||||||
|
if (action == GLFW_DISCONNECTED)
|
||||||
|
_glfwFreeMonitor(monitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notifies shared code that a full screen window has acquired or released
|
||||||
|
// a monitor
|
||||||
|
//
|
||||||
|
void _glfwInputMonitorWindow(_GLFWmonitor* monitor, _GLFWwindow* window)
|
||||||
|
{
|
||||||
|
assert(monitor != NULL);
|
||||||
|
monitor->window = window;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW internal API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Allocates and returns a monitor object with the specified name and dimensions
|
||||||
|
//
|
||||||
|
_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = _glfw_calloc(1, sizeof(_GLFWmonitor));
|
||||||
|
monitor->widthMM = widthMM;
|
||||||
|
monitor->heightMM = heightMM;
|
||||||
|
|
||||||
|
strncpy(monitor->name, name, sizeof(monitor->name) - 1);
|
||||||
|
|
||||||
|
return monitor;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Frees a monitor object and any data associated with it
|
||||||
|
//
|
||||||
|
void _glfwFreeMonitor(_GLFWmonitor* monitor)
|
||||||
|
{
|
||||||
|
if (monitor == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_glfw.platform.freeMonitor(monitor);
|
||||||
|
|
||||||
|
_glfwFreeGammaArrays(&monitor->originalRamp);
|
||||||
|
_glfwFreeGammaArrays(&monitor->currentRamp);
|
||||||
|
|
||||||
|
_glfw_free(monitor->modes);
|
||||||
|
_glfw_free(monitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allocates red, green and blue value arrays of the specified size
|
||||||
|
//
|
||||||
|
void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size)
|
||||||
|
{
|
||||||
|
ramp->red = _glfw_calloc(size, sizeof(unsigned short));
|
||||||
|
ramp->green = _glfw_calloc(size, sizeof(unsigned short));
|
||||||
|
ramp->blue = _glfw_calloc(size, sizeof(unsigned short));
|
||||||
|
ramp->size = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Frees the red, green and blue value arrays and clears the struct
|
||||||
|
//
|
||||||
|
void _glfwFreeGammaArrays(GLFWgammaramp* ramp)
|
||||||
|
{
|
||||||
|
_glfw_free(ramp->red);
|
||||||
|
_glfw_free(ramp->green);
|
||||||
|
_glfw_free(ramp->blue);
|
||||||
|
|
||||||
|
memset(ramp, 0, sizeof(GLFWgammaramp));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Chooses the video mode most closely matching the desired one
|
||||||
|
//
|
||||||
|
const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor,
|
||||||
|
const GLFWvidmode* desired)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
unsigned int sizeDiff, leastSizeDiff = UINT_MAX;
|
||||||
|
unsigned int rateDiff, leastRateDiff = UINT_MAX;
|
||||||
|
unsigned int colorDiff, leastColorDiff = UINT_MAX;
|
||||||
|
const GLFWvidmode* current;
|
||||||
|
const GLFWvidmode* closest = NULL;
|
||||||
|
|
||||||
|
if (!refreshVideoModes(monitor))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
for (i = 0; i < monitor->modeCount; i++)
|
||||||
|
{
|
||||||
|
current = monitor->modes + i;
|
||||||
|
|
||||||
|
colorDiff = 0;
|
||||||
|
|
||||||
|
if (desired->redBits != GLFW_DONT_CARE)
|
||||||
|
colorDiff += abs(current->redBits - desired->redBits);
|
||||||
|
if (desired->greenBits != GLFW_DONT_CARE)
|
||||||
|
colorDiff += abs(current->greenBits - desired->greenBits);
|
||||||
|
if (desired->blueBits != GLFW_DONT_CARE)
|
||||||
|
colorDiff += abs(current->blueBits - desired->blueBits);
|
||||||
|
|
||||||
|
sizeDiff = abs((current->width - desired->width) *
|
||||||
|
(current->width - desired->width) +
|
||||||
|
(current->height - desired->height) *
|
||||||
|
(current->height - desired->height));
|
||||||
|
|
||||||
|
if (desired->refreshRate != GLFW_DONT_CARE)
|
||||||
|
rateDiff = abs(current->refreshRate - desired->refreshRate);
|
||||||
|
else
|
||||||
|
rateDiff = UINT_MAX - current->refreshRate;
|
||||||
|
|
||||||
|
if ((colorDiff < leastColorDiff) ||
|
||||||
|
(colorDiff == leastColorDiff && sizeDiff < leastSizeDiff) ||
|
||||||
|
(colorDiff == leastColorDiff && sizeDiff == leastSizeDiff && rateDiff < leastRateDiff))
|
||||||
|
{
|
||||||
|
closest = current;
|
||||||
|
leastSizeDiff = sizeDiff;
|
||||||
|
leastRateDiff = rateDiff;
|
||||||
|
leastColorDiff = colorDiff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return closest;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Performs lexical comparison between two @ref GLFWvidmode structures
|
||||||
|
//
|
||||||
|
int _glfwCompareVideoModes(const GLFWvidmode* fm, const GLFWvidmode* sm)
|
||||||
|
{
|
||||||
|
return compareVideoModes(fm, sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Splits a color depth into red, green and blue bit depths
|
||||||
|
//
|
||||||
|
void _glfwSplitBPP(int bpp, int* red, int* green, int* blue)
|
||||||
|
{
|
||||||
|
int delta;
|
||||||
|
|
||||||
|
// We assume that by 32 the user really meant 24
|
||||||
|
if (bpp == 32)
|
||||||
|
bpp = 24;
|
||||||
|
|
||||||
|
// Convert "bits per pixel" to red, green & blue sizes
|
||||||
|
|
||||||
|
*red = *green = *blue = bpp / 3;
|
||||||
|
delta = bpp - (*red * 3);
|
||||||
|
if (delta >= 1)
|
||||||
|
*green = *green + 1;
|
||||||
|
|
||||||
|
if (delta == 2)
|
||||||
|
*red = *red + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW public API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GLFWAPI GLFWmonitor** glfwGetMonitors(int* count)
|
||||||
|
{
|
||||||
|
assert(count != NULL);
|
||||||
|
|
||||||
|
*count = 0;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
|
*count = _glfw.monitorCount;
|
||||||
|
return (GLFWmonitor**) _glfw.monitors;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void)
|
||||||
|
{
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
|
if (!_glfw.monitorCount)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return (GLFWmonitor*) _glfw.monitors[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwGetMonitorPos(GLFWmonitor* handle, int* xpos, int* ypos)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
assert(monitor != NULL);
|
||||||
|
|
||||||
|
if (xpos)
|
||||||
|
*xpos = 0;
|
||||||
|
if (ypos)
|
||||||
|
*ypos = 0;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
_glfw.platform.getMonitorPos(monitor, xpos, ypos);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* handle,
|
||||||
|
int* xpos, int* ypos,
|
||||||
|
int* width, int* height)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
assert(monitor != NULL);
|
||||||
|
|
||||||
|
if (xpos)
|
||||||
|
*xpos = 0;
|
||||||
|
if (ypos)
|
||||||
|
*ypos = 0;
|
||||||
|
if (width)
|
||||||
|
*width = 0;
|
||||||
|
if (height)
|
||||||
|
*height = 0;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
_glfw.platform.getMonitorWorkarea(monitor, xpos, ypos, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* handle, int* widthMM, int* heightMM)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
assert(monitor != NULL);
|
||||||
|
|
||||||
|
if (widthMM)
|
||||||
|
*widthMM = 0;
|
||||||
|
if (heightMM)
|
||||||
|
*heightMM = 0;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
if (widthMM)
|
||||||
|
*widthMM = monitor->widthMM;
|
||||||
|
if (heightMM)
|
||||||
|
*heightMM = monitor->heightMM;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwGetMonitorContentScale(GLFWmonitor* handle,
|
||||||
|
float* xscale, float* yscale)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
assert(monitor != NULL);
|
||||||
|
|
||||||
|
if (xscale)
|
||||||
|
*xscale = 0.f;
|
||||||
|
if (yscale)
|
||||||
|
*yscale = 0.f;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
_glfw.platform.getMonitorContentScale(monitor, xscale, yscale);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* handle)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
assert(monitor != NULL);
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
return monitor->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor* handle, void* pointer)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
assert(monitor != NULL);
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
monitor->userPointer = pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor* handle)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
assert(monitor != NULL);
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
return monitor->userPointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun)
|
||||||
|
{
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
_GLFW_SWAP(GLFWmonitorfun, _glfw.callbacks.monitor, cbfun);
|
||||||
|
return cbfun;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
assert(monitor != NULL);
|
||||||
|
assert(count != NULL);
|
||||||
|
|
||||||
|
*count = 0;
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
|
if (!refreshVideoModes(monitor))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
*count = monitor->modeCount;
|
||||||
|
return monitor->modes;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* handle)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
assert(monitor != NULL);
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
|
if (!_glfw.platform.getVideoMode(monitor, &monitor->currentMode))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return &monitor->currentMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
unsigned short* values;
|
||||||
|
GLFWgammaramp ramp;
|
||||||
|
const GLFWgammaramp* original;
|
||||||
|
assert(handle != NULL);
|
||||||
|
assert(gamma > 0.f);
|
||||||
|
assert(gamma <= FLT_MAX);
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
if (gamma != gamma || gamma <= 0.f || gamma > FLT_MAX)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid gamma value %f", gamma);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
original = glfwGetGammaRamp(handle);
|
||||||
|
if (!original)
|
||||||
|
return;
|
||||||
|
|
||||||
|
values = _glfw_calloc(original->size, sizeof(unsigned short));
|
||||||
|
|
||||||
|
for (i = 0; i < original->size; i++)
|
||||||
|
{
|
||||||
|
float value;
|
||||||
|
|
||||||
|
// Calculate intensity
|
||||||
|
value = i / (float) (original->size - 1);
|
||||||
|
// Apply gamma curve
|
||||||
|
value = powf(value, 1.f / gamma) * 65535.f + 0.5f;
|
||||||
|
// Clamp to value range
|
||||||
|
value = fminf(value, 65535.f);
|
||||||
|
|
||||||
|
values[i] = (unsigned short) value;
|
||||||
|
}
|
||||||
|
|
||||||
|
ramp.red = values;
|
||||||
|
ramp.green = values;
|
||||||
|
ramp.blue = values;
|
||||||
|
ramp.size = original->size;
|
||||||
|
|
||||||
|
glfwSetGammaRamp(handle, &ramp);
|
||||||
|
_glfw_free(values);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
assert(monitor != NULL);
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||||
|
|
||||||
|
_glfwFreeGammaArrays(&monitor->currentRamp);
|
||||||
|
if (!_glfw.platform.getGammaRamp(monitor, &monitor->currentRamp))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return &monitor->currentRamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp)
|
||||||
|
{
|
||||||
|
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||||
|
assert(monitor != NULL);
|
||||||
|
assert(ramp != NULL);
|
||||||
|
assert(ramp->size > 0);
|
||||||
|
assert(ramp->red != NULL);
|
||||||
|
assert(ramp->green != NULL);
|
||||||
|
assert(ramp->blue != NULL);
|
||||||
|
|
||||||
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
if (ramp->size <= 0)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE,
|
||||||
|
"Invalid gamma ramp size %i",
|
||||||
|
ramp->size);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!monitor->originalRamp.size)
|
||||||
|
{
|
||||||
|
if (!_glfw.platform.getGammaRamp(monitor, &monitor->originalRamp))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfw.platform.setGammaRamp(monitor, ramp);
|
||||||
|
}
|
||||||
|
|
||||||
384
libraries/raylib/raylib/src/external/glfw/src/nsgl_context.m
vendored
Normal file
384
libraries/raylib/raylib/src/external/glfw/src/nsgl_context.m
vendored
Normal file
|
|
@ -0,0 +1,384 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 macOS - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.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, 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_COCOA)
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
static void makeContextCurrentNSGL(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
@autoreleasepool {
|
||||||
|
|
||||||
|
if (window)
|
||||||
|
[window->context.nsgl.object makeCurrentContext];
|
||||||
|
else
|
||||||
|
[NSOpenGLContext clearCurrentContext];
|
||||||
|
|
||||||
|
_glfwPlatformSetTls(&_glfw.contextSlot, window);
|
||||||
|
|
||||||
|
} // autoreleasepool
|
||||||
|
}
|
||||||
|
|
||||||
|
static void swapBuffersNSGL(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
@autoreleasepool {
|
||||||
|
|
||||||
|
// HACK: Simulate vsync with usleep as NSGL swap interval does not apply to
|
||||||
|
// windows with a non-visible occlusion state
|
||||||
|
if (window->ns.occluded)
|
||||||
|
{
|
||||||
|
int interval = 0;
|
||||||
|
[window->context.nsgl.object getValues:&interval
|
||||||
|
forParameter:NSOpenGLContextParameterSwapInterval];
|
||||||
|
|
||||||
|
if (interval > 0)
|
||||||
|
{
|
||||||
|
const double framerate = 60.0;
|
||||||
|
const uint64_t frequency = _glfwPlatformGetTimerFrequency();
|
||||||
|
const uint64_t value = _glfwPlatformGetTimerValue();
|
||||||
|
|
||||||
|
const double elapsed = value / (double) frequency;
|
||||||
|
const double period = 1.0 / framerate;
|
||||||
|
const double delay = period - fmod(elapsed, period);
|
||||||
|
|
||||||
|
usleep(floorl(delay * 1e6));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[window->context.nsgl.object flushBuffer];
|
||||||
|
|
||||||
|
} // autoreleasepool
|
||||||
|
}
|
||||||
|
|
||||||
|
static void swapIntervalNSGL(int interval)
|
||||||
|
{
|
||||||
|
@autoreleasepool {
|
||||||
|
|
||||||
|
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
||||||
|
assert(window != NULL);
|
||||||
|
|
||||||
|
[window->context.nsgl.object setValues:&interval
|
||||||
|
forParameter:NSOpenGLContextParameterSwapInterval];
|
||||||
|
|
||||||
|
} // autoreleasepool
|
||||||
|
}
|
||||||
|
|
||||||
|
static int extensionSupportedNSGL(const char* extension)
|
||||||
|
{
|
||||||
|
// There are no NSGL extensions
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GLFWglproc getProcAddressNSGL(const char* procname)
|
||||||
|
{
|
||||||
|
CFStringRef symbolName = CFStringCreateWithCString(kCFAllocatorDefault,
|
||||||
|
procname,
|
||||||
|
kCFStringEncodingASCII);
|
||||||
|
|
||||||
|
GLFWglproc symbol = CFBundleGetFunctionPointerForName(_glfw.nsgl.framework,
|
||||||
|
symbolName);
|
||||||
|
|
||||||
|
CFRelease(symbolName);
|
||||||
|
|
||||||
|
return symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void destroyContextNSGL(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
@autoreleasepool {
|
||||||
|
|
||||||
|
[window->context.nsgl.pixelFormat release];
|
||||||
|
window->context.nsgl.pixelFormat = nil;
|
||||||
|
|
||||||
|
[window->context.nsgl.object release];
|
||||||
|
window->context.nsgl.object = nil;
|
||||||
|
|
||||||
|
} // autoreleasepool
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW internal API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Initialize OpenGL support
|
||||||
|
//
|
||||||
|
GLFWbool _glfwInitNSGL(void)
|
||||||
|
{
|
||||||
|
if (_glfw.nsgl.framework)
|
||||||
|
return GLFW_TRUE;
|
||||||
|
|
||||||
|
_glfw.nsgl.framework =
|
||||||
|
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
|
||||||
|
if (_glfw.nsgl.framework == NULL)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"NSGL: Failed to locate OpenGL framework");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Terminate OpenGL support
|
||||||
|
//
|
||||||
|
void _glfwTerminateNSGL(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the OpenGL context
|
||||||
|
//
|
||||||
|
GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
||||||
|
const _GLFWctxconfig* ctxconfig,
|
||||||
|
const _GLFWfbconfig* fbconfig)
|
||||||
|
{
|
||||||
|
if (ctxconfig->client == GLFW_OPENGL_ES_API)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||||
|
"NSGL: OpenGL ES is not available via NSGL");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->major > 2)
|
||||||
|
{
|
||||||
|
if (ctxconfig->major == 3 && ctxconfig->minor < 2)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
|
"NSGL: The targeted version of macOS does not support OpenGL 3.0 or 3.1 but may support 3.2 and above");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->major >= 3 && ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
|
"NSGL: The compatibility profile is not available on macOS");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Context robustness modes (GL_KHR_robustness) are not yet supported by
|
||||||
|
// macOS but are not a hard constraint, so ignore and continue
|
||||||
|
|
||||||
|
// Context release behaviors (GL_KHR_context_flush_control) are not yet
|
||||||
|
// supported by macOS but are not a hard constraint, so ignore and continue
|
||||||
|
|
||||||
|
// Debug contexts (GL_KHR_debug) are not yet supported by macOS but are not
|
||||||
|
// a hard constraint, so ignore and continue
|
||||||
|
|
||||||
|
// No-error contexts (GL_KHR_no_error) are not yet supported by macOS but
|
||||||
|
// are not a hard constraint, so ignore and continue
|
||||||
|
|
||||||
|
#define ADD_ATTRIB(a) \
|
||||||
|
{ \
|
||||||
|
assert((size_t) index < sizeof(attribs) / sizeof(attribs[0])); \
|
||||||
|
attribs[index++] = a; \
|
||||||
|
}
|
||||||
|
#define SET_ATTRIB(a, v) { ADD_ATTRIB(a); ADD_ATTRIB(v); }
|
||||||
|
|
||||||
|
NSOpenGLPixelFormatAttribute attribs[40];
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
ADD_ATTRIB(NSOpenGLPFAAccelerated);
|
||||||
|
ADD_ATTRIB(NSOpenGLPFAClosestPolicy);
|
||||||
|
|
||||||
|
if (ctxconfig->nsgl.offline)
|
||||||
|
{
|
||||||
|
ADD_ATTRIB(NSOpenGLPFAAllowOfflineRenderers);
|
||||||
|
// NOTE: This replaces the NSSupportsAutomaticGraphicsSwitching key in
|
||||||
|
// Info.plist for unbundled applications
|
||||||
|
// HACK: This assumes that NSOpenGLPixelFormat will remain
|
||||||
|
// a straightforward wrapper of its CGL counterpart
|
||||||
|
ADD_ATTRIB(kCGLPFASupportsAutomaticGraphicsSwitching);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
|
||||||
|
if (ctxconfig->major >= 4)
|
||||||
|
{
|
||||||
|
SET_ATTRIB(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
||||||
|
if (ctxconfig->major >= 3)
|
||||||
|
{
|
||||||
|
SET_ATTRIB(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctxconfig->major <= 2)
|
||||||
|
{
|
||||||
|
if (fbconfig->auxBuffers != GLFW_DONT_CARE)
|
||||||
|
SET_ATTRIB(NSOpenGLPFAAuxBuffers, fbconfig->auxBuffers);
|
||||||
|
|
||||||
|
if (fbconfig->accumRedBits != GLFW_DONT_CARE &&
|
||||||
|
fbconfig->accumGreenBits != GLFW_DONT_CARE &&
|
||||||
|
fbconfig->accumBlueBits != GLFW_DONT_CARE &&
|
||||||
|
fbconfig->accumAlphaBits != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
const int accumBits = fbconfig->accumRedBits +
|
||||||
|
fbconfig->accumGreenBits +
|
||||||
|
fbconfig->accumBlueBits +
|
||||||
|
fbconfig->accumAlphaBits;
|
||||||
|
|
||||||
|
SET_ATTRIB(NSOpenGLPFAAccumSize, accumBits);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fbconfig->redBits != GLFW_DONT_CARE &&
|
||||||
|
fbconfig->greenBits != GLFW_DONT_CARE &&
|
||||||
|
fbconfig->blueBits != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
int colorBits = fbconfig->redBits +
|
||||||
|
fbconfig->greenBits +
|
||||||
|
fbconfig->blueBits;
|
||||||
|
|
||||||
|
// macOS needs non-zero color size, so set reasonable values
|
||||||
|
if (colorBits == 0)
|
||||||
|
colorBits = 24;
|
||||||
|
else if (colorBits < 15)
|
||||||
|
colorBits = 15;
|
||||||
|
|
||||||
|
SET_ATTRIB(NSOpenGLPFAColorSize, colorBits);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fbconfig->alphaBits != GLFW_DONT_CARE)
|
||||||
|
SET_ATTRIB(NSOpenGLPFAAlphaSize, fbconfig->alphaBits);
|
||||||
|
|
||||||
|
if (fbconfig->depthBits != GLFW_DONT_CARE)
|
||||||
|
SET_ATTRIB(NSOpenGLPFADepthSize, fbconfig->depthBits);
|
||||||
|
|
||||||
|
if (fbconfig->stencilBits != GLFW_DONT_CARE)
|
||||||
|
SET_ATTRIB(NSOpenGLPFAStencilSize, fbconfig->stencilBits);
|
||||||
|
|
||||||
|
if (fbconfig->stereo)
|
||||||
|
{
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
|
||||||
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
||||||
|
"NSGL: Stereo rendering is deprecated");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
#else
|
||||||
|
ADD_ATTRIB(NSOpenGLPFAStereo);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fbconfig->doublebuffer)
|
||||||
|
ADD_ATTRIB(NSOpenGLPFADoubleBuffer);
|
||||||
|
|
||||||
|
if (fbconfig->samples != GLFW_DONT_CARE)
|
||||||
|
{
|
||||||
|
if (fbconfig->samples == 0)
|
||||||
|
{
|
||||||
|
SET_ATTRIB(NSOpenGLPFASampleBuffers, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SET_ATTRIB(NSOpenGLPFASampleBuffers, 1);
|
||||||
|
SET_ATTRIB(NSOpenGLPFASamples, fbconfig->samples);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: All NSOpenGLPixelFormats on the relevant cards support sRGB
|
||||||
|
// framebuffer, so there's no need (and no way) to request it
|
||||||
|
|
||||||
|
ADD_ATTRIB(0);
|
||||||
|
|
||||||
|
#undef ADD_ATTRIB
|
||||||
|
#undef SET_ATTRIB
|
||||||
|
|
||||||
|
window->context.nsgl.pixelFormat =
|
||||||
|
[[NSOpenGLPixelFormat alloc] initWithAttributes:attribs];
|
||||||
|
if (window->context.nsgl.pixelFormat == nil)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
|
||||||
|
"NSGL: Failed to find a suitable pixel format");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSOpenGLContext* share = nil;
|
||||||
|
|
||||||
|
if (ctxconfig->share)
|
||||||
|
share = ctxconfig->share->context.nsgl.object;
|
||||||
|
|
||||||
|
window->context.nsgl.object =
|
||||||
|
[[NSOpenGLContext alloc] initWithFormat:window->context.nsgl.pixelFormat
|
||||||
|
shareContext:share];
|
||||||
|
if (window->context.nsgl.object == nil)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
|
"NSGL: Failed to create OpenGL context");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fbconfig->transparent)
|
||||||
|
{
|
||||||
|
GLint opaque = 0;
|
||||||
|
[window->context.nsgl.object setValues:&opaque
|
||||||
|
forParameter:NSOpenGLContextParameterSurfaceOpacity];
|
||||||
|
}
|
||||||
|
|
||||||
|
[window->ns.view setWantsBestResolutionOpenGLSurface:window->ns.scaleFramebuffer];
|
||||||
|
|
||||||
|
[window->context.nsgl.object setView:window->ns.view];
|
||||||
|
|
||||||
|
window->context.makeCurrent = makeContextCurrentNSGL;
|
||||||
|
window->context.swapBuffers = swapBuffersNSGL;
|
||||||
|
window->context.swapInterval = swapIntervalNSGL;
|
||||||
|
window->context.extensionSupported = extensionSupportedNSGL;
|
||||||
|
window->context.getProcAddress = getProcAddressNSGL;
|
||||||
|
window->context.destroy = destroyContextNSGL;
|
||||||
|
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW native API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GLFWAPI id glfwGetNSGLContext(GLFWwindow* handle)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(nil);
|
||||||
|
|
||||||
|
if (_glfw.platform.platformID != GLFW_PLATFORM_COCOA)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE,
|
||||||
|
"NSGL: Platform not initialized");
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->context.source != GLFW_NATIVE_CONTEXT_API)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
return window->context.nsgl.object;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // _GLFW_COCOA
|
||||||
|
|
||||||
264
libraries/raylib/raylib/src/external/glfw/src/null_init.c
vendored
Normal file
264
libraries/raylib/raylib/src/external/glfw/src/null_init.c
vendored
Normal file
|
|
@ -0,0 +1,264 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2016 Google Inc.
|
||||||
|
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.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, 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"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW platform API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GLFWbool _glfwConnectNull(int platformID, _GLFWplatform* platform)
|
||||||
|
{
|
||||||
|
const _GLFWplatform null =
|
||||||
|
{
|
||||||
|
.platformID = GLFW_PLATFORM_NULL,
|
||||||
|
.init = _glfwInitNull,
|
||||||
|
.terminate = _glfwTerminateNull,
|
||||||
|
.getCursorPos = _glfwGetCursorPosNull,
|
||||||
|
.setCursorPos = _glfwSetCursorPosNull,
|
||||||
|
.setCursorMode = _glfwSetCursorModeNull,
|
||||||
|
.setRawMouseMotion = _glfwSetRawMouseMotionNull,
|
||||||
|
.rawMouseMotionSupported = _glfwRawMouseMotionSupportedNull,
|
||||||
|
.createCursor = _glfwCreateCursorNull,
|
||||||
|
.createStandardCursor = _glfwCreateStandardCursorNull,
|
||||||
|
.destroyCursor = _glfwDestroyCursorNull,
|
||||||
|
.setCursor = _glfwSetCursorNull,
|
||||||
|
.getScancodeName = _glfwGetScancodeNameNull,
|
||||||
|
.getKeyScancode = _glfwGetKeyScancodeNull,
|
||||||
|
.setClipboardString = _glfwSetClipboardStringNull,
|
||||||
|
.getClipboardString = _glfwGetClipboardStringNull,
|
||||||
|
.initJoysticks = _glfwInitJoysticksNull,
|
||||||
|
.terminateJoysticks = _glfwTerminateJoysticksNull,
|
||||||
|
.pollJoystick = _glfwPollJoystickNull,
|
||||||
|
.getMappingName = _glfwGetMappingNameNull,
|
||||||
|
.updateGamepadGUID = _glfwUpdateGamepadGUIDNull,
|
||||||
|
.freeMonitor = _glfwFreeMonitorNull,
|
||||||
|
.getMonitorPos = _glfwGetMonitorPosNull,
|
||||||
|
.getMonitorContentScale = _glfwGetMonitorContentScaleNull,
|
||||||
|
.getMonitorWorkarea = _glfwGetMonitorWorkareaNull,
|
||||||
|
.getVideoModes = _glfwGetVideoModesNull,
|
||||||
|
.getVideoMode = _glfwGetVideoModeNull,
|
||||||
|
.getGammaRamp = _glfwGetGammaRampNull,
|
||||||
|
.setGammaRamp = _glfwSetGammaRampNull,
|
||||||
|
.createWindow = _glfwCreateWindowNull,
|
||||||
|
.destroyWindow = _glfwDestroyWindowNull,
|
||||||
|
.setWindowTitle = _glfwSetWindowTitleNull,
|
||||||
|
.setWindowIcon = _glfwSetWindowIconNull,
|
||||||
|
.getWindowPos = _glfwGetWindowPosNull,
|
||||||
|
.setWindowPos = _glfwSetWindowPosNull,
|
||||||
|
.getWindowSize = _glfwGetWindowSizeNull,
|
||||||
|
.setWindowSize = _glfwSetWindowSizeNull,
|
||||||
|
.setWindowSizeLimits = _glfwSetWindowSizeLimitsNull,
|
||||||
|
.setWindowAspectRatio = _glfwSetWindowAspectRatioNull,
|
||||||
|
.getFramebufferSize = _glfwGetFramebufferSizeNull,
|
||||||
|
.getWindowFrameSize = _glfwGetWindowFrameSizeNull,
|
||||||
|
.getWindowContentScale = _glfwGetWindowContentScaleNull,
|
||||||
|
.iconifyWindow = _glfwIconifyWindowNull,
|
||||||
|
.restoreWindow = _glfwRestoreWindowNull,
|
||||||
|
.maximizeWindow = _glfwMaximizeWindowNull,
|
||||||
|
.showWindow = _glfwShowWindowNull,
|
||||||
|
.hideWindow = _glfwHideWindowNull,
|
||||||
|
.requestWindowAttention = _glfwRequestWindowAttentionNull,
|
||||||
|
.focusWindow = _glfwFocusWindowNull,
|
||||||
|
.setWindowMonitor = _glfwSetWindowMonitorNull,
|
||||||
|
.windowFocused = _glfwWindowFocusedNull,
|
||||||
|
.windowIconified = _glfwWindowIconifiedNull,
|
||||||
|
.windowVisible = _glfwWindowVisibleNull,
|
||||||
|
.windowMaximized = _glfwWindowMaximizedNull,
|
||||||
|
.windowHovered = _glfwWindowHoveredNull,
|
||||||
|
.framebufferTransparent = _glfwFramebufferTransparentNull,
|
||||||
|
.getWindowOpacity = _glfwGetWindowOpacityNull,
|
||||||
|
.setWindowResizable = _glfwSetWindowResizableNull,
|
||||||
|
.setWindowDecorated = _glfwSetWindowDecoratedNull,
|
||||||
|
.setWindowFloating = _glfwSetWindowFloatingNull,
|
||||||
|
.setWindowOpacity = _glfwSetWindowOpacityNull,
|
||||||
|
.setWindowMousePassthrough = _glfwSetWindowMousePassthroughNull,
|
||||||
|
.pollEvents = _glfwPollEventsNull,
|
||||||
|
.waitEvents = _glfwWaitEventsNull,
|
||||||
|
.waitEventsTimeout = _glfwWaitEventsTimeoutNull,
|
||||||
|
.postEmptyEvent = _glfwPostEmptyEventNull,
|
||||||
|
.getEGLPlatform = _glfwGetEGLPlatformNull,
|
||||||
|
.getEGLNativeDisplay = _glfwGetEGLNativeDisplayNull,
|
||||||
|
.getEGLNativeWindow = _glfwGetEGLNativeWindowNull,
|
||||||
|
.getRequiredInstanceExtensions = _glfwGetRequiredInstanceExtensionsNull,
|
||||||
|
.getPhysicalDevicePresentationSupport = _glfwGetPhysicalDevicePresentationSupportNull,
|
||||||
|
.createWindowSurface = _glfwCreateWindowSurfaceNull
|
||||||
|
};
|
||||||
|
|
||||||
|
*platform = null;
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _glfwInitNull(void)
|
||||||
|
{
|
||||||
|
int scancode;
|
||||||
|
|
||||||
|
memset(_glfw.null.keycodes, -1, sizeof(_glfw.null.keycodes));
|
||||||
|
memset(_glfw.null.scancodes, -1, sizeof(_glfw.null.scancodes));
|
||||||
|
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_SPACE] = GLFW_KEY_SPACE;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_APOSTROPHE] = GLFW_KEY_APOSTROPHE;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_COMMA] = GLFW_KEY_COMMA;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_MINUS] = GLFW_KEY_MINUS;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_PERIOD] = GLFW_KEY_PERIOD;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_SLASH] = GLFW_KEY_SLASH;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_0] = GLFW_KEY_0;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_1] = GLFW_KEY_1;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_2] = GLFW_KEY_2;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_3] = GLFW_KEY_3;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_4] = GLFW_KEY_4;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_5] = GLFW_KEY_5;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_6] = GLFW_KEY_6;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_7] = GLFW_KEY_7;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_8] = GLFW_KEY_8;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_9] = GLFW_KEY_9;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_SEMICOLON] = GLFW_KEY_SEMICOLON;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_EQUAL] = GLFW_KEY_EQUAL;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_A] = GLFW_KEY_A;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_B] = GLFW_KEY_B;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_C] = GLFW_KEY_C;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_D] = GLFW_KEY_D;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_E] = GLFW_KEY_E;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F] = GLFW_KEY_F;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_G] = GLFW_KEY_G;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_H] = GLFW_KEY_H;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_I] = GLFW_KEY_I;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_J] = GLFW_KEY_J;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_K] = GLFW_KEY_K;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_L] = GLFW_KEY_L;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_M] = GLFW_KEY_M;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_N] = GLFW_KEY_N;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_O] = GLFW_KEY_O;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_P] = GLFW_KEY_P;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_Q] = GLFW_KEY_Q;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_R] = GLFW_KEY_R;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_S] = GLFW_KEY_S;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_T] = GLFW_KEY_T;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_U] = GLFW_KEY_U;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_V] = GLFW_KEY_V;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_W] = GLFW_KEY_W;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_X] = GLFW_KEY_X;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_Y] = GLFW_KEY_Y;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_Z] = GLFW_KEY_Z;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_LEFT_BRACKET] = GLFW_KEY_LEFT_BRACKET;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_BACKSLASH] = GLFW_KEY_BACKSLASH;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT_BRACKET] = GLFW_KEY_RIGHT_BRACKET;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_GRAVE_ACCENT] = GLFW_KEY_GRAVE_ACCENT;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_WORLD_1] = GLFW_KEY_WORLD_1;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_WORLD_2] = GLFW_KEY_WORLD_2;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_ESCAPE] = GLFW_KEY_ESCAPE;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_ENTER] = GLFW_KEY_ENTER;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_TAB] = GLFW_KEY_TAB;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_BACKSPACE] = GLFW_KEY_BACKSPACE;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_INSERT] = GLFW_KEY_INSERT;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_DELETE] = GLFW_KEY_DELETE;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT] = GLFW_KEY_RIGHT;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_LEFT] = GLFW_KEY_LEFT;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_DOWN] = GLFW_KEY_DOWN;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_UP] = GLFW_KEY_UP;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_PAGE_UP] = GLFW_KEY_PAGE_UP;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_PAGE_DOWN] = GLFW_KEY_PAGE_DOWN;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_HOME] = GLFW_KEY_HOME;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_END] = GLFW_KEY_END;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_CAPS_LOCK] = GLFW_KEY_CAPS_LOCK;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_SCROLL_LOCK] = GLFW_KEY_SCROLL_LOCK;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_NUM_LOCK] = GLFW_KEY_NUM_LOCK;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_PRINT_SCREEN] = GLFW_KEY_PRINT_SCREEN;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_PAUSE] = GLFW_KEY_PAUSE;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F1] = GLFW_KEY_F1;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F2] = GLFW_KEY_F2;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F3] = GLFW_KEY_F3;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F4] = GLFW_KEY_F4;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F5] = GLFW_KEY_F5;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F6] = GLFW_KEY_F6;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F7] = GLFW_KEY_F7;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F8] = GLFW_KEY_F8;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F9] = GLFW_KEY_F9;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F10] = GLFW_KEY_F10;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F11] = GLFW_KEY_F11;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F12] = GLFW_KEY_F12;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F13] = GLFW_KEY_F13;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F14] = GLFW_KEY_F14;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F15] = GLFW_KEY_F15;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F16] = GLFW_KEY_F16;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F17] = GLFW_KEY_F17;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F18] = GLFW_KEY_F18;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F19] = GLFW_KEY_F19;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F20] = GLFW_KEY_F20;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F21] = GLFW_KEY_F21;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F22] = GLFW_KEY_F22;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F23] = GLFW_KEY_F23;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F24] = GLFW_KEY_F24;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_F25] = GLFW_KEY_F25;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_KP_0] = GLFW_KEY_KP_0;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_KP_1] = GLFW_KEY_KP_1;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_KP_2] = GLFW_KEY_KP_2;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_KP_3] = GLFW_KEY_KP_3;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_KP_4] = GLFW_KEY_KP_4;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_KP_5] = GLFW_KEY_KP_5;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_KP_6] = GLFW_KEY_KP_6;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_KP_7] = GLFW_KEY_KP_7;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_KP_8] = GLFW_KEY_KP_8;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_KP_9] = GLFW_KEY_KP_9;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_KP_DECIMAL] = GLFW_KEY_KP_DECIMAL;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_KP_DIVIDE] = GLFW_KEY_KP_DIVIDE;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_KP_MULTIPLY] = GLFW_KEY_KP_MULTIPLY;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_KP_SUBTRACT] = GLFW_KEY_KP_SUBTRACT;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_KP_ADD] = GLFW_KEY_KP_ADD;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_KP_ENTER] = GLFW_KEY_KP_ENTER;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_KP_EQUAL] = GLFW_KEY_KP_EQUAL;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_LEFT_SHIFT] = GLFW_KEY_LEFT_SHIFT;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_LEFT_CONTROL] = GLFW_KEY_LEFT_CONTROL;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_LEFT_ALT] = GLFW_KEY_LEFT_ALT;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_LEFT_SUPER] = GLFW_KEY_LEFT_SUPER;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT_SHIFT] = GLFW_KEY_RIGHT_SHIFT;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT_CONTROL] = GLFW_KEY_RIGHT_CONTROL;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT_ALT] = GLFW_KEY_RIGHT_ALT;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT_SUPER] = GLFW_KEY_RIGHT_SUPER;
|
||||||
|
_glfw.null.keycodes[GLFW_NULL_SC_MENU] = GLFW_KEY_MENU;
|
||||||
|
|
||||||
|
for (scancode = GLFW_NULL_SC_FIRST; scancode < GLFW_NULL_SC_LAST; scancode++)
|
||||||
|
{
|
||||||
|
if (_glfw.null.keycodes[scancode] > 0)
|
||||||
|
_glfw.null.scancodes[_glfw.null.keycodes[scancode]] = scancode;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwPollMonitorsNull();
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwTerminateNull(void)
|
||||||
|
{
|
||||||
|
free(_glfw.null.clipboardString);
|
||||||
|
_glfwTerminateOSMesa();
|
||||||
|
_glfwTerminateEGL();
|
||||||
|
}
|
||||||
|
|
||||||
56
libraries/raylib/raylib/src/external/glfw/src/null_joystick.c
vendored
Normal file
56
libraries/raylib/raylib/src/external/glfw/src/null_joystick.c
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
//========================================================================
|
||||||
|
// GLFW 3.4 - www.glfw.org
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.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, 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"
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
////// GLFW platform API //////
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
GLFWbool _glfwInitJoysticksNull(void)
|
||||||
|
{
|
||||||
|
return GLFW_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwTerminateJoysticksNull(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWbool _glfwPollJoystickNull(_GLFWjoystick* js, int mode)
|
||||||
|
{
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* _glfwGetMappingNameNull(void)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
void _glfwUpdateGamepadGUIDNull(char* guid)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue