mirror of
https://github.com/gwm17/glfw.git
synced 2025-04-04 08:08:51 -04:00
Compare commits
149 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ecda86fa4f | ||
|
359f0e103c | ||
|
821873974a | ||
|
e8d4cc327d | ||
|
7f775302ae | ||
|
cb49e1821b | ||
|
9fc5fd1375 | ||
|
bb8ed627bf | ||
|
ccb54c3e05 | ||
|
7c9d0081e3 | ||
|
c3b8afc5d6 | ||
|
4df0a2b38e | ||
|
94bb2a138e | ||
|
85a27e9f74 | ||
|
5615c16439 | ||
|
8dd40f1c48 | ||
|
640e3205a9 | ||
|
dd00c6dea1 | ||
|
e8dab39625 | ||
|
9724f33038 | ||
|
8c3d2f769f | ||
|
2b1e2d2e49 | ||
|
39c5e90d94 | ||
|
365321a9af | ||
|
d8648876da | ||
|
bf9c5fcfc2 | ||
|
f25202fbfa | ||
|
b5bccd1425 | ||
|
03f2cde34e | ||
|
cd70e1bbc4 | ||
|
f318ab7467 | ||
|
db2ff13d41 | ||
|
82bd22ec29 | ||
|
bcd232e2ae | ||
|
f650a898f2 | ||
|
8c1b59f885 | ||
|
5a1512aaa0 | ||
|
b05d887968 | ||
|
e135210cb3 | ||
|
2da4adce40 | ||
|
17d727cd35 | ||
|
58c1621481 | ||
|
9db0bd45e6 | ||
|
df4bda44fc | ||
|
50218fbf7e | ||
|
3a2c0aaa27 | ||
|
2bac7ee8da | ||
|
4116db14fd | ||
|
e3c83f684f | ||
|
0ecc84182c | ||
|
b4cc6101ed | ||
|
7c33fb22fd | ||
|
52b77030e4 | ||
|
e662492169 | ||
|
b3c2023ebc | ||
|
129a5ccb19 | ||
|
25af31528c | ||
|
5ea34d62bf | ||
|
7a10e6439c | ||
|
8c46a3e9f9 | ||
|
82effcb7ba | ||
|
11db404fa1 | ||
|
5f7e5cb92b | ||
|
c5a870ebd9 | ||
|
3484aa8187 | ||
|
399c082033 | ||
|
1bf892f603 | ||
|
f9a9bb6747 | ||
|
91c6a542ff | ||
|
411d4dd51e | ||
|
161e9e1215 | ||
|
3a8d97cc3d | ||
|
afcefcb5f7 | ||
|
8c69091c59 | ||
|
857951419a | ||
|
17f1cceb32 | ||
|
3f0390b827 | ||
|
4a62820646 | ||
|
3facbd2083 | ||
|
e4e9581557 | ||
|
087110aa63 | ||
|
e30718e927 | ||
|
613b169899 | ||
|
13a4e4e810 | ||
|
a1b65e8542 | ||
|
649553cc78 | ||
|
934f0e9ff1 | ||
|
b2919dca4b | ||
|
71cfafe2f9 | ||
|
79f4ec6822 | ||
|
2032a8f0dc | ||
|
c0d1249ca2 | ||
|
2d3f388158 | ||
|
30e67357be | ||
|
116f4c831d | ||
|
1e8dc836a0 | ||
|
adcd306fbd | ||
|
b1309dd42a | ||
|
d25e19b790 | ||
|
1daf9de40f | ||
|
cfd93597ec | ||
|
8e923e592d | ||
|
9fc035a562 | ||
|
ce7cd3e288 | ||
|
452a648abb | ||
|
75b415c5b8 | ||
|
248e827673 | ||
|
95e7ad7e5b | ||
|
ff2c00091d | ||
|
b3eb6dd38b | ||
|
84fa724456 | ||
|
633ba53f2c | ||
|
898b7f9c54 | ||
|
eb466a0e0b | ||
|
8542f8dd84 | ||
|
1e12653348 | ||
|
e276f6731e | ||
|
66e06b0609 | ||
|
71a4f2d8a2 | ||
|
7b18f79ea6 | ||
|
f2208ab135 | ||
|
b962ef1241 | ||
|
5416e347ad | ||
|
16186943b4 | ||
|
b436d8e3e6 | ||
|
ad3e7c7f39 | ||
|
15f078c6ad | ||
|
e01128f32f | ||
|
051424f196 | ||
|
97393223ee | ||
|
04522580ad | ||
|
d2634896d6 | ||
|
3afb2cc8ed | ||
|
9f5c6c6e89 | ||
|
4d99045e87 | ||
|
b383e70021 | ||
|
645b8c3bba | ||
|
80935c6c27 | ||
|
73a3ef86db | ||
|
d715917add | ||
|
b596c79014 | ||
|
bc8b567d7c | ||
|
37cc51b823 | ||
|
9cc83cf07f | ||
|
e826f839a4 | ||
|
2e3b4cf898 | ||
|
6648b3d4bb | ||
|
76505355e1 | ||
|
a9343d641c |
|
@ -1,20 +1,62 @@
|
|||
image:
|
||||
- Visual Studio 2015
|
||||
- Visual Studio 2019
|
||||
branches:
|
||||
only:
|
||||
- ci
|
||||
- master
|
||||
- 3.3-stable
|
||||
skip_tags: true
|
||||
skip_commits:
|
||||
files:
|
||||
- README.md
|
||||
- LICENSE.md
|
||||
- docs/*
|
||||
environment:
|
||||
CFLAGS: /WX
|
||||
matrix:
|
||||
- BUILD_SHARED_LIBS: ON
|
||||
- BUILD_SHARED_LIBS: OFF
|
||||
- GENERATOR: MinGW Makefiles
|
||||
BUILD_SHARED_LIBS: ON
|
||||
CFLAGS: -Werror
|
||||
- GENERATOR: MinGW Makefiles
|
||||
BUILD_SHARED_LIBS: OFF
|
||||
CFLAGS: -Werror
|
||||
- GENERATOR: Visual Studio 10 2010
|
||||
BUILD_SHARED_LIBS: ON
|
||||
CFLAGS: /WX
|
||||
- GENERATOR: Visual Studio 10 2010
|
||||
BUILD_SHARED_LIBS: OFF
|
||||
CFLAGS: /WX
|
||||
- GENERATOR: Visual Studio 16 2019
|
||||
BUILD_SHARED_LIBS: ON
|
||||
CFLAGS: /WX
|
||||
- GENERATOR: Visual Studio 16 2019
|
||||
BUILD_SHARED_LIBS: OFF
|
||||
CFLAGS: /WX
|
||||
matrix:
|
||||
fast_finish: true
|
||||
build_script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% ..
|
||||
- cmake --build .
|
||||
exclude:
|
||||
- image: Visual Studio 2015
|
||||
GENERATOR: Visual Studio 16 2019
|
||||
- image: Visual Studio 2019
|
||||
GENERATOR: Visual Studio 10 2010
|
||||
- image: Visual Studio 2019
|
||||
GENERATOR: MinGW Makefiles
|
||||
for:
|
||||
-
|
||||
matrix:
|
||||
except:
|
||||
- GENERATOR: Visual Studio 10 2010
|
||||
build_script:
|
||||
- set PATH=%PATH:C:\Program Files\Git\usr\bin=C:\MinGW\bin%
|
||||
- cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
|
||||
- cmake --build build
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- GENERATOR: Visual Studio 10 2010
|
||||
build_script:
|
||||
- cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
|
||||
- cmake --build build --target glfw
|
||||
notifications:
|
||||
- provider: Email
|
||||
to:
|
||||
|
|
33
.gitignore
vendored
33
.gitignore
vendored
|
@ -1,26 +1,45 @@
|
|||
# External junk
|
||||
.DS_Store
|
||||
# The canonical out-of-tree build subdirectory
|
||||
build
|
||||
|
||||
# Visual Studio clutter
|
||||
_ReSharper*
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.suo
|
||||
*.dir
|
||||
*.vcxproj*
|
||||
*.sln
|
||||
.vs/
|
||||
.vs
|
||||
CMakeSettings.json
|
||||
Win32
|
||||
x64
|
||||
Debug
|
||||
Release
|
||||
MinSizeRel
|
||||
RelWithDebInfo
|
||||
*.xcodeproj
|
||||
*.opensdf
|
||||
|
||||
# CMake files
|
||||
# Xcode clutter
|
||||
GLFW.build
|
||||
GLFW.xcodeproj
|
||||
|
||||
# macOS clutter
|
||||
.DS_Store
|
||||
|
||||
# Makefile generator clutter
|
||||
Makefile
|
||||
|
||||
# Ninja generator clutter
|
||||
build.ninja
|
||||
rules.ninja
|
||||
.ninja_deps
|
||||
.ninja_log
|
||||
|
||||
# CMake clutter
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
CMakeDoxyfile.in
|
||||
CMakeDoxygenDefaults.cmake
|
||||
cmake_install.cmake
|
||||
cmake_uninstall.cmake
|
||||
|
||||
|
@ -80,6 +99,6 @@ tests/tearing
|
|||
tests/threads
|
||||
tests/timeout
|
||||
tests/title
|
||||
tests/vulkan
|
||||
tests/triangle-vulkan
|
||||
tests/windows
|
||||
|
||||
|
|
10
.mailmap
Normal file
10
.mailmap
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>
|
||||
|
56
.travis.yml
56
.travis.yml
|
@ -4,31 +4,47 @@ branches:
|
|||
only:
|
||||
- ci
|
||||
- master
|
||||
sudo: false
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- cmake
|
||||
- libxrandr-dev
|
||||
- libxinerama-dev
|
||||
- libxcursor-dev
|
||||
- libxi-dev
|
||||
- 3.3-stable
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
dist: xenial
|
||||
sudo: false
|
||||
name: "X11 shared library"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libxrandr-dev
|
||||
- libxinerama-dev
|
||||
- libxcursor-dev
|
||||
- libxi-dev
|
||||
env:
|
||||
- BUILD_SHARED_LIBS=ON
|
||||
- CFLAGS=-Werror
|
||||
- os: linux
|
||||
dist: xenial
|
||||
sudo: false
|
||||
name: "X11 static library"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libxrandr-dev
|
||||
- libxinerama-dev
|
||||
- libxcursor-dev
|
||||
- libxi-dev
|
||||
env:
|
||||
- BUILD_SHARED_LIBS=OFF
|
||||
- CFLAGS=-Werror
|
||||
- os: linux
|
||||
dist: xenial
|
||||
sudo: required
|
||||
name: "Wayland shared library"
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ppa:kubuntu-ppa/backports
|
||||
packages:
|
||||
- extra-cmake-modules
|
||||
- libwayland-dev
|
||||
- libxkbcommon-dev
|
||||
- libegl1-mesa-dev
|
||||
|
@ -37,10 +53,15 @@ matrix:
|
|||
- BUILD_SHARED_LIBS=ON
|
||||
- CFLAGS=-Werror
|
||||
- os: linux
|
||||
dist: xenial
|
||||
sudo: required
|
||||
name: "Wayland static library"
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ppa:kubuntu-ppa/backports
|
||||
packages:
|
||||
- extra-cmake-modules
|
||||
- libwayland-dev
|
||||
- libxkbcommon-dev
|
||||
- libegl1-mesa-dev
|
||||
|
@ -49,20 +70,27 @@ matrix:
|
|||
- BUILD_SHARED_LIBS=OFF
|
||||
- CFLAGS=-Werror
|
||||
- os: osx
|
||||
sudo: false
|
||||
name: "Cocoa shared library"
|
||||
env:
|
||||
- BUILD_SHARED_LIBS=ON
|
||||
- CFLAGS=-Werror
|
||||
- MACOSX_DEPLOYMENT_TARGET=10.8
|
||||
- os: osx
|
||||
sudo: false
|
||||
name: "Cocoa static library"
|
||||
env:
|
||||
- BUILD_SHARED_LIBS=OFF
|
||||
- CFLAGS=-Werror
|
||||
- MACOSX_DEPLOYMENT_TARGET=10.8
|
||||
script:
|
||||
- if grep -Inr '\s$' src include docs tests examples CMake *.md .gitattributes .gitignore; then echo Trailing whitespace found, aborting.; exit 1; fi
|
||||
- if grep -Inr '\s$' src include docs tests examples CMake *.md .gitattributes .gitignore; then
|
||||
echo Trailing whitespace found, aborting;
|
||||
exit 1;
|
||||
fi
|
||||
- mkdir build
|
||||
- cd build
|
||||
- if test -n "${USE_WAYLAND}";
|
||||
then wget https://mirrors.kernel.org/ubuntu/pool/universe/e/extra-cmake-modules/extra-cmake-modules_5.38.0a-0ubuntu1_amd64.deb;
|
||||
sudo dpkg -i extra-cmake-modules_5.38.0a-0ubuntu1_amd64.deb;
|
||||
- if test -n "${USE_WAYLAND}"; then
|
||||
git clone git://anongit.freedesktop.org/wayland/wayland-protocols;
|
||||
pushd wayland-protocols;
|
||||
git checkout 1.15 && ./autogen.sh --prefix=/usr && make && sudo make install;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(GLFW C)
|
||||
project(GLFW VERSION 3.3.1 LANGUAGES C)
|
||||
|
||||
set(CMAKE_LEGACY_CYGWIN_WIN32 OFF)
|
||||
|
||||
|
@ -8,12 +8,9 @@ if (POLICY CMP0054)
|
|||
cmake_policy(SET CMP0054 NEW)
|
||||
endif()
|
||||
|
||||
set(GLFW_VERSION_MAJOR "3")
|
||||
set(GLFW_VERSION_MINOR "3")
|
||||
set(GLFW_VERSION_PATCH "0")
|
||||
set(GLFW_VERSION_EXTRA "")
|
||||
set(GLFW_VERSION "${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}")
|
||||
set(GLFW_VERSION_FULL "${GLFW_VERSION}.${GLFW_VERSION_PATCH}${GLFW_VERSION_EXTRA}")
|
||||
if (POLICY CMP0077)
|
||||
cmake_policy(SET CMP0077 NEW)
|
||||
endif()
|
||||
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
|
@ -25,22 +22,16 @@ option(GLFW_INSTALL "Generate installation target" ON)
|
|||
option(GLFW_VULKAN_STATIC "Assume the Vulkan loader is linked with the application" OFF)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(CMakeDependentOption)
|
||||
|
||||
if (UNIX)
|
||||
option(GLFW_USE_OSMESA "Use OSMesa for offscreen context creation" OFF)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF)
|
||||
endif()
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
option(GLFW_USE_WAYLAND "Use Wayland for window creation" OFF)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON)
|
||||
endif()
|
||||
cmake_dependent_option(GLFW_USE_OSMESA "Use OSMesa for offscreen context creation" OFF
|
||||
"UNIX" OFF)
|
||||
cmake_dependent_option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF
|
||||
"WIN32" OFF)
|
||||
cmake_dependent_option(GLFW_USE_WAYLAND "Use Wayland for window creation" OFF
|
||||
"UNIX;NOT APPLE" OFF)
|
||||
cmake_dependent_option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON
|
||||
"MSVC" OFF)
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set(_GLFW_BUILD_DLL 1)
|
||||
|
@ -80,7 +71,7 @@ if (MSVC)
|
|||
include(CheckIncludeFile)
|
||||
check_include_file(dinput.h DINPUT_H_FOUND)
|
||||
if (NOT DINPUT_H_FOUND)
|
||||
message(FATAL_ERROR "DirectX 9 SDK not found")
|
||||
message(FATAL_ERROR "DirectX 9 headers not found; install DirectX 9 SDK")
|
||||
endif()
|
||||
# Workaround for VS 2008 not shipping with stdint.h
|
||||
list(APPEND glfw_INCLUDE_DIRS "${GLFW_SOURCE_DIR}/deps/vs2008")
|
||||
|
@ -211,29 +202,35 @@ if (_GLFW_X11)
|
|||
list(APPEND glfw_LIBRARIES "${X11_X11_LIB}" "${CMAKE_THREAD_LIBS_INIT}")
|
||||
|
||||
# Check for XRandR (modern resolution switching and gamma control)
|
||||
if (NOT X11_Xrandr_FOUND)
|
||||
message(FATAL_ERROR "The RandR headers were not found")
|
||||
if (NOT X11_Xrandr_INCLUDE_PATH)
|
||||
message(FATAL_ERROR "RandR headers not found; install libxrandr development package")
|
||||
endif()
|
||||
|
||||
# Check for Xinerama (legacy multi-monitor support)
|
||||
if (NOT X11_Xinerama_FOUND)
|
||||
message(FATAL_ERROR "The Xinerama headers were not found")
|
||||
if (NOT X11_Xinerama_INCLUDE_PATH)
|
||||
message(FATAL_ERROR "Xinerama headers not found; install libxinerama development package")
|
||||
endif()
|
||||
|
||||
# Check for Xkb (X keyboard extension)
|
||||
if (NOT X11_Xkb_FOUND)
|
||||
message(FATAL_ERROR "The X keyboard extension headers were not found")
|
||||
if (NOT X11_Xkb_INCLUDE_PATH)
|
||||
message(FATAL_ERROR "XKB headers not found; install X11 development package")
|
||||
endif()
|
||||
|
||||
# Check for Xcursor (cursor creation from RGBA images)
|
||||
if (NOT X11_Xcursor_FOUND)
|
||||
message(FATAL_ERROR "The Xcursor headers were not found")
|
||||
if (NOT X11_Xcursor_INCLUDE_PATH)
|
||||
message(FATAL_ERROR "Xcursor headers not found; install libxcursor development package")
|
||||
endif()
|
||||
|
||||
# Check for XInput (modern HID input)
|
||||
if (NOT X11_Xi_INCLUDE_PATH)
|
||||
message(FATAL_ERROR "XInput headers not found; install libxi development package")
|
||||
endif()
|
||||
|
||||
list(APPEND glfw_INCLUDE_DIRS "${X11_Xrandr_INCLUDE_PATH}"
|
||||
"${X11_Xinerama_INCLUDE_PATH}"
|
||||
"${X11_Xkb_INCLUDE_PATH}"
|
||||
"${X11_Xcursor_INCLUDE_PATH}")
|
||||
"${X11_Xcursor_INCLUDE_PATH}"
|
||||
"${X11_Xi_INCLUDE_PATH}")
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
@ -285,11 +282,10 @@ if (_GLFW_COCOA)
|
|||
list(APPEND glfw_LIBRARIES
|
||||
"-framework Cocoa"
|
||||
"-framework IOKit"
|
||||
"-framework CoreFoundation"
|
||||
"-framework CoreVideo")
|
||||
"-framework CoreFoundation")
|
||||
|
||||
set(glfw_PKG_DEPS "")
|
||||
set(glfw_PKG_LIBS "-framework Cocoa -framework IOKit -framework CoreFoundation -framework CoreVideo")
|
||||
set(glfw_PKG_LIBS "-framework Cocoa -framework IOKit -framework CoreFoundation")
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
@ -322,7 +318,7 @@ configure_package_config_file(src/glfw3Config.cmake.in
|
|||
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
||||
|
||||
write_basic_package_version_file(src/glfw3ConfigVersion.cmake
|
||||
VERSION ${GLFW_VERSION_FULL}
|
||||
VERSION ${GLFW_VERSION}
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
|
||||
configure_file(src/glfw_config.h.in src/glfw_config.h @ONLY)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
Copyright (c) 2002-2006 Marcus Geelnard
|
||||
Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
||||
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
|
||||
|
|
235
README.md
235
README.md
|
@ -11,7 +11,7 @@ application development. It provides a simple, platform-independent API for
|
|||
creating windows, contexts and surfaces, reading input, handling events, etc.
|
||||
|
||||
GLFW natively supports Windows, macOS and Linux and other Unix-like systems. On
|
||||
Linux both X11 and Wayland is supported.
|
||||
Linux both X11 and Wayland are supported.
|
||||
|
||||
GLFW is licensed under the [zlib/libpng
|
||||
license](http://www.glfw.org/license.html).
|
||||
|
@ -88,7 +88,7 @@ in the documentation for more information.
|
|||
GLFW itself depends only on the headers and libraries for your window system.
|
||||
|
||||
The (experimental) Wayland backend also depends on the `extra-cmake-modules`
|
||||
package, which is used to generated Wayland protocol headers.
|
||||
package, which is used to generate Wayland protocol headers.
|
||||
|
||||
The examples and test programs depend on a number of tiny libraries. These are
|
||||
located in the `deps/` directory.
|
||||
|
@ -118,188 +118,39 @@ information on what to include when reporting a bug.
|
|||
|
||||
## Changelog
|
||||
|
||||
- Added `glfwGetError` function for querying the last error code and its
|
||||
description (#970)
|
||||
- Added `glfwUpdateGamepadMappings` function for importing gamepad mappings in
|
||||
SDL\_GameControllerDB format (#900)
|
||||
- Added `glfwJoystickIsGamepad` function for querying whether a joystick has
|
||||
a gamepad mapping (#900)
|
||||
- Added `glfwGetJoystickGUID` function for querying the SDL compatible GUID of
|
||||
a joystick (#900)
|
||||
- Added `glfwGetGamepadName` function for querying the name provided by the
|
||||
gamepad mapping (#900)
|
||||
- Added `glfwGetGamepadState` function, `GLFW_GAMEPAD_*` and `GLFWgamepadstate`
|
||||
for retrieving gamepad input state (#900)
|
||||
- Added `glfwGetWindowContentScale`, `glfwGetMonitorContentScale` and
|
||||
`glfwSetWindowContentScaleCallback` for DPI-aware rendering
|
||||
(#235,#439,#677,#845,#898)
|
||||
- Added `glfwRequestWindowAttention` function for requesting attention from the
|
||||
user (#732,#988)
|
||||
- Added `glfwGetMonitorWorkarea` function for retrieving the monitor work area
|
||||
(#920,#989,#1322)
|
||||
- Added `glfwGetKeyScancode` function that allows retrieving platform dependent
|
||||
scancodes for keys (#830)
|
||||
- Added `glfwSetWindowMaximizeCallback` and `GLFWwindowmaximizefun` for
|
||||
receiving window maximization events (#778)
|
||||
- Added `glfwSetWindowAttrib` function for changing window attributes (#537)
|
||||
- Added `glfwGetJoystickHats` function for querying joystick hats
|
||||
(#889,#906,#934)
|
||||
- Added `glfwInitHint` for setting initialization hints
|
||||
- Added `glfwWindowHintString` for setting string type window hints (#893,#1139)
|
||||
- Added `glfwGetWindowOpacity` and `glfwSetWindowOpacity` for controlling whole
|
||||
window transparency (#1089)
|
||||
- Added `glfwSetMonitorUserPointer` and `glfwGetMonitorUserPointer` for
|
||||
per-monitor user pointers
|
||||
- Added `glfwSetJoystickUserPointer` and `glfwGetJoystickUserPointer` for
|
||||
per-joystick user pointers
|
||||
- Added `glfwGetX11SelectionString` and `glfwSetX11SelectionString`
|
||||
functions for accessing X11 primary selection (#894,#1056)
|
||||
- Added `glfwRawMouseMotionSupported` function for querying raw motion support
|
||||
(#125,#1400,#1401)
|
||||
- Added headless [OSMesa](http://mesa3d.org/osmesa.html) backend (#850)
|
||||
- Added definition of `GLAPIENTRY` to public header
|
||||
- Added `GLFW_TRANSPARENT_FRAMEBUFFER` window hint and attribute for controlling
|
||||
per-pixel framebuffer transparency (#197,#663,#715,#723,#1078)
|
||||
- Added `GLFW_HOVERED` window attribute for polling cursor hover state (#1166)
|
||||
- Added `GLFW_CENTER_CURSOR` window hint for controlling cursor centering
|
||||
(#749,#842)
|
||||
- Added `GLFW_FOCUS_ON_SHOW` window hint and attribute to control input focus
|
||||
on calling show window (#1189)
|
||||
- Added `GLFW_SCALE_TO_MONITOR` window hint for automatic window resizing
|
||||
(#676,#1115)
|
||||
- Added `GLFW_JOYSTICK_HAT_BUTTONS` init hint (#889)
|
||||
- Added `GLFW_LOCK_KEY_MODS` input mode and `GLFW_MOD_*_LOCK` mod bits (#946)
|
||||
- Added `GLFW_RAW_MOUSE_MOTION` input mode for selecting raw motion input
|
||||
(#125,#1400,#1401)
|
||||
- Added macOS specific `GLFW_COCOA_RETINA_FRAMEBUFFER` window hint
|
||||
- Added macOS specific `GLFW_COCOA_FRAME_NAME` window hint (#195)
|
||||
- Added macOS specific `GLFW_COCOA_GRAPHICS_SWITCHING` window hint (#377,#935)
|
||||
- Added macOS specific `GLFW_COCOA_CHDIR_RESOURCES` init hint
|
||||
- Added macOS specific `GLFW_COCOA_MENUBAR` init hint
|
||||
- Added X11 specific `GLFW_X11_CLASS_NAME` and `GLFW_X11_INSTANCE_NAME` window
|
||||
hints (#893,#1139)
|
||||
- Added `GLFW_INCLUDE_ES32` for including the OpenGL ES 3.2 header
|
||||
- Added `GLFW_OSMESA_CONTEXT_API` for creating OpenGL contexts with
|
||||
[OSMesa](https://www.mesa3d.org/osmesa.html) (#281)
|
||||
- Added `GenerateMappings.cmake` script for updating gamepad mappings
|
||||
- Made `glfwCreateWindowSurface` emit an error when the window has a context
|
||||
(#1194,#1205)
|
||||
- Deprecated window parameter of clipboard string functions
|
||||
- Deprecated charmods callback
|
||||
- Removed `GLFW_USE_RETINA` compile-time option
|
||||
- Removed `GLFW_USE_CHDIR` compile-time option
|
||||
- Removed `GLFW_USE_MENUBAR` compile-time option
|
||||
- Removed requirement of at least one window for `glfwWaitEvents` and
|
||||
`glfwPostEmptyEvent` (#1317)
|
||||
- Removed all dependencies on the Vulkan SDK
|
||||
- Bugfix: Calling `glfwMaximizeWindow` on a full screen window was not ignored
|
||||
- Bugfix: `GLFW_INCLUDE_VULKAN` could not be combined with the corresponding
|
||||
OpenGL and OpenGL ES header macros
|
||||
- Bugfix: `glfwGetInstanceProcAddress` returned `NULL` for
|
||||
`vkGetInstanceProcAddr` when `_GLFW_VULKAN_STATIC` was enabled
|
||||
- Bugfix: Invalid library paths were used in test and example CMake files (#930)
|
||||
- Bugfix: The scancode for synthetic key release events was always zero
|
||||
- Bugfix: The generated Doxyfile did not handle paths with spaces (#1081)
|
||||
- Bugfix: The gamma ramp generated by `glfwSetGamma` did not use the monitor
|
||||
ramp size (#1387,#1388)
|
||||
- [Win32] Added system error strings to relevant GLFW error descriptions (#733)
|
||||
- [Win32] Removed XInput circular deadzone from joystick axis data (#1045)
|
||||
- [Win32] Bugfix: Undecorated windows could not be iconified by the user (#861)
|
||||
- [Win32] Bugfix: Deadzone logic could underflow with some controllers (#910)
|
||||
- [Win32] Bugfix: `glfwVulkanSupported` emitted an error on systems with
|
||||
a loader but no ICD (#916)
|
||||
- [Win32] Bugfix: Non-iconified full sreeen windows did not prevent screen
|
||||
blanking or password enabled screensavers (#851)
|
||||
- [Win32] Bugfix: Mouse capture logic lost secondary release messages (#954)
|
||||
- [Win32] Bugfix: Monitors with no display devices were not enumerated (#960)
|
||||
- [Win32] Bugfix: Monitor events were not emitted (#784)
|
||||
- [Win32] Bugfix: The DLL was installed to the wrong directory on Cygwin (#1035)
|
||||
- [Win32] Bugfix: Normalization of axis data via XInput was incorrect (#1045)
|
||||
- [Win32] Bugfix: `glfw3native.h` would undefine a foreign `APIENTRY` (#1062)
|
||||
- [Win32] Bugfix: Disabled cursor mode prevented use of caption buttons
|
||||
(#650,#1071)
|
||||
- [Win32] Bugfix: Returned key names did not match other platforms (#943)
|
||||
- [Win32] Bugfix: Undecorated windows did not maximize to workarea (#899)
|
||||
- [Win32] Bugfix: Window was resized twice when entering full screen (#1085)
|
||||
- [Win32] Bugfix: The HID device notification was not unregistered (#1170)
|
||||
- [Win32] Bugfix: `glfwCreateWindow` activated window even with `GLFW_FOCUSED`
|
||||
hint set to false (#1179,#1180)
|
||||
- [Win32] Bugfix: The keypad equals key was reported as `GLFW_KEY_UNKNOWN`
|
||||
(#1315,#1316)
|
||||
- [Win32] Bugfix: A title bar would be drawn over undecorated windows in some
|
||||
circumstances (#1383)
|
||||
- [Win32] Bugfix: Standard cursors were not per-monitor DPI aware (#1431)
|
||||
- [X11] Replaced `_GLFW_HAS_XF86VM` compile-time option with dynamic loading
|
||||
- [X11] Bugfix: `glfwGetVideoMode` would segfault on Cygwin/X
|
||||
- [X11] Bugfix: Dynamic X11 library loading did not use full sonames (#941)
|
||||
- [X11] Bugfix: Window creation on 64-bit would read past top of stack (#951)
|
||||
- [X11] Bugfix: XDND support had multiple non-conformance issues (#968)
|
||||
- [X11] Bugfix: The RandR monitor path was disabled despite working RandR (#972)
|
||||
- [X11] Bugfix: IM-duplicated key events would leak at low polling rates (#747)
|
||||
- [X11] Bugfix: Gamma ramp setting via RandR did not validate ramp size
|
||||
- [X11] Bugfix: Key name string encoding depended on current locale (#981,#983)
|
||||
- [X11] Bugfix: Incremental reading of selections was not supported (#275)
|
||||
- [X11] Bugfix: Selection I/O reported but did not support `COMPOUND_TEXT`
|
||||
- [X11] Bugfix: Latin-1 text read from selections was not converted to UTF-8
|
||||
- [X11] Bugfix: NVidia EGL would segfault if unloaded before closing the display
|
||||
- [X11] Bugfix: Checking window maximized attrib could crash some WMs (#1356)
|
||||
- [X11] Bugfix: Update cursor position on enter event (#1366)
|
||||
- [X11] Bugfix: `glfwSetWindowMonitor` did not update hints when resizing
|
||||
non-user-resizable windows
|
||||
- [X11] Bugfix: `glfwSetWindowMonitor` did not flush output buffer in some cases
|
||||
- [X11] Bugfix: `glfwSetWindowMonitor` did not update the EWMH state of hidden
|
||||
windows (#1358)
|
||||
- [Linux] Added workaround for missing `SYN_DROPPED` in pre-2.6.39 kernel
|
||||
headers (#1196)
|
||||
- [Linux] Moved to evdev for joystick input (#906,#1005)
|
||||
- [Linux] Bugfix: Event processing did not detect joystick disconnection (#932)
|
||||
- [Linux] Bugfix: The joystick device path could be truncated (#1025)
|
||||
- [Linux] Bugfix: `glfwInit` would fail if inotify creation failed (#833)
|
||||
- [Linux] Bugfix: `strdup` was used without any required feature macro (#1055)
|
||||
- [Cocoa] Added support for Vulkan window surface creation via
|
||||
[MoltenVK](https://moltengl.com/moltenvk/) (#870)
|
||||
- [Cocoa] Added support for loading a `MainMenu.nib` when available
|
||||
- [Cocoa] Disabled automatic window tabbing for created windows (#1250)
|
||||
- [Cocoa] Bugfix: Disabling window aspect ratio would assert (#852)
|
||||
- [Cocoa] Bugfix: Window creation failed to set first responder (#876,#883)
|
||||
- [Cocoa] Bugfix: Removed use of deprecated `CGDisplayIOServicePort` function
|
||||
(#165,#192,#508,#511)
|
||||
- [Cocoa] Bugfix: Disabled use of deprecated `CGDisplayModeCopyPixelEncoding`
|
||||
function on macOS 10.12+
|
||||
- [Cocoa] Bugfix: Running in AppSandbox would emit warnings (#816,#882)
|
||||
- [Cocoa] Bugfix: Windows created after the first were not cascaded (#195)
|
||||
- [Cocoa] Bugfix: Leaving video mode with `glfwSetWindowMonitor` would set
|
||||
incorrect position and size (#748)
|
||||
- [Cocoa] Bugfix: Iconified full screen windows could not be restored (#848)
|
||||
- [Cocoa] Bugfix: Value range was ignored for joystick hats and buttons (#888)
|
||||
- [Cocoa] Bugfix: Full screen framebuffer was incorrectly sized for some video
|
||||
modes (#682)
|
||||
- [Cocoa] Bugfix: A string object for IME was updated non-idiomatically (#1050)
|
||||
- [Cocoa] Bugfix: A hidden or disabled cursor would become visible when a user
|
||||
notification was shown (#971,#1028)
|
||||
- [Cocoa] Bugfix: Some characters did not repeat due to Press and Hold (#1010)
|
||||
- [Cocoa] Bugfix: Window title was lost when full screen or undecorated (#1082)
|
||||
- [Cocoa] Bugfix: Window was resized twice when entering full screen (#1085)
|
||||
- [Cocoa] Bugfix: Duplicate size events were not filtered (#1085)
|
||||
- [Cocoa] Bugfix: Event polling did not initialize AppKit if necessary (#1218)
|
||||
- [Cocoa] Bugfix: OpenGL rendering was not visible before resize on early macOS
|
||||
10.14 (#1334,#1346)
|
||||
- [Cocoa] Bugfix: Caps Lock did not generate any key events (#1368,#1373)
|
||||
- [Cocoa] Bugfix: Some buttons for some joysticks were ignored (#1385)
|
||||
- [Cocoa] Bugfix: Analog joystick buttons were not translated correctly (#1385)
|
||||
- [Cocoa] Bugfix: OpenGL swap interval was ignored for occluded windows (#680)
|
||||
- [Cocoa] Bugfix: OpenGL swap interval was ignored on early macOS 10.14
|
||||
(#1337,#1417,#1435)
|
||||
- [Cocoa] Bugfix: The y-coordinate was incorrect for `glfwGetCursorPos` and
|
||||
`glfwSetCursorPos` (#1461)
|
||||
- [WGL] Added support for `WGL_EXT_colorspace` for OpenGL ES contexts
|
||||
- [WGL] Added support for `WGL_ARB_create_context_no_error`
|
||||
- [GLX] Added support for `GLX_ARB_create_context_no_error`
|
||||
- [GLX] Bugfix: Context creation could segfault if no GLXFBConfigs were
|
||||
available (#1040)
|
||||
- [EGL] Added support for `EGL_KHR_get_all_proc_addresses` (#871)
|
||||
- [EGL] Added support for `EGL_KHR_context_flush_control`
|
||||
- [EGL] Bugfix: The test for `EGL_RGB_BUFFER` was invalid
|
||||
- Bugfix: The CMake config-file package used an absolute path and was not
|
||||
relocatable (#1470)
|
||||
- Bugfix: Video modes with a duplicate screen area were discarded (#1555,#1556)
|
||||
- Bugfix: Compiling with -Wextra-semi caused warnings (#1440)
|
||||
- Bugfix: Built-in mappings failed because some OEMs re-used VID/PID (#1583)
|
||||
- [Win32] Bugfix: `GLFW_INCLUDE_VULKAN` plus `VK_USE_PLATFORM_WIN32_KHR` caused
|
||||
symbol redefinition (#1524)
|
||||
- [Win32] Bugfix: The cursor position event was emitted before its cursor enter
|
||||
event (#1490)
|
||||
- [Win32] Bugfix: The window hint `GLFW_MAXIMIZED` did not move or resize the
|
||||
window (#1499)
|
||||
- [Win32] Bugfix: Disabled cursor mode interfered with some non-client actions
|
||||
- [Cocoa] Removed dependency on the CoreVideo framework
|
||||
- [Cocoa] Bugfix: `glfwSetWindowSize` used a bottom-left anchor point (#1553)
|
||||
- [Cocoa] Bugfix: Window remained on screen after destruction until event poll
|
||||
(#1412)
|
||||
- [Cocoa] Bugfix: Event processing before window creation would assert (#1543)
|
||||
- [Cocoa] Bugfix: Undecorated windows could not be iconified on recent macOS
|
||||
- [X11] Bugfix: The CMake files did not check for the XInput headers (#1480)
|
||||
- [X11] Bugfix: Key names were not updated when the keyboard layout changed
|
||||
(#1462,#1528)
|
||||
- [X11] Bugfix: Decorations could not be enabled after window creation (#1566)
|
||||
- [X11] Bugfix: Content scale fallback value could be inconsistent (#1578)
|
||||
- [X11] Bugfix: `glfwMaximizeWindow` had no effect on hidden windows
|
||||
- [X11] Bugfix: Clearing `GLFW_FLOATING` on a hidden window caused invalid read
|
||||
- [X11] Bugfix: Changing `GLFW_FLOATING` on a hidden window could silently fail
|
||||
- [X11] Bugfix: Disabled cursor mode was interrupted by indicator windows
|
||||
- [X11] Bugfix: Monitor physical dimensions could be reported as zero mm
|
||||
- [X11] Bugfix: Window position events were not emitted during resizing (#1613)
|
||||
- [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432)
|
||||
- [NSGL] Bugfix: `GLFW_COCOA_RETINA_FRAMEBUFFER` had no effect on newer
|
||||
macOS versions (#1442)
|
||||
- [NSGL] Bugfix: Workaround for swap interval on 10.14 broke on 10.12 (#1483)
|
||||
|
||||
|
||||
## Contact
|
||||
|
@ -308,7 +159,7 @@ On [glfw.org](http://www.glfw.org/) you can find the latest version of GLFW, as
|
|||
well as news, documentation and other information about the project.
|
||||
|
||||
If you have questions related to the use of GLFW, we have a
|
||||
[forum](http://discourse.glfw.org/), and the `#glfw` IRC channel on
|
||||
[forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on
|
||||
[Freenode](http://freenode.net/).
|
||||
|
||||
If you have a bug to report, a patch to submit or a feature you'd like to
|
||||
|
@ -338,6 +189,7 @@ skills.
|
|||
- blanco
|
||||
- Kyle Brenneman
|
||||
- Rok Breulj
|
||||
- Kai Burjack
|
||||
- Martin Capitanio
|
||||
- David Carlier
|
||||
- Arturo Castro
|
||||
|
@ -370,6 +222,8 @@ skills.
|
|||
- Mário Freitas
|
||||
- GeO4d
|
||||
- Marcus Geelnard
|
||||
- Charles Giessen
|
||||
- Ryan C. Gordon
|
||||
- Stephen Gowen
|
||||
- Kovid Goyal
|
||||
- Eloi Marín Gratacós
|
||||
|
@ -381,6 +235,7 @@ skills.
|
|||
- Lucas Hinderberger
|
||||
- Paul Holden
|
||||
- Warren Hu
|
||||
- Charles Huber
|
||||
- IntellectualKitty
|
||||
- Aaron Jacobs
|
||||
- Erik S. V. Jansson
|
||||
|
@ -393,13 +248,17 @@ skills.
|
|||
- Peter Knut
|
||||
- Christoph Kubisch
|
||||
- Yuri Kunde Schlesner
|
||||
- Rokas Kupstys
|
||||
- Konstantin Käfer
|
||||
- Eric Larson
|
||||
- Robin Leffmann
|
||||
- Glenn Lewis
|
||||
- Shane Liesegang
|
||||
- Anders Lindqvist
|
||||
- Leon Linhart
|
||||
- Eyal Lotem
|
||||
- Aaron Loucks
|
||||
- Luflosi
|
||||
- Tristam MacDonald
|
||||
- Hans Mackowiak
|
||||
- Дмитри Малышев
|
||||
|
@ -412,6 +271,7 @@ skills.
|
|||
- Jonathan Mercier
|
||||
- Marcel Metz
|
||||
- Liam Middlebrook
|
||||
- Ave Milia
|
||||
- Jonathan Miller
|
||||
- Kenneth Miller
|
||||
- Bruce Mitchener
|
||||
|
@ -439,9 +299,13 @@ skills.
|
|||
- Cyril Pichard
|
||||
- Keith Pitt
|
||||
- Stanislav Podgorskiy
|
||||
- Konstantin Podsvirov
|
||||
- Nathan Poirier
|
||||
- Alexandre Pretyman
|
||||
- Pablo Prietz
|
||||
- przemekmirek
|
||||
- pthom
|
||||
- Guillaume Racicot
|
||||
- Philip Rideout
|
||||
- Eddie Ringle
|
||||
- Max Risuhin
|
||||
|
@ -490,6 +354,7 @@ skills.
|
|||
- Jay Weisskopf
|
||||
- Frank Wille
|
||||
- Ryogo Yoshimura
|
||||
- Lukas Zanner
|
||||
- Andrey Zholos
|
||||
- Santi Zupancic
|
||||
- Jonas Ådahl
|
||||
|
|
|
@ -1,24 +1,27 @@
|
|||
|
||||
set(glfw_DOCS_SOURCES
|
||||
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h"
|
||||
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h"
|
||||
"${GLFW_SOURCE_DIR}/docs/main.dox"
|
||||
"${GLFW_SOURCE_DIR}/docs/news.dox"
|
||||
"${GLFW_SOURCE_DIR}/docs/quick.dox"
|
||||
"${GLFW_SOURCE_DIR}/docs/moving.dox"
|
||||
"${GLFW_SOURCE_DIR}/docs/compile.dox"
|
||||
"${GLFW_SOURCE_DIR}/docs/build.dox"
|
||||
"${GLFW_SOURCE_DIR}/docs/intro.dox"
|
||||
"${GLFW_SOURCE_DIR}/docs/context.dox"
|
||||
"${GLFW_SOURCE_DIR}/docs/monitor.dox"
|
||||
"${GLFW_SOURCE_DIR}/docs/window.dox"
|
||||
"${GLFW_SOURCE_DIR}/docs/input.dox"
|
||||
"${GLFW_SOURCE_DIR}/docs/vulkan.dox"
|
||||
"${GLFW_SOURCE_DIR}/docs/compat.dox"
|
||||
"${GLFW_SOURCE_DIR}/docs/internal.dox")
|
||||
# NOTE: The order of this list determines the order of items in the Guides
|
||||
# (i.e. Pages) list in the generated documentation
|
||||
set(GLFW_DOXYGEN_SOURCES
|
||||
"include/GLFW/glfw3.h"
|
||||
"include/GLFW/glfw3native.h"
|
||||
"docs/main.dox"
|
||||
"docs/news.dox"
|
||||
"docs/quick.dox"
|
||||
"docs/moving.dox"
|
||||
"docs/compile.dox"
|
||||
"docs/build.dox"
|
||||
"docs/intro.dox"
|
||||
"docs/context.dox"
|
||||
"docs/monitor.dox"
|
||||
"docs/window.dox"
|
||||
"docs/input.dox"
|
||||
"docs/vulkan.dox"
|
||||
"docs/compat.dox"
|
||||
"docs/internal.dox")
|
||||
|
||||
foreach(arg ${glfw_DOCS_SOURCES})
|
||||
set(GLFW_DOCS_SOURCES "${GLFW_DOCS_SOURCES} \\\n\"${arg}\"")
|
||||
# Format the source list into a Doxyfile INPUT value that Doxygen can parse
|
||||
foreach(path IN LISTS GLFW_DOXYGEN_SOURCES)
|
||||
set(GLFW_DOXYGEN_INPUT "${GLFW_DOXYGEN_INPUT} \\\n\"${GLFW_SOURCE_DIR}/${path}\"")
|
||||
endforeach()
|
||||
|
||||
configure_file(Doxyfile.in Doxyfile @ONLY)
|
||||
|
|
10
docs/CODEOWNERS
Normal file
10
docs/CODEOWNERS
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
* @elmindreda
|
||||
|
||||
src/wl_* @linkmauve
|
||||
|
||||
docs/*.css @glfw/webdev
|
||||
docs/*.less @glfw/webdev
|
||||
docs/*.html @glfw/webdev
|
||||
docs/*.xml @glfw/webdev
|
||||
|
|
@ -20,14 +20,14 @@
|
|||
## Asking a question
|
||||
|
||||
Questions about how to use GLFW should be asked either in the [support
|
||||
section](http://discourse.glfw.org/c/support) of the forum, under the [Stack
|
||||
section](https://discourse.glfw.org/c/support) of the forum, under the [Stack
|
||||
Overflow tag](https://stackoverflow.com/questions/tagged/glfw) or [Game
|
||||
Development tag](https://gamedev.stackexchange.com/questions/tagged/glfw) on
|
||||
Stack Exchange or in the IRC channel `#glfw` on
|
||||
[Freenode](http://freenode.net/).
|
||||
|
||||
Questions about the design or implementation of GLFW or about future plans
|
||||
should be asked in the [dev section](http://discourse.glfw.org/c/dev) of the
|
||||
should be asked in the [dev section](https://discourse.glfw.org/c/dev) of the
|
||||
forum or in the IRC channel. Please don't open a GitHub issue to discuss design
|
||||
questions without first checking with a maintainer.
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ PROJECT_NAME = "GLFW"
|
|||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = @GLFW_VERSION_FULL@
|
||||
PROJECT_NUMBER = @GLFW_VERSION@
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer
|
||||
|
@ -200,6 +200,7 @@ ALIASES = "thread_safety=@par Thread safety^^" \
|
|||
"analysis=@par Analysis^^" \
|
||||
"reentrancy=@par Reentrancy^^" \
|
||||
"errors=@par Errors^^" \
|
||||
"callback_signature=@par Callback signature^^" \
|
||||
"glfw3=__GLFW 3:__" \
|
||||
"x11=__X11:__" \
|
||||
"wayland=__Wayland:__" \
|
||||
|
@ -662,7 +663,7 @@ WARN_LOGFILE = "@GLFW_BINARY_DIR@/docs/warnings.txt"
|
|||
# directories like "/usr/src/myproject". Separate the files or directories
|
||||
# with spaces.
|
||||
|
||||
INPUT = @GLFW_DOCS_SOURCES@
|
||||
INPUT = @GLFW_DOXYGEN_INPUT@
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
|
||||
|
@ -1631,11 +1632,6 @@ ALLEXTERNALS = NO
|
|||
|
||||
EXTERNAL_GROUPS = YES
|
||||
|
||||
# The PERL_PATH should be the absolute path and name of the perl script
|
||||
# interpreter (i.e. the result of `which perl').
|
||||
|
||||
PERL_PATH = /usr/bin/perl
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
|
@ -1648,15 +1644,6 @@ PERL_PATH = /usr/bin/perl
|
|||
|
||||
CLASS_DIAGRAMS = YES
|
||||
|
||||
# You can define message sequence charts within doxygen comments using the \msc
|
||||
# command. Doxygen will then run the mscgen tool (see
|
||||
# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
|
||||
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
|
||||
# the mscgen tool resides. If left empty the tool is assumed to be found in the
|
||||
# default search path.
|
||||
|
||||
MSCGEN_PATH =
|
||||
|
||||
# If set to YES, the inheritance and collaboration graphs will hide
|
||||
# inheritance and usage relations if the target is undocumented
|
||||
# or is not a class.
|
||||
|
@ -1727,7 +1714,7 @@ UML_LOOK = NO
|
|||
# the class node. If there are many fields or methods and many nodes the
|
||||
# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
|
||||
# threshold limits the number of items for each type to make the size more
|
||||
# managable. Set this to 0 for no limit. Note that the threshold may be
|
||||
# manageable. Set this to 0 for no limit. Note that the threshold may be
|
||||
# exceeded by 50% before the limit is enforced.
|
||||
|
||||
UML_LIMIT_NUM_FIELDS = 10
|
||||
|
|
14
docs/SUPPORT.md
Normal file
14
docs/SUPPORT.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
# Support resources
|
||||
|
||||
See the [latest documentation](http://www.glfw.org/docs/latest/) for tutorials,
|
||||
guides and the API reference.
|
||||
|
||||
If you have questions about using GLFW, we have a
|
||||
[forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on
|
||||
[Freenode](http://freenode.net/).
|
||||
|
||||
Bugs are reported to our [issue tracker](https://github.com/glfw/glfw/issues).
|
||||
Please check the [contribution
|
||||
guide](https://github.com/glfw/glfw/blob/master/docs/CONTRIBUTING.md) for
|
||||
information on what to include when reporting a bug.
|
||||
|
|
@ -354,8 +354,8 @@ If you are using the dynamic library version of GLFW, add it to the project
|
|||
dependencies.
|
||||
|
||||
If you are using the static library version of GLFW, add it and the Cocoa,
|
||||
OpenGL, IOKit and CoreVideo frameworks to the project as dependencies. They can
|
||||
all be found in `/System/Library/Frameworks`.
|
||||
OpenGL and IOKit frameworks to the project as dependencies. They can all be
|
||||
found in `/System/Library/Frameworks`.
|
||||
|
||||
|
||||
@subsection build_link_osx With command-line on macOS
|
||||
|
@ -369,7 +369,7 @@ the `-l` and `-framework` switches.
|
|||
If you are using the dynamic GLFW library, which is named `libglfw.3.dylib`, do:
|
||||
|
||||
@code{.sh}
|
||||
cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo
|
||||
cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit
|
||||
@endcode
|
||||
|
||||
If you are using the static library, named `libglfw3.a`, substitute `-lglfw3`
|
||||
|
|
|
@ -864,31 +864,32 @@ GLFW provides high-resolution time input, in seconds, with @ref glfwGetTime.
|
|||
double seconds = glfwGetTime();
|
||||
@endcode
|
||||
|
||||
It returns the number of seconds since the timer was started when the library
|
||||
was initialized with @ref glfwInit. The platform-specific time sources used
|
||||
usually have micro- or nanosecond resolution.
|
||||
It returns the number of seconds since the library was initialized with @ref
|
||||
glfwInit. The platform-specific time sources used typically have micro- or
|
||||
nanosecond resolution.
|
||||
|
||||
You can modify the reference time with @ref glfwSetTime.
|
||||
You can modify the base time with @ref glfwSetTime.
|
||||
|
||||
@code
|
||||
glfwSetTime(4.0);
|
||||
@endcode
|
||||
|
||||
This sets the timer to the specified time, in seconds.
|
||||
This sets the time to the specified time, in seconds, and it continues to count
|
||||
from there.
|
||||
|
||||
You can also access the raw timer value, measured in 1 / frequency
|
||||
seconds, with @ref glfwGetTimerValue.
|
||||
You can also access the raw timer used to implement the functions above,
|
||||
with @ref glfwGetTimerValue.
|
||||
|
||||
@code
|
||||
uint64_t value = glfwGetTimerValue();
|
||||
@endcode
|
||||
|
||||
The frequency of the raw timer varies depending on what time sources are
|
||||
available on the machine. You can query its frequency, in Hz, with @ref
|
||||
glfwGetTimerFrequency.
|
||||
This value is in 1 / frequency seconds. The frequency of the raw
|
||||
timer varies depending on the operating system and hardware. You can query the
|
||||
frequency, in Hz, with @ref glfwGetTimerFrequency.
|
||||
|
||||
@code
|
||||
uint64_t freqency = glfwGetTimerFrequency();
|
||||
uint64_t frequency = glfwGetTimerFrequency();
|
||||
@endcode
|
||||
|
||||
|
||||
|
|
|
@ -94,8 +94,8 @@ for a disconnected monitor and only before the monitor callback returns.
|
|||
@section monitor_properties Monitor properties
|
||||
|
||||
Each monitor has a current video mode, a list of supported video modes,
|
||||
a virtual position, a human-readable name, a user pointer, an estimated physical
|
||||
size and a gamma ramp.
|
||||
a virtual position, a content scale, a human-readable name, a user pointer, an
|
||||
estimated physical size and a gamma ramp.
|
||||
|
||||
|
||||
@subsection monitor_modes Video modes
|
||||
|
|
|
@ -337,7 +337,7 @@ presses _Escape_ or closes the window.
|
|||
The program above can be found in the
|
||||
[source package](https://www.glfw.org/download.html) as `examples/simple.c`
|
||||
and is compiled along with all other examples when you build GLFW. If you
|
||||
built GLFW from the source package then already have this as `simple.exe` on
|
||||
built GLFW from the source package then you already have this as `simple.exe` on
|
||||
Windows, `simple` on Linux or `simple.app` on macOS.
|
||||
|
||||
This tutorial used only a few of the many functions GLFW provides. There are
|
||||
|
|
|
@ -234,6 +234,13 @@ alpha channel will be used to combine the framebuffer with the background. This
|
|||
does not affect window decorations. Possible values are `GLFW_TRUE` and
|
||||
`GLFW_FALSE`.
|
||||
|
||||
@par
|
||||
@win32 GLFW sets a color key for the window to work around repainting issues
|
||||
with a transparent framebuffer. The chosen color value is RGB 255,0,255
|
||||
(magenta). This will make pixels with that exact color fully transparent
|
||||
regardless of their alpha values. If this is a problem, make these pixels any
|
||||
other color before buffer swap.
|
||||
|
||||
@anchor GLFW_FOCUS_ON_SHOW_hint
|
||||
__GLFW_FOCUS_ON_SHOW__ specifies whether the window will be given input
|
||||
focus when @ref glfwShowWindow is called. Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
|
||||
|
@ -1332,6 +1339,21 @@ unknown or the context is an OpenGL ES context. Note that the returned profile
|
|||
may not match the profile bits of the context flags, as GLFW will try other
|
||||
means of detecting the profile when no bits are set.
|
||||
|
||||
@anchor GLFW_CONTEXT_RELEASE_BEHAVIOR_attrib
|
||||
__GLFW_CONTEXT_RELEASE_BEHAVIOR__ indicates the release used by the context.
|
||||
Possible values are one of `GLFW_ANY_RELEASE_BEHAVIOR`,
|
||||
`GLFW_RELEASE_BEHAVIOR_FLUSH` or `GLFW_RELEASE_BEHAVIOR_NONE`. If the
|
||||
behavior is `GLFW_ANY_RELEASE_BEHAVIOR`, the default behavior of the context
|
||||
creation API will be used. If the behavior is `GLFW_RELEASE_BEHAVIOR_FLUSH`,
|
||||
the pipeline will be flushed whenever the context is released from being the
|
||||
current one. If the behavior is `GLFW_RELEASE_BEHAVIOR_NONE`, the pipeline will
|
||||
not be flushed on release.
|
||||
|
||||
@anchor GLFW_CONTEXT_NO_ERROR_attrib
|
||||
__GLFW_CONTEXT_NO_ERROR__ indicates whether errors are generated by the context.
|
||||
Possible values are `GLFW_TRUE` and `GLFW_FALSE`. If enabled, situations that
|
||||
would have generated errors instead cause undefined behavior.
|
||||
|
||||
@anchor GLFW_CONTEXT_ROBUSTNESS_attrib
|
||||
__GLFW_CONTEXT_ROBUSTNESS__ indicates the robustness strategy used by the
|
||||
context. This is `GLFW_LOSE_CONTEXT_ON_RESET` or `GLFW_NO_RESET_NOTIFICATION`
|
||||
|
@ -1385,7 +1407,7 @@ glfwSwapBuffers(window);
|
|||
|
||||
Sometimes it can be useful to select when the buffer swap will occur. With the
|
||||
function @ref glfwSwapInterval it is possible to select the minimum number of
|
||||
monitor refreshes the driver wait should from the time @ref glfwSwapBuffers was
|
||||
monitor refreshes the driver should wait from the time @ref glfwSwapBuffers was
|
||||
called before swapping the buffers:
|
||||
|
||||
@code
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
link_libraries(glfw)
|
||||
|
||||
include_directories(${glfw_INCLUDE_DIRS} "${GLFW_SOURCE_DIR}/deps")
|
||||
include_directories("${GLFW_SOURCE_DIR}/deps")
|
||||
|
||||
if (MATH_LIBRARY)
|
||||
link_libraries("${MATH_LIBRARY}")
|
||||
|
@ -11,16 +11,21 @@ if (MSVC)
|
|||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
if (GLFW_USE_OSMESA)
|
||||
add_definitions(-DUSE_NATIVE_OSMESA)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
set(ICON glfw.rc)
|
||||
elseif (APPLE)
|
||||
set(ICON glfw.icns)
|
||||
set_source_files_properties(glfw.icns PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION "Resources")
|
||||
endif()
|
||||
|
||||
if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR
|
||||
${CMAKE_VERSION} VERSION_GREATER "3.1.0")
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
else()
|
||||
# Remove this fallback when removing support for CMake version less than 3.1
|
||||
add_compile_options("$<$<C_COMPILER_ID:AppleClang>:-std=c99>"
|
||||
"$<$<C_COMPILER_ID:Clang>:-std=c99>"
|
||||
"$<$<C_COMPILER_ID:GNU>:-std=c99>")
|
||||
|
||||
endif()
|
||||
|
||||
set(GLAD_GL "${GLFW_SOURCE_DIR}/deps/glad/gl.h"
|
||||
|
@ -45,15 +50,20 @@ if (RT_LIBRARY)
|
|||
target_link_libraries(particles "${RT_LIBRARY}")
|
||||
endif()
|
||||
|
||||
set(WINDOWS_BINARIES boing gears heightmap particles sharing simple splitview wave)
|
||||
set(GUI_ONLY_BINARIES boing gears heightmap particles sharing simple splitview
|
||||
wave)
|
||||
set(CONSOLE_BINARIES offscreen)
|
||||
|
||||
set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
|
||||
set_target_properties(${GUI_ONLY_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
|
||||
FOLDER "GLFW3/Examples")
|
||||
|
||||
if (GLFW_USE_OSMESA)
|
||||
target_compile_definitions(offscreen PRIVATE USE_NATIVE_OSMESA)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
# Tell MSVC to use main instead of WinMain for Windows subsystem executables
|
||||
set_target_properties(${WINDOWS_BINARIES} PROPERTIES
|
||||
set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES
|
||||
LINK_FLAGS "/ENTRY:mainCRTStartup")
|
||||
endif()
|
||||
|
||||
|
@ -67,10 +77,11 @@ if (APPLE)
|
|||
set_target_properties(splitview PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "SplitView")
|
||||
set_target_properties(wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave")
|
||||
|
||||
set_target_properties(${WINDOWS_BINARIES} PROPERTIES
|
||||
RESOURCE glfw.icns
|
||||
set_source_files_properties(glfw.icns PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION "Resources")
|
||||
set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION}
|
||||
MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION_FULL}
|
||||
MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION}
|
||||
MACOSX_BUNDLE_ICON_FILE glfw.icns
|
||||
MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/MacOSXBundleInfo.plist.in")
|
||||
endif()
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <math.h>
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <linmath.h>
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <stddef.h>
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
/* Map height updates */
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#if USE_NATIVE_OSMESA
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <linmath.h>
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
// Define tokens for GL_EXT_separate_specular_color if not already defined
|
||||
|
@ -443,7 +444,7 @@ static void draw_particles(GLFWwindow* window, double t, float dt)
|
|||
}
|
||||
|
||||
// Set up vertex arrays. We use interleaved arrays, which is easier to
|
||||
// handle (in most situations) and it gives a linear memeory access
|
||||
// handle (in most situations) and it gives a linear memory access
|
||||
// access pattern (which may give better performance in some
|
||||
// situations). GL_T2F_C4UB_V3F means: 2 floats for texture coords,
|
||||
// 4 ubytes for color and 3 floats for vertex coord (in that order).
|
||||
|
@ -653,7 +654,7 @@ static void draw_fountain(void)
|
|||
|
||||
|
||||
//========================================================================
|
||||
// Recursive function for building variable tesselated floor
|
||||
// Recursive function for building variable tessellated floor
|
||||
//========================================================================
|
||||
|
||||
static void tessellate_floor(float x1, float y1, float x2, float y2, int depth)
|
||||
|
@ -720,7 +721,7 @@ static void draw_floor(void)
|
|||
glMaterialfv(GL_FRONT, GL_SPECULAR, floor_specular);
|
||||
glMaterialf(GL_FRONT, GL_SHININESS, floor_shininess);
|
||||
|
||||
// Draw floor as a bunch of triangle strips (high tesselation
|
||||
// Draw floor as a bunch of triangle strips (high tessellation
|
||||
// improves lighting)
|
||||
glNormal3f(0.f, 0.f, 1.f);
|
||||
glBegin(GL_QUADS);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
//! [code]
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include "linmath.h"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// The program uses a "split window" view, rendering four views of the
|
||||
// same scene in one window (e.g. uesful for 3D modelling software). This
|
||||
// demo uses scissors to separete the four different rendering areas from
|
||||
// demo uses scissors to separate the four different rendering areas from
|
||||
// each other.
|
||||
//
|
||||
// (If the code seems a little bit strange here and there, it may be
|
||||
|
@ -11,6 +11,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <math.h>
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <linmath.h>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -73,58 +73,78 @@ if (_GLFW_X11 OR _GLFW_WAYLAND)
|
|||
endif()
|
||||
|
||||
if (APPLE)
|
||||
# For some reason, CMake doesn't know about .m
|
||||
set_source_files_properties(${glfw_SOURCES} PROPERTIES LANGUAGE C)
|
||||
endif()
|
||||
|
||||
# Make GCC and Clang warn about declarations that VS 2010 and 2012 won't accept
|
||||
# for all source files that VS will build
|
||||
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR
|
||||
"${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
|
||||
"${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang")
|
||||
|
||||
if (WIN32)
|
||||
set(windows_SOURCES ${glfw_SOURCES})
|
||||
else()
|
||||
set(windows_SOURCES ${common_SOURCES})
|
||||
endif()
|
||||
set_source_files_properties(${windows_SOURCES} PROPERTIES
|
||||
COMPILE_FLAGS -Wdeclaration-after-statement)
|
||||
# For some reason CMake didn't know about .m until version 3.16
|
||||
set_source_files_properties(cocoa_init.m cocoa_joystick.m cocoa_monitor.m
|
||||
cocoa_window.m nsgl_context.m PROPERTIES
|
||||
LANGUAGE C)
|
||||
endif()
|
||||
|
||||
add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS})
|
||||
set_target_properties(glfw PROPERTIES
|
||||
OUTPUT_NAME ${GLFW_LIB_NAME}
|
||||
VERSION ${GLFW_VERSION}
|
||||
VERSION ${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}
|
||||
SOVERSION ${GLFW_VERSION_MAJOR}
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
FOLDER "GLFW3")
|
||||
|
||||
if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR
|
||||
${CMAKE_VERSION} VERSION_GREATER "3.1.0")
|
||||
|
||||
set_target_properties(glfw PROPERTIES C_STANDARD 99)
|
||||
else()
|
||||
# Remove this fallback when removing support for CMake version less than 3.1
|
||||
target_compile_options(glfw PRIVATE
|
||||
"$<$<C_COMPILER_ID:AppleClang>:-std=c99>"
|
||||
"$<$<C_COMPILER_ID:Clang>:-std=c99>"
|
||||
"$<$<C_COMPILER_ID:GNU>:-std=c99>")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(glfw PRIVATE _GLFW_USE_CONFIG_H)
|
||||
target_include_directories(glfw PUBLIC
|
||||
"$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_FULL_INCLUDEDIR}>")
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
|
||||
target_include_directories(glfw PRIVATE
|
||||
"${GLFW_SOURCE_DIR}/src"
|
||||
"${GLFW_BINARY_DIR}/src"
|
||||
${glfw_INCLUDE_DIRS})
|
||||
target_link_libraries(glfw PRIVATE ${glfw_LIBRARIES})
|
||||
|
||||
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR
|
||||
"${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
|
||||
"${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang")
|
||||
|
||||
# Make GCC and Clang warn about declarations that VS 2010 and 2012 won't
|
||||
# accept for all source files that VS will build
|
||||
set_source_files_properties(context.c init.c input.c monitor.c vulkan.c
|
||||
window.c win32_init.c win32_joystick.c
|
||||
win32_monitor.c win32_time.c win32_thread.c
|
||||
win32_window.c wgl_context.c egl_context.c
|
||||
osmesa_context.c PROPERTIES
|
||||
COMPILE_FLAGS -Wdeclaration-after-statement)
|
||||
|
||||
# Enable a reasonable set of warnings (no, -Wextra is not reasonable)
|
||||
target_compile_options(glfw PRIVATE "-Wall")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
target_compile_definitions(glfw PRIVATE _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.
|
||||
target_compile_definitions(glfw PRIVATE
|
||||
"$<$<BOOL:${MINGW}>:UNICODE;WINVER=0x0501>")
|
||||
|
||||
# Enable a reasonable set of warnings (no, -Wextra is not reasonable)
|
||||
target_compile_options(glfw PRIVATE
|
||||
"$<$<C_COMPILER_ID:AppleClang>:-Wall>"
|
||||
"$<$<C_COMPILER_ID:Clang>:-Wall>"
|
||||
"$<$<C_COMPILER_ID:GNU>:-Wall>")
|
||||
if (MINGW)
|
||||
target_compile_definitions(glfw PRIVATE UNICODE WINVER=0x0501)
|
||||
endif()
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
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 "")
|
||||
|
||||
|
@ -134,21 +154,20 @@ if (BUILD_SHARED_LIBS)
|
|||
# Add a suffix to the import library to avoid naming conflicts
|
||||
set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.lib")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(glfw INTERFACE GLFW_DLL)
|
||||
elseif (APPLE)
|
||||
# Add -fno-common to work around a bug in Apple's GCC
|
||||
target_compile_options(glfw PRIVATE "-fno-common")
|
||||
|
||||
set_target_properties(glfw PROPERTIES
|
||||
INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}")
|
||||
elseif (UNIX)
|
||||
endif()
|
||||
|
||||
if (UNIX)
|
||||
# Hide symbols not explicitly tagged for export from the shared library
|
||||
target_compile_options(glfw PRIVATE "-fvisibility=hidden")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(glfw INTERFACE GLFW_DLL)
|
||||
target_link_libraries(glfw PRIVATE ${glfw_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries(glfw INTERFACE ${glfw_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
#include <sys/param.h> // For MAXPATHLEN
|
||||
|
@ -429,9 +431,8 @@ static GLFWbool initializeTIS(void)
|
|||
// In case we are unbundled, make us a proper UI application
|
||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||
|
||||
// Menu bar setup must go between sharedApplication above and
|
||||
// finishLaunching below, in order to properly emulate the behavior
|
||||
// of NSApplicationMain
|
||||
// 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"])
|
||||
{
|
||||
|
@ -446,9 +447,9 @@ static GLFWbool initializeTIS(void)
|
|||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
||||
{
|
||||
[NSApp stop:nil];
|
||||
|
||||
_glfw.ns.finishedLaunching = GLFW_TRUE;
|
||||
_glfwPlatformPostEmptyEvent();
|
||||
[NSApp stop:nil];
|
||||
}
|
||||
|
||||
- (void)applicationDidHide:(NSNotification *)notification
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <IOKit/hid/IOHIDKeys.h>
|
||||
|
||||
#define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickNS ns
|
||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE
|
||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyJoystick; }
|
||||
|
||||
#define _GLFW_PLATFORM_MAPPING_NAME "Mac OS X"
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -329,7 +331,7 @@ void _glfwInitJoysticksNS(void)
|
|||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < sizeof(usages) / sizeof(long); i++)
|
||||
for (size_t i = 0; i < sizeof(usages) / sizeof(long); i++)
|
||||
{
|
||||
const long page = kHIDPage_GenericDesktop;
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -142,7 +144,7 @@ static GLFWbool modeIsGood(CGDisplayModeRef mode)
|
|||
// Convert Core Graphics display mode to GLFW video mode
|
||||
//
|
||||
static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode,
|
||||
CVDisplayLinkRef link)
|
||||
double fallbackRefreshRate)
|
||||
{
|
||||
GLFWvidmode result;
|
||||
result.width = (int) CGDisplayModeGetWidth(mode);
|
||||
|
@ -150,11 +152,7 @@ static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode,
|
|||
result.refreshRate = (int) round(CGDisplayModeGetRefreshRate(mode));
|
||||
|
||||
if (result.refreshRate == 0)
|
||||
{
|
||||
const CVTime time = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(link);
|
||||
if (!(time.flags & kCVTimeIsIndefinite))
|
||||
result.refreshRate = (int) (time.timeScale / (double) time.timeValue);
|
||||
}
|
||||
result.refreshRate = (int) round(fallbackRefreshRate);
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED <= 101100
|
||||
CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
|
||||
|
@ -213,7 +211,7 @@ static void endFadeReservation(CGDisplayFadeReservationToken token)
|
|||
|
||||
// Finds and caches the NSScreen corresponding to the specified monitor
|
||||
//
|
||||
GLFWbool refreshMonitorScreen(_GLFWmonitor* monitor)
|
||||
static GLFWbool refreshMonitorScreen(_GLFWmonitor* monitor)
|
||||
{
|
||||
if (monitor->ns.screen)
|
||||
return GLFW_TRUE;
|
||||
|
@ -236,6 +234,68 @@ GLFWbool refreshMonitorScreen(_GLFWmonitor* monitor)
|
|||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
// 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(kIOMasterPortDefault,
|
||||
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);
|
||||
if (!clockRef || !countRef)
|
||||
break;
|
||||
|
||||
uint32_t clock = 0, count = 0;
|
||||
CFNumberGetValue(clockRef, kCFNumberIntType, &clock);
|
||||
CFNumberGetValue(countRef, kCFNumberIntType, &count);
|
||||
CFRelease(clockRef);
|
||||
CFRelease(countRef);
|
||||
|
||||
if (clock > 0 && count > 0)
|
||||
refreshRate = clock / (double) count;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
IOObjectRelease(it);
|
||||
return refreshRate;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW internal API //////
|
||||
|
@ -245,18 +305,16 @@ GLFWbool refreshMonitorScreen(_GLFWmonitor* monitor)
|
|||
//
|
||||
void _glfwPollMonitorsNS(void)
|
||||
{
|
||||
uint32_t i, j, displayCount, disconnectedCount;
|
||||
CGDirectDisplayID* displays;
|
||||
_GLFWmonitor** disconnected = NULL;
|
||||
|
||||
uint32_t displayCount;
|
||||
CGGetOnlineDisplayList(0, NULL, &displayCount);
|
||||
displays = calloc(displayCount, sizeof(CGDirectDisplayID));
|
||||
CGDirectDisplayID* displays = calloc(displayCount, sizeof(CGDirectDisplayID));
|
||||
CGGetOnlineDisplayList(displayCount, displays, &displayCount);
|
||||
|
||||
for (i = 0; i < _glfw.monitorCount; i++)
|
||||
for (int i = 0; i < _glfw.monitorCount; i++)
|
||||
_glfw.monitors[i]->ns.screen = nil;
|
||||
|
||||
disconnectedCount = _glfw.monitorCount;
|
||||
_GLFWmonitor** disconnected = NULL;
|
||||
uint32_t disconnectedCount = _glfw.monitorCount;
|
||||
if (disconnectedCount)
|
||||
{
|
||||
disconnected = calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
|
||||
|
@ -265,19 +323,17 @@ void _glfwPollMonitorsNS(void)
|
|||
_glfw.monitorCount * sizeof(_GLFWmonitor*));
|
||||
}
|
||||
|
||||
for (i = 0; i < displayCount; i++)
|
||||
for (uint32_t i = 0; i < displayCount; i++)
|
||||
{
|
||||
_GLFWmonitor* monitor;
|
||||
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
|
||||
|
||||
if (CGDisplayIsAsleep(displays[i]))
|
||||
continue;
|
||||
|
||||
for (j = 0; j < disconnectedCount; j++)
|
||||
// HACK: Compare unit numbers instead of display IDs to work around
|
||||
// display replacement on machines with automatic graphics
|
||||
// switching
|
||||
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
|
||||
for (uint32_t j = 0; j < disconnectedCount; j++)
|
||||
{
|
||||
// HACK: Compare unit numbers instead of display IDs to work around
|
||||
// display replacement on machines with automatic graphics
|
||||
// switching
|
||||
if (disconnected[j] && disconnected[j]->ns.unitNumber == unitNumber)
|
||||
{
|
||||
disconnected[j] = NULL;
|
||||
|
@ -290,16 +346,21 @@ void _glfwPollMonitorsNS(void)
|
|||
if (!name)
|
||||
name = _glfw_strdup("Unknown");
|
||||
|
||||
monitor = _glfwAllocMonitor(name, size.width, size.height);
|
||||
_GLFWmonitor* monitor = _glfwAllocMonitor(name, size.width, size.height);
|
||||
monitor->ns.displayID = displays[i];
|
||||
monitor->ns.unitNumber = unitNumber;
|
||||
|
||||
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 (i = 0; i < disconnectedCount; i++)
|
||||
for (uint32_t i = 0; i < disconnectedCount; i++)
|
||||
{
|
||||
if (disconnected[i])
|
||||
_glfwInputMonitor(disconnected[i], GLFW_DISCONNECTED, 0);
|
||||
|
@ -313,30 +374,25 @@ void _glfwPollMonitorsNS(void)
|
|||
//
|
||||
void _glfwSetVideoModeNS(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
||||
{
|
||||
CFArrayRef modes;
|
||||
CFIndex count, i;
|
||||
CVDisplayLinkRef link;
|
||||
CGDisplayModeRef native = NULL;
|
||||
GLFWvidmode current;
|
||||
const GLFWvidmode* best;
|
||||
|
||||
best = _glfwChooseVideoMode(monitor, desired);
|
||||
_glfwPlatformGetVideoMode(monitor, ¤t);
|
||||
|
||||
const GLFWvidmode* best = _glfwChooseVideoMode(monitor, desired);
|
||||
if (_glfwCompareVideoModes(¤t, best) == 0)
|
||||
return;
|
||||
|
||||
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
|
||||
CFArrayRef modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
|
||||
const CFIndex count = CFArrayGetCount(modes);
|
||||
CGDisplayModeRef native = NULL;
|
||||
|
||||
modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
|
||||
count = CFArrayGetCount(modes);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
for (CFIndex i = 0; i < count; i++)
|
||||
{
|
||||
CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
|
||||
if (!modeIsGood(dm))
|
||||
continue;
|
||||
|
||||
const GLFWvidmode mode = vidmodeFromCGDisplayMode(dm, link);
|
||||
const GLFWvidmode mode =
|
||||
vidmodeFromCGDisplayMode(dm, monitor->ns.fallbackRefreshRate);
|
||||
if (_glfwCompareVideoModes(best, &mode) == 0)
|
||||
{
|
||||
native = dm;
|
||||
|
@ -355,7 +411,6 @@ void _glfwSetVideoModeNS(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
|||
}
|
||||
|
||||
CFRelease(modes);
|
||||
CVDisplayLinkRelease(link);
|
||||
}
|
||||
|
||||
// Restore the previously saved (original) video mode
|
||||
|
@ -443,26 +498,21 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
CFArrayRef modes;
|
||||
CFIndex found, i, j;
|
||||
GLFWvidmode* result;
|
||||
CVDisplayLinkRef link;
|
||||
|
||||
*count = 0;
|
||||
|
||||
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
|
||||
CFArrayRef modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
|
||||
const CFIndex found = CFArrayGetCount(modes);
|
||||
GLFWvidmode* result = calloc(found, sizeof(GLFWvidmode));
|
||||
|
||||
modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
|
||||
found = CFArrayGetCount(modes);
|
||||
result = calloc(found, sizeof(GLFWvidmode));
|
||||
|
||||
for (i = 0; i < found; i++)
|
||||
for (CFIndex i = 0; i < found; i++)
|
||||
{
|
||||
CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
|
||||
if (!modeIsGood(dm))
|
||||
continue;
|
||||
|
||||
const GLFWvidmode mode = vidmodeFromCGDisplayMode(dm, link);
|
||||
const GLFWvidmode mode =
|
||||
vidmodeFromCGDisplayMode(dm, monitor->ns.fallbackRefreshRate);
|
||||
CFIndex j;
|
||||
|
||||
for (j = 0; j < *count; j++)
|
||||
{
|
||||
|
@ -479,7 +529,6 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
|
|||
}
|
||||
|
||||
CFRelease(modes);
|
||||
CVDisplayLinkRelease(link);
|
||||
return result;
|
||||
|
||||
} // autoreleasepool
|
||||
|
@ -489,16 +538,9 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode *mode)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
CGDisplayModeRef displayMode;
|
||||
CVDisplayLinkRef link;
|
||||
|
||||
CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
|
||||
|
||||
displayMode = CGDisplayCopyDisplayMode(monitor->ns.displayID);
|
||||
*mode = vidmodeFromCGDisplayMode(displayMode, link);
|
||||
CGDisplayModeRelease(displayMode);
|
||||
|
||||
CVDisplayLinkRelease(link);
|
||||
CGDisplayModeRef native = CGDisplayCopyDisplayMode(monitor->ns.displayID);
|
||||
*mode = vidmodeFromCGDisplayMode(native, monitor->ns.fallbackRefreshRate);
|
||||
CGDisplayModeRelease(native);
|
||||
|
||||
} // autoreleasepool
|
||||
}
|
||||
|
@ -507,7 +549,7 @@ GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
uint32_t i, size = CGDisplayGammaTableCapacity(monitor->ns.displayID);
|
||||
uint32_t size = CGDisplayGammaTableCapacity(monitor->ns.displayID);
|
||||
CGGammaValue* values = calloc(size * 3, sizeof(CGGammaValue));
|
||||
|
||||
CGGetDisplayTransferByTable(monitor->ns.displayID,
|
||||
|
@ -519,7 +561,7 @@ GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
|||
|
||||
_glfwAllocGammaArrays(ramp, size);
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
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);
|
||||
|
@ -536,10 +578,9 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
int i;
|
||||
CGGammaValue* values = calloc(ramp->size * 3, sizeof(CGGammaValue));
|
||||
|
||||
for (i = 0; i < ramp->size; i++)
|
||||
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;
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
#include <dlfcn.h>
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <CoreVideo/CVBase.h>
|
||||
#include <CoreVideo/CVDisplayLink.h>
|
||||
|
||||
// NOTE: All of NSGL was deprecated in the 10.14 SDK
|
||||
// This disables the pointless warnings for every symbol we use
|
||||
|
@ -41,6 +39,9 @@
|
|||
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 the other deprecated
|
||||
// We use the newer names in code and these macros to handle compatibility
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
|
||||
#define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat
|
||||
#define NSEventMaskAny NSAnyEventMask
|
||||
|
@ -139,7 +140,7 @@ typedef struct _GLFWlibraryNS
|
|||
id keyUpMonitor;
|
||||
id nibObjects;
|
||||
|
||||
char keyName[64];
|
||||
char keynames[GLFW_KEY_LAST + 1][17];
|
||||
short int keycodes[256];
|
||||
short int scancodes[GLFW_KEY_LAST + 1];
|
||||
char* clipboardString;
|
||||
|
@ -167,6 +168,7 @@ typedef struct _GLFWmonitorNS
|
|||
CGDisplayModeRef previousMode;
|
||||
uint32_t unitNumber;
|
||||
id screen;
|
||||
double fallbackRefreshRate;
|
||||
|
||||
} _GLFWmonitorNS;
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -33,15 +35,14 @@
|
|||
//
|
||||
static NSUInteger getStyleMask(_GLFWwindow* window)
|
||||
{
|
||||
NSUInteger styleMask = 0;
|
||||
NSUInteger styleMask = NSWindowStyleMaskMiniaturizable;
|
||||
|
||||
if (window->monitor || !window->decorated)
|
||||
styleMask |= NSWindowStyleMaskBorderless;
|
||||
else
|
||||
{
|
||||
styleMask |= NSWindowStyleMaskTitled |
|
||||
NSWindowStyleMaskClosable |
|
||||
NSWindowStyleMaskMiniaturizable;
|
||||
NSWindowStyleMaskClosable;
|
||||
|
||||
if (window->resizable)
|
||||
styleMask |= NSWindowStyleMaskResizable;
|
||||
|
@ -321,12 +322,6 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||
_glfwInputWindowFocus(window, GLFW_FALSE);
|
||||
}
|
||||
|
||||
- (void)windowDidChangeScreen:(NSNotification *)notification
|
||||
{
|
||||
if (window->context.source == GLFW_NATIVE_CONTEXT_API)
|
||||
_glfwUpdateDisplayLinkDisplayNSGL(window);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
@ -610,10 +605,8 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||
|
||||
- (void)scrollWheel:(NSEvent *)event
|
||||
{
|
||||
double deltaX, deltaY;
|
||||
|
||||
deltaX = [event scrollingDeltaX];
|
||||
deltaY = [event scrollingDeltaY];
|
||||
double deltaX = [event scrollingDeltaX];
|
||||
double deltaY = [event scrollingDeltaY];
|
||||
|
||||
if ([event hasPreciseScrollingDeltas])
|
||||
{
|
||||
|
@ -730,9 +723,8 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||
else
|
||||
characters = (NSString*) string;
|
||||
|
||||
NSUInteger i, length = [characters length];
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
const NSUInteger length = [characters length];
|
||||
for (NSUInteger i = 0; i < length; i++)
|
||||
{
|
||||
const unichar codepoint = [characters characterAtIndex:i];
|
||||
if ((codepoint & 0xff00) == 0xf700)
|
||||
|
@ -817,7 +809,7 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
|||
[window->ns.object setLevel:NSMainMenuWindowLevel + 1];
|
||||
else
|
||||
{
|
||||
[window->ns.object center];
|
||||
[(NSWindow*) window->ns.object center];
|
||||
_glfw.ns.cascadePoint =
|
||||
NSPointToCGPoint([window->ns.object cascadeTopLeftFromPoint:
|
||||
NSPointFromCGPoint(_glfw.ns.cascadePoint)]);
|
||||
|
@ -893,10 +885,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||
@autoreleasepool {
|
||||
|
||||
if (!_glfw.ns.finishedLaunching)
|
||||
{
|
||||
[NSApp run];
|
||||
_glfw.ns.finishedLaunching = GLFW_TRUE;
|
||||
}
|
||||
|
||||
if (!createNativeWindow(window, wndconfig, fbconfig))
|
||||
return GLFW_FALSE;
|
||||
|
@ -963,16 +952,20 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
|||
[window->ns.object close];
|
||||
window->ns.object = nil;
|
||||
|
||||
// HACK: Allow Cocoa to catch up before returning
|
||||
_glfwPlatformPollEvents();
|
||||
|
||||
} // autoreleasepool
|
||||
}
|
||||
|
||||
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char *title)
|
||||
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
||||
{
|
||||
@autoreleasepool {
|
||||
[window->ns.object setTitle:@(title)];
|
||||
NSString* string = @(title);
|
||||
[window->ns.object setTitle:string];
|
||||
// HACK: Set the miniwindow title explicitly as setTitle: doesn't update it
|
||||
// if the window lacks NSWindowStyleMaskTitled
|
||||
[window->ns.object setMiniwindowTitle:@(title)];
|
||||
[window->ns.object setMiniwindowTitle:string];
|
||||
} // autoreleasepool
|
||||
}
|
||||
|
||||
|
@ -1033,7 +1026,14 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
|||
acquireMonitor(window);
|
||||
}
|
||||
else
|
||||
[window->ns.object setContentSize:NSMakeSize(width, height)];
|
||||
{
|
||||
NSRect contentRect =
|
||||
[window->ns.object contentRectForFrameRect:[window->ns.object frame]];
|
||||
contentRect.origin.y += contentRect.size.height - height;
|
||||
contentRect.size = NSMakeSize(width, height);
|
||||
[window->ns.object setFrame:[window->ns.object frameRectForContentRect:contentRect]
|
||||
display:YES];
|
||||
}
|
||||
|
||||
} // autoreleasepool
|
||||
}
|
||||
|
@ -1222,7 +1222,7 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|||
// HACK: Changing the style mask can cause the first responder to be cleared
|
||||
[window->ns.object makeFirstResponder:window->ns.view];
|
||||
|
||||
if (monitor)
|
||||
if (window->monitor)
|
||||
{
|
||||
[window->ns.object setLevel:NSMainMenuWindowLevel + 1];
|
||||
[window->ns.object setHasShadow:NO];
|
||||
|
@ -1377,6 +1377,9 @@ void _glfwPlatformPollEvents(void)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
if (!_glfw.ns.finishedLaunching)
|
||||
[NSApp run];
|
||||
|
||||
for (;;)
|
||||
{
|
||||
NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny
|
||||
|
@ -1396,6 +1399,9 @@ void _glfwPlatformWaitEvents(void)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
if (!_glfw.ns.finishedLaunching)
|
||||
[NSApp run];
|
||||
|
||||
// I wanted to pass NO to dequeue:, and rely on PollEvents to
|
||||
// dequeue and send. For reasons not at all clear to me, passing
|
||||
// NO to dequeue: causes this method never to return.
|
||||
|
@ -1414,6 +1420,9 @@ void _glfwPlatformWaitEventsTimeout(double timeout)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
if (!_glfw.ns.finishedLaunching)
|
||||
[NSApp run];
|
||||
|
||||
NSDate* date = [NSDate dateWithTimeIntervalSinceNow:timeout];
|
||||
NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny
|
||||
untilDate:date
|
||||
|
@ -1431,6 +1440,9 @@ void _glfwPlatformPostEmptyEvent(void)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
if (!_glfw.ns.finishedLaunching)
|
||||
[NSApp run];
|
||||
|
||||
NSEvent* event = [NSEvent otherEventWithType:NSEventTypeApplicationDefined
|
||||
location:NSMakePoint(0, 0)
|
||||
modifierFlags:0
|
||||
|
@ -1504,8 +1516,10 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
const int key = _glfw.ns.keycodes[scancode];
|
||||
|
||||
UInt32 deadKeyState = 0;
|
||||
UniChar characters[8];
|
||||
UniChar characters[4];
|
||||
UniCharCount characterCount = 0;
|
||||
|
||||
if (UCKeyTranslate([(NSData*) _glfw.ns.unicodeData bytes],
|
||||
|
@ -1530,12 +1544,12 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||
characterCount,
|
||||
kCFAllocatorNull);
|
||||
CFStringGetCString(string,
|
||||
_glfw.ns.keyName,
|
||||
sizeof(_glfw.ns.keyName),
|
||||
_glfw.ns.keynames[key],
|
||||
sizeof(_glfw.ns.keynames[key]),
|
||||
kCFStringEncodingUTF8);
|
||||
CFRelease(string);
|
||||
|
||||
return _glfw.ns.keyName;
|
||||
return _glfw.ns.keynames[key];
|
||||
|
||||
} // autoreleasepool
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -121,23 +123,24 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
|
|||
continue;
|
||||
|
||||
#if defined(_GLFW_X11)
|
||||
XVisualInfo vi = {0};
|
||||
|
||||
// Only consider EGLConfigs with associated Visuals
|
||||
vi.visualid = getEGLConfigAttrib(n, EGL_NATIVE_VISUAL_ID);
|
||||
if (!vi.visualid)
|
||||
continue;
|
||||
|
||||
if (desired->transparent)
|
||||
{
|
||||
int count;
|
||||
XVisualInfo* vis = XGetVisualInfo(_glfw.x11.display,
|
||||
VisualIDMask, &vi,
|
||||
&count);
|
||||
if (vis)
|
||||
XVisualInfo vi = {0};
|
||||
|
||||
// Only consider EGLConfigs with associated Visuals
|
||||
vi.visualid = getEGLConfigAttrib(n, EGL_NATIVE_VISUAL_ID);
|
||||
if (!vi.visualid)
|
||||
continue;
|
||||
|
||||
if (desired->transparent)
|
||||
{
|
||||
u->transparent = _glfwIsVisualTransparentX11(vis[0].visual);
|
||||
XFree(vis);
|
||||
int count;
|
||||
XVisualInfo* vis =
|
||||
XGetVisualInfo(_glfw.x11.display, VisualIDMask, &vi, &count);
|
||||
if (vis)
|
||||
{
|
||||
u->transparent = _glfwIsVisualTransparentX11(vis[0].visual);
|
||||
XFree(vis);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // _GLFW_X11
|
||||
|
|
|
@ -47,26 +47,26 @@ typedef struct wl_egl_window* EGLNativeWindowType;
|
|||
#error "No supported EGL platform selected"
|
||||
#endif
|
||||
|
||||
#define EGL_SUCCESS 0x3000
|
||||
#define EGL_NOT_INITIALIZED 0x3001
|
||||
#define EGL_SUCCESS 0x3000
|
||||
#define EGL_NOT_INITIALIZED 0x3001
|
||||
#define EGL_BAD_ACCESS 0x3002
|
||||
#define EGL_BAD_ALLOC 0x3003
|
||||
#define EGL_BAD_ATTRIBUTE 0x3004
|
||||
#define EGL_BAD_CONFIG 0x3005
|
||||
#define EGL_BAD_CONTEXT 0x3006
|
||||
#define EGL_BAD_CURRENT_SURFACE 0x3007
|
||||
#define EGL_BAD_DISPLAY 0x3008
|
||||
#define EGL_BAD_CONTEXT 0x3006
|
||||
#define EGL_BAD_CURRENT_SURFACE 0x3007
|
||||
#define EGL_BAD_DISPLAY 0x3008
|
||||
#define EGL_BAD_MATCH 0x3009
|
||||
#define EGL_BAD_NATIVE_PIXMAP 0x300a
|
||||
#define EGL_BAD_NATIVE_WINDOW 0x300b
|
||||
#define EGL_BAD_PARAMETER 0x300c
|
||||
#define EGL_BAD_SURFACE 0x300d
|
||||
#define EGL_BAD_SURFACE 0x300d
|
||||
#define EGL_CONTEXT_LOST 0x300e
|
||||
#define EGL_COLOR_BUFFER_TYPE 0x303f
|
||||
#define EGL_RGB_BUFFER 0x308e
|
||||
#define EGL_SURFACE_TYPE 0x3033
|
||||
#define EGL_WINDOW_BIT 0x0004
|
||||
#define EGL_RENDERABLE_TYPE 0x3040
|
||||
#define EGL_RENDERABLE_TYPE 0x3040
|
||||
#define EGL_OPENGL_ES_BIT 0x0001
|
||||
#define EGL_OPENGL_ES2_BIT 0x0004
|
||||
#define EGL_OPENGL_BIT 0x0008
|
||||
|
@ -76,7 +76,7 @@ typedef struct wl_egl_window* EGLNativeWindowType;
|
|||
#define EGL_RED_SIZE 0x3024
|
||||
#define EGL_DEPTH_SIZE 0x3025
|
||||
#define EGL_STENCIL_SIZE 0x3026
|
||||
#define EGL_SAMPLES 0x3031
|
||||
#define EGL_SAMPLES 0x3031
|
||||
#define EGL_OPENGL_ES_API 0x30a0
|
||||
#define EGL_OPENGL_API 0x30a2
|
||||
#define EGL_NONE 0x3038
|
||||
|
|
|
@ -5,7 +5,7 @@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
|||
|
||||
Name: GLFW
|
||||
Description: A multi-platform library for OpenGL, window and input
|
||||
Version: @GLFW_VERSION_FULL@
|
||||
Version: @GLFW_VERSION@
|
||||
URL: https://www.glfw.org/
|
||||
Requires.private: @GLFW_PKG_DEPS@
|
||||
Libs: -L${libdir} -l@GLFW_LIB_NAME@
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -226,8 +228,6 @@ static GLFWglproc getProcAddressGLX(const char* procname)
|
|||
return _glfw_dlsym(_glfw.glx.handle, procname);
|
||||
}
|
||||
|
||||
// Destroy the OpenGL context
|
||||
//
|
||||
static void destroyContextGLX(_GLFWwindow* window)
|
||||
{
|
||||
if (window->context.glx.window)
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
#define GLX_RGBA_BIT 0x00000001
|
||||
#define GLX_WINDOW_BIT 0x00000001
|
||||
#define GLX_DRAWABLE_TYPE 0x8010
|
||||
#define GLX_RENDER_TYPE 0x8011
|
||||
#define GLX_RENDER_TYPE 0x8011
|
||||
#define GLX_RGBA_TYPE 0x8014
|
||||
#define GLX_DOUBLEBUFFER 5
|
||||
#define GLX_STEREO 6
|
||||
#define GLX_AUX_BUFFERS 7
|
||||
#define GLX_AUX_BUFFERS 7
|
||||
#define GLX_RED_SIZE 8
|
||||
#define GLX_GREEN_SIZE 9
|
||||
#define GLX_BLUE_SIZE 10
|
||||
|
@ -42,7 +42,7 @@
|
|||
#define GLX_STENCIL_SIZE 13
|
||||
#define GLX_ACCUM_RED_SIZE 14
|
||||
#define GLX_ACCUM_GREEN_SIZE 15
|
||||
#define GLX_ACCUM_BLUE_SIZE 16
|
||||
#define GLX_ACCUM_BLUE_SIZE 16
|
||||
#define GLX_ACCUM_ALPHA_SIZE 17
|
||||
#define GLX_SAMPLES 0x186a1
|
||||
#define GLX_VISUAL_ID 0x800b
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
#include "mappings.h"
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
|
@ -84,8 +84,8 @@ typedef GLFWglproc (* _GLFWgetprocaddressfun)(const char*);
|
|||
typedef void (* _GLFWdestroycontextfun)(_GLFWwindow*);
|
||||
|
||||
#define GL_VERSION 0x1f02
|
||||
#define GL_NONE 0
|
||||
#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||
#define GL_NONE 0
|
||||
#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||
#define GL_UNSIGNED_BYTE 0x1401
|
||||
#define GL_EXTENSIONS 0x1f03
|
||||
#define GL_NUM_EXTENSIONS 0x821d
|
||||
|
@ -102,7 +102,7 @@ typedef void (* _GLFWdestroycontextfun)(_GLFWwindow*);
|
|||
#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82fc
|
||||
#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008
|
||||
|
||||
typedef int GLint;
|
||||
typedef int GLint;
|
||||
typedef unsigned int GLuint;
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned int GLbitfield;
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -104,9 +106,7 @@ static void handleAbsEvent(_GLFWjoystick* js, int code, int value)
|
|||
//
|
||||
static void pollAbsState(_GLFWjoystick* js)
|
||||
{
|
||||
int code;
|
||||
|
||||
for (code = 0; code < ABS_CNT; code++)
|
||||
for (int code = 0; code < ABS_CNT; code++)
|
||||
{
|
||||
if (js->linjs.absMap[code] < 0)
|
||||
continue;
|
||||
|
@ -126,18 +126,7 @@ static void pollAbsState(_GLFWjoystick* js)
|
|||
//
|
||||
static GLFWbool openJoystickDevice(const char* path)
|
||||
{
|
||||
int jid, code;
|
||||
char name[256] = "";
|
||||
char guid[33] = "";
|
||||
char evBits[(EV_CNT + 7) / 8] = {0};
|
||||
char keyBits[(KEY_CNT + 7) / 8] = {0};
|
||||
char absBits[(ABS_CNT + 7) / 8] = {0};
|
||||
int axisCount = 0, buttonCount = 0, hatCount = 0;
|
||||
struct input_id id;
|
||||
_GLFWjoystickLinux linjs = {0};
|
||||
_GLFWjoystick* js = NULL;
|
||||
|
||||
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||
{
|
||||
if (!_glfw.joysticks[jid].present)
|
||||
continue;
|
||||
|
@ -145,10 +134,16 @@ static GLFWbool openJoystickDevice(const char* path)
|
|||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
_GLFWjoystickLinux linjs = {0};
|
||||
linjs.fd = open(path, O_RDONLY | O_NONBLOCK);
|
||||
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 ||
|
||||
|
@ -168,9 +163,13 @@ static GLFWbool openJoystickDevice(const char* path)
|
|||
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)
|
||||
{
|
||||
|
@ -189,7 +188,9 @@ static GLFWbool openJoystickDevice(const char* path)
|
|||
name[8], name[9], name[10]);
|
||||
}
|
||||
|
||||
for (code = BTN_MISC; code < KEY_CNT; code++)
|
||||
int axisCount = 0, buttonCount = 0, hatCount = 0;
|
||||
|
||||
for (int code = BTN_MISC; code < KEY_CNT; code++)
|
||||
{
|
||||
if (!isBitSet(code, keyBits))
|
||||
continue;
|
||||
|
@ -198,7 +199,7 @@ static GLFWbool openJoystickDevice(const char* path)
|
|||
buttonCount++;
|
||||
}
|
||||
|
||||
for (code = 0; code < ABS_CNT; code++)
|
||||
for (int code = 0; code < ABS_CNT; code++)
|
||||
{
|
||||
linjs.absMap[code] = -1;
|
||||
if (!isBitSet(code, absBits))
|
||||
|
@ -221,7 +222,8 @@ static GLFWbool openJoystickDevice(const char* path)
|
|||
}
|
||||
}
|
||||
|
||||
js = _glfwAllocJoystick(name, guid, axisCount, buttonCount, hatCount);
|
||||
_GLFWjoystick* js =
|
||||
_glfwAllocJoystick(name, guid, axisCount, buttonCount, hatCount);
|
||||
if (!js)
|
||||
{
|
||||
close(linjs.fd);
|
||||
|
@ -266,8 +268,6 @@ static int compareJoysticks(const void* fp, const void* sp)
|
|||
//
|
||||
GLFWbool _glfwInitJoysticksLinux(void)
|
||||
{
|
||||
DIR* dir;
|
||||
int count = 0;
|
||||
const char* dirname = "/dev/input";
|
||||
|
||||
_glfw.linjs.inotify = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
|
||||
|
@ -289,7 +289,9 @@ GLFWbool _glfwInitJoysticksLinux(void)
|
|||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
dir = opendir(dirname);
|
||||
int count = 0;
|
||||
|
||||
DIR* dir = opendir(dirname);
|
||||
if (dir)
|
||||
{
|
||||
struct dirent* entry;
|
||||
|
@ -344,12 +346,11 @@ void _glfwTerminateJoysticksLinux(void)
|
|||
|
||||
void _glfwDetectJoystickConnectionLinux(void)
|
||||
{
|
||||
ssize_t offset = 0;
|
||||
char buffer[16384];
|
||||
|
||||
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)
|
||||
|
@ -369,9 +370,7 @@ void _glfwDetectJoystickConnectionLinux(void)
|
|||
openJoystickDevice(path);
|
||||
else if (e->mask & IN_DELETE)
|
||||
{
|
||||
int jid;
|
||||
|
||||
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||
{
|
||||
if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0)
|
||||
{
|
||||
|
|
|
@ -84,7 +84,6 @@ const char* _glfwDefaultMappings[] =
|
|||
"030000000d0f00008700000000000000,Fighting Stick mini 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
|
||||
"030000000d0f00002700000000000000,FIGHTING STICK V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
|
||||
"78696e70757403000000000000000000,Fightstick TES,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,platform:Windows,",
|
||||
"03000000790000000600000000000000,G-Shark GS-GP702,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,platform:Windows,",
|
||||
"03000000260900002625000000000000,Gamecube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,lefttrigger:a4,leftx:a0,lefty:a1,righttrigger:a5,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Windows,",
|
||||
"030000008f0e00000d31000000000000,GAMEPAD 3 TURBO,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows,",
|
||||
"03000000280400000140000000000000,GamePad Pro USB,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows,",
|
||||
|
@ -207,7 +206,6 @@ const char* _glfwDefaultMappings[] =
|
|||
"030000008305000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",
|
||||
"03000000260900008888000088020000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,platform:Mac OS X,",
|
||||
"03000000a306000022f6000001030000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Mac OS X,",
|
||||
"03000000790000000600000000000000,G-Shark GP-702,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Mac OS X,",
|
||||
"03000000ad1b000001f9000000000000,Gamestop BB-070 X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X,",
|
||||
"0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Mac OS X,",
|
||||
"030000000d0f00005f00000000010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X,",
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -54,6 +56,10 @@ static int compareVideoModes(const void* fp, const void* sp)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
//
|
||||
//========================================================================
|
||||
|
||||
// NOTE: Many Cocoa enum values have been renamed and we need to build across
|
||||
// SDK versions where one is unavailable or the other deprecated
|
||||
// We use the newer names in code and these macros to handle compatibility
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101400
|
||||
#define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval
|
||||
#define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity
|
||||
|
@ -41,10 +44,6 @@ typedef struct _GLFWcontextNSGL
|
|||
{
|
||||
id pixelFormat;
|
||||
id object;
|
||||
CVDisplayLinkRef displayLink;
|
||||
atomic_int swapInterval;
|
||||
int swapIntervalsPassed;
|
||||
id swapIntervalCond;
|
||||
|
||||
} _GLFWcontextNSGL;
|
||||
|
||||
|
@ -64,5 +63,4 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
|||
const _GLFWctxconfig* ctxconfig,
|
||||
const _GLFWfbconfig* fbconfig);
|
||||
void _glfwDestroyContextNSGL(_GLFWwindow* window);
|
||||
void _glfwUpdateDisplayLinkDisplayNSGL(_GLFWwindow* window);
|
||||
|
||||
|
|
|
@ -23,32 +23,13 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
// Display link callback for manual swap interval implementation
|
||||
// This is based on a similar workaround added to SDL2
|
||||
//
|
||||
static CVReturn displayLinkCallback(CVDisplayLinkRef displayLink,
|
||||
const CVTimeStamp* now,
|
||||
const CVTimeStamp* outputTime,
|
||||
CVOptionFlags flagsIn,
|
||||
CVOptionFlags* flagsOut,
|
||||
void* userInfo)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow *) userInfo;
|
||||
|
||||
const int interval = atomic_load(&window->context.nsgl.swapInterval);
|
||||
if (interval > 0)
|
||||
{
|
||||
[window->context.nsgl.swapIntervalCond lock];
|
||||
window->context.nsgl.swapIntervalsPassed++;
|
||||
[window->context.nsgl.swapIntervalCond signal];
|
||||
[window->context.nsgl.swapIntervalCond unlock];
|
||||
}
|
||||
|
||||
return kCVReturnSuccess;
|
||||
}
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
|
||||
static void makeContextCurrentNSGL(_GLFWwindow* window)
|
||||
{
|
||||
|
@ -68,19 +49,28 @@ static void swapBuffersNSGL(_GLFWwindow* window)
|
|||
{
|
||||
@autoreleasepool {
|
||||
|
||||
const int interval = atomic_load(&window->context.nsgl.swapInterval);
|
||||
if (interval > 0)
|
||||
// HACK: Simulate vsync with usleep as NSGL swap interval does not apply to
|
||||
// windows with a non-visible occlusion state
|
||||
if (!([window->ns.object occlusionState] & NSWindowOcclusionStateVisible))
|
||||
{
|
||||
[window->context.nsgl.swapIntervalCond lock];
|
||||
do
|
||||
int interval = 0;
|
||||
[window->context.nsgl.object getValues:&interval
|
||||
forParameter:NSOpenGLContextParameterSwapInterval];
|
||||
|
||||
if (interval > 0)
|
||||
{
|
||||
[window->context.nsgl.swapIntervalCond wait];
|
||||
} while (window->context.nsgl.swapIntervalsPassed % interval != 0);
|
||||
window->context.nsgl.swapIntervalsPassed = 0;
|
||||
[window->context.nsgl.swapIntervalCond unlock];
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
// ARP appears to be unnecessary, but this is future-proof
|
||||
[window->context.nsgl.object flushBuffer];
|
||||
|
||||
} // autoreleasepool
|
||||
|
@ -89,11 +79,14 @@ static void swapBuffersNSGL(_GLFWwindow* window)
|
|||
static void swapIntervalNSGL(int interval)
|
||||
{
|
||||
@autoreleasepool {
|
||||
|
||||
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
|
||||
atomic_store(&window->context.nsgl.swapInterval, interval);
|
||||
[window->context.nsgl.swapIntervalCond lock];
|
||||
window->context.nsgl.swapIntervalsPassed = 0;
|
||||
[window->context.nsgl.swapIntervalCond unlock];
|
||||
if (window)
|
||||
{
|
||||
[window->context.nsgl.object setValues:&interval
|
||||
forParameter:NSOpenGLContextParameterSwapInterval];
|
||||
}
|
||||
|
||||
} // autoreleasepool
|
||||
}
|
||||
|
||||
|
@ -117,23 +110,10 @@ static GLFWglproc getProcAddressNSGL(const char* procname)
|
|||
return symbol;
|
||||
}
|
||||
|
||||
// Destroy the OpenGL context
|
||||
//
|
||||
static void destroyContextNSGL(_GLFWwindow* window)
|
||||
{
|
||||
@autoreleasepool {
|
||||
|
||||
if (window->context.nsgl.displayLink)
|
||||
{
|
||||
if (CVDisplayLinkIsRunning(window->context.nsgl.displayLink))
|
||||
CVDisplayLinkStop(window->context.nsgl.displayLink);
|
||||
|
||||
CVDisplayLinkRelease(window->context.nsgl.displayLink);
|
||||
}
|
||||
|
||||
[window->context.nsgl.swapIntervalCond release];
|
||||
window->context.nsgl.swapIntervalCond = nil;
|
||||
|
||||
[window->context.nsgl.pixelFormat release];
|
||||
window->context.nsgl.pixelFormat = nil;
|
||||
|
||||
|
@ -339,7 +319,7 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
|||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
NSOpenGLContext* share = NULL;
|
||||
NSOpenGLContext* share = nil;
|
||||
|
||||
if (ctxconfig->share)
|
||||
share = ctxconfig->share->context.nsgl.object;
|
||||
|
@ -361,17 +341,10 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
|||
forParameter:NSOpenGLContextParameterSurfaceOpacity];
|
||||
}
|
||||
|
||||
if (window->ns.retina)
|
||||
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
|
||||
|
||||
GLint interval = 0;
|
||||
[window->context.nsgl.object setValues:&interval
|
||||
forParameter:NSOpenGLContextParameterSwapInterval];
|
||||
[window->ns.view setWantsBestResolutionOpenGLSurface:window->ns.retina];
|
||||
|
||||
[window->context.nsgl.object setView:window->ns.view];
|
||||
|
||||
window->context.nsgl.swapIntervalCond = [NSCondition new];
|
||||
|
||||
window->context.makeCurrent = makeContextCurrentNSGL;
|
||||
window->context.swapBuffers = swapBuffersNSGL;
|
||||
window->context.swapInterval = swapIntervalNSGL;
|
||||
|
@ -379,26 +352,9 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
|||
window->context.getProcAddress = getProcAddressNSGL;
|
||||
window->context.destroy = destroyContextNSGL;
|
||||
|
||||
CVDisplayLinkCreateWithActiveCGDisplays(&window->context.nsgl.displayLink);
|
||||
CVDisplayLinkSetOutputCallback(window->context.nsgl.displayLink,
|
||||
&displayLinkCallback,
|
||||
window);
|
||||
CVDisplayLinkStart(window->context.nsgl.displayLink);
|
||||
|
||||
_glfwUpdateDisplayLinkDisplayNSGL(window);
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
void _glfwUpdateDisplayLinkDisplayNSGL(_GLFWwindow* window)
|
||||
{
|
||||
CGDirectDisplayID displayID =
|
||||
[[[window->ns.object screen] deviceDescription][@"NSScreenNumber"] unsignedIntValue];
|
||||
if (!displayID)
|
||||
return;
|
||||
|
||||
CVDisplayLinkSetCurrentCGDisplay(window->context.nsgl.displayLink, displayID);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW native API //////
|
||||
|
@ -412,7 +368,7 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* handle)
|
|||
if (window->context.client == GLFW_NO_API)
|
||||
{
|
||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||
return NULL;
|
||||
return nil;
|
||||
}
|
||||
|
||||
return window->context.nsgl.object;
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
//
|
||||
//========================================================================
|
||||
|
||||
#define _GLFW_PLATFORM_JOYSTICK_STATE int nulljs
|
||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE int nulljs
|
||||
#define _GLFW_PLATFORM_JOYSTICK_STATE struct { int dummyJoystick; }
|
||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; }
|
||||
|
||||
#define _GLFW_PLATFORM_MAPPING_NAME ""
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
|
@ -29,13 +29,13 @@
|
|||
|
||||
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNull null
|
||||
|
||||
#define _GLFW_PLATFORM_CONTEXT_STATE
|
||||
#define _GLFW_PLATFORM_MONITOR_STATE
|
||||
#define _GLFW_PLATFORM_CURSOR_STATE
|
||||
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE
|
||||
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE
|
||||
#define _GLFW_EGL_CONTEXT_STATE
|
||||
#define _GLFW_EGL_LIBRARY_CONTEXT_STATE
|
||||
#define _GLFW_PLATFORM_CONTEXT_STATE struct { int dummyContext; }
|
||||
#define _GLFW_PLATFORM_MONITOR_STATE struct { int dummyMonitor; }
|
||||
#define _GLFW_PLATFORM_CURSOR_STATE struct { int dummyCursor; }
|
||||
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE struct { int dummyLibraryWindow; }
|
||||
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE struct { int dummyLibraryContext; }
|
||||
#define _GLFW_EGL_CONTEXT_STATE struct { int dummyEGLContext; }
|
||||
#define _GLFW_EGL_LIBRARY_CONTEXT_STATE struct { int dummyEGLLibraryContext; }
|
||||
|
||||
#include "osmesa_context.h"
|
||||
#include "posix_time.h"
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -75,8 +77,8 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||
{
|
||||
const int attrib = WGL_NUMBER_PIXEL_FORMATS_ARB;
|
||||
|
||||
if (!_glfw.wgl.GetPixelFormatAttribivARB(window->context.wgl.dc,
|
||||
1, 0, 1, &attrib, &nativeCount))
|
||||
if (!wglGetPixelFormatAttribivARB(window->context.wgl.dc,
|
||||
1, 0, 1, &attrib, &nativeCount))
|
||||
{
|
||||
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
||||
"WGL: Failed to retrieve pixel format attribute");
|
||||
|
@ -139,10 +141,10 @@ static int choosePixelFormat(_GLFWwindow* window,
|
|||
{
|
||||
// Get pixel format attributes through "modern" extension
|
||||
|
||||
if (!_glfw.wgl.GetPixelFormatAttribivARB(window->context.wgl.dc,
|
||||
pixelFormat, 0,
|
||||
attribCount,
|
||||
attribs, values))
|
||||
if (!wglGetPixelFormatAttribivARB(window->context.wgl.dc,
|
||||
pixelFormat, 0,
|
||||
attribCount,
|
||||
attribs, values))
|
||||
{
|
||||
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
||||
"WGL: Failed to retrieve pixel format attributes");
|
||||
|
@ -360,7 +362,7 @@ static void swapIntervalWGL(int interval)
|
|||
}
|
||||
|
||||
if (_glfw.wgl.EXT_swap_control)
|
||||
_glfw.wgl.SwapIntervalEXT(interval);
|
||||
wglSwapIntervalEXT(interval);
|
||||
}
|
||||
|
||||
static int extensionSupportedWGL(const char* extension)
|
||||
|
@ -368,9 +370,9 @@ static int extensionSupportedWGL(const char* extension)
|
|||
const char* extensions = NULL;
|
||||
|
||||
if (_glfw.wgl.GetExtensionsStringARB)
|
||||
extensions = _glfw.wgl.GetExtensionsStringARB(wglGetCurrentDC());
|
||||
extensions = wglGetExtensionsStringARB(wglGetCurrentDC());
|
||||
else if (_glfw.wgl.GetExtensionsStringEXT)
|
||||
extensions = _glfw.wgl.GetExtensionsStringEXT();
|
||||
extensions = wglGetExtensionsStringEXT();
|
||||
|
||||
if (!extensions)
|
||||
return GLFW_FALSE;
|
||||
|
@ -387,8 +389,6 @@ static GLFWglproc getProcAddressWGL(const char* procname)
|
|||
return (GLFWglproc) GetProcAddress(_glfw.wgl.instance, procname);
|
||||
}
|
||||
|
||||
// Destroy the OpenGL context
|
||||
//
|
||||
static void destroyContextWGL(_GLFWwindow* window)
|
||||
{
|
||||
if (window->context.wgl.handle)
|
||||
|
@ -693,8 +693,7 @@ GLFWbool _glfwCreateContextWGL(_GLFWwindow* window,
|
|||
setAttrib(0, 0);
|
||||
|
||||
window->context.wgl.handle =
|
||||
_glfw.wgl.CreateContextAttribsARB(window->context.wgl.dc,
|
||||
share, attribs);
|
||||
wglCreateContextAttribsARB(window->context.wgl.dc, share, attribs);
|
||||
if (!window->context.wgl.handle)
|
||||
{
|
||||
const DWORD error = GetLastError();
|
||||
|
|
|
@ -76,12 +76,19 @@
|
|||
#define ERROR_INVALID_PROFILE_ARB 0x2096
|
||||
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
|
||||
|
||||
// WGL extension pointer typedefs
|
||||
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC)(int);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC)(HDC,int,int,UINT,const int*,int*);
|
||||
typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC)(void);
|
||||
typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC)(HDC);
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC,HGLRC,const int*);
|
||||
#define wglSwapIntervalEXT _glfw.wgl.SwapIntervalEXT
|
||||
#define wglGetPixelFormatAttribivARB _glfw.wgl.GetPixelFormatAttribivARB
|
||||
#define wglGetExtensionsStringEXT _glfw.wgl.GetExtensionsStringEXT
|
||||
#define wglGetExtensionsStringARB _glfw.wgl.GetExtensionsStringARB
|
||||
#define wglCreateContextAttribsARB _glfw.wgl.CreateContextAttribsARB
|
||||
|
||||
// opengl32.dll function pointer typedefs
|
||||
typedef HGLRC (WINAPI * PFN_wglCreateContext)(HDC);
|
||||
typedef BOOL (WINAPI * PFN_wglDeleteContext)(HGLRC);
|
||||
typedef PROC (WINAPI * PFN_wglGetProcAddress)(LPCSTR);
|
||||
|
@ -89,8 +96,6 @@ typedef HDC (WINAPI * PFN_wglGetCurrentDC)(void);
|
|||
typedef HGLRC (WINAPI * PFN_wglGetCurrentContext)(void);
|
||||
typedef BOOL (WINAPI * PFN_wglMakeCurrent)(HDC,HGLRC);
|
||||
typedef BOOL (WINAPI * PFN_wglShareLists)(HGLRC,HGLRC);
|
||||
|
||||
// opengl32.dll function pointer typedefs
|
||||
#define wglCreateContext _glfw.wgl.CreateContext
|
||||
#define wglDeleteContext _glfw.wgl.DeleteContext
|
||||
#define wglGetProcAddress _glfw.wgl.GetProcAddress
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -523,7 +525,7 @@ BOOL _glfwIsWindowsVersionOrGreaterWin32(WORD major, WORD minor, WORD sp)
|
|||
cond = VerSetConditionMask(cond, VER_MINORVERSION, VER_GREATER_EQUAL);
|
||||
cond = VerSetConditionMask(cond, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
|
||||
// HACK: Use RtlVerifyVersionInfo instead of VerifyVersionInfoW as the
|
||||
// latter lies unless the user knew to embedd a non-default manifest
|
||||
// latter lies unless the user knew to embed a non-default manifest
|
||||
// announcing support for Windows 10 via supportedOS GUID
|
||||
return RtlVerifyVersionInfo(&osvi, mask, cond) == 0;
|
||||
}
|
||||
|
@ -538,7 +540,7 @@ BOOL _glfwIsWindows10BuildOrGreaterWin32(WORD build)
|
|||
cond = VerSetConditionMask(cond, VER_MINORVERSION, VER_GREATER_EQUAL);
|
||||
cond = VerSetConditionMask(cond, VER_BUILDNUMBER, VER_GREATER_EQUAL);
|
||||
// HACK: Use RtlVerifyVersionInfo instead of VerifyVersionInfoW as the
|
||||
// latter lies unless the user knew to embedd a non-default manifest
|
||||
// latter lies unless the user knew to embed a non-default manifest
|
||||
// announcing support for Windows 10 via supportedOS GUID
|
||||
return RtlVerifyVersionInfo(&osvi, mask, cond) == 0;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
//========================================================================
|
||||
|
||||
#define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickWin32 win32
|
||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE int dummy
|
||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; }
|
||||
|
||||
#define _GLFW_PLATFORM_MAPPING_NAME "Windows"
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -31,6 +33,7 @@
|
|||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <malloc.h>
|
||||
#include <wchar.h>
|
||||
|
||||
|
||||
// Callback for EnumDisplayMonitors in createMonitor
|
||||
|
@ -475,7 +478,7 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
|||
GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||
{
|
||||
HDC dc;
|
||||
WORD values[768];
|
||||
WORD values[3][256];
|
||||
|
||||
dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL);
|
||||
GetDeviceGammaRamp(dc, values);
|
||||
|
@ -483,9 +486,9 @@ GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
|||
|
||||
_glfwAllocGammaArrays(ramp, 256);
|
||||
|
||||
memcpy(ramp->red, values + 0, 256 * sizeof(unsigned short));
|
||||
memcpy(ramp->green, values + 256, 256 * sizeof(unsigned short));
|
||||
memcpy(ramp->blue, values + 512, 256 * sizeof(unsigned short));
|
||||
memcpy(ramp->red, values[0], sizeof(values[0]));
|
||||
memcpy(ramp->green, values[1], sizeof(values[1]));
|
||||
memcpy(ramp->blue, values[2], sizeof(values[2]));
|
||||
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
@ -493,7 +496,7 @@ GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
|||
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
||||
{
|
||||
HDC dc;
|
||||
WORD values[768];
|
||||
WORD values[3][256];
|
||||
|
||||
if (ramp->size != 256)
|
||||
{
|
||||
|
@ -502,9 +505,9 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
|||
return;
|
||||
}
|
||||
|
||||
memcpy(values + 0, ramp->red, 256 * sizeof(unsigned short));
|
||||
memcpy(values + 256, ramp->green, 256 * sizeof(unsigned short));
|
||||
memcpy(values + 512, ramp->blue, 256 * sizeof(unsigned short));
|
||||
memcpy(values[0], ramp->red, sizeof(values[0]));
|
||||
memcpy(values[1], ramp->green, sizeof(values[1]));
|
||||
memcpy(values[2], ramp->blue, sizeof(values[2]));
|
||||
|
||||
dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL);
|
||||
SetDeviceGammaRamp(dc, values);
|
||||
|
|
|
@ -212,7 +212,7 @@ typedef enum
|
|||
|
||||
// HACK: Define macros that some dinput.h variants don't
|
||||
#ifndef DIDFT_OPTIONAL
|
||||
#define DIDFT_OPTIONAL 0x80000000
|
||||
#define DIDFT_OPTIONAL 0x80000000
|
||||
#endif
|
||||
|
||||
// winmm.dll function pointer typedefs
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -409,7 +411,7 @@ static void updateFramebufferTransparency(const _GLFWwindow* window)
|
|||
// issue. When set to black, something is making the hit test
|
||||
// not resize with the window frame.
|
||||
SetLayeredWindowAttributes(window->win32.handle,
|
||||
RGB(0, 193, 48), 255, LWA_COLORKEY);
|
||||
RGB(255, 0, 255), 255, LWA_COLORKEY);
|
||||
}
|
||||
|
||||
DeleteObject(region);
|
||||
|
@ -479,7 +481,7 @@ static int translateKey(WPARAM wParam, LPARAM lParam)
|
|||
DWORD time;
|
||||
|
||||
// Right side keys have the extended key bit set
|
||||
if (lParam & 0x01000000)
|
||||
if (HIWORD(lParam) & KF_EXTENDED)
|
||||
return GLFW_KEY_RIGHT_CONTROL;
|
||||
|
||||
// HACK: Alt Gr sends Left Ctrl and then Right Alt in close sequence
|
||||
|
@ -495,7 +497,7 @@ static int translateKey(WPARAM wParam, LPARAM lParam)
|
|||
next.message == WM_SYSKEYUP)
|
||||
{
|
||||
if (next.wParam == VK_MENU &&
|
||||
(next.lParam & 0x01000000) &&
|
||||
(HIWORD(next.lParam) & KF_EXTENDED) &&
|
||||
next.time == time)
|
||||
{
|
||||
// Next message is Right Alt down so discard this
|
||||
|
@ -629,12 +631,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
// clicking a caption button
|
||||
if (HIWORD(lParam) == WM_LBUTTONDOWN)
|
||||
{
|
||||
if (LOWORD(lParam) == HTCLOSE ||
|
||||
LOWORD(lParam) == HTMINBUTTON ||
|
||||
LOWORD(lParam) == HTMAXBUTTON)
|
||||
{
|
||||
if (LOWORD(lParam) != HTCLIENT)
|
||||
window->win32.frameAction = GLFW_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -742,8 +740,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
case WM_SYSKEYUP:
|
||||
{
|
||||
const int key = translateKey(wParam, lParam);
|
||||
const int scancode = (lParam >> 16) & 0x1ff;
|
||||
const int action = ((lParam >> 31) & 1) ? GLFW_RELEASE : GLFW_PRESS;
|
||||
const int scancode = (HIWORD(lParam) & 0x1ff);
|
||||
const int action = (HIWORD(lParam) & KF_UP) ? GLFW_RELEASE : GLFW_PRESS;
|
||||
const int mods = getKeyMods();
|
||||
|
||||
if (key == _GLFW_KEY_INVALID)
|
||||
|
@ -830,7 +828,19 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
const int x = GET_X_LPARAM(lParam);
|
||||
const int y = GET_Y_LPARAM(lParam);
|
||||
|
||||
// Disabled cursor motion input is provided by WM_INPUT
|
||||
if (!window->win32.cursorTracked)
|
||||
{
|
||||
TRACKMOUSEEVENT tme;
|
||||
ZeroMemory(&tme, sizeof(tme));
|
||||
tme.cbSize = sizeof(tme);
|
||||
tme.dwFlags = TME_LEAVE;
|
||||
tme.hwndTrack = window->win32.handle;
|
||||
TrackMouseEvent(&tme);
|
||||
|
||||
window->win32.cursorTracked = GLFW_TRUE;
|
||||
_glfwInputCursorEnter(window, GLFW_TRUE);
|
||||
}
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
{
|
||||
const int dx = x - window->win32.lastCursorPosX;
|
||||
|
@ -851,19 +861,6 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
window->win32.lastCursorPosX = x;
|
||||
window->win32.lastCursorPosY = y;
|
||||
|
||||
if (!window->win32.cursorTracked)
|
||||
{
|
||||
TRACKMOUSEEVENT tme;
|
||||
ZeroMemory(&tme, sizeof(tme));
|
||||
tme.cbSize = sizeof(tme);
|
||||
tme.dwFlags = TME_LEAVE;
|
||||
tme.hwndTrack = window->win32.handle;
|
||||
TrackMouseEvent(&tme);
|
||||
|
||||
window->win32.cursorTracked = GLFW_TRUE;
|
||||
_glfwInputCursorEnter(window, GLFW_TRUE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -942,6 +939,9 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
case WM_ENTERSIZEMOVE:
|
||||
case WM_ENTERMENULOOP:
|
||||
{
|
||||
if (window->win32.frameAction)
|
||||
break;
|
||||
|
||||
// HACK: Enable the cursor while the user is moving or
|
||||
// resizing the window or using the window menu
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
|
@ -953,6 +953,9 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||
case WM_EXITSIZEMOVE:
|
||||
case WM_EXITMENULOOP:
|
||||
{
|
||||
if (window->win32.frameAction)
|
||||
break;
|
||||
|
||||
// HACK: Disable the cursor once the user is done moving or
|
||||
// resizing the window or using the menu
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
|
@ -1225,6 +1228,7 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||
xpos = CW_USEDEFAULT;
|
||||
ypos = CW_USEDEFAULT;
|
||||
|
||||
window->win32.maximized = wndconfig->maximized;
|
||||
if (wndconfig->maximized)
|
||||
style |= WS_MAXIMIZE;
|
||||
|
||||
|
@ -1272,12 +1276,13 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||
|
||||
window->win32.scaleToMonitor = wndconfig->scaleToMonitor;
|
||||
|
||||
// Adjust window size to account for DPI scaling of the window frame and
|
||||
// optionally DPI scaling of the content area
|
||||
// This cannot be done until we know what monitor it was placed on
|
||||
// Adjust window rect to account for DPI scaling of the window frame and
|
||||
// (if enabled) DPI scaling of the content area
|
||||
// This cannot be done until we know what monitor the window was placed on
|
||||
if (!window->monitor)
|
||||
{
|
||||
RECT rect = { 0, 0, wndconfig->width, wndconfig->height };
|
||||
WINDOWPLACEMENT wp = { sizeof(wp) };
|
||||
|
||||
if (wndconfig->scaleToMonitor)
|
||||
{
|
||||
|
@ -1298,10 +1303,11 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||
else
|
||||
AdjustWindowRectEx(&rect, style, FALSE, exStyle);
|
||||
|
||||
SetWindowPos(window->win32.handle, NULL,
|
||||
rect.left, rect.top,
|
||||
rect.right - rect.left, rect.bottom - rect.top,
|
||||
SWP_NOACTIVATE | SWP_NOZORDER);
|
||||
// Only update the restored window rect as the window may be maximized
|
||||
GetWindowPlacement(window->win32.handle, &wp);
|
||||
wp.rcNormalPosition = rect;
|
||||
wp.showCmd = SW_HIDE;
|
||||
SetWindowPlacement(window->win32.handle, &wp);
|
||||
}
|
||||
|
||||
DragAcceptFiles(window->win32.handle, TRUE);
|
||||
|
@ -1722,7 +1728,7 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|||
|
||||
_glfwInputWindowMonitor(window, monitor);
|
||||
|
||||
if (monitor)
|
||||
if (window->monitor)
|
||||
{
|
||||
MONITORINFO mi = { sizeof(mi) };
|
||||
UINT flags = SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOCOPYBITS;
|
||||
|
@ -1928,8 +1934,8 @@ void _glfwPlatformPollEvents(void)
|
|||
window = GetPropW(handle, L"GLFW");
|
||||
if (window)
|
||||
{
|
||||
const GLFWbool lshift = (GetAsyncKeyState(VK_LSHIFT) >> 15) & 1;
|
||||
const GLFWbool rshift = (GetAsyncKeyState(VK_RSHIFT) >> 15) & 1;
|
||||
const GLFWbool lshift = (GetAsyncKeyState(VK_LSHIFT) & 0x8000) != 0;
|
||||
const GLFWbool rshift = (GetAsyncKeyState(VK_RSHIFT) & 0x8000) != 0;
|
||||
|
||||
if (!lshift && window->keys[GLFW_KEY_LEFT_SHIFT] == GLFW_PRESS)
|
||||
{
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -123,6 +125,7 @@ static void pointerHandleLeave(void* data,
|
|||
_glfw.wl.serial = serial;
|
||||
_glfw.wl.pointerFocus = NULL;
|
||||
_glfwInputCursorEnter(window, GLFW_FALSE);
|
||||
_glfw.wl.cursorPreviousName = NULL;
|
||||
}
|
||||
|
||||
static void setCursor(_GLFWwindow* window, const char* name)
|
||||
|
@ -167,6 +170,7 @@ static void setCursor(_GLFWwindow* window, const char* name)
|
|||
wl_surface_damage(surface, 0, 0,
|
||||
image->width, image->height);
|
||||
wl_surface_commit(surface);
|
||||
_glfw.wl.cursorPreviousName = name;
|
||||
}
|
||||
|
||||
static void pointerHandleMotion(void* data,
|
||||
|
@ -176,48 +180,47 @@ static void pointerHandleMotion(void* data,
|
|||
wl_fixed_t sy)
|
||||
{
|
||||
_GLFWwindow* window = _glfw.wl.pointerFocus;
|
||||
const char* cursorName;
|
||||
const char* cursorName = NULL;
|
||||
double x, y;
|
||||
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
return;
|
||||
else
|
||||
{
|
||||
window->wl.cursorPosX = wl_fixed_to_double(sx);
|
||||
window->wl.cursorPosY = wl_fixed_to_double(sy);
|
||||
}
|
||||
x = wl_fixed_to_double(sx);
|
||||
y = wl_fixed_to_double(sy);
|
||||
|
||||
switch (window->wl.decorations.focus)
|
||||
{
|
||||
case mainWindow:
|
||||
_glfwInputCursorPos(window,
|
||||
wl_fixed_to_double(sx),
|
||||
wl_fixed_to_double(sy));
|
||||
window->wl.cursorPosX = x;
|
||||
window->wl.cursorPosY = y;
|
||||
_glfwInputCursorPos(window, x, y);
|
||||
_glfw.wl.cursorPreviousName = NULL;
|
||||
return;
|
||||
case topDecoration:
|
||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
||||
if (y < _GLFW_DECORATION_WIDTH)
|
||||
cursorName = "n-resize";
|
||||
else
|
||||
cursorName = "left_ptr";
|
||||
break;
|
||||
case leftDecoration:
|
||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
||||
if (y < _GLFW_DECORATION_WIDTH)
|
||||
cursorName = "nw-resize";
|
||||
else
|
||||
cursorName = "w-resize";
|
||||
break;
|
||||
case rightDecoration:
|
||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
||||
if (y < _GLFW_DECORATION_WIDTH)
|
||||
cursorName = "ne-resize";
|
||||
else
|
||||
cursorName = "e-resize";
|
||||
break;
|
||||
case bottomDecoration:
|
||||
if (window->wl.cursorPosX < _GLFW_DECORATION_WIDTH)
|
||||
if (x < _GLFW_DECORATION_WIDTH)
|
||||
cursorName = "sw-resize";
|
||||
else if (window->wl.cursorPosX > window->wl.width + _GLFW_DECORATION_WIDTH)
|
||||
else if (x > window->wl.width + _GLFW_DECORATION_WIDTH)
|
||||
cursorName = "se-resize";
|
||||
else
|
||||
cursorName = "s-resize";
|
||||
|
@ -225,7 +228,8 @@ static void pointerHandleMotion(void* data,
|
|||
default:
|
||||
assert(0);
|
||||
}
|
||||
setCursor(window, cursorName);
|
||||
if (_glfw.wl.cursorPreviousName != cursorName)
|
||||
setCursor(window, cursorName);
|
||||
}
|
||||
|
||||
static void pointerHandleButton(void* data,
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -198,7 +200,7 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
|||
GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Wayland: Gamma ramp access it not available");
|
||||
"Wayland: Gamma ramp access is not available");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,8 +75,8 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR
|
|||
#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorWayland wl
|
||||
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorWayland wl
|
||||
|
||||
#define _GLFW_PLATFORM_CONTEXT_STATE
|
||||
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE
|
||||
#define _GLFW_PLATFORM_CONTEXT_STATE struct { int dummyContext; }
|
||||
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE struct { int dummyLibraryContext; }
|
||||
|
||||
struct wl_cursor_image {
|
||||
uint32_t width;
|
||||
|
@ -249,6 +249,7 @@ typedef struct _GLFWlibraryWayland
|
|||
struct wl_cursor_theme* cursorTheme;
|
||||
struct wl_cursor_theme* cursorThemeHiDPI;
|
||||
struct wl_surface* cursorSurface;
|
||||
const char* cursorPreviousName;
|
||||
int cursorTimerfd;
|
||||
uint32_t serial;
|
||||
|
||||
|
@ -332,7 +333,7 @@ typedef struct _GLFWlibraryWayland
|
|||
typedef struct _GLFWmonitorWayland
|
||||
{
|
||||
struct wl_output* output;
|
||||
int name;
|
||||
uint32_t name;
|
||||
int currentMode;
|
||||
|
||||
int x;
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
|
@ -132,7 +134,7 @@ static int createTmpfileCloexec(char* tmpname)
|
|||
* SCM_RIGHTS methods.
|
||||
*
|
||||
* posix_fallocate() is used to guarantee that disk space is available
|
||||
* for the file at the given size. If disk space is insufficent, errno
|
||||
* for the file at the given size. If disk space is insufficient, errno
|
||||
* is set to ENOSPC. If posix_fallocate() is not supported, program may
|
||||
* receive SIGBUS on accessing mmap()'ed file contents instead.
|
||||
*/
|
||||
|
@ -902,7 +904,7 @@ static char *translateCursorShape(int shape)
|
|||
case GLFW_CROSSHAIR_CURSOR:
|
||||
return "crosshair";
|
||||
case GLFW_HAND_CURSOR:
|
||||
return "grabbing";
|
||||
return "hand2";
|
||||
case GLFW_HRESIZE_CURSOR:
|
||||
return "sb_h_double_arrow";
|
||||
case GLFW_VRESIZE_CURSOR:
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -52,7 +54,7 @@ static int translateKeyCode(int scancode)
|
|||
// Note: This way we always force "NumLock = ON", which is intentional
|
||||
// since the returned key code should correspond to a physical
|
||||
// location.
|
||||
keySym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, 0, 1);
|
||||
keySym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, _glfw.x11.xkb.group, 1);
|
||||
switch (keySym)
|
||||
{
|
||||
case XK_KP_0: return GLFW_KEY_KP_0;
|
||||
|
@ -74,7 +76,7 @@ static int translateKeyCode(int scancode)
|
|||
|
||||
// Now try primary keysym for function keys (non-printable keys)
|
||||
// These should not depend on the current keyboard layout
|
||||
keySym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, 0, 0);
|
||||
keySym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, _glfw.x11.xkb.group, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -329,14 +331,13 @@ static void createKeyTables(void)
|
|||
//
|
||||
static GLFWbool hasUsableInputMethodStyle(void)
|
||||
{
|
||||
unsigned int i;
|
||||
GLFWbool found = GLFW_FALSE;
|
||||
XIMStyles* styles = NULL;
|
||||
|
||||
if (XGetIMValues(_glfw.x11.im, XNQueryInputStyle, &styles, NULL) != NULL)
|
||||
return GLFW_FALSE;
|
||||
|
||||
for (i = 0; i < styles->count_styles; i++)
|
||||
for (unsigned int i = 0; i < styles->count_styles; i++)
|
||||
{
|
||||
if (styles->supported_styles[i] == (XIMPreeditNothing | XIMStatusNothing))
|
||||
{
|
||||
|
@ -355,10 +356,9 @@ static Atom getSupportedAtom(Atom* supportedAtoms,
|
|||
unsigned long atomCount,
|
||||
const char* atomName)
|
||||
{
|
||||
unsigned long i;
|
||||
const Atom atom = XInternAtom(_glfw.x11.display, atomName, False);
|
||||
|
||||
for (i = 0; i < atomCount; i++)
|
||||
for (unsigned int i = 0; i < atomCount; i++)
|
||||
{
|
||||
if (supportedAtoms[i] == atom)
|
||||
return atom;
|
||||
|
@ -371,18 +371,11 @@ static Atom getSupportedAtom(Atom* supportedAtoms,
|
|||
//
|
||||
static void detectEWMH(void)
|
||||
{
|
||||
// First we read the _NET_SUPPORTING_WM_CHECK property on the root window
|
||||
|
||||
Window* windowFromRoot = NULL;
|
||||
Window* windowFromChild = NULL;
|
||||
|
||||
// First we need a couple of atoms
|
||||
const Atom supportingWmCheck =
|
||||
XInternAtom(_glfw.x11.display, "_NET_SUPPORTING_WM_CHECK", False);
|
||||
const Atom wmSupported =
|
||||
XInternAtom(_glfw.x11.display, "_NET_SUPPORTED", False);
|
||||
|
||||
// Then we look for the _NET_SUPPORTING_WM_CHECK property of the root window
|
||||
if (!_glfwGetWindowPropertyX11(_glfw.x11.root,
|
||||
supportingWmCheck,
|
||||
_glfw.x11.NET_SUPPORTING_WM_CHECK,
|
||||
XA_WINDOW,
|
||||
(unsigned char**) &windowFromRoot))
|
||||
{
|
||||
|
@ -391,10 +384,12 @@ static void detectEWMH(void)
|
|||
|
||||
_glfwGrabErrorHandlerX11();
|
||||
|
||||
// It should be the ID of a child window (of the root)
|
||||
// Then we look for the same property on the child window
|
||||
// If it exists, it should be the XID of a top-level window
|
||||
// Then we look for the same property on that window
|
||||
|
||||
Window* windowFromChild = NULL;
|
||||
if (!_glfwGetWindowPropertyX11(*windowFromRoot,
|
||||
supportingWmCheck,
|
||||
_glfw.x11.NET_SUPPORTING_WM_CHECK,
|
||||
XA_WINDOW,
|
||||
(unsigned char**) &windowFromChild))
|
||||
{
|
||||
|
@ -404,7 +399,8 @@ static void detectEWMH(void)
|
|||
|
||||
_glfwReleaseErrorHandlerX11();
|
||||
|
||||
// It should be the ID of that same child window
|
||||
// If the property exists, it should contain the XID of the window
|
||||
|
||||
if (*windowFromRoot != *windowFromChild)
|
||||
{
|
||||
XFree(windowFromRoot);
|
||||
|
@ -415,19 +411,20 @@ static void detectEWMH(void)
|
|||
XFree(windowFromRoot);
|
||||
XFree(windowFromChild);
|
||||
|
||||
// We are now fairly sure that an EWMH-compliant window manager is running
|
||||
// We are now fairly sure that an EWMH-compliant WM is currently running
|
||||
// We can now start querying the WM about what features it supports by
|
||||
// looking in the _NET_SUPPORTED property on the root window
|
||||
// It should contain a list of supported EWMH protocol and state atoms
|
||||
|
||||
Atom* supportedAtoms;
|
||||
unsigned long atomCount;
|
||||
|
||||
// Now we need to check the _NET_SUPPORTED property of the root window
|
||||
// It should be a list of supported WM protocol and state atoms
|
||||
atomCount = _glfwGetWindowPropertyX11(_glfw.x11.root,
|
||||
wmSupported,
|
||||
XA_ATOM,
|
||||
(unsigned char**) &supportedAtoms);
|
||||
Atom* supportedAtoms = NULL;
|
||||
const unsigned long atomCount =
|
||||
_glfwGetWindowPropertyX11(_glfw.x11.root,
|
||||
_glfw.x11.NET_SUPPORTED,
|
||||
XA_ATOM,
|
||||
(unsigned char**) &supportedAtoms);
|
||||
|
||||
// See which of the atoms we support that are supported by the WM
|
||||
|
||||
_glfw.x11.NET_WM_STATE =
|
||||
getSupportedAtom(supportedAtoms, atomCount, "_NET_WM_STATE");
|
||||
_glfw.x11.NET_WM_STATE_ABOVE =
|
||||
|
@ -662,6 +659,14 @@ static GLFWbool initExtensions(void)
|
|||
if (supported)
|
||||
_glfw.x11.xkb.detectable = GLFW_TRUE;
|
||||
}
|
||||
|
||||
_glfw.x11.xkb.group = 0;
|
||||
XkbStateRec state;
|
||||
if (XkbGetState(_glfw.x11.display, XkbUseCoreKbd, &state) == Success)
|
||||
{
|
||||
XkbSelectEventDetails(_glfw.x11.display, XkbUseCoreKbd, XkbStateNotify, XkbAllStateComponentsMask, XkbGroupStateMask);
|
||||
_glfw.x11.xkb.group = (unsigned int)state.group;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
|
@ -707,9 +712,6 @@ static GLFWbool initExtensions(void)
|
|||
// the keyboard mapping.
|
||||
createKeyTables();
|
||||
|
||||
// Detect whether an EWMH-conformant window manager is running
|
||||
detectEWMH();
|
||||
|
||||
// String format atoms
|
||||
_glfw.x11.NULL_ = XInternAtom(_glfw.x11.display, "NULL", False);
|
||||
_glfw.x11.UTF8_STRING = XInternAtom(_glfw.x11.display, "UTF8_STRING", False);
|
||||
|
@ -753,6 +755,10 @@ static GLFWbool initExtensions(void)
|
|||
XInternAtom(_glfw.x11.display, "WM_STATE", False);
|
||||
_glfw.x11.WM_DELETE_WINDOW =
|
||||
XInternAtom(_glfw.x11.display, "WM_DELETE_WINDOW", False);
|
||||
_glfw.x11.NET_SUPPORTED =
|
||||
XInternAtom(_glfw.x11.display, "_NET_SUPPORTED", False);
|
||||
_glfw.x11.NET_SUPPORTING_WM_CHECK =
|
||||
XInternAtom(_glfw.x11.display, "_NET_SUPPORTING_WM_CHECK", False);
|
||||
_glfw.x11.NET_WM_ICON =
|
||||
XInternAtom(_glfw.x11.display, "_NET_WM_ICON", False);
|
||||
_glfw.x11.NET_WM_PING =
|
||||
|
@ -777,6 +783,9 @@ static GLFWbool initExtensions(void)
|
|||
_glfw.x11.NET_WM_CM_Sx = XInternAtom(_glfw.x11.display, name, False);
|
||||
}
|
||||
|
||||
// Detect whether an EWMH-conformant window manager is running
|
||||
detectEWMH();
|
||||
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
|
@ -784,13 +793,10 @@ static GLFWbool initExtensions(void)
|
|||
//
|
||||
static void getSystemContentScale(float* xscale, float* yscale)
|
||||
{
|
||||
// NOTE: Fall back to the display-wide DPI instead of RandR monitor DPI if
|
||||
// Xft.dpi retrieval below fails as we don't currently have an exact
|
||||
// policy for which monitor a window is considered to "be on"
|
||||
float xdpi = DisplayWidth(_glfw.x11.display, _glfw.x11.screen) *
|
||||
25.4f / DisplayWidthMM(_glfw.x11.display, _glfw.x11.screen);
|
||||
float ydpi = DisplayHeight(_glfw.x11.display, _glfw.x11.screen) *
|
||||
25.4f / DisplayHeightMM(_glfw.x11.display, _glfw.x11.screen);
|
||||
// Start by assuming the default X11 DPI
|
||||
// NOTE: Some desktop environments (KDE) may remove the Xft.dpi field when it
|
||||
// would be set to 96, so assume that is the case if we cannot find it
|
||||
float xdpi = 96.f, ydpi = 96.f;
|
||||
|
||||
// NOTE: Basing the scale on Xft.dpi where available should provide the most
|
||||
// consistent user experience (matches Qt, Gtk, etc), although not
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -54,9 +56,7 @@ static int calculateRefreshRate(const XRRModeInfo* mi)
|
|||
//
|
||||
static const XRRModeInfo* getModeInfo(const XRRScreenResources* sr, RRMode id)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sr->nmode; i++)
|
||||
for (int i = 0; i < sr->nmode; i++)
|
||||
{
|
||||
if (sr->modes[i].id == id)
|
||||
return sr->modes + i;
|
||||
|
@ -102,7 +102,7 @@ void _glfwPollMonitorsX11(void)
|
|||
{
|
||||
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||
{
|
||||
int i, j, disconnectedCount, screenCount = 0;
|
||||
int disconnectedCount, screenCount = 0;
|
||||
_GLFWmonitor** disconnected = NULL;
|
||||
XineramaScreenInfo* screens = NULL;
|
||||
XRRScreenResources* sr = XRRGetScreenResourcesCurrent(_glfw.x11.display,
|
||||
|
@ -122,14 +122,11 @@ void _glfwPollMonitorsX11(void)
|
|||
_glfw.monitorCount * sizeof(_GLFWmonitor*));
|
||||
}
|
||||
|
||||
for (i = 0; i < sr->noutput; i++)
|
||||
for (int i = 0; i < sr->noutput; i++)
|
||||
{
|
||||
int type, widthMM, heightMM;
|
||||
XRROutputInfo* oi;
|
||||
XRRCrtcInfo* ci;
|
||||
_GLFWmonitor* monitor;
|
||||
int j, type, widthMM, heightMM;
|
||||
|
||||
oi = XRRGetOutputInfo(_glfw.x11.display, sr, sr->outputs[i]);
|
||||
XRROutputInfo* oi = XRRGetOutputInfo(_glfw.x11.display, sr, sr->outputs[i]);
|
||||
if (oi->connection != RR_Connected || oi->crtc == None)
|
||||
{
|
||||
XRRFreeOutputInfo(oi);
|
||||
|
@ -152,7 +149,7 @@ void _glfwPollMonitorsX11(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, oi->crtc);
|
||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, oi->crtc);
|
||||
if (ci->rotation == RR_Rotate_90 || ci->rotation == RR_Rotate_270)
|
||||
{
|
||||
widthMM = oi->mm_height;
|
||||
|
@ -164,7 +161,17 @@ void _glfwPollMonitorsX11(void)
|
|||
heightMM = oi->mm_height;
|
||||
}
|
||||
|
||||
monitor = _glfwAllocMonitor(oi->name, widthMM, heightMM);
|
||||
if (widthMM <= 0 || heightMM <= 0)
|
||||
{
|
||||
// HACK: If RandR does not provide a physical size, assume the
|
||||
// X11 default 96 DPI and calcuate from the CRTC viewport
|
||||
// NOTE: These members are affected by rotation, unlike the mode
|
||||
// info and output info members
|
||||
widthMM = (int) (ci->width * 25.4f / 96.f);
|
||||
heightMM = (int) (ci->height * 25.4f / 96.f);
|
||||
}
|
||||
|
||||
_GLFWmonitor* monitor = _glfwAllocMonitor(oi->name, widthMM, heightMM);
|
||||
monitor->x11.output = sr->outputs[i];
|
||||
monitor->x11.crtc = oi->crtc;
|
||||
|
||||
|
@ -196,7 +203,7 @@ void _glfwPollMonitorsX11(void)
|
|||
if (screens)
|
||||
XFree(screens);
|
||||
|
||||
for (i = 0; i < disconnectedCount; i++)
|
||||
for (int i = 0; i < disconnectedCount; i++)
|
||||
{
|
||||
if (disconnected[i])
|
||||
_glfwInputMonitor(disconnected[i], GLFW_DISCONNECTED, 0);
|
||||
|
@ -221,24 +228,20 @@ void _glfwSetVideoModeX11(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
|||
{
|
||||
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||
{
|
||||
XRRScreenResources* sr;
|
||||
XRRCrtcInfo* ci;
|
||||
XRROutputInfo* oi;
|
||||
GLFWvidmode current;
|
||||
const GLFWvidmode* best;
|
||||
RRMode native = None;
|
||||
int i;
|
||||
|
||||
best = _glfwChooseVideoMode(monitor, desired);
|
||||
const GLFWvidmode* best = _glfwChooseVideoMode(monitor, desired);
|
||||
_glfwPlatformGetVideoMode(monitor, ¤t);
|
||||
if (_glfwCompareVideoModes(¤t, best) == 0)
|
||||
return;
|
||||
|
||||
sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
oi = XRRGetOutputInfo(_glfw.x11.display, sr, monitor->x11.output);
|
||||
XRRScreenResources* sr =
|
||||
XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
XRROutputInfo* oi = XRRGetOutputInfo(_glfw.x11.display, sr, monitor->x11.output);
|
||||
|
||||
for (i = 0; i < oi->nmode; i++)
|
||||
for (int i = 0; i < oi->nmode; i++)
|
||||
{
|
||||
const XRRModeInfo* mi = getModeInfo(sr, oi->modes[i]);
|
||||
if (!modeIsGood(mi))
|
||||
|
@ -279,14 +282,12 @@ void _glfwRestoreVideoModeX11(_GLFWmonitor* monitor)
|
|||
{
|
||||
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||
{
|
||||
XRRScreenResources* sr;
|
||||
XRRCrtcInfo* ci;
|
||||
|
||||
if (monitor->x11.oldMode == None)
|
||||
return;
|
||||
|
||||
sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
XRRScreenResources* sr =
|
||||
XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
|
||||
XRRSetCrtcConfig(_glfw.x11.display,
|
||||
sr, monitor->x11.crtc,
|
||||
|
@ -317,11 +318,9 @@ void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
|||
{
|
||||
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||
{
|
||||
XRRScreenResources* sr;
|
||||
XRRCrtcInfo* ci;
|
||||
|
||||
sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
XRRScreenResources* sr =
|
||||
XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
|
||||
if (xpos)
|
||||
*xpos = ci->x;
|
||||
|
@ -348,11 +347,9 @@ void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos
|
|||
|
||||
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||
{
|
||||
XRRScreenResources* sr;
|
||||
XRRCrtcInfo* ci;
|
||||
|
||||
sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
XRRScreenResources* sr =
|
||||
XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
|
||||
areaX = ci->x;
|
||||
areaY = ci->y;
|
||||
|
@ -444,24 +441,21 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
|
|||
|
||||
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||
{
|
||||
int i, j;
|
||||
XRRScreenResources* sr;
|
||||
XRRCrtcInfo* ci;
|
||||
XRROutputInfo* oi;
|
||||
|
||||
sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
oi = XRRGetOutputInfo(_glfw.x11.display, sr, monitor->x11.output);
|
||||
XRRScreenResources* sr =
|
||||
XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
XRROutputInfo* oi = XRRGetOutputInfo(_glfw.x11.display, sr, monitor->x11.output);
|
||||
|
||||
result = calloc(oi->nmode, sizeof(GLFWvidmode));
|
||||
|
||||
for (i = 0; i < oi->nmode; i++)
|
||||
for (int i = 0; i < oi->nmode; i++)
|
||||
{
|
||||
const XRRModeInfo* mi = getModeInfo(sr, oi->modes[i]);
|
||||
if (!modeIsGood(mi))
|
||||
continue;
|
||||
|
||||
const GLFWvidmode mode = vidmodeFromModeInfo(mi, ci);
|
||||
int j;
|
||||
|
||||
for (j = 0; j < *count; j++)
|
||||
{
|
||||
|
@ -495,11 +489,9 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
|||
{
|
||||
if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
|
||||
{
|
||||
XRRScreenResources* sr;
|
||||
XRRCrtcInfo* ci;
|
||||
|
||||
sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
XRRScreenResources* sr =
|
||||
XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
|
||||
XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
|
||||
|
||||
*mode = vidmodeFromModeInfo(getModeInfo(sr, ci->mode), ci);
|
||||
|
||||
|
|
|
@ -180,6 +180,7 @@ typedef struct _GLFWwindowX11
|
|||
{
|
||||
Colormap colormap;
|
||||
Window handle;
|
||||
Window parent;
|
||||
XIC ic;
|
||||
|
||||
GLFWbool overrideRedirect;
|
||||
|
@ -228,7 +229,7 @@ typedef struct _GLFWlibraryX11
|
|||
// Clipboard string (while the selection is owned)
|
||||
char* clipboardString;
|
||||
// Key name string
|
||||
char keyName[5];
|
||||
char keynames[GLFW_KEY_LAST + 1][5];
|
||||
// X11 keycode to GLFW key LUT
|
||||
short int keycodes[256];
|
||||
// GLFW key to X11 keycode LUT
|
||||
|
@ -239,6 +240,8 @@ typedef struct _GLFWlibraryX11
|
|||
_GLFWwindow* disabledCursorWindow;
|
||||
|
||||
// Window manager atoms
|
||||
Atom NET_SUPPORTED;
|
||||
Atom NET_SUPPORTING_WM_CHECK;
|
||||
Atom WM_PROTOCOLS;
|
||||
Atom WM_STATE;
|
||||
Atom WM_DELETE_WINDOW;
|
||||
|
@ -321,13 +324,14 @@ typedef struct _GLFWlibraryX11
|
|||
} randr;
|
||||
|
||||
struct {
|
||||
GLFWbool available;
|
||||
GLFWbool detectable;
|
||||
int majorOpcode;
|
||||
int eventBase;
|
||||
int errorBase;
|
||||
int major;
|
||||
int minor;
|
||||
GLFWbool available;
|
||||
GLFWbool detectable;
|
||||
int majorOpcode;
|
||||
int eventBase;
|
||||
int errorBase;
|
||||
int major;
|
||||
int minor;
|
||||
unsigned int group;
|
||||
} xkb;
|
||||
|
||||
struct {
|
||||
|
|
348
src/x11_window.c
348
src/x11_window.c
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -48,6 +50,10 @@
|
|||
#define Button6 6
|
||||
#define Button7 7
|
||||
|
||||
// Motif WM hints flags
|
||||
#define MWM_HINTS_DECORATIONS 2
|
||||
#define MWM_DECOR_ALL 1
|
||||
|
||||
#define _GLFW_XDND_VERSION 5
|
||||
|
||||
|
||||
|
@ -213,10 +219,7 @@ static int translateKey(int scancode)
|
|||
static void sendEventToWM(_GLFWwindow* window, Atom type,
|
||||
long a, long b, long c, long d, long e)
|
||||
{
|
||||
XEvent event;
|
||||
memset(&event, 0, sizeof(event));
|
||||
|
||||
event.type = ClientMessage;
|
||||
XEvent event = { ClientMessage };
|
||||
event.xclient.window = window->x11.handle;
|
||||
event.xclient.format = 32; // Data is 32-bit longs
|
||||
event.xclient.message_type = type;
|
||||
|
@ -610,46 +613,40 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
|||
|
||||
window->x11.transparent = _glfwIsVisualTransparentX11(visual);
|
||||
|
||||
// Create the actual window
|
||||
XSetWindowAttributes wa = { 0 };
|
||||
wa.colormap = window->x11.colormap;
|
||||
wa.event_mask = StructureNotifyMask | KeyPressMask | KeyReleaseMask |
|
||||
PointerMotionMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ExposureMask | FocusChangeMask | VisibilityChangeMask |
|
||||
EnterWindowMask | LeaveWindowMask | PropertyChangeMask;
|
||||
|
||||
_glfwGrabErrorHandlerX11();
|
||||
|
||||
window->x11.handle = XCreateWindow(_glfw.x11.display,
|
||||
_glfw.x11.root,
|
||||
0, 0, // Position
|
||||
width, height,
|
||||
0, // Border width
|
||||
depth, // Color depth
|
||||
InputOutput,
|
||||
visual,
|
||||
CWBorderPixel | CWColormap | CWEventMask,
|
||||
&wa);
|
||||
|
||||
_glfwReleaseErrorHandlerX11();
|
||||
|
||||
if (!window->x11.handle)
|
||||
{
|
||||
XSetWindowAttributes wa;
|
||||
const unsigned long wamask = CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
wa.colormap = window->x11.colormap;
|
||||
wa.border_pixel = 0;
|
||||
wa.event_mask = StructureNotifyMask | KeyPressMask | KeyReleaseMask |
|
||||
PointerMotionMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ExposureMask | FocusChangeMask | VisibilityChangeMask |
|
||||
EnterWindowMask | LeaveWindowMask | PropertyChangeMask;
|
||||
|
||||
_glfwGrabErrorHandlerX11();
|
||||
|
||||
window->x11.handle = XCreateWindow(_glfw.x11.display,
|
||||
_glfw.x11.root,
|
||||
0, 0,
|
||||
width, height,
|
||||
0, // Border width
|
||||
depth, // Color depth
|
||||
InputOutput,
|
||||
visual,
|
||||
wamask,
|
||||
&wa);
|
||||
|
||||
_glfwReleaseErrorHandlerX11();
|
||||
|
||||
if (!window->x11.handle)
|
||||
{
|
||||
_glfwInputErrorX11(GLFW_PLATFORM_ERROR,
|
||||
"X11: Failed to create window");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
XSaveContext(_glfw.x11.display,
|
||||
window->x11.handle,
|
||||
_glfw.x11.context,
|
||||
(XPointer) window);
|
||||
_glfwInputErrorX11(GLFW_PLATFORM_ERROR,
|
||||
"X11: Failed to create window");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
XSaveContext(_glfw.x11.display,
|
||||
window->x11.handle,
|
||||
_glfw.x11.context,
|
||||
(XPointer) window);
|
||||
|
||||
if (!wndconfig->decorated)
|
||||
_glfwPlatformSetWindowDecorated(window, GLFW_FALSE);
|
||||
|
||||
|
@ -679,7 +676,7 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
|||
{
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
|
||||
PropModeReplace, (unsigned char*) &states, count);
|
||||
PropModeReplace, (unsigned char*) states, count);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -784,6 +781,13 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
|||
NULL);
|
||||
}
|
||||
|
||||
if (window->x11.ic)
|
||||
{
|
||||
unsigned long filter = 0;
|
||||
if (XGetICValues(window->x11.ic, XNFilterEvents, &filter, NULL) == NULL)
|
||||
XSelectInput(_glfw.x11.display, window->x11.handle, wa.event_mask | filter);
|
||||
}
|
||||
|
||||
_glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos);
|
||||
_glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height);
|
||||
|
||||
|
@ -944,11 +948,8 @@ static void handleSelectionRequest(XEvent* event)
|
|||
{
|
||||
const XSelectionRequestEvent* request = &event->xselectionrequest;
|
||||
|
||||
XEvent reply;
|
||||
memset(&reply, 0, sizeof(reply));
|
||||
|
||||
XEvent reply = { SelectionNotify };
|
||||
reply.xselection.property = writeTargetToProperty(request);
|
||||
reply.xselection.type = SelectionNotify;
|
||||
reply.xselection.display = request->display;
|
||||
reply.xselection.requestor = request->requestor;
|
||||
reply.xselection.selection = request->selection;
|
||||
|
@ -960,7 +961,6 @@ static void handleSelectionRequest(XEvent* event)
|
|||
|
||||
static const char* getSelectionString(Atom selection)
|
||||
{
|
||||
size_t i;
|
||||
char** selectionString = NULL;
|
||||
const Atom targets[] = { _glfw.x11.UTF8_STRING, XA_STRING };
|
||||
const size_t targetCount = sizeof(targets) / sizeof(targets[0]);
|
||||
|
@ -981,7 +981,7 @@ static const char* getSelectionString(Atom selection)
|
|||
free(*selectionString);
|
||||
*selectionString = NULL;
|
||||
|
||||
for (i = 0; i < targetCount; i++)
|
||||
for (size_t i = 0; i < targetCount; i++)
|
||||
{
|
||||
char* data;
|
||||
Atom actualType;
|
||||
|
@ -1165,7 +1165,6 @@ static void releaseMonitor(_GLFWwindow* window)
|
|||
//
|
||||
static void processEvent(XEvent *event)
|
||||
{
|
||||
_GLFWwindow* window = NULL;
|
||||
int keycode = 0;
|
||||
Bool filtered = False;
|
||||
|
||||
|
@ -1186,6 +1185,18 @@ static void processEvent(XEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
if (_glfw.x11.xkb.available)
|
||||
{
|
||||
if (event->type == _glfw.x11.xkb.eventBase + XkbEventCode)
|
||||
{
|
||||
if (((XkbEvent*) event)->any.xkb_type == XkbStateNotify &&
|
||||
(((XkbEvent*) event)->state.changed & XkbGroupStateMask))
|
||||
{
|
||||
_glfw.x11.xkb.group = ((XkbEvent*) event)->state.group;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event->type == GenericEvent)
|
||||
{
|
||||
if (_glfw.x11.xi.available)
|
||||
|
@ -1235,6 +1246,7 @@ static void processEvent(XEvent *event)
|
|||
return;
|
||||
}
|
||||
|
||||
_GLFWwindow* window = NULL;
|
||||
if (XFindContext(_glfw.x11.display,
|
||||
event->xany.window,
|
||||
_glfw.x11.context,
|
||||
|
@ -1246,6 +1258,18 @@ static void processEvent(XEvent *event)
|
|||
|
||||
switch (event->type)
|
||||
{
|
||||
case CreateNotify:
|
||||
{
|
||||
window->x11.parent = event->xcreatewindow.parent;
|
||||
return;
|
||||
}
|
||||
|
||||
case ReparentNotify:
|
||||
{
|
||||
window->x11.parent = event->xreparent.parent;
|
||||
return;
|
||||
}
|
||||
|
||||
case KeyPress:
|
||||
{
|
||||
const int key = translateKey(keycode);
|
||||
|
@ -1530,18 +1554,28 @@ static void processEvent(XEvent *event)
|
|||
window->x11.height = event->xconfigure.height;
|
||||
}
|
||||
|
||||
if (event->xconfigure.x != window->x11.xpos ||
|
||||
event->xconfigure.y != window->x11.ypos)
|
||||
{
|
||||
if (window->x11.overrideRedirect || event->xany.send_event)
|
||||
{
|
||||
_glfwInputWindowPos(window,
|
||||
event->xconfigure.x,
|
||||
event->xconfigure.y);
|
||||
int xpos = event->xconfigure.x;
|
||||
int ypos = event->xconfigure.y;
|
||||
|
||||
window->x11.xpos = event->xconfigure.x;
|
||||
window->x11.ypos = event->xconfigure.y;
|
||||
}
|
||||
// NOTE: ConfigureNotify events from the server are in local
|
||||
// coordinates, so if we are reparented we need to translate
|
||||
// the position into root (screen) coordinates
|
||||
if (!event->xany.send_event && window->x11.parent != _glfw.x11.root)
|
||||
{
|
||||
Window dummy;
|
||||
XTranslateCoordinates(_glfw.x11.display,
|
||||
window->x11.parent,
|
||||
_glfw.x11.root,
|
||||
xpos, ypos,
|
||||
&xpos, &ypos,
|
||||
&dummy);
|
||||
}
|
||||
|
||||
if (xpos != window->x11.xpos || ypos != window->x11.ypos)
|
||||
{
|
||||
_glfwInputWindowPos(window, xpos, ypos);
|
||||
window->x11.xpos = xpos;
|
||||
window->x11.ypos = ypos;
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -1646,10 +1680,7 @@ static void processEvent(XEvent *event)
|
|||
}
|
||||
else if (_glfw.x11.xdnd.version >= 2)
|
||||
{
|
||||
XEvent reply;
|
||||
memset(&reply, 0, sizeof(reply));
|
||||
|
||||
reply.type = ClientMessage;
|
||||
XEvent reply = { ClientMessage };
|
||||
reply.xclient.window = _glfw.x11.xdnd.source;
|
||||
reply.xclient.message_type = _glfw.x11.XdndFinished;
|
||||
reply.xclient.format = 32;
|
||||
|
@ -1682,10 +1713,7 @@ static void processEvent(XEvent *event)
|
|||
|
||||
_glfwInputCursorPos(window, xpos, ypos);
|
||||
|
||||
XEvent reply;
|
||||
memset(&reply, 0, sizeof(reply));
|
||||
|
||||
reply.type = ClientMessage;
|
||||
XEvent reply = { ClientMessage };
|
||||
reply.xclient.window = _glfw.x11.xdnd.source;
|
||||
reply.xclient.message_type = _glfw.x11.XdndStatus;
|
||||
reply.xclient.format = 32;
|
||||
|
@ -1738,10 +1766,7 @@ static void processEvent(XEvent *event)
|
|||
|
||||
if (_glfw.x11.xdnd.version >= 2)
|
||||
{
|
||||
XEvent reply;
|
||||
memset(&reply, 0, sizeof(reply));
|
||||
|
||||
reply.type = ClientMessage;
|
||||
XEvent reply = { ClientMessage };
|
||||
reply.xclient.window = _glfw.x11.xdnd.source;
|
||||
reply.xclient.message_type = _glfw.x11.XdndFinished;
|
||||
reply.xclient.format = 32;
|
||||
|
@ -1760,9 +1785,6 @@ static void processEvent(XEvent *event)
|
|||
|
||||
case FocusIn:
|
||||
{
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
disableCursor(window);
|
||||
|
||||
if (event->xfocus.mode == NotifyGrab ||
|
||||
event->xfocus.mode == NotifyUngrab)
|
||||
{
|
||||
|
@ -1771,6 +1793,9 @@ static void processEvent(XEvent *event)
|
|||
return;
|
||||
}
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
disableCursor(window);
|
||||
|
||||
if (window->x11.ic)
|
||||
XSetICFocus(window->x11.ic);
|
||||
|
||||
|
@ -1780,9 +1805,6 @@ static void processEvent(XEvent *event)
|
|||
|
||||
case FocusOut:
|
||||
{
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
enableCursor(window);
|
||||
|
||||
if (event->xfocus.mode == NotifyGrab ||
|
||||
event->xfocus.mode == NotifyUngrab)
|
||||
{
|
||||
|
@ -1791,6 +1813,9 @@ static void processEvent(XEvent *event)
|
|||
return;
|
||||
}
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||
enableCursor(window);
|
||||
|
||||
if (window->x11.ic)
|
||||
XUnsetICFocus(window->x11.ic);
|
||||
|
||||
|
@ -2338,18 +2363,67 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
|||
|
||||
void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
|
||||
{
|
||||
if (_glfw.x11.NET_WM_STATE &&
|
||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT &&
|
||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ)
|
||||
if (!_glfw.x11.NET_WM_STATE ||
|
||||
!_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT ||
|
||||
!_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_glfwPlatformWindowVisible(window))
|
||||
{
|
||||
sendEventToWM(window,
|
||||
_glfw.x11.NET_WM_STATE,
|
||||
_NET_WM_STATE_ADD,
|
||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT,
|
||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ,
|
||||
1, 0);
|
||||
XFlush(_glfw.x11.display);
|
||||
_glfw.x11.NET_WM_STATE,
|
||||
_NET_WM_STATE_ADD,
|
||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT,
|
||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ,
|
||||
1, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Atom* states = NULL;
|
||||
unsigned long count =
|
||||
_glfwGetWindowPropertyX11(window->x11.handle,
|
||||
_glfw.x11.NET_WM_STATE,
|
||||
XA_ATOM,
|
||||
(unsigned char**) &states);
|
||||
|
||||
// NOTE: We don't check for failure as this property may not exist yet
|
||||
// and that's fine (and we'll create it implicitly with append)
|
||||
|
||||
Atom missing[2] =
|
||||
{
|
||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT,
|
||||
_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ
|
||||
};
|
||||
unsigned long missingCount = 2;
|
||||
|
||||
for (unsigned long i = 0; i < count; i++)
|
||||
{
|
||||
for (unsigned long j = 0; j < missingCount; j++)
|
||||
{
|
||||
if (states[i] == missing[j])
|
||||
{
|
||||
missing[j] = missing[missingCount - 1];
|
||||
missingCount--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (states)
|
||||
XFree(states);
|
||||
|
||||
if (!missingCount)
|
||||
return;
|
||||
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
|
||||
PropModeAppend,
|
||||
(unsigned char*) missing,
|
||||
missingCount);
|
||||
}
|
||||
|
||||
XFlush(_glfw.x11.display);
|
||||
}
|
||||
|
||||
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
||||
|
@ -2369,6 +2443,9 @@ void _glfwPlatformHideWindow(_GLFWwindow* window)
|
|||
|
||||
void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
|
||||
{
|
||||
if (!_glfw.x11.NET_WM_STATE || !_glfw.x11.NET_WM_STATE_DEMANDS_ATTENTION)
|
||||
return;
|
||||
|
||||
sendEventToWM(window,
|
||||
_glfw.x11.NET_WM_STATE,
|
||||
_NET_WM_STATE_ADD,
|
||||
|
@ -2538,33 +2615,24 @@ void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
|
|||
|
||||
void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
|
||||
{
|
||||
if (enabled)
|
||||
struct
|
||||
{
|
||||
XDeleteProperty(_glfw.x11.display,
|
||||
window->x11.handle,
|
||||
_glfw.x11.MOTIF_WM_HINTS);
|
||||
}
|
||||
else
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned long functions;
|
||||
unsigned long decorations;
|
||||
long input_mode;
|
||||
unsigned long status;
|
||||
} hints;
|
||||
unsigned long flags;
|
||||
unsigned long functions;
|
||||
unsigned long decorations;
|
||||
long input_mode;
|
||||
unsigned long status;
|
||||
} hints = {0};
|
||||
|
||||
hints.flags = 2; // Set decorations
|
||||
hints.decorations = 0; // No decorations
|
||||
hints.flags = MWM_HINTS_DECORATIONS;
|
||||
hints.decorations = enabled ? MWM_DECOR_ALL : 0;
|
||||
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.MOTIF_WM_HINTS,
|
||||
_glfw.x11.MOTIF_WM_HINTS, 32,
|
||||
PropModeReplace,
|
||||
(unsigned char*) &hints,
|
||||
sizeof(hints) / sizeof(long));
|
||||
}
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.MOTIF_WM_HINTS,
|
||||
_glfw.x11.MOTIF_WM_HINTS, 32,
|
||||
PropModeReplace,
|
||||
(unsigned char*) &hints,
|
||||
sizeof(hints) / sizeof(long));
|
||||
}
|
||||
|
||||
void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
|
||||
|
@ -2574,7 +2642,7 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
|
|||
|
||||
if (_glfwPlatformWindowVisible(window))
|
||||
{
|
||||
const Atom action = enabled ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
|
||||
const long action = enabled ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
|
||||
sendEventToWM(window,
|
||||
_glfw.x11.NET_WM_STATE,
|
||||
action,
|
||||
|
@ -2583,15 +2651,16 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
|
|||
}
|
||||
else
|
||||
{
|
||||
Atom* states;
|
||||
Atom* states = NULL;
|
||||
unsigned long i, count;
|
||||
|
||||
count = _glfwGetWindowPropertyX11(window->x11.handle,
|
||||
_glfw.x11.NET_WM_STATE,
|
||||
XA_ATOM,
|
||||
(unsigned char**) &states);
|
||||
if (!states)
|
||||
return;
|
||||
|
||||
// NOTE: We don't check for failure as this property may not exist yet
|
||||
// and that's fine (and we'll create it implicitly with append)
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
|
@ -2601,32 +2670,36 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
|
|||
break;
|
||||
}
|
||||
|
||||
if (i == count)
|
||||
{
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
|
||||
PropModeAppend,
|
||||
(unsigned char*) &_glfw.x11.NET_WM_STATE_ABOVE,
|
||||
1);
|
||||
}
|
||||
if (i < count)
|
||||
return;
|
||||
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
|
||||
PropModeAppend,
|
||||
(unsigned char*) &_glfw.x11.NET_WM_STATE_ABOVE,
|
||||
1);
|
||||
}
|
||||
else
|
||||
else if (states)
|
||||
{
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (states[i] == _glfw.x11.NET_WM_STATE_ABOVE)
|
||||
{
|
||||
states[i] = states[count - 1];
|
||||
count--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == count)
|
||||
return;
|
||||
|
||||
states[i] = states[count - 1];
|
||||
count--;
|
||||
|
||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||
_glfw.x11.NET_WM_STATE, XA_ATOM, 32,
|
||||
PropModeReplace, (unsigned char*) &states, count);
|
||||
PropModeReplace, (unsigned char*) states, count);
|
||||
}
|
||||
|
||||
XFree(states);
|
||||
if (states)
|
||||
XFree(states);
|
||||
}
|
||||
|
||||
XFlush(_glfw.x11.display);
|
||||
|
@ -2737,10 +2810,7 @@ void _glfwPlatformWaitEventsTimeout(double timeout)
|
|||
|
||||
void _glfwPlatformPostEmptyEvent(void)
|
||||
{
|
||||
XEvent event;
|
||||
|
||||
memset(&event, 0, sizeof(event));
|
||||
event.type = ClientMessage;
|
||||
XEvent event = { ClientMessage };
|
||||
event.xclient.window = _glfw.x11.helperWindowHandle;
|
||||
event.xclient.format = 32; // Data is 32-bit longs
|
||||
event.xclient.message_type = _glfw.x11.NULL_;
|
||||
|
@ -2797,7 +2867,9 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||
if (!_glfw.x11.xkb.available)
|
||||
return NULL;
|
||||
|
||||
const KeySym keysym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, 0, 0);
|
||||
const int key = _glfw.x11.keycodes[scancode];
|
||||
const KeySym keysym = XkbKeycodeToKeysym(_glfw.x11.display,
|
||||
scancode, _glfw.x11.xkb.group, 0);
|
||||
if (keysym == NoSymbol)
|
||||
return NULL;
|
||||
|
||||
|
@ -2805,12 +2877,12 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||
if (ch == -1)
|
||||
return NULL;
|
||||
|
||||
const size_t count = encodeUTF8(_glfw.x11.keyName, (unsigned int) ch);
|
||||
const size_t count = encodeUTF8(_glfw.x11.keynames[key], (unsigned int) ch);
|
||||
if (count == 0)
|
||||
return NULL;
|
||||
|
||||
_glfw.x11.keyName[count] = '\0';
|
||||
return _glfw.x11.keyName;
|
||||
_glfw.x11.keynames[key][count] = '\0';
|
||||
return _glfw.x11.keynames[key];
|
||||
}
|
||||
|
||||
int _glfwPlatformGetKeyScancode(int key)
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
// It is fine to use C99 in this file because it will not be built with VS
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
link_libraries(glfw)
|
||||
|
||||
include_directories(${glfw_INCLUDE_DIRS} "${GLFW_SOURCE_DIR}/deps")
|
||||
include_directories("${GLFW_SOURCE_DIR}/deps")
|
||||
|
||||
if (MATH_LIBRARY)
|
||||
link_libraries("${MATH_LIBRARY}")
|
||||
|
@ -20,6 +20,17 @@ set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
|
|||
set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
|
||||
"${GLFW_SOURCE_DIR}/deps/tinycthread.c")
|
||||
|
||||
if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR
|
||||
${CMAKE_VERSION} VERSION_GREATER "3.1.0")
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
else()
|
||||
# Remove this fallback when removing support for CMake version less than 3.1
|
||||
add_compile_options("$<$<C_COMPILER_ID:AppleClang>:-std=c99>"
|
||||
"$<$<C_COMPILER_ID:Clang>:-std=c99>"
|
||||
"$<$<C_COMPILER_ID:GNU>:-std=c99>")
|
||||
|
||||
endif()
|
||||
|
||||
add_executable(clipboard clipboard.c ${GETOPT} ${GLAD_GL})
|
||||
add_executable(events events.c ${GETOPT} ${GLAD_GL})
|
||||
add_executable(msaa msaa.c ${GETOPT} ${GLAD_GL})
|
||||
|
@ -39,7 +50,7 @@ add_executable(tearing WIN32 MACOSX_BUNDLE tearing.c ${GLAD_GL})
|
|||
add_executable(threads WIN32 MACOSX_BUNDLE threads.c ${TINYCTHREAD} ${GLAD_GL})
|
||||
add_executable(timeout WIN32 MACOSX_BUNDLE timeout.c ${GLAD_GL})
|
||||
add_executable(title WIN32 MACOSX_BUNDLE title.c ${GLAD_GL})
|
||||
add_executable(vulkan WIN32 vulkan.c ${ICON} ${GLAD_VULKAN})
|
||||
add_executable(triangle-vulkan WIN32 triangle-vulkan.c ${GLAD_VULKAN})
|
||||
add_executable(windows WIN32 MACOSX_BUNDLE windows.c ${GETOPT} ${GLAD_GL})
|
||||
|
||||
target_link_libraries(empty "${CMAKE_THREAD_LIBS_INIT}")
|
||||
|
@ -49,17 +60,17 @@ if (RT_LIBRARY)
|
|||
target_link_libraries(threads "${RT_LIBRARY}")
|
||||
endif()
|
||||
|
||||
set(WINDOWS_BINARIES empty gamma icon inputlag joysticks opacity tearing
|
||||
threads timeout title vulkan windows)
|
||||
set(GUI_ONLY_BINARIES empty gamma icon inputlag joysticks opacity tearing
|
||||
threads timeout title triangle-vulkan windows)
|
||||
set(CONSOLE_BINARIES clipboard events msaa glfwinfo iconify monitors reopen
|
||||
cursor)
|
||||
|
||||
set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
|
||||
set_target_properties(${GUI_ONLY_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
|
||||
FOLDER "GLFW3/Tests")
|
||||
|
||||
if (MSVC)
|
||||
# Tell MSVC to use main instead of WinMain for Windows subsystem executables
|
||||
set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
|
||||
set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES
|
||||
LINK_FLAGS "/ENTRY:mainCRTStartup")
|
||||
endif()
|
||||
|
||||
|
@ -73,12 +84,11 @@ if (APPLE)
|
|||
set_target_properties(threads PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Threads")
|
||||
set_target_properties(timeout PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Timeout")
|
||||
set_target_properties(title PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Title")
|
||||
set_target_properties(windows PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Vulkan")
|
||||
set_target_properties(windows PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Windows")
|
||||
|
||||
set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
|
||||
set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION}
|
||||
MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION_FULL}
|
||||
MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION}
|
||||
MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/MacOSXBundleInfo.plist.in")
|
||||
endif()
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "tinycthread.h"
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <math.h>
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -174,7 +175,7 @@ static const char* get_key_name(int key)
|
|||
case GLFW_KEY_KP_8: return "KEYPAD 8";
|
||||
case GLFW_KEY_KP_9: return "KEYPAD 9";
|
||||
case GLFW_KEY_KP_DIVIDE: return "KEYPAD DIVIDE";
|
||||
case GLFW_KEY_KP_MULTIPLY: return "KEYPAD MULTPLY";
|
||||
case GLFW_KEY_KP_MULTIPLY: return "KEYPAD MULTIPLY";
|
||||
case GLFW_KEY_KP_SUBTRACT: return "KEYPAD SUBTRACT";
|
||||
case GLFW_KEY_KP_ADD: return "KEYPAD ADD";
|
||||
case GLFW_KEY_KP_DECIMAL: return "KEYPAD DECIMAL";
|
||||
|
@ -252,17 +253,32 @@ static const char* get_mods_name(int mods)
|
|||
return name;
|
||||
}
|
||||
|
||||
static const char* get_character_string(int codepoint)
|
||||
static size_t encode_utf8(char* s, unsigned int ch)
|
||||
{
|
||||
// This assumes UTF-8, which is stupid
|
||||
static char result[6 + 1];
|
||||
size_t count = 0;
|
||||
|
||||
int length = wctomb(result, codepoint);
|
||||
if (length == -1)
|
||||
length = 0;
|
||||
if (ch < 0x80)
|
||||
s[count++] = (char) ch;
|
||||
else if (ch < 0x800)
|
||||
{
|
||||
s[count++] = (ch >> 6) | 0xc0;
|
||||
s[count++] = (ch & 0x3f) | 0x80;
|
||||
}
|
||||
else if (ch < 0x10000)
|
||||
{
|
||||
s[count++] = (ch >> 12) | 0xe0;
|
||||
s[count++] = ((ch >> 6) & 0x3f) | 0x80;
|
||||
s[count++] = (ch & 0x3f) | 0x80;
|
||||
}
|
||||
else if (ch < 0x110000)
|
||||
{
|
||||
s[count++] = (ch >> 18) | 0xf0;
|
||||
s[count++] = ((ch >> 12) & 0x3f) | 0x80;
|
||||
s[count++] = ((ch >> 6) & 0x3f) | 0x80;
|
||||
s[count++] = (ch & 0x3f) | 0x80;
|
||||
}
|
||||
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
return count;
|
||||
}
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
|
@ -424,12 +440,14 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
|
|||
static void char_callback(GLFWwindow* window, unsigned int codepoint)
|
||||
{
|
||||
Slot* slot = glfwGetWindowUserPointer(window);
|
||||
char string[5] = "";
|
||||
|
||||
encode_utf8(string, codepoint);
|
||||
printf("%08x to %i at %0.3f: Character 0x%08x (%s) input\n",
|
||||
counter++, slot->number, glfwGetTime(), codepoint,
|
||||
get_character_string(codepoint));
|
||||
counter++, slot->number, glfwGetTime(), codepoint, string);
|
||||
}
|
||||
|
||||
static void drop_callback(GLFWwindow* window, int count, const char** paths)
|
||||
static void drop_callback(GLFWwindow* window, int count, const char* paths[])
|
||||
{
|
||||
int i;
|
||||
Slot* slot = glfwGetWindowUserPointer(window);
|
||||
|
@ -499,8 +517,6 @@ int main(int argc, char** argv)
|
|||
GLFWmonitor* monitor = NULL;
|
||||
int ch, i, width, height, count = 1;
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define NK_IMPLEMENTATION
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <glad/gl.h>
|
||||
#include <glad/vulkan.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -358,7 +359,8 @@ int main(int argc, char** argv)
|
|||
GLenum error;
|
||||
GLFWwindow* window;
|
||||
|
||||
enum { CLIENT, CONTEXT, BEHAVIOR, DEBUG, FORWARD, HELP, EXTENSIONS, LAYERS,
|
||||
enum { CLIENT, CONTEXT, BEHAVIOR, DEBUG_CONTEXT, FORWARD, HELP,
|
||||
EXTENSIONS, LAYERS,
|
||||
MAJOR, MINOR, PROFILE, ROBUSTNESS, VERSION,
|
||||
REDBITS, GREENBITS, BLUEBITS, ALPHABITS, DEPTHBITS, STENCILBITS,
|
||||
ACCUMREDBITS, ACCUMGREENBITS, ACCUMBLUEBITS, ACCUMALPHABITS,
|
||||
|
@ -369,7 +371,7 @@ int main(int argc, char** argv)
|
|||
{ "behavior", 1, NULL, BEHAVIOR },
|
||||
{ "client-api", 1, NULL, CLIENT },
|
||||
{ "context-api", 1, NULL, CONTEXT },
|
||||
{ "debug", 0, NULL, DEBUG },
|
||||
{ "debug", 0, NULL, DEBUG_CONTEXT },
|
||||
{ "forward", 0, NULL, FORWARD },
|
||||
{ "help", 0, NULL, HELP },
|
||||
{ "list-extensions", 0, NULL, EXTENSIONS },
|
||||
|
@ -460,7 +462,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
break;
|
||||
case 'd':
|
||||
case DEBUG:
|
||||
case DEBUG_CONTEXT:
|
||||
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE);
|
||||
break;
|
||||
case 'f':
|
||||
|
@ -809,6 +811,7 @@ int main(int argc, char** argv)
|
|||
|
||||
if (glfwVulkanSupported())
|
||||
{
|
||||
uint32_t loader_version = VK_API_VERSION_1_0;
|
||||
uint32_t i, re_count, pd_count;
|
||||
const char** re;
|
||||
VkApplicationInfo ai = {0};
|
||||
|
@ -818,6 +821,17 @@ int main(int argc, char** argv)
|
|||
|
||||
gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, NULL);
|
||||
|
||||
if (vkEnumerateInstanceVersion)
|
||||
{
|
||||
uint32_t version;
|
||||
if (vkEnumerateInstanceVersion(&version) == VK_SUCCESS)
|
||||
loader_version = version;
|
||||
}
|
||||
|
||||
printf("Vulkan loader API version: %i.%i\n",
|
||||
VK_VERSION_MAJOR(loader_version),
|
||||
VK_VERSION_MINOR(loader_version));
|
||||
|
||||
re = glfwGetRequiredInstanceExtensions(&re_count);
|
||||
|
||||
printf("Vulkan required instance extensions:");
|
||||
|
@ -838,10 +852,14 @@ int main(int argc, char** argv)
|
|||
|
||||
ai.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
||||
ai.pApplicationName = "glfwinfo";
|
||||
ai.applicationVersion = GLFW_VERSION_MAJOR;
|
||||
ai.pEngineName = "GLFW";
|
||||
ai.engineVersion = GLFW_VERSION_MAJOR;
|
||||
ai.apiVersion = VK_API_VERSION_1_0;
|
||||
ai.applicationVersion = VK_MAKE_VERSION(GLFW_VERSION_MAJOR,
|
||||
GLFW_VERSION_MINOR,
|
||||
GLFW_VERSION_REVISION);
|
||||
|
||||
if (loader_version >= VK_API_VERSION_1_1)
|
||||
ai.apiVersion = VK_API_VERSION_1_1;
|
||||
else
|
||||
ai.apiVersion = VK_API_VERSION_1_0;
|
||||
|
||||
ici.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||
ici.pApplicationInfo = &ai;
|
||||
|
@ -879,9 +897,11 @@ int main(int argc, char** argv)
|
|||
|
||||
vkGetPhysicalDeviceProperties(pd[i], &pdp);
|
||||
|
||||
printf("Vulkan %s device: \"%s\"\n",
|
||||
printf("Vulkan %s device: \"%s\" API version %i.%i\n",
|
||||
get_device_type_name(pdp.deviceType),
|
||||
pdp.deviceName);
|
||||
pdp.deviceName,
|
||||
VK_VERSION_MAJOR(pdp.apiVersion),
|
||||
VK_VERSION_MINOR(pdp.apiVersion));
|
||||
|
||||
if (list_extensions)
|
||||
list_vulkan_device_extensions(instance, pd[i]);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define NK_IMPLEMENTATION
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define NK_IMPLEMENTATION
|
||||
|
@ -85,7 +86,7 @@ static void joystick_callback(int jid, int event)
|
|||
glfwRequestWindowAttention(window);
|
||||
}
|
||||
|
||||
static void drop_callback(GLFWwindow* window, int count, const char** paths)
|
||||
static void drop_callback(GLFWwindow* window, int count, const char* paths[])
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -108,13 +109,13 @@ static void list_modes(GLFWmonitor* monitor)
|
|||
glfwGetMonitorName(monitor),
|
||||
glfwGetPrimaryMonitor() == monitor ? "primary" : "secondary");
|
||||
printf("Current mode: %s\n", format_mode(mode));
|
||||
printf("Virtual position: %i %i\n", x, y);
|
||||
printf("Content scale: %f %f\n", xscale, yscale);
|
||||
printf("Virtual position: %i, %i\n", x, y);
|
||||
printf("Content scale: %f x %f\n", xscale, yscale);
|
||||
|
||||
printf("Physical size: %i x %i mm (%0.2f dpi)\n",
|
||||
width_mm, height_mm, mode->width * 25.4f / width_mm);
|
||||
printf("Monitor work area: pos=(%d,%d) size=(%dx%d)\n",
|
||||
workarea_x, workarea_y, workarea_width, workarea_height);
|
||||
printf("Physical size: %i x %i mm (%0.2f dpi at %i x %i)\n",
|
||||
width_mm, height_mm, mode->width * 25.4f / width_mm, mode->width, mode->height);
|
||||
printf("Monitor work area: %i x %i starting at %i, %i\n",
|
||||
workarea_width, workarea_height, workarea_x, workarea_y);
|
||||
|
||||
printf("Modes:\n");
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define NK_IMPLEMENTATION
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <time.h>
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -68,14 +69,6 @@ static int swap_tear;
|
|||
static int swap_interval;
|
||||
static double frame_rate;
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
printf("Usage: tearing [-f] [-h]\n");
|
||||
printf("Options:\n");
|
||||
printf(" -f use full screen\n");
|
||||
printf(" -h show this help\n");
|
||||
}
|
||||
|
||||
static void update_window_title(GLFWwindow* window)
|
||||
{
|
||||
char title[256];
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "tinycthread.h"
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <time.h>
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -2177,6 +2177,7 @@ static void demo_resize(struct demo *demo) {
|
|||
|
||||
if (demo->setup_cmd) {
|
||||
vkFreeCommandBuffers(demo->device, demo->cmd_pool, 1, &demo->setup_cmd);
|
||||
demo->setup_cmd = VK_NULL_HANDLE;
|
||||
}
|
||||
vkFreeCommandBuffers(demo->device, demo->cmd_pool, 1, &demo->draw_cmd);
|
||||
vkDestroyCommandPool(demo->device, demo->cmd_pool, NULL);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user