mirror of
https://github.com/glfw/glfw.git
synced 2024-11-15 10:44:34 +00:00
Merged from glfw master
This commit is contained in:
commit
1a8305e57c
@ -1,21 +1,62 @@
|
|||||||
|
image:
|
||||||
|
- Visual Studio 2015
|
||||||
|
- Visual Studio 2019
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- ci
|
- ci
|
||||||
- master
|
- master
|
||||||
- 3.3-stable
|
- 3.3-stable
|
||||||
skip_tags: true
|
skip_tags: true
|
||||||
|
skip_commits:
|
||||||
|
files:
|
||||||
|
- README.md
|
||||||
|
- LICENSE.md
|
||||||
|
- docs/*
|
||||||
environment:
|
environment:
|
||||||
|
matrix:
|
||||||
|
- 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
|
CFLAGS: /WX
|
||||||
matrix:
|
|
||||||
- BUILD_SHARED_LIBS: ON
|
|
||||||
- BUILD_SHARED_LIBS: OFF
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
|
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:
|
build_script:
|
||||||
- mkdir build
|
- set PATH=%PATH:C:\Program Files\Git\usr\bin=C:\MinGW\bin%
|
||||||
- cd build
|
- cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
|
||||||
- cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% ..
|
- cmake --build build
|
||||||
- cmake --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:
|
notifications:
|
||||||
- provider: Email
|
- provider: Email
|
||||||
to:
|
to:
|
||||||
|
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>
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
if (NOT EXISTS "@GLFW_BINARY_DIR@/install_manifest.txt")
|
||||||
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
message(FATAL_ERROR "Cannot find install manifest: \"@GLFW_BINARY_DIR@/install_manifest.txt\"")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
file(READ "@GLFW_BINARY_DIR@/install_manifest.txt" files)
|
||||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||||
|
|
||||||
foreach (file ${files})
|
foreach (file ${files})
|
@ -367,7 +367,7 @@ if (GLFW_INSTALL)
|
|||||||
|
|
||||||
# Only generate this target if no higher-level project already has
|
# Only generate this target if no higher-level project already has
|
||||||
if (NOT TARGET uninstall)
|
if (NOT TARGET uninstall)
|
||||||
configure_file(cmake_uninstall.cmake.in
|
configure_file(CMake/cmake_uninstall.cmake.in
|
||||||
cmake_uninstall.cmake IMMEDIATE @ONLY)
|
cmake_uninstall.cmake IMMEDIATE @ONLY)
|
||||||
|
|
||||||
add_custom_target(uninstall
|
add_custom_target(uninstall
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
Copyright (c) 2002-2006 Marcus Geelnard
|
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
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
21
README.md
21
README.md
@ -118,18 +118,33 @@ information on what to include when reporting a bug.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
- Added `GLFW_RESIZE_NWSE_CURSOR`, `GLFW_RESIZE_NESW_CURSOR`,
|
||||||
|
`GLFW_RESIZE_ALL_CURSOR` and `GLFW_NOT_ALLOWED_CURSOR` cursor shapes (#427)
|
||||||
|
- Added `GLFW_RESIZE_EW_CURSOR` alias for `GLFW_HRESIZE_CURSOR` (#427)
|
||||||
|
- Added `GLFW_RESIZE_NS_CURSOR` alias for `GLFW_VRESIZE_CURSOR` (#427)
|
||||||
|
- Added `GLFW_POINTING_HAND_CURSOR` alias for `GLFW_HAND_CURSOR` (#427)
|
||||||
- Disabled tests and examples by default when built as a CMake subdirectory
|
- Disabled tests and examples by default when built as a CMake subdirectory
|
||||||
- Bugfix: The CMake config-file package used an absolute path and was not
|
- Bugfix: The CMake config-file package used an absolute path and was not
|
||||||
relocatable (#1470)
|
relocatable (#1470)
|
||||||
|
- Bugfix: Video modes with a duplicate screen area were discarded (#1555,#1556)
|
||||||
|
- Bugfix: Compiling with -Wextra-semi caused warnings (#1440)
|
||||||
|
- [Win32] Added the `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access
|
||||||
|
to the window menu
|
||||||
- [Win32] Bugfix: `GLFW_INCLUDE_VULKAN` plus `VK_USE_PLATFORM_WIN32_KHR` caused
|
- [Win32] Bugfix: `GLFW_INCLUDE_VULKAN` plus `VK_USE_PLATFORM_WIN32_KHR` caused
|
||||||
symbol redefinition (#1524)
|
symbol redefinition (#1524)
|
||||||
- [Win32] Bugfix: The cursor position event was emitted before its cursor enter
|
- [Win32] Bugfix: The cursor position event was emitted before its cursor enter
|
||||||
event (#1490)
|
event (#1490)
|
||||||
- [Win32] Bugfix: The window hint `GLFW_MAXIMIZED` did not move or resize the
|
- [Win32] Bugfix: The window hint `GLFW_MAXIMIZED` did not move or resize the
|
||||||
window (#1499)
|
window (#1499)
|
||||||
|
- [Cocoa] Bugfix: `glfwSetWindowSize` used a bottom-left anchor point (#1553)
|
||||||
|
- [Cocoa] Bugfix: Window remained on screen after destruction until event poll
|
||||||
|
(#1412)
|
||||||
- [X11] Bugfix: The CMake files did not check for the XInput headers (#1480)
|
- [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
|
- [X11] Bugfix: Key names were not updated when the keyboard layout changed
|
||||||
(#1462,#1528)
|
(#1462,#1528)
|
||||||
|
- [X11] Bugfix: Decorations could not be enabled after window creation (#1566)
|
||||||
|
- [X11] Bugfix: Content scale fallback value could be inconsistent (#1578)
|
||||||
|
- [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432)
|
||||||
- [NSGL] Removed enforcement of forward-compatible flag for core contexts
|
- [NSGL] Removed enforcement of forward-compatible flag for core contexts
|
||||||
|
|
||||||
|
|
||||||
@ -139,7 +154,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.
|
well as news, documentation and other information about the project.
|
||||||
|
|
||||||
If you have questions related to the use of GLFW, we have a
|
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/).
|
[Freenode](http://freenode.net/).
|
||||||
|
|
||||||
If you have a bug to report, a patch to submit or a feature you'd like to
|
If you have a bug to report, a patch to submit or a feature you'd like to
|
||||||
@ -169,6 +184,7 @@ skills.
|
|||||||
- blanco
|
- blanco
|
||||||
- Kyle Brenneman
|
- Kyle Brenneman
|
||||||
- Rok Breulj
|
- Rok Breulj
|
||||||
|
- Kai Burjack
|
||||||
- Martin Capitanio
|
- Martin Capitanio
|
||||||
- David Carlier
|
- David Carlier
|
||||||
- Arturo Castro
|
- Arturo Castro
|
||||||
@ -226,6 +242,7 @@ skills.
|
|||||||
- Peter Knut
|
- Peter Knut
|
||||||
- Christoph Kubisch
|
- Christoph Kubisch
|
||||||
- Yuri Kunde Schlesner
|
- Yuri Kunde Schlesner
|
||||||
|
- Rokas Kupstys
|
||||||
- Konstantin Käfer
|
- Konstantin Käfer
|
||||||
- Eric Larson
|
- Eric Larson
|
||||||
- Robin Leffmann
|
- Robin Leffmann
|
||||||
@ -279,7 +296,9 @@ skills.
|
|||||||
- Konstantin Podsvirov
|
- Konstantin Podsvirov
|
||||||
- Nathan Poirier
|
- Nathan Poirier
|
||||||
- Alexandre Pretyman
|
- Alexandre Pretyman
|
||||||
|
- Pablo Prietz
|
||||||
- przemekmirek
|
- przemekmirek
|
||||||
|
- Guillaume Racicot
|
||||||
- Philip Rideout
|
- Philip Rideout
|
||||||
- Eddie Ringle
|
- Eddie Ringle
|
||||||
- Max Risuhin
|
- Max Risuhin
|
||||||
|
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
|
## Asking a question
|
||||||
|
|
||||||
Questions about how to use GLFW should be asked either in the [support
|
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
|
Overflow tag](https://stackoverflow.com/questions/tagged/glfw) or [Game
|
||||||
Development tag](https://gamedev.stackexchange.com/questions/tagged/glfw) on
|
Development tag](https://gamedev.stackexchange.com/questions/tagged/glfw) on
|
||||||
Stack Exchange or in the IRC channel `#glfw` on
|
Stack Exchange or in the IRC channel `#glfw` on
|
||||||
[Freenode](http://freenode.net/).
|
[Freenode](http://freenode.net/).
|
||||||
|
|
||||||
Questions about the design or implementation of GLFW or about future plans
|
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
|
forum or in the IRC channel. Please don't open a GitHub issue to discuss design
|
||||||
questions without first checking with a maintainer.
|
questions without first checking with a maintainer.
|
||||||
|
|
||||||
|
@ -1632,11 +1632,6 @@ ALLEXTERNALS = NO
|
|||||||
|
|
||||||
EXTERNAL_GROUPS = YES
|
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
|
# Configuration options related to the dot tool
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@ -1649,15 +1644,6 @@ PERL_PATH = /usr/bin/perl
|
|||||||
|
|
||||||
CLASS_DIAGRAMS = YES
|
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
|
# If set to YES, the inheritance and collaboration graphs will hide
|
||||||
# inheritance and usage relations if the target is undocumented
|
# inheritance and usage relations if the target is undocumented
|
||||||
# or is not a class.
|
# or is not a class.
|
||||||
@ -1728,7 +1714,7 @@ UML_LOOK = NO
|
|||||||
# the class node. If there are many fields or methods and many nodes the
|
# 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
|
# 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
|
# 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.
|
# exceeded by 50% before the limit is enforced.
|
||||||
|
|
||||||
UML_LIMIT_NUM_FIELDS = 10
|
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.
|
||||||
|
|
@ -85,6 +85,13 @@ transparent window framebuffers. If the running X server does not support this
|
|||||||
extension or there is no running compositing manager, the
|
extension or there is no running compositing manager, the
|
||||||
`GLFW_TRANSPARENT_FRAMEBUFFER` framebuffer hint will have no effect.
|
`GLFW_TRANSPARENT_FRAMEBUFFER` framebuffer hint will have no effect.
|
||||||
|
|
||||||
|
GLFW uses both the Xcursor extension and the freedesktop cursor conventions to
|
||||||
|
provide an expanded set of standard cursor shapes. If the running X server does
|
||||||
|
not support this extension or the current cursor theme does not support the
|
||||||
|
conventions, the `GLFW_RESIZE_NWSE_CURSOR`, `GLFW_RESIZE_NESW_CURSOR` and
|
||||||
|
`GLFW_NOT_ALLOWED_CURSOR` shapes will not be available and other shapes may use
|
||||||
|
legacy images.
|
||||||
|
|
||||||
|
|
||||||
@section compat_wayland Wayland protocols and IPC standards
|
@section compat_wayland Wayland protocols and IPC standards
|
||||||
|
|
||||||
@ -230,8 +237,7 @@ at most OpenGL version 2.1.
|
|||||||
|
|
||||||
Because of this, on OS X 10.7 and later, the `GLFW_CONTEXT_VERSION_MAJOR` and
|
Because of this, on OS X 10.7 and later, the `GLFW_CONTEXT_VERSION_MAJOR` and
|
||||||
`GLFW_CONTEXT_VERSION_MINOR` hints will cause @ref glfwCreateWindow to fail if
|
`GLFW_CONTEXT_VERSION_MINOR` hints will cause @ref glfwCreateWindow to fail if
|
||||||
given version 3.0 or 3.1. The `GLFW_OPENGL_FORWARD_COMPAT` hint must be set to
|
given version 3.0 or 3.1. The `GLFW_OPENGL_PROFILE` hint must be set to
|
||||||
`GLFW_TRUE` and the `GLFW_OPENGL_PROFILE` hint must be set to
|
|
||||||
`GLFW_OPENGL_CORE_PROFILE` when creating OpenGL 3.2 and later contexts. The
|
`GLFW_OPENGL_CORE_PROFILE` when creating OpenGL 3.2 and later contexts. The
|
||||||
`GLFW_OPENGL_DEBUG_CONTEXT` and `GLFW_CONTEXT_NO_ERROR` hints are ignored.
|
`GLFW_OPENGL_DEBUG_CONTEXT` and `GLFW_CONTEXT_NO_ERROR` hints are ignored.
|
||||||
|
|
||||||
|
@ -373,12 +373,15 @@ A cursor with a [standard shape](@ref shapes) from the current system cursor
|
|||||||
theme can be can be created with @ref glfwCreateStandardCursor.
|
theme can be can be created with @ref glfwCreateStandardCursor.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
GLFWcursor* cursor = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR);
|
GLFWcursor* url_cursor = glfwCreateStandardCursor(GLFW_POINTING_HAND_CURSOR);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
These cursor objects behave in the exact same way as those created with @ref
|
These cursor objects behave in the exact same way as those created with @ref
|
||||||
glfwCreateCursor except that the system cursor theme provides the actual image.
|
glfwCreateCursor except that the system cursor theme provides the actual image.
|
||||||
|
|
||||||
|
A few of these shapes are not available everywhere. If a shape is unavailable,
|
||||||
|
`NULL` is returned. See @ref glfwCreateStandardCursor for details.
|
||||||
|
|
||||||
|
|
||||||
@subsubsection cursor_destruction Cursor destruction
|
@subsubsection cursor_destruction Cursor destruction
|
||||||
|
|
||||||
@ -889,7 +892,7 @@ timer varies depending on the operating system and hardware. You can query the
|
|||||||
frequency, in Hz, with @ref glfwGetTimerFrequency.
|
frequency, in Hz, with @ref glfwGetTimerFrequency.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
uint64_t freqency = glfwGetTimerFrequency();
|
uint64_t frequency = glfwGetTimerFrequency();
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
||||||
|
892
docs/news.dox
892
docs/news.dox
@ -9,6 +9,33 @@
|
|||||||
|
|
||||||
@subsection features_34 New features in version 3.4
|
@subsection features_34 New features in version 3.4
|
||||||
|
|
||||||
|
@subsubsection standard_cursors_34 More standard cursors
|
||||||
|
|
||||||
|
GLFW now provides the standard cursor shapes @ref GLFW_RESIZE_NWSE_CURSOR and
|
||||||
|
@ref GLFW_RESIZE_NESW_CURSOR for diagonal resizing, @ref GLFW_RESIZE_ALL_CURSOR
|
||||||
|
for omni-directional resizing and @ref GLFW_NOT_ALLOWED_CURSOR for showing an
|
||||||
|
action is not allowed.
|
||||||
|
|
||||||
|
Unlike the original set, these shapes may not be available everywhere and
|
||||||
|
creation will then fail with the new @ref GLFW_CURSOR_UNAVAILABLE error.
|
||||||
|
|
||||||
|
The cursors for horizontal and vertical resizing are now referred to as @ref
|
||||||
|
GLFW_RESIZE_EW_CURSOR and @ref GLFW_RESIZE_NS_CURSOR, and the pointing hand
|
||||||
|
cursor is now referred to as @ref GLFW_POINTING_HAND_CURSOR. The older names
|
||||||
|
are still available.
|
||||||
|
|
||||||
|
For more information see @ref cursor_standard.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection features_34_win32_keymenu Support for keyboard access to Windows window menu
|
||||||
|
|
||||||
|
GLFW now provides the
|
||||||
|
[GLFW_WIN32_KEYBOARD_MENU](@ref GLFW_WIN32_KEYBOARD_MENU_hint) window hint for
|
||||||
|
enabling keyboard access to the window menu via the Alt+Space and
|
||||||
|
Alt-and-then-Space shortcuts. This may be useful for more GUI-oriented
|
||||||
|
applications.
|
||||||
|
|
||||||
|
|
||||||
@subsection caveats_34 Caveats for version 3.4
|
@subsection caveats_34 Caveats for version 3.4
|
||||||
|
|
||||||
@subsubsection standalone_34 Tests and examples are disabled when built as a sub-project
|
@subsubsection standalone_34 Tests and examples are disabled when built as a sub-project
|
||||||
@ -35,853 +62,22 @@ add_subdirectory(path/to/glfw)
|
|||||||
@subsubsection types_34 New types in version 3.4
|
@subsubsection types_34 New types in version 3.4
|
||||||
@subsubsection constants_34 New constants in version 3.4
|
@subsubsection constants_34 New constants in version 3.4
|
||||||
|
|
||||||
|
- @ref GLFW_POINTING_HAND_CURSOR
|
||||||
@section news_33 Release notes for version 3.3
|
- @ref GLFW_RESIZE_EW_CURSOR
|
||||||
|
- @ref GLFW_RESIZE_NS_CURSOR
|
||||||
These are the release notes for version 3.3. For a more detailed view including
|
- @ref GLFW_RESIZE_NWSE_CURSOR
|
||||||
all fixed bugs see the [version history](https://www.glfw.org/changelog.html).
|
- @ref GLFW_RESIZE_NESW_CURSOR
|
||||||
|
- @ref GLFW_RESIZE_ALL_CURSOR
|
||||||
Please review the caveats, deprecations and removals if your project was written
|
- @ref GLFW_NOT_ALLOWED_CURSOR
|
||||||
against an earlier version of GLFW 3.
|
- @ref GLFW_CURSOR_UNAVAILABLE
|
||||||
|
- @ref GLFW_WIN32_KEYBOARD_MENU
|
||||||
|
|
||||||
@subsection features_33 New features in version 3.3
|
|
||||||
|
@section news_archive Release notes for earlier versions
|
||||||
@subsubsection gamepad_33 Gamepad input via SDL_GameControllerDB
|
|
||||||
|
- [Release notes for 3.3](https://www.glfw.org/docs/3.3/news.html)
|
||||||
GLFW can now remap game controllers to a standard Xbox-like layout using
|
- [Release notes for 3.2](https://www.glfw.org/docs/3.2/news.html)
|
||||||
a built-in copy of SDL_GameControllerDB. Call @ref glfwJoystickIsGamepad to
|
- [Release notes for 3.1](https://www.glfw.org/docs/3.1/news.html)
|
||||||
check if a joystick has a mapping, @ref glfwGetGamepadState to retrieve its
|
- [Release notes for 3.0](https://www.glfw.org/docs/3.0/news.html)
|
||||||
input state, @ref glfwUpdateGamepadMappings to add newer mappings and @ref
|
|
||||||
glfwGetGamepadName and @ref glfwGetJoystickGUID for mapping related information.
|
|
||||||
|
|
||||||
For more information see @ref gamepad.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection moltenvk_33 Support for Vulkan on macOS via MoltenVK
|
|
||||||
|
|
||||||
GLFW now supports [MoltenVK](https://moltengl.com/moltenvk/), a Vulkan
|
|
||||||
implementation on top of the Metal API, and its `VK_MVK_macos_surface` window
|
|
||||||
surface creation extension. MoltenVK is included in the [macOS Vulkan
|
|
||||||
SDK](https://vulkan.lunarg.com/).
|
|
||||||
|
|
||||||
For more information see @ref vulkan_guide.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection content_scale_33 Content scale queries for DPI-aware rendering
|
|
||||||
|
|
||||||
GLFW now provides content scales for windows and monitors, i.e. the ratio
|
|
||||||
between their current DPI and the platform's default DPI, with @ref
|
|
||||||
glfwGetWindowContentScale and @ref glfwGetMonitorContentScale.
|
|
||||||
|
|
||||||
Changes of the content scale of a window can be received with the window content
|
|
||||||
scale callback, set with @ref glfwSetWindowContentScaleCallback.
|
|
||||||
|
|
||||||
The @ref GLFW_SCALE_TO_MONITOR window hint enables automatic resizing of a
|
|
||||||
window by the content scale of the monitor it is placed, on platforms like
|
|
||||||
Windows where this is necessary. This takes effect both on creation and when
|
|
||||||
the window is moved between monitors. It is related to but different from
|
|
||||||
[GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint).
|
|
||||||
|
|
||||||
For more information see @ref window_scale.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection setwindowattrib_33 Support for updating window attributes
|
|
||||||
|
|
||||||
GLFW now supports changing the [GLFW_DECORATED](@ref GLFW_DECORATED_attrib),
|
|
||||||
[GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib),
|
|
||||||
[GLFW_FLOATING](@ref GLFW_FLOATING_attrib),
|
|
||||||
[GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and
|
|
||||||
[GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib) attributes for existing
|
|
||||||
windows with @ref glfwSetWindowAttrib.
|
|
||||||
|
|
||||||
For more information see @ref window_attribs.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection raw_motion_33 Support for raw mouse motion
|
|
||||||
|
|
||||||
GLFW now supports raw (unscaled and unaccelerated) mouse motion in disabled
|
|
||||||
cursor mode with the [GLFW_RAW_MOUSE_MOTION](@ref GLFW_RAW_MOUSE_MOTION) input
|
|
||||||
mode. Raw mouse motion input is not yet implemented on macOS. Call @ref
|
|
||||||
glfwRawMouseMotionSupported to check if GLFW can provide raw mouse motion on the
|
|
||||||
current system.
|
|
||||||
|
|
||||||
For more information see @ref raw_mouse_motion.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection joysticks_33 Joystick hats
|
|
||||||
|
|
||||||
GLFW can now return the state of hats (i.e. POVs or D-pads) of a joystick with
|
|
||||||
@ref glfwGetJoystickHats. For compatibility, hats are also exposed as buttons.
|
|
||||||
This can be disabled with the @ref GLFW_JOYSTICK_HAT_BUTTONS initialization
|
|
||||||
hint.
|
|
||||||
|
|
||||||
For more information see @ref joystick_hat.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection geterror_33 Error query
|
|
||||||
|
|
||||||
GLFW now supports querying the last error code for the calling thread and its
|
|
||||||
human-readable description with @ref glfwGetError. This can be used instead of
|
|
||||||
or together with the error callback.
|
|
||||||
|
|
||||||
For more information see @ref error_handling.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection init_hints_33 Support for initialization hints
|
|
||||||
|
|
||||||
GLFW now supports setting library initialization hints with @ref glfwInitHint.
|
|
||||||
These must be set before initialization to take effect. Some of these hints are
|
|
||||||
platform specific but are safe to set on any platform.
|
|
||||||
|
|
||||||
For more information see @ref init_hints.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection attention_33 User attention request
|
|
||||||
|
|
||||||
GLFW now supports requesting user attention with @ref
|
|
||||||
glfwRequestWindowAttention. Where possible this calls attention to the
|
|
||||||
specified window. On platforms like macOS it calls attention to the whole
|
|
||||||
application.
|
|
||||||
|
|
||||||
For more information see @ref window_attention.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection maximize_33 Window maximization callback
|
|
||||||
|
|
||||||
GLFW now supports notifying the application that the window has been maximized
|
|
||||||
@ref glfwSetWindowMaximizeCallback. This is called both when the window was
|
|
||||||
maximized by the user and when it was done with @ref glfwMaximizeWindow.
|
|
||||||
|
|
||||||
For more information see @ref window_maximize.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection workarea_33 Query for the monitor work area
|
|
||||||
|
|
||||||
GLFW now supports querying the work area of a monitor, i.e. the area not
|
|
||||||
occupied by task bars or global menu bars, with @ref glfwGetMonitorWorkarea. On
|
|
||||||
platforms that lack this concept, the whole area of the monitor is returned.
|
|
||||||
|
|
||||||
For more information see @ref monitor_workarea.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection transparency_33 Transparent windows and framebuffers
|
|
||||||
|
|
||||||
GLFW now supports the creation of windows with transparent framebuffers on
|
|
||||||
systems with desktop compositing enabled with the @ref
|
|
||||||
GLFW_TRANSPARENT_FRAMEBUFFER window hint and attribute. This hint must be set
|
|
||||||
before window creation and leaves any window decorations opaque.
|
|
||||||
|
|
||||||
GLFW now also supports whole window transparency with @ref glfwGetWindowOpacity
|
|
||||||
and @ref glfwSetWindowOpacity. This value controls the opacity of the whole
|
|
||||||
window including decorations and unlike framebuffer transparency can be changed
|
|
||||||
at any time after window creation.
|
|
||||||
|
|
||||||
For more information see @ref window_transparency.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection key_scancode_33 Query for the scancode of a key
|
|
||||||
|
|
||||||
GLFW now supports querying the platform dependent scancode of any physical key
|
|
||||||
with @ref glfwGetKeyScancode.
|
|
||||||
|
|
||||||
For more information see @ref input_key.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection center_cursor_33 Cursor centering window hint
|
|
||||||
|
|
||||||
GLFW now supports controlling whether the cursor is centered over newly created
|
|
||||||
full screen windows with the [GLFW_CENTER_CURSOR](@ref GLFW_CENTER_CURSOR_hint)
|
|
||||||
window hint. It is enabled by default.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection cursor_hover_33 Mouse cursor hover window attribute
|
|
||||||
|
|
||||||
GLFW now supports polling whether the cursor is hovering over the window content
|
|
||||||
area with the [GLFW_HOVERED](@ref GLFW_HOVERED_attrib) window attribute. This
|
|
||||||
attribute corresponds to the [cursor enter/leave](@ref cursor_enter) event.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection focusonshow_33 Window hint and attribute for input focus on show
|
|
||||||
|
|
||||||
GLFW now has the [GLFW_FOCUS_ON_SHOW](@ref GLFW_DECORATED_hint) window hint and
|
|
||||||
attribute for controlling whether a window gets input focus when shown. It is
|
|
||||||
enabled by default. It applies both when creating an visible window with @ref
|
|
||||||
glfwCreateWindow and when showing it with @ref glfwShowWindow.
|
|
||||||
|
|
||||||
This is a workaround for GLFW 3.0 lacking @ref glfwFocusWindow and will be
|
|
||||||
corrected in the next major version.
|
|
||||||
|
|
||||||
For more information see @ref window_hide.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection device_userptr_33 Monitor and joystick user pointers
|
|
||||||
|
|
||||||
GLFW now supports setting and querying user pointers for connected monitors and
|
|
||||||
joysticks with @ref glfwSetMonitorUserPointer, @ref glfwGetMonitorUserPointer,
|
|
||||||
@ref glfwSetJoystickUserPointer and @ref glfwGetJoystickUserPointer.
|
|
||||||
|
|
||||||
For more information see @ref monitor_userptr and @ref joystick_userptr.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection macos_nib_33 macOS menu bar from nib file
|
|
||||||
|
|
||||||
GLFW will now load a `MainMenu.nib` file if found in the `Contents/Resources`
|
|
||||||
directory of the application bundle, as a way to replace the GLFW menu bar
|
|
||||||
without recompiling GLFW. This behavior can be disabled with the
|
|
||||||
[GLFW_COCOA_MENUBAR](@ref GLFW_COCOA_MENUBAR_hint) initialization hint.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection glext_33 Support for more context creation extensions
|
|
||||||
|
|
||||||
The context hint @ref GLFW_SRGB_CAPABLE now supports OpenGL ES via
|
|
||||||
`WGL_EXT_colorspace`, the context hint @ref GLFW_CONTEXT_NO_ERROR now supports
|
|
||||||
`WGL_ARB_create_context_no_error` and `GLX_ARB_create_context_no_error`, the
|
|
||||||
context hint @ref GLFW_CONTEXT_RELEASE_BEHAVIOR now supports
|
|
||||||
`EGL_KHR_context_flush_control` and @ref glfwGetProcAddress now supports
|
|
||||||
`EGL_KHR_get_all_proc_addresses`.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection osmesa_33 OSMesa off-screen context creation support
|
|
||||||
|
|
||||||
GLFW now supports creating off-screen OpenGL contexts using
|
|
||||||
[OSMesa](https://www.mesa3d.org/osmesa.html) by setting
|
|
||||||
[GLFW_CONTEXT_CREATION_API](@ref GLFW_CONTEXT_CREATION_API_hint) to
|
|
||||||
`GLFW_OSMESA_CONTEXT_API`. Native access function have been added to retrieve
|
|
||||||
the OSMesa color and depth buffers.
|
|
||||||
|
|
||||||
There is also a new null backend that uses OSMesa as its native context
|
|
||||||
creation API, intended for automated testing. This backend does not provide
|
|
||||||
input.
|
|
||||||
|
|
||||||
|
|
||||||
@subsection caveats_33 Caveats for version 3.3
|
|
||||||
|
|
||||||
@subsubsection joystick_layout_33 Layout of joysticks have changed
|
|
||||||
|
|
||||||
The way joystick elements are arranged have changed to match SDL2 in order to
|
|
||||||
support SDL_GameControllerDB mappings. The layout of joysticks may
|
|
||||||
change again if required for compatibility with SDL2. If you need a known and
|
|
||||||
stable layout for game controllers, see if you can switch to @ref gamepad.
|
|
||||||
|
|
||||||
Existing code that depends on a specific joystick layout will likely have to be
|
|
||||||
updated.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection wait_events_33 No window required to wait for events
|
|
||||||
|
|
||||||
The @ref glfwWaitEvents and @ref glfwWaitEventsTimeout functions no longer need
|
|
||||||
a window to be created to wait for events. Before version 3.3 these functions
|
|
||||||
would return immediately if there were no user-created windows. On platforms
|
|
||||||
where only windows can receive events, an internal helper window is used.
|
|
||||||
|
|
||||||
Existing code that depends on the earlier behavior will likely have to be
|
|
||||||
updated.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection gamma_ramp_size_33 Gamma ramp size of 256 may be rejected
|
|
||||||
|
|
||||||
The documentation for versions before 3.3 stated that a gamma ramp size of 256
|
|
||||||
would always be accepted. This was never the case on X11 and could lead to
|
|
||||||
artifacts on macOS. The @ref glfwSetGamma function has been updated to always
|
|
||||||
generate a ramp of the correct size.
|
|
||||||
|
|
||||||
Existing code that hardcodes a size of 256 should be updated to use the size of
|
|
||||||
the current ramp of a monitor when setting a new ramp for that monitor.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection xinput_deadzone_33 Windows XInput deadzone removed
|
|
||||||
|
|
||||||
GLFW no longer applies any deadzone to the input state received from the XInput
|
|
||||||
API. This was never done for any other platform joystick API so this change
|
|
||||||
makes the behavior more consistent but you will need to apply your own deadzone
|
|
||||||
if desired.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection x11_clipboard_33 X11 clipboard transfer limits
|
|
||||||
|
|
||||||
GLFW now supports reading clipboard text via the `INCR` method, which removes
|
|
||||||
the limit on how much text can be read with @ref glfwGetClipboardString.
|
|
||||||
However, writing via this method is not yet supported, so you may not be able to
|
|
||||||
write a very large string with @ref glfwSetClipboardString even if you read it
|
|
||||||
from the clipboard earlier.
|
|
||||||
|
|
||||||
The exact size limit for writing to the clipboard is negotiated with each
|
|
||||||
receiving application but is at least several tens of kilobytes. Note that only
|
|
||||||
the read limit has changed. Any string that could be written before still can
|
|
||||||
be.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection x11_linking_33 X11 extension libraries are loaded dynamically
|
|
||||||
|
|
||||||
GLFW now loads all X11 extension libraries at initialization. The only X11
|
|
||||||
library you need to link against is `libX11`. The header files for the
|
|
||||||
extension libraries are still required for compilation.
|
|
||||||
|
|
||||||
Existing projects and makefiles that link GLFW directly against the extension
|
|
||||||
libraries should still build correctly but will add these libraries as load-time
|
|
||||||
dependencies.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection cmake_version_33 CMake 3.0 or later is required
|
|
||||||
|
|
||||||
The minimum CMake version has been raised from 2.8.12 to 3.0. This is only
|
|
||||||
a requirement of the GLFW CMake files. The GLFW source files do not depend on
|
|
||||||
CMake.
|
|
||||||
|
|
||||||
|
|
||||||
@subsection deprecations_33 Deprecations in version 3.3
|
|
||||||
|
|
||||||
@subsubsection charmods_callback_33 Character with modifiers callback
|
|
||||||
|
|
||||||
The character with modifiers callback set with @ref glfwSetCharModsCallback has
|
|
||||||
been deprecated and should if possible not be used.
|
|
||||||
|
|
||||||
Existing code should still work but further bug fixes will likely not be made.
|
|
||||||
The callback will be removed in the next major version.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection clipboard_window_33 Window parameter to clipboard functions
|
|
||||||
|
|
||||||
The window parameter of the clipboard functions @ref glfwGetClipboardString and
|
|
||||||
@ref glfwSetClipboardString has been deprecated and is no longer used on any
|
|
||||||
platform. On platforms where the clipboard must be owned by a specific window,
|
|
||||||
an internal helper window is used.
|
|
||||||
|
|
||||||
Existing code should still work unless it depends on a specific window owning
|
|
||||||
the clipboard. New code may pass `NULL` as the window argument. The parameter
|
|
||||||
will be removed in a future release.
|
|
||||||
|
|
||||||
|
|
||||||
@subsection removals_33 Removals in 3.3
|
|
||||||
|
|
||||||
@subsubsection macos_options_33 macOS specific CMake options and macros
|
|
||||||
|
|
||||||
The `GLFW_USE_RETINA`, `GLFW_USE_CHDIR` and `GLFW_USE_MENUBAR` CMake options and
|
|
||||||
the `_GLFW_USE_RETINA`, `_GLFW_USE_CHDIR` and `_GLFW_USE_MENUBAR` compile-time
|
|
||||||
macros have been removed.
|
|
||||||
|
|
||||||
These options and macros are replaced by the window hint
|
|
||||||
[GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint)
|
|
||||||
and the init hints
|
|
||||||
[GLFW_COCOA_CHDIR_RESOURCES](@ref GLFW_COCOA_CHDIR_RESOURCES_hint) and
|
|
||||||
[GLFW_COCOA_MENUBAR](@ref GLFW_COCOA_MENUBAR_hint).
|
|
||||||
|
|
||||||
Existing projects and makefiles that set these options or define these macros
|
|
||||||
during compilation of GLFW will still build but it will have no effect and the
|
|
||||||
default behaviors will be used.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection vulkan_sdk_33 LunarG Vulkan SDK dependency
|
|
||||||
|
|
||||||
The GLFW test programs that previously depended on the LunarG Vulkan SDK now
|
|
||||||
instead uses a Vulkan loader generated by
|
|
||||||
[glad2](https://github.com/Dav1dde/glad). This means the GLFW CMake files no
|
|
||||||
longer look for the Vulkan SDK.
|
|
||||||
|
|
||||||
Existing CMake projects that depended on the Vulkan SDK cache variables from
|
|
||||||
GLFW will need to call `find_package(Vulkan)` themselves. CMake 3.7 and later
|
|
||||||
already comes with a
|
|
||||||
[Vulkan find module](https://cmake.org/cmake/help/latest/module/FindVulkan.html)
|
|
||||||
similar to the one GLFW previously included.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection lib_suffix_33 CMake option LIB_SUFFIX
|
|
||||||
|
|
||||||
The `LIB_SUFFIX` CMake option has been removed. GLFW now uses the
|
|
||||||
GNUInstallDirs CMake package to handle platform specific details like the
|
|
||||||
library directory suffix and the `LIB_SUFFIX` CMake option has been removed.
|
|
||||||
|
|
||||||
Existing projects and makefiles that set the `LIB_SUFFIX` option will use the
|
|
||||||
suffix chosen by the GNUInstallDirs package and the option will be ignored.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection mir_removed_33 Mir support
|
|
||||||
|
|
||||||
The experimental Mir support has been completely removed as the Mir project has
|
|
||||||
implemented support for the Wayland protocol and is recommending that
|
|
||||||
applications use that instead.
|
|
||||||
|
|
||||||
Existing projects and makefiles that select Mir when compiling GLFW will fail.
|
|
||||||
Use Wayland or X11 instead.
|
|
||||||
|
|
||||||
|
|
||||||
@subsection symbols_33 New symbols in version 3.3
|
|
||||||
|
|
||||||
@subsubsection functions_33 New functions in version 3.3
|
|
||||||
|
|
||||||
- @ref glfwInitHint
|
|
||||||
- @ref glfwGetError
|
|
||||||
- @ref glfwGetMonitorWorkarea
|
|
||||||
- @ref glfwGetMonitorContentScale
|
|
||||||
- @ref glfwGetMonitorUserPointer
|
|
||||||
- @ref glfwSetMonitorUserPointer
|
|
||||||
- @ref glfwWindowHintString
|
|
||||||
- @ref glfwGetWindowContentScale
|
|
||||||
- @ref glfwGetWindowOpacity
|
|
||||||
- @ref glfwSetWindowOpacity
|
|
||||||
- @ref glfwRequestWindowAttention
|
|
||||||
- @ref glfwSetWindowAttrib
|
|
||||||
- @ref glfwSetWindowMaximizeCallback
|
|
||||||
- @ref glfwSetWindowContentScaleCallback
|
|
||||||
- @ref glfwRawMouseMotionSupported
|
|
||||||
- @ref glfwGetKeyScancode
|
|
||||||
- @ref glfwGetJoystickHats
|
|
||||||
- @ref glfwGetJoystickGUID
|
|
||||||
- @ref glfwGetJoystickUserPointer
|
|
||||||
- @ref glfwSetJoystickUserPointer
|
|
||||||
- @ref glfwJoystickIsGamepad
|
|
||||||
- @ref glfwUpdateGamepadMappings
|
|
||||||
- @ref glfwGetGamepadName
|
|
||||||
- @ref glfwGetGamepadState
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection types_33 New types in version 3.3
|
|
||||||
|
|
||||||
- @ref GLFWwindowmaximizefun
|
|
||||||
- @ref GLFWwindowcontentscalefun
|
|
||||||
- @ref GLFWgamepadstate
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection constants_33 New constants in version 3.3
|
|
||||||
|
|
||||||
- @ref GLFW_NO_ERROR
|
|
||||||
- @ref GLFW_JOYSTICK_HAT_BUTTONS
|
|
||||||
- @ref GLFW_COCOA_CHDIR_RESOURCES
|
|
||||||
- @ref GLFW_COCOA_MENUBAR
|
|
||||||
- @ref GLFW_CENTER_CURSOR
|
|
||||||
- @ref GLFW_TRANSPARENT_FRAMEBUFFER
|
|
||||||
- @ref GLFW_HOVERED
|
|
||||||
- @ref GLFW_FOCUS_ON_SHOW
|
|
||||||
- @ref GLFW_SCALE_TO_MONITOR
|
|
||||||
- @ref GLFW_COCOA_RETINA_FRAMEBUFFER
|
|
||||||
- @ref GLFW_COCOA_FRAME_NAME
|
|
||||||
- @ref GLFW_COCOA_GRAPHICS_SWITCHING
|
|
||||||
- @ref GLFW_X11_CLASS_NAME
|
|
||||||
- @ref GLFW_X11_INSTANCE_NAME
|
|
||||||
- @ref GLFW_OSMESA_CONTEXT_API
|
|
||||||
- @ref GLFW_HAT_CENTERED
|
|
||||||
- @ref GLFW_HAT_UP
|
|
||||||
- @ref GLFW_HAT_RIGHT
|
|
||||||
- @ref GLFW_HAT_DOWN
|
|
||||||
- @ref GLFW_HAT_LEFT
|
|
||||||
- @ref GLFW_HAT_RIGHT_UP
|
|
||||||
- @ref GLFW_HAT_RIGHT_DOWN
|
|
||||||
- @ref GLFW_HAT_LEFT_UP
|
|
||||||
- @ref GLFW_HAT_LEFT_DOWN
|
|
||||||
- @ref GLFW_MOD_CAPS_LOCK
|
|
||||||
- @ref GLFW_MOD_NUM_LOCK
|
|
||||||
- @ref GLFW_LOCK_KEY_MODS
|
|
||||||
- @ref GLFW_RAW_MOUSE_MOTION
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_A
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_B
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_X
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_Y
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_LEFT_BUMPER
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_BACK
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_START
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_GUIDE
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_LEFT_THUMB
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_RIGHT_THUMB
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_DPAD_UP
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_DPAD_RIGHT
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_DPAD_DOWN
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_DPAD_LEFT
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_LAST
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_CROSS
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_CIRCLE
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_SQUARE
|
|
||||||
- @ref GLFW_GAMEPAD_BUTTON_TRIANGLE
|
|
||||||
- @ref GLFW_GAMEPAD_AXIS_LEFT_X
|
|
||||||
- @ref GLFW_GAMEPAD_AXIS_LEFT_Y
|
|
||||||
- @ref GLFW_GAMEPAD_AXIS_RIGHT_X
|
|
||||||
- @ref GLFW_GAMEPAD_AXIS_RIGHT_Y
|
|
||||||
- @ref GLFW_GAMEPAD_AXIS_LEFT_TRIGGER
|
|
||||||
- @ref GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER
|
|
||||||
- @ref GLFW_GAMEPAD_AXIS_LAST
|
|
||||||
|
|
||||||
|
|
||||||
@section news_32 Release notes for 3.2
|
|
||||||
|
|
||||||
These are the release notes for version 3.2. For a more detailed view including
|
|
||||||
all fixed bugs see the [version history](https://www.glfw.org/changelog.html).
|
|
||||||
|
|
||||||
|
|
||||||
@subsection features_32 New features in version 3.2
|
|
||||||
|
|
||||||
@subsubsection news_32_vulkan Support for Vulkan
|
|
||||||
|
|
||||||
GLFW now supports basic integration with Vulkan with @ref glfwVulkanSupported,
|
|
||||||
@ref glfwGetRequiredInstanceExtensions, @ref glfwGetInstanceProcAddress, @ref
|
|
||||||
glfwGetPhysicalDevicePresentationSupport and @ref glfwCreateWindowSurface.
|
|
||||||
Vulkan header inclusion can be selected with
|
|
||||||
@ref GLFW_INCLUDE_VULKAN.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_32_setwindowmonitor Window mode switching
|
|
||||||
|
|
||||||
GLFW now supports switching between windowed and full screen modes and updating
|
|
||||||
the monitor and desired resolution and refresh rate of full screen windows with
|
|
||||||
@ref glfwSetWindowMonitor.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_32_maximize Window maxmimization support
|
|
||||||
|
|
||||||
GLFW now supports window maximization with @ref glfwMaximizeWindow and the
|
|
||||||
@ref GLFW_MAXIMIZED window hint and attribute.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_32_focus Window input focus control
|
|
||||||
|
|
||||||
GLFW now supports giving windows input focus with @ref glfwFocusWindow.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_32_sizelimits Window size limit support
|
|
||||||
|
|
||||||
GLFW now supports setting both absolute and relative window size limits with
|
|
||||||
@ref glfwSetWindowSizeLimits and @ref glfwSetWindowAspectRatio.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_32_keyname Localized key names
|
|
||||||
|
|
||||||
GLFW now supports querying the localized name of printable keys with @ref
|
|
||||||
glfwGetKeyName, either by key token or by scancode.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_32_waittimeout Wait for events with timeout
|
|
||||||
|
|
||||||
GLFW now supports waiting for events for a set amount of time with @ref
|
|
||||||
glfwWaitEventsTimeout.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_32_icon Window icon support
|
|
||||||
|
|
||||||
GLFW now supports setting the icon of windows with @ref glfwSetWindowIcon.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_32_timer Raw timer access
|
|
||||||
|
|
||||||
GLFW now supports raw timer values with @ref glfwGetTimerValue and @ref
|
|
||||||
glfwGetTimerFrequency.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_32_joystick Joystick connection callback
|
|
||||||
|
|
||||||
GLFW now supports notifying when a joystick has been connected or disconnected
|
|
||||||
with @ref glfwSetJoystickCallback.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_32_noapi Context-less windows
|
|
||||||
|
|
||||||
GLFW now supports creating windows without a OpenGL or OpenGL ES context by
|
|
||||||
setting the [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_32_contextapi Run-time context creation API selection
|
|
||||||
|
|
||||||
GLFW now supports selecting and querying the context creation API at run-time
|
|
||||||
with the @ref GLFW_CONTEXT_CREATION_API hint and attribute.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_32_noerror Error-free context creation
|
|
||||||
|
|
||||||
GLFW now supports creating and querying OpenGL and OpenGL ES contexts that do
|
|
||||||
not emit errors with the @ref GLFW_CONTEXT_NO_ERROR hint, provided the machine
|
|
||||||
supports the `GL_KHR_no_error` extension.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_32_cmake CMake config-file package support
|
|
||||||
|
|
||||||
GLFW now supports being used as a
|
|
||||||
[config-file package](@ref build_link_cmake_package) from other projects for
|
|
||||||
easy linking with the library and its dependencies.
|
|
||||||
|
|
||||||
|
|
||||||
@section news_31 Release notes for 3.1
|
|
||||||
|
|
||||||
These are the release notes for version 3.1. For a more detailed view including
|
|
||||||
all fixed bugs see the [version history](https://www.glfw.org/changelog.html).
|
|
||||||
|
|
||||||
|
|
||||||
@subsection features_31 New features in version 3.1
|
|
||||||
|
|
||||||
@subsubsection news_31_cursor Custom mouse cursor images
|
|
||||||
|
|
||||||
GLFW now supports creating and setting both custom cursor images and standard
|
|
||||||
cursor shapes. They are created with @ref glfwCreateCursor or @ref
|
|
||||||
glfwCreateStandardCursor, set with @ref glfwSetCursor and destroyed with @ref
|
|
||||||
glfwDestroyCursor.
|
|
||||||
|
|
||||||
@see @ref cursor_object
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_31_drop Path drop event
|
|
||||||
|
|
||||||
GLFW now provides a callback for receiving the paths of files and directories
|
|
||||||
dropped onto GLFW windows. The callback is set with @ref glfwSetDropCallback.
|
|
||||||
|
|
||||||
@see @ref path_drop
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_31_emptyevent Main thread wake-up
|
|
||||||
|
|
||||||
GLFW now provides the @ref glfwPostEmptyEvent function for posting an empty
|
|
||||||
event from another thread to the main thread event queue, causing @ref
|
|
||||||
glfwWaitEvents to return.
|
|
||||||
|
|
||||||
@see @ref events
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_31_framesize Window frame size query
|
|
||||||
|
|
||||||
GLFW now supports querying the size, on each side, of the frame around the
|
|
||||||
content area of a window, with @ref glfwGetWindowFrameSize.
|
|
||||||
|
|
||||||
@see [Window size](@ref window_size)
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_31_autoiconify Simultaneous multi-monitor rendering
|
|
||||||
|
|
||||||
GLFW now supports disabling auto-iconification of full screen windows with
|
|
||||||
the [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_hint) window hint. This is
|
|
||||||
intended for people building multi-monitor installations, where you need windows
|
|
||||||
to stay in full screen despite losing input focus.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_31_floating Floating windows
|
|
||||||
|
|
||||||
GLFW now supports floating windows, also called topmost or always on top, for
|
|
||||||
easier debugging with the @ref GLFW_FLOATING window hint and attribute.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_31_focused Initially unfocused windows
|
|
||||||
|
|
||||||
GLFW now supports preventing a windowed mode window from gaining input focus on
|
|
||||||
creation, with the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) window hint.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_31_direct Direct access for window attributes and cursor position
|
|
||||||
|
|
||||||
GLFW now queries the window input focus, visibility and iconification attributes
|
|
||||||
and the cursor position directly instead of returning cached data.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_31_charmods Character with modifiers callback
|
|
||||||
|
|
||||||
GLFW now provides a callback for character events with modifier key bits. The
|
|
||||||
callback is set with @ref glfwSetCharModsCallback. Unlike the regular character
|
|
||||||
callback, this will report character events that will not result in a character
|
|
||||||
being input, for example if the Control key is held down.
|
|
||||||
|
|
||||||
@see @ref input_char
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_31_single Single buffered framebuffers
|
|
||||||
|
|
||||||
GLFW now supports the creation of single buffered windows, with the @ref
|
|
||||||
GLFW_DOUBLEBUFFER hint.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_31_glext Macro for including extension header
|
|
||||||
|
|
||||||
GLFW now includes the extension header appropriate for the chosen OpenGL or
|
|
||||||
OpenGL ES header when @ref GLFW_INCLUDE_GLEXT is defined. GLFW does not provide
|
|
||||||
these headers. They must be provided by your development environment or your
|
|
||||||
OpenGL or OpenGL ES SDK.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_31_release Context release behaviors
|
|
||||||
|
|
||||||
GLFW now supports controlling and querying whether the pipeline is flushed when
|
|
||||||
a context is made non-current, with the @ref GLFW_CONTEXT_RELEASE_BEHAVIOR hint
|
|
||||||
and attribute, provided the machine supports the `GL_KHR_context_flush_control`
|
|
||||||
extension.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_31_wayland (Experimental) Wayland support
|
|
||||||
|
|
||||||
GLFW now has an _experimental_ Wayland display protocol backend that can be
|
|
||||||
selected on Linux with a CMake option.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_31_mir (Experimental) Mir support
|
|
||||||
|
|
||||||
GLFW now has an _experimental_ Mir display server backend that can be selected
|
|
||||||
on Linux with a CMake option.
|
|
||||||
|
|
||||||
|
|
||||||
@section news_30 Release notes for 3.0
|
|
||||||
|
|
||||||
These are the release notes for version 3.0. For a more detailed view including
|
|
||||||
all fixed bugs see the [version history](https://www.glfw.org/changelog.html).
|
|
||||||
|
|
||||||
|
|
||||||
@subsection features_30 New features in version 3.0
|
|
||||||
|
|
||||||
@subsubsection news_30_cmake CMake build system
|
|
||||||
|
|
||||||
GLFW now uses the CMake build system instead of the various makefiles and
|
|
||||||
project files used by earlier versions. CMake is available for all platforms
|
|
||||||
supported by GLFW, is present in most package systems and can generate
|
|
||||||
makefiles and/or project files for most popular development environments.
|
|
||||||
|
|
||||||
For more information on how to use CMake, see the
|
|
||||||
[CMake manual](https://cmake.org/cmake/help/documentation.html).
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_multiwnd Multi-window support
|
|
||||||
|
|
||||||
GLFW now supports the creation of multiple windows, each with their own OpenGL
|
|
||||||
or OpenGL ES context, and all window functions now take a window handle. Event
|
|
||||||
callbacks are now per-window and are provided with the handle of the window that
|
|
||||||
received the event. The @ref glfwMakeContextCurrent function has been added to
|
|
||||||
select which context is current on a given thread.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_multimon Multi-monitor support
|
|
||||||
|
|
||||||
GLFW now explicitly supports multiple monitors. They can be enumerated with
|
|
||||||
@ref glfwGetMonitors, queried with @ref glfwGetVideoModes, @ref
|
|
||||||
glfwGetMonitorPos, @ref glfwGetMonitorName and @ref glfwGetMonitorPhysicalSize,
|
|
||||||
and specified at window creation to make the newly created window full screen on
|
|
||||||
that specific monitor.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_unicode Unicode support
|
|
||||||
|
|
||||||
All string arguments to GLFW functions and all strings returned by GLFW now use
|
|
||||||
the UTF-8 encoding. This includes the window title, error string, clipboard
|
|
||||||
text, monitor and joystick names as well as the extension function arguments (as
|
|
||||||
ASCII is a subset of UTF-8).
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_clipboard Clipboard text I/O
|
|
||||||
|
|
||||||
GLFW now supports reading and writing plain text to and from the system
|
|
||||||
clipboard, with the @ref glfwGetClipboardString and @ref glfwSetClipboardString
|
|
||||||
functions.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_gamma Gamma ramp support
|
|
||||||
|
|
||||||
GLFW now supports setting and reading back the gamma ramp of monitors, with the
|
|
||||||
@ref glfwGetGammaRamp and @ref glfwSetGammaRamp functions. There is also @ref
|
|
||||||
glfwSetGamma, which generates a ramp from a gamma value and then sets it.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_gles OpenGL ES support
|
|
||||||
|
|
||||||
GLFW now supports the creation of OpenGL ES contexts, by setting the
|
|
||||||
[GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_OPENGL_ES_API`, where
|
|
||||||
creation of such contexts are supported. Note that GLFW _does not implement_
|
|
||||||
OpenGL ES, so your driver must provide support in a way usable by GLFW. Modern
|
|
||||||
Nvidia and Intel drivers support creation of OpenGL ES context using the GLX and
|
|
||||||
WGL APIs, while AMD provides an EGL implementation instead.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_egl (Experimental) EGL support
|
|
||||||
|
|
||||||
GLFW now has an experimental EGL context creation back end that can be selected
|
|
||||||
through CMake options.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_hidpi High-DPI support
|
|
||||||
|
|
||||||
GLFW now supports high-DPI monitors on both Windows and macOS, giving windows
|
|
||||||
full resolution framebuffers where other UI elements are scaled up. To achieve
|
|
||||||
this, @ref glfwGetFramebufferSize and @ref glfwSetFramebufferSizeCallback have
|
|
||||||
been added. These work with pixels, while the rest of the GLFW API works with
|
|
||||||
screen coordinates. This is important as OpenGL uses pixels, not screen
|
|
||||||
coordinates.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_error Error callback
|
|
||||||
|
|
||||||
GLFW now has an error callback, which can provide your application with much
|
|
||||||
more detailed diagnostics than was previously possible. The callback is passed
|
|
||||||
an error code and a description string.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_wndptr Per-window user pointer
|
|
||||||
|
|
||||||
Each window now has a user-defined pointer, retrieved with @ref
|
|
||||||
glfwGetWindowUserPointer and set with @ref glfwSetWindowUserPointer, to make it
|
|
||||||
easier to integrate GLFW into C++ code.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_iconifyfun Window iconification callback
|
|
||||||
|
|
||||||
Each window now has a callback for iconification and restoration events,
|
|
||||||
which is set with @ref glfwSetWindowIconifyCallback.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_wndposfun Window position callback
|
|
||||||
|
|
||||||
Each window now has a callback for position events, which is set with @ref
|
|
||||||
glfwSetWindowPosCallback.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_wndpos Window position query
|
|
||||||
|
|
||||||
The position of a window can now be retrieved using @ref glfwGetWindowPos.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_focusfun Window focus callback
|
|
||||||
|
|
||||||
Each windows now has a callback for focus events, which is set with @ref
|
|
||||||
glfwSetWindowFocusCallback.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_enterleave Cursor enter/leave callback
|
|
||||||
|
|
||||||
Each window now has a callback for when the mouse cursor enters or leaves its
|
|
||||||
content area, which is set with @ref glfwSetCursorEnterCallback.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_wndtitle Initial window title
|
|
||||||
|
|
||||||
The title of a window is now specified at creation time, as one of the arguments
|
|
||||||
to @ref glfwCreateWindow.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_hidden Hidden windows
|
|
||||||
|
|
||||||
Windows can now be hidden with @ref glfwHideWindow, shown using @ref
|
|
||||||
glfwShowWindow and created initially hidden with the @ref GLFW_VISIBLE window
|
|
||||||
hint and attribute. This allows for off-screen rendering in a way compatible
|
|
||||||
with most drivers, as well as moving a window to a specific position before
|
|
||||||
showing it.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_undecorated Undecorated windows
|
|
||||||
|
|
||||||
Windowed mode windows can now be created without decorations, e.g. things like
|
|
||||||
a frame, a title bar, with the @ref GLFW_DECORATED window hint and attribute.
|
|
||||||
This allows for the creation of things like splash screens.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_keymods Modifier key bit masks
|
|
||||||
|
|
||||||
[Modifier key bit mask](@ref mods) parameters have been added to the
|
|
||||||
[mouse button](@ref GLFWmousebuttonfun) and [key](@ref GLFWkeyfun) callbacks.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_scancode Platform-specific scancodes
|
|
||||||
|
|
||||||
A scancode parameter has been added to the [key callback](@ref GLFWkeyfun). Keys
|
|
||||||
that don't have a [key token](@ref keys) still get passed on with the key
|
|
||||||
parameter set to `GLFW_KEY_UNKNOWN`. These scancodes will vary between machines
|
|
||||||
and are intended to be used for key bindings.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_jsname Joystick names
|
|
||||||
|
|
||||||
The name of a joystick can now be retrieved using @ref glfwGetJoystickName.
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection news_30_doxygen Doxygen documentation
|
|
||||||
|
|
||||||
You are reading it.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
@ -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
|
does not affect window decorations. Possible values are `GLFW_TRUE` and
|
||||||
`GLFW_FALSE`.
|
`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
|
@anchor GLFW_FOCUS_ON_SHOW_hint
|
||||||
__GLFW_FOCUS_ON_SHOW__ specifies whether the window will be given input
|
__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`.
|
focus when @ref glfwShowWindow is called. Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
|
||||||
@ -383,12 +390,10 @@ Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested,
|
|||||||
and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0,
|
and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0,
|
||||||
but OpenGL ES 2.0 is not backward compatible with 1.x.
|
but OpenGL ES 2.0 is not backward compatible with 1.x.
|
||||||
|
|
||||||
@note @macos The OS only supports forward-compatible core profile contexts for
|
@note @macos The OS only supports core profile contexts for OpenGL versions 3.2
|
||||||
OpenGL versions 3.2 and later. Before creating an OpenGL context of version
|
and later. Before creating an OpenGL context of version 3.2 or later you must
|
||||||
3.2 or later you must set the
|
set the [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hint accordingly.
|
||||||
[GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and
|
OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.
|
||||||
[GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly. OpenGL
|
|
||||||
3.0 and 3.1 contexts are not supported at all on macOS.
|
|
||||||
|
|
||||||
@anchor GLFW_OPENGL_FORWARD_COMPAT_hint
|
@anchor GLFW_OPENGL_FORWARD_COMPAT_hint
|
||||||
__GLFW_OPENGL_FORWARD_COMPAT__ specifies whether the OpenGL context should be
|
__GLFW_OPENGL_FORWARD_COMPAT__ specifies whether the OpenGL context should be
|
||||||
@ -450,6 +455,14 @@ The no error mode for OpenGL and OpenGL ES is described in detail by the
|
|||||||
extension.
|
extension.
|
||||||
|
|
||||||
|
|
||||||
|
@subsubsection window_hints_win32 Windows specific window hints
|
||||||
|
|
||||||
|
@anchor GLFW_WIN32_KEYBOARD_MENU_hint
|
||||||
|
__GLFW_WIN32_KEYBOARD_MENU__ specifies whether to allow access to the window
|
||||||
|
menu via the Alt+Space and Alt-and-then-Space keyboard shortcuts. This is
|
||||||
|
ignored on other platforms.
|
||||||
|
|
||||||
|
|
||||||
@subsubsection window_hints_osx macOS specific window hints
|
@subsubsection window_hints_osx macOS specific window hints
|
||||||
|
|
||||||
@anchor GLFW_COCOA_RETINA_FRAMEBUFFER_hint
|
@anchor GLFW_COCOA_RETINA_FRAMEBUFFER_hint
|
||||||
@ -530,6 +543,7 @@ GLFW_CONTEXT_RELEASE_BEHAVIOR | `GLFW_ANY_RELEASE_BEHAVIOR` | `GLFW_ANY_RELEASE_
|
|||||||
GLFW_OPENGL_FORWARD_COMPAT | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
GLFW_OPENGL_FORWARD_COMPAT | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
GLFW_OPENGL_DEBUG_CONTEXT | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
GLFW_OPENGL_DEBUG_CONTEXT | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
GLFW_OPENGL_PROFILE | `GLFW_OPENGL_ANY_PROFILE` | `GLFW_OPENGL_ANY_PROFILE`, `GLFW_OPENGL_COMPAT_PROFILE` or `GLFW_OPENGL_CORE_PROFILE`
|
GLFW_OPENGL_PROFILE | `GLFW_OPENGL_ANY_PROFILE` | `GLFW_OPENGL_ANY_PROFILE`, `GLFW_OPENGL_COMPAT_PROFILE` or `GLFW_OPENGL_CORE_PROFILE`
|
||||||
|
GLFW_WIN32_KEYBOARD_MENU | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
GLFW_COCOA_RETINA_FRAMEBUFFER | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
GLFW_COCOA_RETINA_FRAMEBUFFER | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
GLFW_COCOA_FRAME_NAME | `""` | A UTF-8 encoded frame autosave name
|
GLFW_COCOA_FRAME_NAME | `""` | A UTF-8 encoded frame autosave name
|
||||||
GLFW_COCOA_GRAPHICS_SWITCHING | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
GLFW_COCOA_GRAPHICS_SWITCHING | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||||
@ -1400,7 +1414,7 @@ glfwSwapBuffers(window);
|
|||||||
|
|
||||||
Sometimes it can be useful to select when the buffer swap will occur. With the
|
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
|
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:
|
called before swapping the buffers:
|
||||||
|
|
||||||
@code
|
@code
|
||||||
|
@ -23,6 +23,17 @@ elseif (APPLE)
|
|||||||
MACOSX_PACKAGE_LOCATION "Resources")
|
MACOSX_PACKAGE_LOCATION "Resources")
|
||||||
endif()
|
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"
|
set(GLAD_GL "${GLFW_SOURCE_DIR}/deps/glad/gl.h"
|
||||||
"${GLFW_SOURCE_DIR}/deps/glad_gl.c")
|
"${GLFW_SOURCE_DIR}/deps/glad_gl.c")
|
||||||
set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
|
set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
|
||||||
|
@ -444,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
|
// 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
|
// access pattern (which may give better performance in some
|
||||||
// situations). GL_T2F_C4UB_V3F means: 2 floats for texture coords,
|
// situations). GL_T2F_C4UB_V3F means: 2 floats for texture coords,
|
||||||
// 4 ubytes for color and 3 floats for vertex coord (in that order).
|
// 4 ubytes for color and 3 floats for vertex coord (in that order).
|
||||||
@ -654,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)
|
static void tessellate_floor(float x1, float y1, float x2, float y2, int depth)
|
||||||
@ -721,7 +721,7 @@ static void draw_floor(void)
|
|||||||
glMaterialfv(GL_FRONT, GL_SPECULAR, floor_specular);
|
glMaterialfv(GL_FRONT, GL_SPECULAR, floor_specular);
|
||||||
glMaterialf(GL_FRONT, GL_SHININESS, floor_shininess);
|
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)
|
// improves lighting)
|
||||||
glNormal3f(0.f, 0.f, 1.f);
|
glNormal3f(0.f, 0.f, 1.f);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
// The program uses a "split window" view, rendering four views of the
|
// 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
|
// 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.
|
// each other.
|
||||||
//
|
//
|
||||||
// (If the code seems a little bit strange here and there, it may be
|
// (If the code seems a little bit strange here and there, it may be
|
||||||
|
@ -757,6 +757,17 @@ extern "C" {
|
|||||||
* @analysis Application programmer error. Fix the offending call.
|
* @analysis Application programmer error. Fix the offending call.
|
||||||
*/
|
*/
|
||||||
#define GLFW_NO_WINDOW_CONTEXT 0x0001000A
|
#define GLFW_NO_WINDOW_CONTEXT 0x0001000A
|
||||||
|
/*! @brief The specified cursor shape is not available.
|
||||||
|
*
|
||||||
|
* The specified standard cursor shape is not available, either because the
|
||||||
|
* current system cursor theme does not provide it or because it is not
|
||||||
|
* available on the platform.
|
||||||
|
*
|
||||||
|
* @analysis Platform or system settings limitation. Pick another
|
||||||
|
* [standard cursor shape](@ref shapes) or create a
|
||||||
|
* [custom cursor](@ref cursor_custom).
|
||||||
|
*/
|
||||||
|
#define GLFW_CURSOR_UNAVAILABLE 0x0001000B
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
/*! @addtogroup window
|
/*! @addtogroup window
|
||||||
@ -1003,6 +1014,7 @@ extern "C" {
|
|||||||
* [window hint](@ref GLFW_X11_CLASS_NAME_hint).
|
* [window hint](@ref GLFW_X11_CLASS_NAME_hint).
|
||||||
*/
|
*/
|
||||||
#define GLFW_X11_INSTANCE_NAME 0x00024002
|
#define GLFW_X11_INSTANCE_NAME 0x00024002
|
||||||
|
#define GLFW_WIN32_KEYBOARD_MENU 0x00025001
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
#define GLFW_NO_API 0
|
#define GLFW_NO_API 0
|
||||||
@ -1038,14 +1050,15 @@ extern "C" {
|
|||||||
/*! @defgroup shapes Standard cursor shapes
|
/*! @defgroup shapes Standard cursor shapes
|
||||||
* @brief Standard system cursor shapes.
|
* @brief Standard system cursor shapes.
|
||||||
*
|
*
|
||||||
* See [standard cursor creation](@ref cursor_standard) for how these are used.
|
* These are the [standard cursor shapes](@ref cursor_standard) that can be
|
||||||
|
* requested from the window system.
|
||||||
*
|
*
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
* @{ */
|
* @{ */
|
||||||
|
|
||||||
/*! @brief The regular arrow cursor shape.
|
/*! @brief The regular arrow cursor shape.
|
||||||
*
|
*
|
||||||
* The regular arrow cursor.
|
* The regular arrow cursor shape.
|
||||||
*/
|
*/
|
||||||
#define GLFW_ARROW_CURSOR 0x00036001
|
#define GLFW_ARROW_CURSOR 0x00036001
|
||||||
/*! @brief The text input I-beam cursor shape.
|
/*! @brief The text input I-beam cursor shape.
|
||||||
@ -1053,26 +1066,91 @@ extern "C" {
|
|||||||
* The text input I-beam cursor shape.
|
* The text input I-beam cursor shape.
|
||||||
*/
|
*/
|
||||||
#define GLFW_IBEAM_CURSOR 0x00036002
|
#define GLFW_IBEAM_CURSOR 0x00036002
|
||||||
/*! @brief The crosshair shape.
|
/*! @brief The crosshair cursor shape.
|
||||||
*
|
*
|
||||||
* The crosshair shape.
|
* The crosshair cursor shape.
|
||||||
*/
|
*/
|
||||||
#define GLFW_CROSSHAIR_CURSOR 0x00036003
|
#define GLFW_CROSSHAIR_CURSOR 0x00036003
|
||||||
/*! @brief The hand shape.
|
/*! @brief The pointing hand cursor shape.
|
||||||
*
|
*
|
||||||
* The hand shape.
|
* The pointing hand cursor shape.
|
||||||
*/
|
*/
|
||||||
#define GLFW_HAND_CURSOR 0x00036004
|
#define GLFW_POINTING_HAND_CURSOR 0x00036004
|
||||||
/*! @brief The horizontal resize arrow shape.
|
/*! @brief The horizontal resize/move arrow shape.
|
||||||
*
|
*
|
||||||
* The horizontal resize arrow shape.
|
* The horizontal resize/move arrow shape. This is usually a horizontal
|
||||||
|
* double-headed arrow.
|
||||||
*/
|
*/
|
||||||
#define GLFW_HRESIZE_CURSOR 0x00036005
|
#define GLFW_RESIZE_EW_CURSOR 0x00036005
|
||||||
/*! @brief The vertical resize arrow shape.
|
/*! @brief The vertical resize/move arrow shape.
|
||||||
*
|
*
|
||||||
* The vertical resize arrow shape.
|
* The vertical resize/move shape. This is usually a vertical double-headed
|
||||||
|
* arrow.
|
||||||
*/
|
*/
|
||||||
#define GLFW_VRESIZE_CURSOR 0x00036006
|
#define GLFW_RESIZE_NS_CURSOR 0x00036006
|
||||||
|
/*! @brief The top-left to bottom-right diagonal resize/move arrow shape.
|
||||||
|
*
|
||||||
|
* The top-left to bottom-right diagonal resize/move shape. This is usually
|
||||||
|
* a diagonal double-headed arrow.
|
||||||
|
*
|
||||||
|
* @note @macos This shape is provided by a private system API and may fail
|
||||||
|
* with @ref GLFW_CURSOR_UNAVAILABLE in the future.
|
||||||
|
*
|
||||||
|
* @note @x11 This shape is provided by a newer standard not supported by all
|
||||||
|
* cursor themes.
|
||||||
|
*
|
||||||
|
* @note @wayland This shape is provided by a newer standard not supported by
|
||||||
|
* all cursor themes.
|
||||||
|
*/
|
||||||
|
#define GLFW_RESIZE_NWSE_CURSOR 0x00036007
|
||||||
|
/*! @brief The top-right to bottom-left diagonal resize/move arrow shape.
|
||||||
|
*
|
||||||
|
* The top-right to bottom-left diagonal resize/move shape. This is usually
|
||||||
|
* a diagonal double-headed arrow.
|
||||||
|
*
|
||||||
|
* @note @macos This shape is provided by a private system API and may fail
|
||||||
|
* with @ref GLFW_CURSOR_UNAVAILABLE in the future.
|
||||||
|
*
|
||||||
|
* @note @x11 This shape is provided by a newer standard not supported by all
|
||||||
|
* cursor themes.
|
||||||
|
*
|
||||||
|
* @note @wayland This shape is provided by a newer standard not supported by
|
||||||
|
* all cursor themes.
|
||||||
|
*/
|
||||||
|
#define GLFW_RESIZE_NESW_CURSOR 0x00036008
|
||||||
|
/*! @brief The omni-directional resize/move cursor shape.
|
||||||
|
*
|
||||||
|
* The omni-directional resize cursor/move shape. This is usually either
|
||||||
|
* a combined horizontal and vertical double-headed arrow or a grabbing hand.
|
||||||
|
*/
|
||||||
|
#define GLFW_RESIZE_ALL_CURSOR 0x00036009
|
||||||
|
/*! @brief The operation-not-allowed shape.
|
||||||
|
*
|
||||||
|
* The operation-not-allowed shape. This is usually a circle with a diagonal
|
||||||
|
* line through it.
|
||||||
|
*
|
||||||
|
* @note @x11 This shape is provided by a newer standard not supported by all
|
||||||
|
* cursor themes.
|
||||||
|
*
|
||||||
|
* @note @wayland This shape is provided by a newer standard not supported by
|
||||||
|
* all cursor themes.
|
||||||
|
*/
|
||||||
|
#define GLFW_NOT_ALLOWED_CURSOR 0x0003600A
|
||||||
|
/*! @brief Legacy name for compatibility.
|
||||||
|
*
|
||||||
|
* This is an alias for compatibility with earlier versions.
|
||||||
|
*/
|
||||||
|
#define GLFW_HRESIZE_CURSOR GLFW_RESIZE_EW_CURSOR
|
||||||
|
/*! @brief Legacy name for compatibility.
|
||||||
|
*
|
||||||
|
* This is an alias for compatibility with earlier versions.
|
||||||
|
*/
|
||||||
|
#define GLFW_VRESIZE_CURSOR GLFW_RESIZE_NS_CURSOR
|
||||||
|
/*! @brief Legacy name for compatibility.
|
||||||
|
*
|
||||||
|
* This is an alias for compatibility with earlier versions.
|
||||||
|
*/
|
||||||
|
#define GLFW_HAND_CURSOR GLFW_POINTING_HAND_CURSOR
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
#define GLFW_CONNECTED 0x00040001
|
#define GLFW_CONNECTED 0x00040001
|
||||||
@ -2041,7 +2119,7 @@ GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
|
|||||||
*/
|
*/
|
||||||
GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
|
GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
|
||||||
|
|
||||||
/*! @brief Retrives the work area of the monitor.
|
/*! @brief Retrieves the work area of the monitor.
|
||||||
*
|
*
|
||||||
* This function returns the position, in screen coordinates, of the upper-left
|
* This function returns the position, in screen coordinates, of the upper-left
|
||||||
* corner of the work area of the specified monitor along with the work area
|
* corner of the work area of the specified monitor along with the work area
|
||||||
@ -2325,7 +2403,7 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
|
|||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||||
* GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
|
* GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @remark @wayland Gamma handling is a priviledged protocol, this function
|
* @remark @wayland Gamma handling is a privileged protocol, this function
|
||||||
* will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR.
|
* will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @thread_safety This function must only be called from the main thread.
|
* @thread_safety This function must only be called from the main thread.
|
||||||
@ -2349,7 +2427,7 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
|
|||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
* GLFW_PLATFORM_ERROR.
|
* GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @remark @wayland Gamma handling is a priviledged protocol, this function
|
* @remark @wayland Gamma handling is a privileged protocol, this function
|
||||||
* will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR while
|
* will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR while
|
||||||
* returning `NULL`.
|
* returning `NULL`.
|
||||||
*
|
*
|
||||||
@ -2393,7 +2471,7 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
|
|||||||
*
|
*
|
||||||
* @remark @win32 The gamma ramp size must be 256.
|
* @remark @win32 The gamma ramp size must be 256.
|
||||||
*
|
*
|
||||||
* @remark @wayland Gamma handling is a priviledged protocol, this function
|
* @remark @wayland Gamma handling is a privileged protocol, this function
|
||||||
* will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR.
|
* will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @pointer_lifetime The specified gamma ramp is copied before this function
|
* @pointer_lifetime The specified gamma ramp is copied before this function
|
||||||
@ -2580,12 +2658,11 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
|
|||||||
* @remark @win32 The context to share resources with must not be current on
|
* @remark @win32 The context to share resources with must not be current on
|
||||||
* any other thread.
|
* any other thread.
|
||||||
*
|
*
|
||||||
* @remark @macos The OS only supports forward-compatible core profile contexts
|
* @remark @macos The OS only supports core profile contexts for OpenGL
|
||||||
* for OpenGL versions 3.2 and later. Before creating an OpenGL context of
|
* versions 3.2 and later. Before creating an OpenGL context of version 3.2 or
|
||||||
* version 3.2 or later you must set the
|
* later you must set the [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint)
|
||||||
* [GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and
|
* hint accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all
|
||||||
* [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly.
|
* on macOS.
|
||||||
* OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.
|
|
||||||
*
|
*
|
||||||
* @remark @macos The GLFW window has no icon, as it is not a document
|
* @remark @macos The GLFW window has no icon, as it is not a document
|
||||||
* window, but the dock icon will be the same as the application bundle's icon.
|
* window, but the dock icon will be the same as the application bundle's icon.
|
||||||
@ -2612,7 +2689,7 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
|
|||||||
*
|
*
|
||||||
* @remark @macos When activating frame autosaving with
|
* @remark @macos When activating frame autosaving with
|
||||||
* [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified
|
* [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified
|
||||||
* window size and position may be overriden by previously saved values.
|
* window size and position may be overridden by previously saved values.
|
||||||
*
|
*
|
||||||
* @remark @x11 Some window managers will not respect the placement of
|
* @remark @x11 Some window managers will not respect the placement of
|
||||||
* initially hidden windows.
|
* initially hidden windows.
|
||||||
@ -4190,9 +4267,11 @@ GLFWAPI int glfwRawMouseMotionSupported(void);
|
|||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||||
* GLFW_PLATFORM_ERROR.
|
* GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
|
* @remark The contents of the returned string may change when a keyboard
|
||||||
|
* layout change event is received.
|
||||||
|
*
|
||||||
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
||||||
* should not free it yourself. It is valid until the next call to @ref
|
* should not free it yourself. It is valid until the library is terminated.
|
||||||
* glfwGetKeyName, or until the library is terminated.
|
|
||||||
*
|
*
|
||||||
* @thread_safety This function must only be called from the main thread.
|
* @thread_safety This function must only be called from the main thread.
|
||||||
*
|
*
|
||||||
@ -4415,19 +4494,44 @@ GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot)
|
|||||||
|
|
||||||
/*! @brief Creates a cursor with a standard shape.
|
/*! @brief Creates a cursor with a standard shape.
|
||||||
*
|
*
|
||||||
* Returns a cursor with a [standard shape](@ref shapes), that can be set for
|
* Returns a cursor with a standard shape, that can be set for a window with
|
||||||
* a window with @ref glfwSetCursor.
|
* @ref glfwSetCursor. The images for these cursors come from the system
|
||||||
|
* cursor theme and their exact appearance will vary between platforms.
|
||||||
|
*
|
||||||
|
* Most of these shapes are guaranteed to exist on every supported platform but
|
||||||
|
* a few may not be present. See the table below for details.
|
||||||
|
*
|
||||||
|
* Cursor shape | Windows | macOS | X11 | Wayland
|
||||||
|
* ------------------------------ | ------- | ----- | ------ | -------
|
||||||
|
* @ref GLFW_ARROW_CURSOR | Yes | Yes | Yes | Yes
|
||||||
|
* @ref GLFW_IBEAM_CURSOR | Yes | Yes | Yes | Yes
|
||||||
|
* @ref GLFW_CROSSHAIR_CURSOR | Yes | Yes | Yes | Yes
|
||||||
|
* @ref GLFW_POINTING_HAND_CURSOR | Yes | Yes | Yes | Yes
|
||||||
|
* @ref GLFW_RESIZE_EW_CURSOR | Yes | Yes | Yes | Yes
|
||||||
|
* @ref GLFW_RESIZE_NS_CURSOR | Yes | Yes | Yes | Yes
|
||||||
|
* @ref GLFW_RESIZE_NWSE_CURSOR | Yes | Yes<sup>1</sup> | Maybe<sup>2</sup> | Maybe<sup>2</sup>
|
||||||
|
* @ref GLFW_RESIZE_NESW_CURSOR | Yes | Yes<sup>1</sup> | Maybe<sup>2</sup> | Maybe<sup>2</sup>
|
||||||
|
* @ref GLFW_RESIZE_ALL_CURSOR | Yes | Yes | Yes | Yes
|
||||||
|
* @ref GLFW_NOT_ALLOWED_CURSOR | Yes | Yes | Maybe<sup>2</sup> | Maybe<sup>2</sup>
|
||||||
|
*
|
||||||
|
* 1) This uses a private system API and may fail in the future.
|
||||||
|
*
|
||||||
|
* 2) This uses a newer standard that not all cursor themes support.
|
||||||
|
*
|
||||||
|
* If the requested shape is not available, this function emits a @ref
|
||||||
|
* GLFW_CURSOR_UNAVAILABLE error and returns `NULL`.
|
||||||
*
|
*
|
||||||
* @param[in] shape One of the [standard shapes](@ref shapes).
|
* @param[in] shape One of the [standard shapes](@ref shapes).
|
||||||
* @return A new cursor ready to use or `NULL` if an
|
* @return A new cursor ready to use or `NULL` if an
|
||||||
* [error](@ref error_handling) occurred.
|
* [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||||
* GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
|
* GLFW_INVALID_ENUM, @ref GLFW_CURSOR_UNAVAILABLE and @ref
|
||||||
|
* GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @thread_safety This function must only be called from the main thread.
|
* @thread_safety This function must only be called from the main thread.
|
||||||
*
|
*
|
||||||
* @sa @ref cursor_object
|
* @sa @ref cursor_standard
|
||||||
* @sa @ref glfwCreateCursor
|
* @sa @ref glfwCreateCursor
|
||||||
*
|
*
|
||||||
* @since Added in version 3.1.
|
* @since Added in version 3.1.
|
||||||
@ -4982,7 +5086,7 @@ GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count);
|
|||||||
*/
|
*/
|
||||||
GLFWAPI const char* glfwGetJoystickName(int jid);
|
GLFWAPI const char* glfwGetJoystickName(int jid);
|
||||||
|
|
||||||
/*! @brief Returns the SDL comaptible GUID of the specified joystick.
|
/*! @brief Returns the SDL compatible GUID of the specified joystick.
|
||||||
*
|
*
|
||||||
* This function returns the SDL compatible GUID, as a UTF-8 encoded
|
* This function returns the SDL compatible GUID, as a UTF-8 encoded
|
||||||
* hexadecimal string, of the specified joystick. The returned string is
|
* hexadecimal string, of the specified joystick. The returned string is
|
||||||
@ -5203,7 +5307,7 @@ GLFWAPI const char* glfwGetGamepadName(int jid);
|
|||||||
|
|
||||||
/*! @brief Retrieves the state of the specified joystick remapped as a gamepad.
|
/*! @brief Retrieves the state of the specified joystick remapped as a gamepad.
|
||||||
*
|
*
|
||||||
* This function retrives the state of the specified joystick remapped to
|
* This function retrieves the state of the specified joystick remapped to
|
||||||
* an Xbox-like gamepad.
|
* an Xbox-like gamepad.
|
||||||
*
|
*
|
||||||
* If the specified joystick is not present or does not have a gamepad mapping
|
* If the specified joystick is not present or does not have a gamepad mapping
|
||||||
|
@ -100,6 +100,18 @@ set_target_properties(glfw PROPERTIES
|
|||||||
POSITION_INDEPENDENT_CODE ON
|
POSITION_INDEPENDENT_CODE ON
|
||||||
FOLDER "GLFW3")
|
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_compile_definitions(glfw PRIVATE _GLFW_USE_CONFIG_H)
|
||||||
target_include_directories(glfw PUBLIC
|
target_include_directories(glfw PUBLIC
|
||||||
"$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>"
|
"$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>"
|
||||||
@ -125,6 +137,10 @@ target_compile_options(glfw PRIVATE
|
|||||||
if (BUILD_SHARED_LIBS)
|
if (BUILD_SHARED_LIBS)
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
if (MINGW)
|
if (MINGW)
|
||||||
|
# Remove the dependency on the shared version of libgcc
|
||||||
|
# NOTE: MinGW-w64 has the correct default but MinGW needs this
|
||||||
|
target_link_options(glfw PRIVATE "-static-libgcc")
|
||||||
|
|
||||||
# Remove the lib prefix on the DLL (but not the import library)
|
# Remove the lib prefix on the DLL (but not the import library)
|
||||||
set_target_properties(glfw PROPERTIES PREFIX "")
|
set_target_properties(glfw PROPERTIES PREFIX "")
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include <IOKit/hid/IOHIDKeys.h>
|
#include <IOKit/hid/IOHIDKeys.h>
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickNS ns
|
#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"
|
#define _GLFW_PLATFORM_MAPPING_NAME "Mac OS X"
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ void _glfwPollMonitorsNS(void)
|
|||||||
CGDirectDisplayID* displays = calloc(displayCount, sizeof(CGDirectDisplayID));
|
CGDirectDisplayID* displays = calloc(displayCount, sizeof(CGDirectDisplayID));
|
||||||
CGGetOnlineDisplayList(displayCount, displays, &displayCount);
|
CGGetOnlineDisplayList(displayCount, displays, &displayCount);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < _glfw.monitorCount; i++)
|
for (int i = 0; i < _glfw.monitorCount; i++)
|
||||||
_glfw.monitors[i]->ns.screen = nil;
|
_glfw.monitors[i]->ns.screen = nil;
|
||||||
|
|
||||||
_GLFWmonitor** disconnected = NULL;
|
_GLFWmonitor** disconnected = NULL;
|
||||||
@ -528,7 +528,7 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
|||||||
|
|
||||||
CGGammaValue* values = calloc(ramp->size * 3, sizeof(CGGammaValue));
|
CGGammaValue* values = calloc(ramp->size * 3, sizeof(CGGammaValue));
|
||||||
|
|
||||||
for (int 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->red[i] / 65535.f;
|
||||||
values[i + ramp->size] = ramp->green[i] / 65535.f;
|
values[i + ramp->size] = ramp->green[i] / 65535.f;
|
||||||
|
@ -41,6 +41,9 @@
|
|||||||
typedef void* id;
|
typedef void* id;
|
||||||
#endif
|
#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
|
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
|
||||||
#define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat
|
#define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat
|
||||||
#define NSEventMaskAny NSAnyEventMask
|
#define NSEventMaskAny NSAnyEventMask
|
||||||
@ -139,7 +142,7 @@ typedef struct _GLFWlibraryNS
|
|||||||
id keyUpMonitor;
|
id keyUpMonitor;
|
||||||
id nibObjects;
|
id nibObjects;
|
||||||
|
|
||||||
char keyName[64];
|
char keynames[GLFW_KEY_LAST + 1][17];
|
||||||
short int keycodes[256];
|
short int keycodes[256];
|
||||||
short int scancodes[GLFW_KEY_LAST + 1];
|
short int scancodes[GLFW_KEY_LAST + 1];
|
||||||
char* clipboardString;
|
char* clipboardString;
|
||||||
|
@ -35,15 +35,14 @@
|
|||||||
//
|
//
|
||||||
static NSUInteger getStyleMask(_GLFWwindow* window)
|
static NSUInteger getStyleMask(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
NSUInteger styleMask = 0;
|
NSUInteger styleMask = NSWindowStyleMaskMiniaturizable;
|
||||||
|
|
||||||
if (window->monitor || !window->decorated)
|
if (window->monitor || !window->decorated)
|
||||||
styleMask |= NSWindowStyleMaskBorderless;
|
styleMask |= NSWindowStyleMaskBorderless;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
styleMask |= NSWindowStyleMaskTitled |
|
styleMask |= NSWindowStyleMaskTitled |
|
||||||
NSWindowStyleMaskClosable |
|
NSWindowStyleMaskClosable;
|
||||||
NSWindowStyleMaskMiniaturizable;
|
|
||||||
|
|
||||||
if (window->resizable)
|
if (window->resizable)
|
||||||
styleMask |= NSWindowStyleMaskResizable;
|
styleMask |= NSWindowStyleMaskResizable;
|
||||||
@ -816,7 +815,7 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
|||||||
[window->ns.object setLevel:NSMainMenuWindowLevel + 1];
|
[window->ns.object setLevel:NSMainMenuWindowLevel + 1];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[window->ns.object center];
|
[(NSWindow*) window->ns.object center];
|
||||||
_glfw.ns.cascadePoint =
|
_glfw.ns.cascadePoint =
|
||||||
NSPointToCGPoint([window->ns.object cascadeTopLeftFromPoint:
|
NSPointToCGPoint([window->ns.object cascadeTopLeftFromPoint:
|
||||||
NSPointFromCGPoint(_glfw.ns.cascadePoint)]);
|
NSPointFromCGPoint(_glfw.ns.cascadePoint)]);
|
||||||
@ -962,6 +961,9 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
|||||||
[window->ns.object close];
|
[window->ns.object close];
|
||||||
window->ns.object = nil;
|
window->ns.object = nil;
|
||||||
|
|
||||||
|
// HACK: Allow Cocoa to catch up before returning
|
||||||
|
_glfwPlatformPollEvents();
|
||||||
|
|
||||||
} // autoreleasepool
|
} // autoreleasepool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1032,7 +1034,14 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
|||||||
acquireMonitor(window);
|
acquireMonitor(window);
|
||||||
}
|
}
|
||||||
else
|
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
|
} // autoreleasepool
|
||||||
}
|
}
|
||||||
@ -1503,8 +1512,10 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
|
||||||
|
const int key = _glfw.ns.keycodes[scancode];
|
||||||
|
|
||||||
UInt32 deadKeyState = 0;
|
UInt32 deadKeyState = 0;
|
||||||
UniChar characters[8];
|
UniChar characters[4];
|
||||||
UniCharCount characterCount = 0;
|
UniCharCount characterCount = 0;
|
||||||
|
|
||||||
if (UCKeyTranslate([(NSData*) _glfw.ns.unicodeData bytes],
|
if (UCKeyTranslate([(NSData*) _glfw.ns.unicodeData bytes],
|
||||||
@ -1529,12 +1540,12 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||||||
characterCount,
|
characterCount,
|
||||||
kCFAllocatorNull);
|
kCFAllocatorNull);
|
||||||
CFStringGetCString(string,
|
CFStringGetCString(string,
|
||||||
_glfw.ns.keyName,
|
_glfw.ns.keynames[key],
|
||||||
sizeof(_glfw.ns.keyName),
|
sizeof(_glfw.ns.keynames[key]),
|
||||||
kCFStringEncodingUTF8);
|
kCFStringEncodingUTF8);
|
||||||
CFRelease(string);
|
CFRelease(string);
|
||||||
|
|
||||||
return _glfw.ns.keyName;
|
return _glfw.ns.keynames[key];
|
||||||
|
|
||||||
} // autoreleasepool
|
} // autoreleasepool
|
||||||
}
|
}
|
||||||
@ -1592,23 +1603,49 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
|||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
|
|
||||||
|
SEL cursorSelector = NULL;
|
||||||
|
|
||||||
|
// HACK: Try to use a private message
|
||||||
|
if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||||
|
cursorSelector = @selector(_windowResizeEastWestCursor);
|
||||||
|
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||||
|
cursorSelector = @selector(_windowResizeNorthSouthCursor);
|
||||||
|
else if (shape == GLFW_RESIZE_NWSE_CURSOR)
|
||||||
|
cursorSelector = @selector(_windowResizeNorthWestSouthEastCursor);
|
||||||
|
else if (shape == GLFW_RESIZE_NESW_CURSOR)
|
||||||
|
cursorSelector = @selector(_windowResizeNorthEastSouthWestCursor);
|
||||||
|
|
||||||
|
if (cursorSelector && [NSCursor respondsToSelector:cursorSelector])
|
||||||
|
{
|
||||||
|
id object = [NSCursor performSelector:cursorSelector];
|
||||||
|
if ([object isKindOfClass:[NSCursor class]])
|
||||||
|
cursor->ns.object = object;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cursor->ns.object)
|
||||||
|
{
|
||||||
if (shape == GLFW_ARROW_CURSOR)
|
if (shape == GLFW_ARROW_CURSOR)
|
||||||
cursor->ns.object = [NSCursor arrowCursor];
|
cursor->ns.object = [NSCursor arrowCursor];
|
||||||
else if (shape == GLFW_IBEAM_CURSOR)
|
else if (shape == GLFW_IBEAM_CURSOR)
|
||||||
cursor->ns.object = [NSCursor IBeamCursor];
|
cursor->ns.object = [NSCursor IBeamCursor];
|
||||||
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||||
cursor->ns.object = [NSCursor crosshairCursor];
|
cursor->ns.object = [NSCursor crosshairCursor];
|
||||||
else if (shape == GLFW_HAND_CURSOR)
|
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||||
cursor->ns.object = [NSCursor pointingHandCursor];
|
cursor->ns.object = [NSCursor pointingHandCursor];
|
||||||
else if (shape == GLFW_HRESIZE_CURSOR)
|
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||||
cursor->ns.object = [NSCursor resizeLeftRightCursor];
|
cursor->ns.object = [NSCursor resizeLeftRightCursor];
|
||||||
else if (shape == GLFW_VRESIZE_CURSOR)
|
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||||
cursor->ns.object = [NSCursor resizeUpDownCursor];
|
cursor->ns.object = [NSCursor resizeUpDownCursor];
|
||||||
|
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||||
|
cursor->ns.object = [NSCursor closedHandCursor];
|
||||||
|
else if (shape == GLFW_NOT_ALLOWED_CURSOR)
|
||||||
|
cursor->ns.object = [NSCursor operationNotAllowedCursor];
|
||||||
|
}
|
||||||
|
|
||||||
if (!cursor->ns.object)
|
if (!cursor->ns.object)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_CURSOR_UNAVAILABLE,
|
||||||
"Cocoa: Failed to retrieve standard cursor");
|
"Cocoa: Standard cursor shape unavailable");
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,6 +189,8 @@ void _glfwInputError(int code, const char* format, ...)
|
|||||||
strcpy(description, "The requested format is unavailable");
|
strcpy(description, "The requested format is unavailable");
|
||||||
else if (code == GLFW_NO_WINDOW_CONTEXT)
|
else if (code == GLFW_NO_WINDOW_CONTEXT)
|
||||||
strcpy(description, "The specified window has no context");
|
strcpy(description, "The specified window has no context");
|
||||||
|
else if (code == GLFW_CURSOR_UNAVAILABLE)
|
||||||
|
strcpy(description, "The specified cursor shape is unavailable");
|
||||||
else
|
else
|
||||||
strcpy(description, "ERROR: UNKNOWN GLFW ERROR");
|
strcpy(description, "ERROR: UNKNOWN GLFW ERROR");
|
||||||
}
|
}
|
||||||
|
10
src/input.c
10
src/input.c
@ -757,9 +757,13 @@ GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape)
|
|||||||
if (shape != GLFW_ARROW_CURSOR &&
|
if (shape != GLFW_ARROW_CURSOR &&
|
||||||
shape != GLFW_IBEAM_CURSOR &&
|
shape != GLFW_IBEAM_CURSOR &&
|
||||||
shape != GLFW_CROSSHAIR_CURSOR &&
|
shape != GLFW_CROSSHAIR_CURSOR &&
|
||||||
shape != GLFW_HAND_CURSOR &&
|
shape != GLFW_POINTING_HAND_CURSOR &&
|
||||||
shape != GLFW_HRESIZE_CURSOR &&
|
shape != GLFW_RESIZE_EW_CURSOR &&
|
||||||
shape != GLFW_VRESIZE_CURSOR)
|
shape != GLFW_RESIZE_NS_CURSOR &&
|
||||||
|
shape != GLFW_RESIZE_NWSE_CURSOR &&
|
||||||
|
shape != GLFW_RESIZE_NESW_CURSOR &&
|
||||||
|
shape != GLFW_RESIZE_ALL_CURSOR &&
|
||||||
|
shape != GLFW_NOT_ALLOWED_CURSOR)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid standard cursor 0x%08X", shape);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid standard cursor 0x%08X", shape);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -274,6 +274,9 @@ struct _GLFWwndconfig
|
|||||||
char className[256];
|
char className[256];
|
||||||
char instanceName[256];
|
char instanceName[256];
|
||||||
} x11;
|
} x11;
|
||||||
|
struct {
|
||||||
|
GLFWbool keymenu;
|
||||||
|
} win32;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Context configuration
|
// Context configuration
|
||||||
|
@ -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,",
|
"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,",
|
"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,",
|
"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,",
|
"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,",
|
"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,",
|
"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,",
|
"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,",
|
"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,",
|
"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,",
|
"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,",
|
"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,",
|
"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,",
|
||||||
|
@ -56,6 +56,10 @@ static int compareVideoModes(const void* fp, const void* sp)
|
|||||||
if (farea != sarea)
|
if (farea != sarea)
|
||||||
return farea - sarea;
|
return farea - sarea;
|
||||||
|
|
||||||
|
// Then sort on width
|
||||||
|
if (fm->width != sm->width)
|
||||||
|
return fm->width - sm->width;
|
||||||
|
|
||||||
// Lastly sort on refresh rate
|
// Lastly sort on refresh rate
|
||||||
return fm->refreshRate - sm->refreshRate;
|
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
|
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101400
|
||||||
#define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval
|
#define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval
|
||||||
#define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity
|
#define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity
|
||||||
|
@ -332,7 +332,7 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
|||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSOpenGLContext* share = NULL;
|
NSOpenGLContext* share = nil;
|
||||||
|
|
||||||
if (ctxconfig->share)
|
if (ctxconfig->share)
|
||||||
share = ctxconfig->share->context.nsgl.object;
|
share = ctxconfig->share->context.nsgl.object;
|
||||||
@ -405,7 +405,7 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* handle)
|
|||||||
if (window->context.client == GLFW_NO_API)
|
if (window->context.client == GLFW_NO_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
return NULL;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
return window->context.nsgl.object;
|
return window->context.nsgl.object;
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
//
|
//
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_JOYSTICK_STATE int nulljs
|
#define _GLFW_PLATFORM_JOYSTICK_STATE struct { int dummyJoystick; }
|
||||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE int nulljs
|
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; }
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_MAPPING_NAME ""
|
#define _GLFW_PLATFORM_MAPPING_NAME ""
|
||||||
|
|
||||||
|
@ -29,13 +29,13 @@
|
|||||||
|
|
||||||
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNull null
|
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNull null
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_CONTEXT_STATE
|
#define _GLFW_PLATFORM_CONTEXT_STATE struct { int dummyContext; }
|
||||||
#define _GLFW_PLATFORM_MONITOR_STATE
|
#define _GLFW_PLATFORM_MONITOR_STATE struct { int dummyMonitor; }
|
||||||
#define _GLFW_PLATFORM_CURSOR_STATE
|
#define _GLFW_PLATFORM_CURSOR_STATE struct { int dummyCursor; }
|
||||||
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE
|
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE struct { int dummyLibraryWindow; }
|
||||||
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE
|
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE struct { int dummyLibraryContext; }
|
||||||
#define _GLFW_EGL_CONTEXT_STATE
|
#define _GLFW_EGL_CONTEXT_STATE struct { int dummyEGLContext; }
|
||||||
#define _GLFW_EGL_LIBRARY_CONTEXT_STATE
|
#define _GLFW_EGL_LIBRARY_CONTEXT_STATE struct { int dummyEGLLibraryContext; }
|
||||||
|
|
||||||
#include "osmesa_context.h"
|
#include "osmesa_context.h"
|
||||||
#include "posix_time.h"
|
#include "posix_time.h"
|
||||||
|
@ -525,7 +525,7 @@ BOOL _glfwIsWindowsVersionOrGreaterWin32(WORD major, WORD minor, WORD sp)
|
|||||||
cond = VerSetConditionMask(cond, VER_MINORVERSION, VER_GREATER_EQUAL);
|
cond = VerSetConditionMask(cond, VER_MINORVERSION, VER_GREATER_EQUAL);
|
||||||
cond = VerSetConditionMask(cond, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
|
cond = VerSetConditionMask(cond, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
|
||||||
// HACK: Use RtlVerifyVersionInfo instead of VerifyVersionInfoW as the
|
// 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
|
// announcing support for Windows 10 via supportedOS GUID
|
||||||
return RtlVerifyVersionInfo(&osvi, mask, cond) == 0;
|
return RtlVerifyVersionInfo(&osvi, mask, cond) == 0;
|
||||||
}
|
}
|
||||||
@ -540,7 +540,7 @@ BOOL _glfwIsWindows10BuildOrGreaterWin32(WORD build)
|
|||||||
cond = VerSetConditionMask(cond, VER_MINORVERSION, VER_GREATER_EQUAL);
|
cond = VerSetConditionMask(cond, VER_MINORVERSION, VER_GREATER_EQUAL);
|
||||||
cond = VerSetConditionMask(cond, VER_BUILDNUMBER, VER_GREATER_EQUAL);
|
cond = VerSetConditionMask(cond, VER_BUILDNUMBER, VER_GREATER_EQUAL);
|
||||||
// HACK: Use RtlVerifyVersionInfo instead of VerifyVersionInfoW as the
|
// 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
|
// announcing support for Windows 10 via supportedOS GUID
|
||||||
return RtlVerifyVersionInfo(&osvi, mask, cond) == 0;
|
return RtlVerifyVersionInfo(&osvi, mask, cond) == 0;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickWin32 win32
|
#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"
|
#define _GLFW_PLATFORM_MAPPING_NAME "Windows"
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
|
|||||||
GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||||
{
|
{
|
||||||
HDC dc;
|
HDC dc;
|
||||||
WORD values[768];
|
WORD values[3][256];
|
||||||
|
|
||||||
dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL);
|
dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL);
|
||||||
GetDeviceGammaRamp(dc, values);
|
GetDeviceGammaRamp(dc, values);
|
||||||
@ -485,9 +485,9 @@ GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
|||||||
|
|
||||||
_glfwAllocGammaArrays(ramp, 256);
|
_glfwAllocGammaArrays(ramp, 256);
|
||||||
|
|
||||||
memcpy(ramp->red, values + 0, 256 * sizeof(unsigned short));
|
memcpy(ramp->red, values[0], sizeof(values[0]));
|
||||||
memcpy(ramp->green, values + 256, 256 * sizeof(unsigned short));
|
memcpy(ramp->green, values[1], sizeof(values[1]));
|
||||||
memcpy(ramp->blue, values + 512, 256 * sizeof(unsigned short));
|
memcpy(ramp->blue, values[2], sizeof(values[2]));
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
@ -495,7 +495,7 @@ GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
|||||||
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
||||||
{
|
{
|
||||||
HDC dc;
|
HDC dc;
|
||||||
WORD values[768];
|
WORD values[3][256];
|
||||||
|
|
||||||
if (ramp->size != 256)
|
if (ramp->size != 256)
|
||||||
{
|
{
|
||||||
@ -504,9 +504,9 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(values + 0, ramp->red, 256 * sizeof(unsigned short));
|
memcpy(values[0], ramp->red, sizeof(values[0]));
|
||||||
memcpy(values + 256, ramp->green, 256 * sizeof(unsigned short));
|
memcpy(values[1], ramp->green, sizeof(values[1]));
|
||||||
memcpy(values + 512, ramp->blue, 256 * sizeof(unsigned short));
|
memcpy(values[2], ramp->blue, sizeof(values[2]));
|
||||||
|
|
||||||
dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL);
|
dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL);
|
||||||
SetDeviceGammaRamp(dc, values);
|
SetDeviceGammaRamp(dc, values);
|
||||||
|
@ -315,6 +315,7 @@ typedef struct _GLFWwindowWin32
|
|||||||
// Whether to enable framebuffer transparency on DWM
|
// Whether to enable framebuffer transparency on DWM
|
||||||
GLFWbool transparent;
|
GLFWbool transparent;
|
||||||
GLFWbool scaleToMonitor;
|
GLFWbool scaleToMonitor;
|
||||||
|
GLFWbool keymenu;
|
||||||
|
|
||||||
// The last received cursor position, regardless of source
|
// The last received cursor position, regardless of source
|
||||||
int lastCursorPosX, lastCursorPosY;
|
int lastCursorPosX, lastCursorPosY;
|
||||||
|
@ -411,7 +411,7 @@ static void updateFramebufferTransparency(const _GLFWwindow* window)
|
|||||||
// issue. When set to black, something is making the hit test
|
// issue. When set to black, something is making the hit test
|
||||||
// not resize with the window frame.
|
// not resize with the window frame.
|
||||||
SetLayeredWindowAttributes(window->win32.handle,
|
SetLayeredWindowAttributes(window->win32.handle,
|
||||||
RGB(0, 193, 48), 255, LWA_COLORKEY);
|
RGB(255, 0, 255), 255, LWA_COLORKEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteObject(region);
|
DeleteObject(region);
|
||||||
@ -481,7 +481,7 @@ static int translateKey(WPARAM wParam, LPARAM lParam)
|
|||||||
DWORD time;
|
DWORD time;
|
||||||
|
|
||||||
// Right side keys have the extended key bit set
|
// Right side keys have the extended key bit set
|
||||||
if (lParam & 0x01000000)
|
if (HIWORD(lParam) & KF_EXTENDED)
|
||||||
return GLFW_KEY_RIGHT_CONTROL;
|
return GLFW_KEY_RIGHT_CONTROL;
|
||||||
|
|
||||||
// HACK: Alt Gr sends Left Ctrl and then Right Alt in close sequence
|
// HACK: Alt Gr sends Left Ctrl and then Right Alt in close sequence
|
||||||
@ -497,7 +497,7 @@ static int translateKey(WPARAM wParam, LPARAM lParam)
|
|||||||
next.message == WM_SYSKEYUP)
|
next.message == WM_SYSKEYUP)
|
||||||
{
|
{
|
||||||
if (next.wParam == VK_MENU &&
|
if (next.wParam == VK_MENU &&
|
||||||
(next.lParam & 0x01000000) &&
|
(HIWORD(next.lParam) & KF_EXTENDED) &&
|
||||||
next.time == time)
|
next.time == time)
|
||||||
{
|
{
|
||||||
// Next message is Right Alt down so discard this
|
// Next message is Right Alt down so discard this
|
||||||
@ -699,7 +699,12 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
|
|
||||||
// User trying to access application menu using ALT?
|
// User trying to access application menu using ALT?
|
||||||
case SC_KEYMENU:
|
case SC_KEYMENU:
|
||||||
|
{
|
||||||
|
if (!window->win32.keymenu)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -731,6 +736,10 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
_glfwInputChar(window, (unsigned int) wParam, getKeyMods(), plain);
|
_glfwInputChar(window, (unsigned int) wParam, getKeyMods(), plain);
|
||||||
|
|
||||||
|
if (uMsg == WM_SYSCHAR && window->win32.keymenu)
|
||||||
|
break;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -740,8 +749,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
case WM_SYSKEYUP:
|
case WM_SYSKEYUP:
|
||||||
{
|
{
|
||||||
const int key = translateKey(wParam, lParam);
|
const int key = translateKey(wParam, lParam);
|
||||||
const int scancode = (lParam >> 16) & 0x1ff;
|
const int scancode = (HIWORD(lParam) & 0x1ff);
|
||||||
const int action = ((lParam >> 31) & 1) ? GLFW_RELEASE : GLFW_PRESS;
|
const int action = (HIWORD(lParam) & KF_UP) ? GLFW_RELEASE : GLFW_PRESS;
|
||||||
const int mods = getKeyMods();
|
const int mods = getKeyMods();
|
||||||
|
|
||||||
if (key == _GLFW_KEY_INVALID)
|
if (key == _GLFW_KEY_INVALID)
|
||||||
@ -1275,10 +1284,11 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
window->win32.scaleToMonitor = wndconfig->scaleToMonitor;
|
window->win32.scaleToMonitor = wndconfig->scaleToMonitor;
|
||||||
|
window->win32.keymenu = wndconfig->win32.keymenu;
|
||||||
|
|
||||||
// Adjust window size to account for DPI scaling of the window frame and
|
// Adjust window rect to account for DPI scaling of the window frame and
|
||||||
// optionally DPI scaling of the content area
|
// (if enabled) DPI scaling of the content area
|
||||||
// This cannot be done until we know what monitor it was placed on
|
// This cannot be done until we know what monitor the window was placed on
|
||||||
if (!window->monitor)
|
if (!window->monitor)
|
||||||
{
|
{
|
||||||
RECT rect = { 0, 0, wndconfig->width, wndconfig->height };
|
RECT rect = { 0, 0, wndconfig->width, wndconfig->height };
|
||||||
@ -1934,8 +1944,8 @@ void _glfwPlatformPollEvents(void)
|
|||||||
window = GetPropW(handle, L"GLFW");
|
window = GetPropW(handle, L"GLFW");
|
||||||
if (window)
|
if (window)
|
||||||
{
|
{
|
||||||
const GLFWbool lshift = (GetAsyncKeyState(VK_LSHIFT) >> 15) & 1;
|
const GLFWbool lshift = (GetAsyncKeyState(VK_LSHIFT) & 0x8000) != 0;
|
||||||
const GLFWbool rshift = (GetAsyncKeyState(VK_RSHIFT) >> 15) & 1;
|
const GLFWbool rshift = (GetAsyncKeyState(VK_RSHIFT) & 0x8000) != 0;
|
||||||
|
|
||||||
if (!lshift && window->keys[GLFW_KEY_LEFT_SHIFT] == GLFW_PRESS)
|
if (!lshift && window->keys[GLFW_KEY_LEFT_SHIFT] == GLFW_PRESS)
|
||||||
{
|
{
|
||||||
@ -2058,14 +2068,25 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
|||||||
id = OCR_IBEAM;
|
id = OCR_IBEAM;
|
||||||
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||||
id = OCR_CROSS;
|
id = OCR_CROSS;
|
||||||
else if (shape == GLFW_HAND_CURSOR)
|
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||||
id = OCR_HAND;
|
id = OCR_HAND;
|
||||||
else if (shape == GLFW_HRESIZE_CURSOR)
|
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||||
id = OCR_SIZEWE;
|
id = OCR_SIZEWE;
|
||||||
else if (shape == GLFW_VRESIZE_CURSOR)
|
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||||
id = OCR_SIZENS;
|
id = OCR_SIZENS;
|
||||||
|
else if (shape == GLFW_RESIZE_NWSE_CURSOR)
|
||||||
|
id = OCR_SIZENWSE;
|
||||||
|
else if (shape == GLFW_RESIZE_NESW_CURSOR)
|
||||||
|
id = OCR_SIZENESW;
|
||||||
|
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||||
|
id = OCR_SIZEALL;
|
||||||
|
else if (shape == GLFW_NOT_ALLOWED_CURSOR)
|
||||||
|
id = OCR_NO;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Unknown standard cursor");
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
cursor->win32.handle = LoadImageW(NULL,
|
cursor->win32.handle = LoadImageW(NULL,
|
||||||
MAKEINTRESOURCEW(id), IMAGE_CURSOR, 0, 0,
|
MAKEINTRESOURCEW(id), IMAGE_CURSOR, 0, 0,
|
||||||
|
@ -363,6 +363,9 @@ GLFWAPI void glfwWindowHint(int hint, int value)
|
|||||||
case GLFW_COCOA_RETINA_FRAMEBUFFER:
|
case GLFW_COCOA_RETINA_FRAMEBUFFER:
|
||||||
_glfw.hints.window.ns.retina = value ? GLFW_TRUE : GLFW_FALSE;
|
_glfw.hints.window.ns.retina = value ? GLFW_TRUE : GLFW_FALSE;
|
||||||
return;
|
return;
|
||||||
|
case GLFW_WIN32_KEYBOARD_MENU:
|
||||||
|
_glfw.hints.window.win32.keymenu = value ? GLFW_TRUE : GLFW_FALSE;
|
||||||
|
return;
|
||||||
case GLFW_COCOA_GRAPHICS_SWITCHING:
|
case GLFW_COCOA_GRAPHICS_SWITCHING:
|
||||||
_glfw.hints.context.nsgl.offline = value ? GLFW_TRUE : GLFW_FALSE;
|
_glfw.hints.context.nsgl.offline = value ? GLFW_TRUE : GLFW_FALSE;
|
||||||
return;
|
return;
|
||||||
|
@ -169,6 +169,7 @@ static void setCursor(_GLFWwindow* window, const char* name)
|
|||||||
wl_surface_damage(surface, 0, 0,
|
wl_surface_damage(surface, 0, 0,
|
||||||
image->width, image->height);
|
image->width, image->height);
|
||||||
wl_surface_commit(surface);
|
wl_surface_commit(surface);
|
||||||
|
_glfw.wl.cursorPreviousName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pointerHandleMotion(void* data,
|
static void pointerHandleMotion(void* data,
|
||||||
@ -178,48 +179,46 @@ static void pointerHandleMotion(void* data,
|
|||||||
wl_fixed_t sy)
|
wl_fixed_t sy)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = _glfw.wl.pointerFocus;
|
_GLFWwindow* window = _glfw.wl.pointerFocus;
|
||||||
const char* cursorName;
|
const char* cursorName = NULL;
|
||||||
|
double x, y;
|
||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
||||||
return;
|
return;
|
||||||
else
|
x = wl_fixed_to_double(sx);
|
||||||
{
|
y = wl_fixed_to_double(sy);
|
||||||
window->wl.cursorPosX = wl_fixed_to_double(sx);
|
|
||||||
window->wl.cursorPosY = wl_fixed_to_double(sy);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (window->wl.decorations.focus)
|
switch (window->wl.decorations.focus)
|
||||||
{
|
{
|
||||||
case mainWindow:
|
case mainWindow:
|
||||||
_glfwInputCursorPos(window,
|
window->wl.cursorPosX = x;
|
||||||
wl_fixed_to_double(sx),
|
window->wl.cursorPosY = y;
|
||||||
wl_fixed_to_double(sy));
|
_glfwInputCursorPos(window, x, y);
|
||||||
return;
|
return;
|
||||||
case topDecoration:
|
case topDecoration:
|
||||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
if (y < _GLFW_DECORATION_WIDTH)
|
||||||
cursorName = "n-resize";
|
cursorName = "n-resize";
|
||||||
else
|
else
|
||||||
cursorName = "left_ptr";
|
cursorName = "left_ptr";
|
||||||
break;
|
break;
|
||||||
case leftDecoration:
|
case leftDecoration:
|
||||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
if (y < _GLFW_DECORATION_WIDTH)
|
||||||
cursorName = "nw-resize";
|
cursorName = "nw-resize";
|
||||||
else
|
else
|
||||||
cursorName = "w-resize";
|
cursorName = "w-resize";
|
||||||
break;
|
break;
|
||||||
case rightDecoration:
|
case rightDecoration:
|
||||||
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
|
if (y < _GLFW_DECORATION_WIDTH)
|
||||||
cursorName = "ne-resize";
|
cursorName = "ne-resize";
|
||||||
else
|
else
|
||||||
cursorName = "e-resize";
|
cursorName = "e-resize";
|
||||||
break;
|
break;
|
||||||
case bottomDecoration:
|
case bottomDecoration:
|
||||||
if (window->wl.cursorPosX < _GLFW_DECORATION_WIDTH)
|
if (x < _GLFW_DECORATION_WIDTH)
|
||||||
cursorName = "sw-resize";
|
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";
|
cursorName = "se-resize";
|
||||||
else
|
else
|
||||||
cursorName = "s-resize";
|
cursorName = "s-resize";
|
||||||
@ -227,6 +226,7 @@ static void pointerHandleMotion(void* data,
|
|||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
if (_glfw.wl.cursorPreviousName != cursorName)
|
||||||
setCursor(window, cursorName);
|
setCursor(window, cursorName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +75,8 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR
|
|||||||
#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorWayland wl
|
#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorWayland wl
|
||||||
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorWayland wl
|
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorWayland wl
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_CONTEXT_STATE
|
#define _GLFW_PLATFORM_CONTEXT_STATE struct { int dummyContext; }
|
||||||
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE
|
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE struct { int dummyLibraryContext; }
|
||||||
|
|
||||||
struct wl_cursor_image {
|
struct wl_cursor_image {
|
||||||
uint32_t width;
|
uint32_t width;
|
||||||
@ -247,6 +247,7 @@ typedef struct _GLFWlibraryWayland
|
|||||||
struct wl_cursor_theme* cursorTheme;
|
struct wl_cursor_theme* cursorTheme;
|
||||||
struct wl_cursor_theme* cursorThemeHiDPI;
|
struct wl_cursor_theme* cursorThemeHiDPI;
|
||||||
struct wl_surface* cursorSurface;
|
struct wl_surface* cursorSurface;
|
||||||
|
const char* cursorPreviousName;
|
||||||
int cursorTimerfd;
|
int cursorTimerfd;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
|
|
||||||
@ -330,7 +331,7 @@ typedef struct _GLFWlibraryWayland
|
|||||||
typedef struct _GLFWmonitorWayland
|
typedef struct _GLFWmonitorWayland
|
||||||
{
|
{
|
||||||
struct wl_output* output;
|
struct wl_output* output;
|
||||||
int name;
|
uint32_t name;
|
||||||
int currentMode;
|
int currentMode;
|
||||||
|
|
||||||
int x;
|
int x;
|
||||||
|
107
src/wl_window.c
107
src/wl_window.c
@ -68,7 +68,7 @@ static int createTmpfileCloexec(char* tmpname)
|
|||||||
* SCM_RIGHTS methods.
|
* SCM_RIGHTS methods.
|
||||||
*
|
*
|
||||||
* posix_fallocate() is used to guarantee that disk space is available
|
* 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
|
* is set to ENOSPC. If posix_fallocate() is not supported, program may
|
||||||
* receive SIGBUS on accessing mmap()'ed file contents instead.
|
* receive SIGBUS on accessing mmap()'ed file contents instead.
|
||||||
*/
|
*/
|
||||||
@ -770,28 +770,6 @@ static void handleEvents(int timeout)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Translates a GLFW standard cursor to a theme cursor name
|
|
||||||
//
|
|
||||||
static char *translateCursorShape(int shape)
|
|
||||||
{
|
|
||||||
switch (shape)
|
|
||||||
{
|
|
||||||
case GLFW_ARROW_CURSOR:
|
|
||||||
return "left_ptr";
|
|
||||||
case GLFW_IBEAM_CURSOR:
|
|
||||||
return "xterm";
|
|
||||||
case GLFW_CROSSHAIR_CURSOR:
|
|
||||||
return "crosshair";
|
|
||||||
case GLFW_HAND_CURSOR:
|
|
||||||
return "grabbing";
|
|
||||||
case GLFW_HRESIZE_CURSOR:
|
|
||||||
return "sb_h_double_arrow";
|
|
||||||
case GLFW_VRESIZE_CURSOR:
|
|
||||||
return "sb_v_double_arrow";
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
////// GLFW platform API //////
|
////// GLFW platform API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@ -1233,26 +1211,79 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
|||||||
|
|
||||||
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
||||||
{
|
{
|
||||||
struct wl_cursor* standardCursor;
|
const char* name = NULL;
|
||||||
|
|
||||||
standardCursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme,
|
// Try the XDG names first
|
||||||
translateCursorShape(shape));
|
if (shape == GLFW_ARROW_CURSOR)
|
||||||
if (!standardCursor)
|
name = "default";
|
||||||
{
|
else if (shape == GLFW_IBEAM_CURSOR)
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
name = "text";
|
||||||
"Wayland: Standard cursor \"%s\" not found",
|
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||||
translateCursorShape(shape));
|
name = "crosshair";
|
||||||
return GLFW_FALSE;
|
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||||
}
|
name = "pointer";
|
||||||
|
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||||
|
name = "ew-resize";
|
||||||
|
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||||
|
name = "ns-resize";
|
||||||
|
else if (shape == GLFW_RESIZE_NWSE_CURSOR)
|
||||||
|
name = "nwse-resize";
|
||||||
|
else if (shape == GLFW_RESIZE_NESW_CURSOR)
|
||||||
|
name = "nesw-resize";
|
||||||
|
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||||
|
name = "all-scroll";
|
||||||
|
else if (shape == GLFW_NOT_ALLOWED_CURSOR)
|
||||||
|
name = "not-allowed";
|
||||||
|
|
||||||
cursor->wl.cursor = standardCursor;
|
cursor->wl.cursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, name);
|
||||||
cursor->wl.currentImage = 0;
|
|
||||||
|
|
||||||
if (_glfw.wl.cursorThemeHiDPI)
|
if (_glfw.wl.cursorThemeHiDPI)
|
||||||
{
|
{
|
||||||
standardCursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI,
|
cursor->wl.cursorHiDPI =
|
||||||
translateCursorShape(shape));
|
wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI, name);
|
||||||
cursor->wl.cursorHiDPI = standardCursor;
|
}
|
||||||
|
|
||||||
|
if (!cursor->wl.cursor)
|
||||||
|
{
|
||||||
|
// Fall back to the core X11 names
|
||||||
|
if (shape == GLFW_ARROW_CURSOR)
|
||||||
|
name = "left_ptr";
|
||||||
|
else if (shape == GLFW_IBEAM_CURSOR)
|
||||||
|
name = "xterm";
|
||||||
|
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||||
|
name = "crosshair";
|
||||||
|
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||||
|
name = "hand2";
|
||||||
|
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||||
|
name = "sb_h_double_arrow";
|
||||||
|
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||||
|
name = "sb_v_double_arrow";
|
||||||
|
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||||
|
name = "fleur";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_CURSOR_UNAVAILABLE,
|
||||||
|
"Wayland: Standard cursor shape unavailable");
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor->wl.cursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, name);
|
||||||
|
if (!cursor->wl.cursor)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"Wayland: Failed to create standard cursor \"%s\"",
|
||||||
|
name);
|
||||||
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfw.wl.cursorThemeHiDPI)
|
||||||
|
{
|
||||||
|
if (!cursor->wl.cursorHiDPI)
|
||||||
|
{
|
||||||
|
cursor->wl.cursorHiDPI =
|
||||||
|
wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
|
@ -615,6 +615,12 @@ static GLFWbool initExtensions(void)
|
|||||||
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorImageDestroy");
|
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorImageDestroy");
|
||||||
_glfw.x11.xcursor.ImageLoadCursor = (PFN_XcursorImageLoadCursor)
|
_glfw.x11.xcursor.ImageLoadCursor = (PFN_XcursorImageLoadCursor)
|
||||||
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorImageLoadCursor");
|
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorImageLoadCursor");
|
||||||
|
_glfw.x11.xcursor.GetTheme = (PFN_XcursorGetTheme)
|
||||||
|
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorGetTheme");
|
||||||
|
_glfw.x11.xcursor.GetDefaultSize = (PFN_XcursorGetDefaultSize)
|
||||||
|
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorGetDefaultSize");
|
||||||
|
_glfw.x11.xcursor.LibraryLoadImage = (PFN_XcursorLibraryLoadImage)
|
||||||
|
_glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorLibraryLoadImage");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__CYGWIN__)
|
#if defined(__CYGWIN__)
|
||||||
@ -793,13 +799,10 @@ static GLFWbool initExtensions(void)
|
|||||||
//
|
//
|
||||||
static void getSystemContentScale(float* xscale, float* yscale)
|
static void getSystemContentScale(float* xscale, float* yscale)
|
||||||
{
|
{
|
||||||
// NOTE: Fall back to the display-wide DPI instead of RandR monitor DPI if
|
// Start by assuming the default X11 DPI
|
||||||
// Xft.dpi retrieval below fails as we don't currently have an exact
|
// NOTE: Some desktop environments (KDE) may remove the Xft.dpi field when it
|
||||||
// policy for which monitor a window is considered to "be on"
|
// would be set to 96, so assume that is the case if we cannot find it
|
||||||
float xdpi = DisplayWidth(_glfw.x11.display, _glfw.x11.screen) *
|
float xdpi = 96.f, ydpi = 96.f;
|
||||||
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);
|
|
||||||
|
|
||||||
// NOTE: Basing the scale on Xft.dpi where available should provide the most
|
// NOTE: Basing the scale on Xft.dpi where available should provide the most
|
||||||
// consistent user experience (matches Qt, Gtk, etc), although not
|
// consistent user experience (matches Qt, Gtk, etc), although not
|
||||||
|
@ -161,6 +161,16 @@ void _glfwPollMonitorsX11(void)
|
|||||||
heightMM = oi->mm_height;
|
heightMM = oi->mm_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
_GLFWmonitor* monitor = _glfwAllocMonitor(oi->name, widthMM, heightMM);
|
||||||
monitor->x11.output = sr->outputs[i];
|
monitor->x11.output = sr->outputs[i];
|
||||||
monitor->x11.crtc = oi->crtc;
|
monitor->x11.crtc = oi->crtc;
|
||||||
|
@ -85,9 +85,15 @@ typedef int (* PFN_XRRUpdateConfiguration)(XEvent*);
|
|||||||
typedef XcursorImage* (* PFN_XcursorImageCreate)(int,int);
|
typedef XcursorImage* (* PFN_XcursorImageCreate)(int,int);
|
||||||
typedef void (* PFN_XcursorImageDestroy)(XcursorImage*);
|
typedef void (* PFN_XcursorImageDestroy)(XcursorImage*);
|
||||||
typedef Cursor (* PFN_XcursorImageLoadCursor)(Display*,const XcursorImage*);
|
typedef Cursor (* PFN_XcursorImageLoadCursor)(Display*,const XcursorImage*);
|
||||||
|
typedef char* (* PFN_XcursorGetTheme)(Display*);
|
||||||
|
typedef int (* PFN_XcursorGetDefaultSize)(Display*);
|
||||||
|
typedef XcursorImage* (* PFN_XcursorLibraryLoadImage)(const char*,const char*,int);
|
||||||
#define XcursorImageCreate _glfw.x11.xcursor.ImageCreate
|
#define XcursorImageCreate _glfw.x11.xcursor.ImageCreate
|
||||||
#define XcursorImageDestroy _glfw.x11.xcursor.ImageDestroy
|
#define XcursorImageDestroy _glfw.x11.xcursor.ImageDestroy
|
||||||
#define XcursorImageLoadCursor _glfw.x11.xcursor.ImageLoadCursor
|
#define XcursorImageLoadCursor _glfw.x11.xcursor.ImageLoadCursor
|
||||||
|
#define XcursorGetTheme _glfw.x11.xcursor.GetTheme
|
||||||
|
#define XcursorGetDefaultSize _glfw.x11.xcursor.GetDefaultSize
|
||||||
|
#define XcursorLibraryLoadImage _glfw.x11.xcursor.LibraryLoadImage
|
||||||
|
|
||||||
typedef Bool (* PFN_XineramaIsActive)(Display*);
|
typedef Bool (* PFN_XineramaIsActive)(Display*);
|
||||||
typedef Bool (* PFN_XineramaQueryExtension)(Display*,int*,int*);
|
typedef Bool (* PFN_XineramaQueryExtension)(Display*,int*,int*);
|
||||||
@ -228,7 +234,7 @@ typedef struct _GLFWlibraryX11
|
|||||||
// Clipboard string (while the selection is owned)
|
// Clipboard string (while the selection is owned)
|
||||||
char* clipboardString;
|
char* clipboardString;
|
||||||
// Key name string
|
// Key name string
|
||||||
char keyName[5];
|
char keynames[GLFW_KEY_LAST + 1][5];
|
||||||
// X11 keycode to GLFW key LUT
|
// X11 keycode to GLFW key LUT
|
||||||
short int keycodes[256];
|
short int keycodes[256];
|
||||||
// GLFW key to X11 keycode LUT
|
// GLFW key to X11 keycode LUT
|
||||||
@ -352,6 +358,9 @@ typedef struct _GLFWlibraryX11
|
|||||||
PFN_XcursorImageCreate ImageCreate;
|
PFN_XcursorImageCreate ImageCreate;
|
||||||
PFN_XcursorImageDestroy ImageDestroy;
|
PFN_XcursorImageDestroy ImageDestroy;
|
||||||
PFN_XcursorImageLoadCursor ImageLoadCursor;
|
PFN_XcursorImageLoadCursor ImageLoadCursor;
|
||||||
|
PFN_XcursorGetTheme GetTheme;
|
||||||
|
PFN_XcursorGetDefaultSize GetDefaultSize;
|
||||||
|
PFN_XcursorLibraryLoadImage LibraryLoadImage;
|
||||||
} xcursor;
|
} xcursor;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
@ -50,6 +50,10 @@
|
|||||||
#define Button6 6
|
#define Button6 6
|
||||||
#define Button7 7
|
#define Button7 7
|
||||||
|
|
||||||
|
// Motif WM hints flags
|
||||||
|
#define MWM_HINTS_DECORATIONS 2
|
||||||
|
#define MWM_DECOR_ALL 1
|
||||||
|
|
||||||
#define _GLFW_XDND_VERSION 5
|
#define _GLFW_XDND_VERSION 5
|
||||||
|
|
||||||
|
|
||||||
@ -2535,14 +2539,6 @@ void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
|
void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
|
||||||
{
|
|
||||||
if (enabled)
|
|
||||||
{
|
|
||||||
XDeleteProperty(_glfw.x11.display,
|
|
||||||
window->x11.handle,
|
|
||||||
_glfw.x11.MOTIF_WM_HINTS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -2551,10 +2547,10 @@ void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
|
|||||||
unsigned long decorations;
|
unsigned long decorations;
|
||||||
long input_mode;
|
long input_mode;
|
||||||
unsigned long status;
|
unsigned long status;
|
||||||
} hints;
|
} hints = {0};
|
||||||
|
|
||||||
hints.flags = 2; // Set decorations
|
hints.flags = MWM_HINTS_DECORATIONS;
|
||||||
hints.decorations = 0; // No decorations
|
hints.decorations = enabled ? MWM_DECOR_ALL : 0;
|
||||||
|
|
||||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||||
_glfw.x11.MOTIF_WM_HINTS,
|
_glfw.x11.MOTIF_WM_HINTS,
|
||||||
@ -2563,7 +2559,6 @@ void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
|
|||||||
(unsigned char*) &hints,
|
(unsigned char*) &hints,
|
||||||
sizeof(hints) / sizeof(long));
|
sizeof(hints) / sizeof(long));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
|
void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
|
||||||
{
|
{
|
||||||
@ -2792,6 +2787,7 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||||||
if (!_glfw.x11.xkb.available)
|
if (!_glfw.x11.xkb.available)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
const int key = _glfw.x11.keycodes[scancode];
|
||||||
const KeySym keysym = XkbKeycodeToKeysym(_glfw.x11.display,
|
const KeySym keysym = XkbKeycodeToKeysym(_glfw.x11.display,
|
||||||
scancode, _glfw.x11.xkb.group, 0);
|
scancode, _glfw.x11.xkb.group, 0);
|
||||||
if (keysym == NoSymbol)
|
if (keysym == NoSymbol)
|
||||||
@ -2801,12 +2797,12 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
|||||||
if (ch == -1)
|
if (ch == -1)
|
||||||
return NULL;
|
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)
|
if (count == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
_glfw.x11.keyName[count] = '\0';
|
_glfw.x11.keynames[key][count] = '\0';
|
||||||
return _glfw.x11.keyName;
|
return _glfw.x11.keynames[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
int _glfwPlatformGetKeyScancode(int key)
|
int _glfwPlatformGetKeyScancode(int key)
|
||||||
@ -2827,7 +2823,47 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
|||||||
|
|
||||||
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
||||||
{
|
{
|
||||||
int native = 0;
|
if (_glfw.x11.xcursor.handle)
|
||||||
|
{
|
||||||
|
char* theme = XcursorGetTheme(_glfw.x11.display);
|
||||||
|
if (theme)
|
||||||
|
{
|
||||||
|
const int size = XcursorGetDefaultSize(_glfw.x11.display);
|
||||||
|
const char* name = NULL;
|
||||||
|
|
||||||
|
if (shape == GLFW_ARROW_CURSOR)
|
||||||
|
name = "default";
|
||||||
|
else if (shape == GLFW_IBEAM_CURSOR)
|
||||||
|
name = "text";
|
||||||
|
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||||
|
name = "crosshair";
|
||||||
|
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||||
|
name = "pointer";
|
||||||
|
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||||
|
name = "ew-resize";
|
||||||
|
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||||
|
name = "ns-resize";
|
||||||
|
else if (shape == GLFW_RESIZE_NWSE_CURSOR)
|
||||||
|
name = "nwse-resize";
|
||||||
|
else if (shape == GLFW_RESIZE_NESW_CURSOR)
|
||||||
|
name = "nesw-resize";
|
||||||
|
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||||
|
name = "all-scroll";
|
||||||
|
else if (shape == GLFW_NOT_ALLOWED_CURSOR)
|
||||||
|
name = "not-allowed";
|
||||||
|
|
||||||
|
XcursorImage* image = XcursorLibraryLoadImage(name, theme, size);
|
||||||
|
if (image)
|
||||||
|
{
|
||||||
|
cursor->x11.handle = XcursorImageLoadCursor(_glfw.x11.display, image);
|
||||||
|
XcursorImageDestroy(image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cursor->x11.handle)
|
||||||
|
{
|
||||||
|
unsigned int native = 0;
|
||||||
|
|
||||||
if (shape == GLFW_ARROW_CURSOR)
|
if (shape == GLFW_ARROW_CURSOR)
|
||||||
native = XC_left_ptr;
|
native = XC_left_ptr;
|
||||||
@ -2835,14 +2871,20 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
|||||||
native = XC_xterm;
|
native = XC_xterm;
|
||||||
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||||
native = XC_crosshair;
|
native = XC_crosshair;
|
||||||
else if (shape == GLFW_HAND_CURSOR)
|
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||||
native = XC_hand2;
|
native = XC_hand2;
|
||||||
else if (shape == GLFW_HRESIZE_CURSOR)
|
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||||
native = XC_sb_h_double_arrow;
|
native = XC_sb_h_double_arrow;
|
||||||
else if (shape == GLFW_VRESIZE_CURSOR)
|
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||||
native = XC_sb_v_double_arrow;
|
native = XC_sb_v_double_arrow;
|
||||||
|
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||||
|
native = XC_fleur;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_CURSOR_UNAVAILABLE,
|
||||||
|
"X11: Standard cursor shape unavailable");
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
cursor->x11.handle = XCreateFontCursor(_glfw.x11.display, native);
|
cursor->x11.handle = XCreateFontCursor(_glfw.x11.display, native);
|
||||||
if (!cursor->x11.handle)
|
if (!cursor->x11.handle)
|
||||||
@ -2851,6 +2893,7 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
|||||||
"X11: Failed to create standard cursor");
|
"X11: Failed to create standard cursor");
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,17 @@ set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
|
|||||||
set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
|
set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
|
||||||
"${GLFW_SOURCE_DIR}/deps/tinycthread.c")
|
"${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(clipboard clipboard.c ${GETOPT} ${GLAD_GL})
|
||||||
add_executable(events events.c ${GETOPT} ${GLAD_GL})
|
add_executable(events events.c ${GETOPT} ${GLAD_GL})
|
||||||
add_executable(msaa msaa.c ${GETOPT} ${GLAD_GL})
|
add_executable(msaa msaa.c ${GETOPT} ${GLAD_GL})
|
||||||
|
@ -69,7 +69,7 @@ static int swap_interval = 1;
|
|||||||
static int wait_events = GLFW_TRUE;
|
static int wait_events = GLFW_TRUE;
|
||||||
static int animate_cursor = GLFW_FALSE;
|
static int animate_cursor = GLFW_FALSE;
|
||||||
static int track_cursor = GLFW_FALSE;
|
static int track_cursor = GLFW_FALSE;
|
||||||
static GLFWcursor* standard_cursors[6];
|
static GLFWcursor* standard_cursors[10];
|
||||||
static GLFWcursor* tracking_cursor = NULL;
|
static GLFWcursor* tracking_cursor = NULL;
|
||||||
|
|
||||||
static void error_callback(int error, const char* description)
|
static void error_callback(int error, const char* description)
|
||||||
@ -271,28 +271,24 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GLFW_KEY_1:
|
case GLFW_KEY_1:
|
||||||
glfwSetCursor(window, standard_cursors[0]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GLFW_KEY_2:
|
case GLFW_KEY_2:
|
||||||
glfwSetCursor(window, standard_cursors[1]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GLFW_KEY_3:
|
case GLFW_KEY_3:
|
||||||
glfwSetCursor(window, standard_cursors[2]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GLFW_KEY_4:
|
case GLFW_KEY_4:
|
||||||
glfwSetCursor(window, standard_cursors[3]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GLFW_KEY_5:
|
case GLFW_KEY_5:
|
||||||
glfwSetCursor(window, standard_cursors[4]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GLFW_KEY_6:
|
case GLFW_KEY_6:
|
||||||
glfwSetCursor(window, standard_cursors[5]);
|
case GLFW_KEY_7:
|
||||||
|
case GLFW_KEY_8:
|
||||||
|
case GLFW_KEY_9:
|
||||||
|
{
|
||||||
|
int index = key - GLFW_KEY_1;
|
||||||
|
if (mods & GLFW_MOD_SHIFT)
|
||||||
|
index += 9;
|
||||||
|
|
||||||
|
if (index < sizeof(standard_cursors) / sizeof(standard_cursors[0]))
|
||||||
|
glfwSetCursor(window, standard_cursors[index]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case GLFW_KEY_F11:
|
case GLFW_KEY_F11:
|
||||||
case GLFW_KEY_ENTER:
|
case GLFW_KEY_ENTER:
|
||||||
@ -358,17 +354,16 @@ int main(void)
|
|||||||
GLFW_ARROW_CURSOR,
|
GLFW_ARROW_CURSOR,
|
||||||
GLFW_IBEAM_CURSOR,
|
GLFW_IBEAM_CURSOR,
|
||||||
GLFW_CROSSHAIR_CURSOR,
|
GLFW_CROSSHAIR_CURSOR,
|
||||||
GLFW_HAND_CURSOR,
|
GLFW_POINTING_HAND_CURSOR,
|
||||||
GLFW_HRESIZE_CURSOR,
|
GLFW_RESIZE_EW_CURSOR,
|
||||||
GLFW_VRESIZE_CURSOR
|
GLFW_RESIZE_NS_CURSOR,
|
||||||
|
GLFW_RESIZE_NWSE_CURSOR,
|
||||||
|
GLFW_RESIZE_NESW_CURSOR,
|
||||||
|
GLFW_RESIZE_ALL_CURSOR,
|
||||||
|
GLFW_NOT_ALLOWED_CURSOR
|
||||||
};
|
};
|
||||||
|
|
||||||
standard_cursors[i] = glfwCreateStandardCursor(shapes[i]);
|
standard_cursors[i] = glfwCreateStandardCursor(shapes[i]);
|
||||||
if (!standard_cursors[i])
|
|
||||||
{
|
|
||||||
glfwTerminate();
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
|
||||||
|
@ -175,7 +175,7 @@ static const char* get_key_name(int key)
|
|||||||
case GLFW_KEY_KP_8: return "KEYPAD 8";
|
case GLFW_KEY_KP_8: return "KEYPAD 8";
|
||||||
case GLFW_KEY_KP_9: return "KEYPAD 9";
|
case GLFW_KEY_KP_9: return "KEYPAD 9";
|
||||||
case GLFW_KEY_KP_DIVIDE: return "KEYPAD DIVIDE";
|
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_SUBTRACT: return "KEYPAD SUBTRACT";
|
||||||
case GLFW_KEY_KP_ADD: return "KEYPAD ADD";
|
case GLFW_KEY_KP_ADD: return "KEYPAD ADD";
|
||||||
case GLFW_KEY_KP_DECIMAL: return "KEYPAD DECIMAL";
|
case GLFW_KEY_KP_DECIMAL: return "KEYPAD DECIMAL";
|
||||||
@ -253,17 +253,32 @@ static const char* get_mods_name(int mods)
|
|||||||
return name;
|
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
|
size_t count = 0;
|
||||||
static char result[6 + 1];
|
|
||||||
|
|
||||||
int length = wctomb(result, codepoint);
|
if (ch < 0x80)
|
||||||
if (length == -1)
|
s[count++] = (char) ch;
|
||||||
length = 0;
|
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 count;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void error_callback(int error, const char* description)
|
static void error_callback(int error, const char* description)
|
||||||
@ -305,6 +320,12 @@ static void window_close_callback(GLFWwindow* window)
|
|||||||
printf("%08x to %i at %0.3f: Window close\n",
|
printf("%08x to %i at %0.3f: Window close\n",
|
||||||
counter++, slot->number, glfwGetTime());
|
counter++, slot->number, glfwGetTime());
|
||||||
|
|
||||||
|
if (!slot->closeable)
|
||||||
|
{
|
||||||
|
printf("(( closing is disabled, press %s to re-enable )\n",
|
||||||
|
glfwGetKeyName(GLFW_KEY_C, 0));
|
||||||
|
}
|
||||||
|
|
||||||
glfwSetWindowShouldClose(window, slot->closeable);
|
glfwSetWindowShouldClose(window, slot->closeable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,9 +446,11 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
|
|||||||
static void char_callback(GLFWwindow* window, unsigned int codepoint)
|
static void char_callback(GLFWwindow* window, unsigned int codepoint)
|
||||||
{
|
{
|
||||||
Slot* slot = glfwGetWindowUserPointer(window);
|
Slot* slot = glfwGetWindowUserPointer(window);
|
||||||
|
char string[5] = "";
|
||||||
|
|
||||||
|
encode_utf8(string, codepoint);
|
||||||
printf("%08x to %i at %0.3f: Character 0x%08x (%s) input\n",
|
printf("%08x to %i at %0.3f: Character 0x%08x (%s) input\n",
|
||||||
counter++, slot->number, glfwGetTime(), codepoint,
|
counter++, slot->number, glfwGetTime(), codepoint, string);
|
||||||
get_character_string(codepoint));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drop_callback(GLFWwindow* window, int count, const char* paths[])
|
static void drop_callback(GLFWwindow* window, int count, const char* paths[])
|
||||||
@ -486,6 +509,20 @@ static void joystick_callback(int jid, int event)
|
|||||||
axisCount,
|
axisCount,
|
||||||
buttonCount,
|
buttonCount,
|
||||||
hatCount);
|
hatCount);
|
||||||
|
|
||||||
|
if (glfwJoystickIsGamepad(jid))
|
||||||
|
{
|
||||||
|
printf(" Joystick %i (%s) has a gamepad mapping (%s)\n",
|
||||||
|
jid,
|
||||||
|
glfwGetJoystickGUID(jid),
|
||||||
|
glfwGetGamepadName(jid));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf(" Joystick %i (%s) has no gamepad mapping\n",
|
||||||
|
jid,
|
||||||
|
glfwGetJoystickGUID(jid));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -500,8 +537,6 @@ int main(int argc, char** argv)
|
|||||||
GLFWmonitor* monitor = NULL;
|
GLFWmonitor* monitor = NULL;
|
||||||
int ch, i, width, height, count = 1;
|
int ch, i, width, height, count = 1;
|
||||||
|
|
||||||
setlocale(LC_ALL, "");
|
|
||||||
|
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
|
|
||||||
if (!glfwInit())
|
if (!glfwInit())
|
||||||
|
@ -101,6 +101,7 @@ int main(int argc, char** argv)
|
|||||||
monitor = glfwGetPrimaryMonitor();
|
monitor = glfwGetPrimaryMonitor();
|
||||||
|
|
||||||
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
||||||
|
glfwWindowHint(GLFW_WIN32_KEYBOARD_MENU, GLFW_TRUE);
|
||||||
|
|
||||||
window = glfwCreateWindow(800, 400, "Gamma Test", NULL, NULL);
|
window = glfwCreateWindow(800, 400, "Gamma Test", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
|
@ -202,6 +202,7 @@ int main(int argc, char** argv)
|
|||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||||
|
|
||||||
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
||||||
|
glfwWindowHint(GLFW_WIN32_KEYBOARD_MENU, GLFW_TRUE);
|
||||||
|
|
||||||
window = glfwCreateWindow(width, height, "Input lag test", monitor, NULL);
|
window = glfwCreateWindow(width, height, "Input lag test", monitor, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
|
@ -182,6 +182,7 @@ int main(void)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
||||||
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
||||||
|
glfwWindowHint(GLFW_WIN32_KEYBOARD_MENU, GLFW_TRUE);
|
||||||
|
|
||||||
window = glfwCreateWindow(800, 600, "Joystick Test", NULL, NULL);
|
window = glfwCreateWindow(800, 600, "Joystick Test", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
|
@ -109,13 +109,13 @@ static void list_modes(GLFWmonitor* monitor)
|
|||||||
glfwGetMonitorName(monitor),
|
glfwGetMonitorName(monitor),
|
||||||
glfwGetPrimaryMonitor() == monitor ? "primary" : "secondary");
|
glfwGetPrimaryMonitor() == monitor ? "primary" : "secondary");
|
||||||
printf("Current mode: %s\n", format_mode(mode));
|
printf("Current mode: %s\n", format_mode(mode));
|
||||||
printf("Virtual position: %i %i\n", x, y);
|
printf("Virtual position: %i, %i\n", x, y);
|
||||||
printf("Content scale: %f %f\n", xscale, yscale);
|
printf("Content scale: %f x %f\n", xscale, yscale);
|
||||||
|
|
||||||
printf("Physical size: %i x %i mm (%0.2f dpi)\n",
|
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);
|
width_mm, height_mm, mode->width * 25.4f / width_mm, mode->width, mode->height);
|
||||||
printf("Monitor work area: pos=(%d,%d) size=(%dx%d)\n",
|
printf("Monitor work area: %i x %i starting at %i, %i\n",
|
||||||
workarea_x, workarea_y, workarea_width, workarea_height);
|
workarea_width, workarea_height, workarea_x, workarea_y);
|
||||||
|
|
||||||
printf("Modes:\n");
|
printf("Modes:\n");
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ int main(int argc, char** argv)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
||||||
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
||||||
|
glfwWindowHint(GLFW_WIN32_KEYBOARD_MENU, GLFW_TRUE);
|
||||||
|
|
||||||
window = glfwCreateWindow(400, 400, "Opacity", NULL, NULL);
|
window = glfwCreateWindow(400, 400, "Opacity", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
|
Loading…
Reference in New Issue
Block a user