mirror of
https://github.com/glfw/glfw.git
synced 2025-12-21 14:42:06 +00:00
Compare commits
13 Commits
4e0bb7e16b
...
b0b9bbcfd5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0b9bbcfd5 | ||
|
|
8e15281d34 | ||
|
|
621e99d53e | ||
|
|
1a0b7827d4 | ||
|
|
4c64184455 | ||
|
|
bfcb98fb6c | ||
|
|
f8582d26d0 | ||
|
|
1fdd39cf3e | ||
|
|
c9b129753a | ||
|
|
04a67c8267 | ||
|
|
5c87937e44 | ||
|
|
09efa97ef5 | ||
|
|
de06756d4d |
@ -24,10 +24,11 @@ if (DEFINED GLFW_USE_WAYLAND AND UNIX AND NOT APPLE)
|
||||
"GLFW_USE_WAYLAND has been removed; delete the CMake cache and set GLFW_BUILD_WAYLAND and GLFW_BUILD_X11 instead")
|
||||
endif()
|
||||
|
||||
cmake_dependent_option(GLFW_BUILD_WIN32 "Build support for Win32" ON "WIN32" OFF)
|
||||
cmake_dependent_option(GLFW_BUILD_COCOA "Build support for Cocoa" ON "APPLE" OFF)
|
||||
cmake_dependent_option(GLFW_BUILD_X11 "Build support for X11" ON "UNIX;NOT APPLE" OFF)
|
||||
cmake_dependent_option(GLFW_BUILD_WAYLAND "Build support for Wayland" ON "UNIX;NOT APPLE" OFF)
|
||||
cmake_dependent_option(GLFW_BUILD_WIN32 "Build support for Win32" ON "WIN32;NOT ANDROID" OFF)
|
||||
cmake_dependent_option(GLFW_BUILD_COCOA "Build support for Cocoa" ON "APPLE;NOT ANDROID" OFF)
|
||||
cmake_dependent_option(GLFW_BUILD_X11 "Build support for X11" ON "UNIX;NOT APPLE;NOT ANDROID" OFF)
|
||||
cmake_dependent_option(GLFW_BUILD_WAYLAND "Build support for Wayland" ON "UNIX;NOT APPLE;NOT ANDROID" OFF)
|
||||
cmake_dependent_option(GLFW_BUILD_ANDROID "Build support for Android" ON "ANDROID" OFF)
|
||||
|
||||
cmake_dependent_option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF
|
||||
"WIN32" OFF)
|
||||
@ -66,6 +67,9 @@ endif()
|
||||
if (GLFW_BUILD_X11)
|
||||
message(STATUS "Including X11 support")
|
||||
endif()
|
||||
if (GLFW_BUILD_ANDROID)
|
||||
message(STATUS "Including Android support")
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Apply Microsoft C runtime library option
|
||||
|
||||
@ -23,6 +23,7 @@ video tutorials.
|
||||
- Denis Bernard
|
||||
- BiBi
|
||||
- Doug Binks
|
||||
- bitb4ker
|
||||
- blanco
|
||||
- Waris Boonyasiriwat
|
||||
- Kyle Brenneman
|
||||
@ -123,6 +124,7 @@ video tutorials.
|
||||
- Josh Kilmer
|
||||
- Byunghoon Kim
|
||||
- Cameron King
|
||||
- knokko
|
||||
- Peter Knut
|
||||
- Christoph Kubisch
|
||||
- Yuri Kunde Schlesner
|
||||
|
||||
131
README.md
131
README.md
@ -9,34 +9,28 @@ GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan
|
||||
application development. It provides a simple, platform-independent API for
|
||||
creating windows, contexts and surfaces, reading input, handling events, etc.
|
||||
|
||||
GLFW natively supports Windows, macOS and Linux and other Unix-like systems. On
|
||||
Linux both Wayland and X11 are supported.
|
||||
GLFW is written primarily in C99, with parts of macOS support being written in
|
||||
Objective-C.
|
||||
|
||||
GLFW supports Windows, macOS and Linux, and also works on many other Unix-like
|
||||
systems. On Linux both Wayland and X11 are supported.
|
||||
|
||||
GLFW is licensed under the [zlib/libpng
|
||||
license](https://www.glfw.org/license.html).
|
||||
|
||||
You can [download](https://www.glfw.org/download.html) the latest stable release
|
||||
as source or Windows binaries. Each release starting with 3.0 also has
|
||||
a corresponding [annotated tag](https://github.com/glfw/glfw/releases) with
|
||||
source and binary archives.
|
||||
as source or Windows and macOS binaries. There are [release
|
||||
tags](https://github.com/glfw/glfw/releases) with source and binary archives
|
||||
attached for every version since 3.0.
|
||||
|
||||
The [documentation](https://www.glfw.org/docs/latest/) is available online and is
|
||||
included in all source and binary archives. See the [release
|
||||
notes](https://www.glfw.org/docs/latest/news.html) for new features, caveats and
|
||||
deprecations in the latest release. For more details see the [version
|
||||
history](https://www.glfw.org/changelog.html).
|
||||
|
||||
The `master` branch is the stable integration branch and _should_ always compile
|
||||
and run on all supported platforms, although details of newly added features may
|
||||
change until they have been included in a release. New features and many bug
|
||||
fixes live in [other branches](https://github.com/glfw/glfw/branches/all) until
|
||||
they are stable enough to merge.
|
||||
|
||||
If you are new to GLFW, you may find the
|
||||
[tutorial](https://www.glfw.org/docs/latest/quick.html) for GLFW 3 useful. If
|
||||
you have used GLFW 2 in the past, there is a [transition
|
||||
guide](https://www.glfw.org/docs/latest/moving.html) for moving to the GLFW
|
||||
3 API.
|
||||
also included in source and binary archives, except those generated
|
||||
automatically by Github. The documentation contains guides, a tutorial and the
|
||||
API reference. The [release
|
||||
notes](https://www.glfw.org/docs/latest/news.html) list the new features,
|
||||
caveats and deprecations in the latest release. The [version
|
||||
history](https://www.glfw.org/changelog.html) lists every user-visible change
|
||||
for every release.
|
||||
|
||||
GLFW exists because of the contributions of [many people](CONTRIBUTORS.md)
|
||||
around the world, whether by reporting bugs, providing community support, adding
|
||||
@ -44,57 +38,37 @@ features, reviewing or testing code, debugging, proofreading docs, suggesting
|
||||
features or fixing bugs.
|
||||
|
||||
|
||||
## Compiling GLFW
|
||||
|
||||
GLFW is written primarily in C99, with parts of macOS support being written in
|
||||
Objective-C. GLFW itself requires only the headers and libraries for your OS
|
||||
and window system. It does not need any additional headers for context creation
|
||||
APIs (WGL, GLX, EGL, NSGL, OSMesa) or rendering APIs (OpenGL, OpenGL ES, Vulkan)
|
||||
to enable support for them.
|
||||
|
||||
GLFW supports compilation on Windows with Visual C++ (2013 and later) and
|
||||
MinGW-w64, on macOS with Clang and on Linux and other Unix-like systems with GCC
|
||||
and Clang. It will likely compile in other environments as well, but this is
|
||||
not regularly tested.
|
||||
|
||||
There are [pre-compiled binaries](https://www.glfw.org/download.html) available
|
||||
for all supported compilers on Windows and macOS.
|
||||
|
||||
See the [compilation guide](https://www.glfw.org/docs/latest/compile.html) for
|
||||
more information about how to compile GLFW yourself.
|
||||
|
||||
|
||||
## Using GLFW
|
||||
|
||||
See the [documentation](https://www.glfw.org/docs/latest/) for tutorials, guides
|
||||
and the API reference.
|
||||
|
||||
|
||||
## Contributing to GLFW
|
||||
|
||||
See the [contribution
|
||||
guide](https://github.com/glfw/glfw/blob/master/docs/CONTRIBUTING.md) for
|
||||
more information.
|
||||
|
||||
|
||||
## System requirements
|
||||
|
||||
GLFW supports Windows 7 and later and macOS 10.11 and later. Linux and other
|
||||
Unix-like systems running the X Window System are supported even without
|
||||
a desktop environment or modern extensions, although some features require
|
||||
a running window or clipboard manager. The OSMesa backend requires Mesa 6.3.
|
||||
GLFW supports Windows 7 and later and macOS 10.11 and later. On GNOME Wayland,
|
||||
window decorations will be very basic unless the
|
||||
[libdecor](https://gitlab.freedesktop.org/libdecor/libdecor) package is
|
||||
installed. Linux and other Unix-like systems running X11 are supported even
|
||||
without a desktop environment or modern extensions, although some features
|
||||
require a clipboard manager or a modern window manager.
|
||||
|
||||
See the [compatibility guide](https://www.glfw.org/docs/latest/compat.html)
|
||||
in the documentation for more information.
|
||||
for more detailed information.
|
||||
|
||||
|
||||
## Dependencies
|
||||
## Compiling GLFW
|
||||
|
||||
GLFW itself needs only CMake 3.16 or later and the headers and libraries for your
|
||||
OS and window system.
|
||||
GLFW supports compilation with Visual C++ (2013 and later), GCC and Clang. Both
|
||||
Clang-CL and MinGW-w64 are supported. Other C99 compilers will likely also
|
||||
work, but this is not regularly tested.
|
||||
|
||||
There are [pre-compiled binaries](https://www.glfw.org/download.html)
|
||||
available for Windows and macOS.
|
||||
|
||||
GLFW itself needs only CMake and the headers and libraries for your operating
|
||||
system and window system. No other SDKs are required.
|
||||
|
||||
See the [compilation guide](https://www.glfw.org/docs/latest/compile.html) for
|
||||
more information about compiling GLFW and the exact dependencies required for
|
||||
each window system.
|
||||
|
||||
The examples and test programs depend on a number of tiny libraries. These are
|
||||
located in the `deps/` directory.
|
||||
bundled in the `deps/` directory. The repository has no submodules.
|
||||
|
||||
- [getopt\_port](https://github.com/kimgr/getopt_port/) for examples
|
||||
with command-line options
|
||||
@ -107,8 +81,33 @@ located in the `deps/` directory.
|
||||
- [Nuklear](https://github.com/Immediate-Mode-UI/Nuklear) for test and example UI
|
||||
- [stb\_image\_write](https://github.com/nothings/stb) for writing images to disk
|
||||
|
||||
The documentation is generated with [Doxygen](https://doxygen.org/) if CMake can
|
||||
find that tool.
|
||||
The documentation is generated with [Doxygen](https://doxygen.org/) when the
|
||||
library is built, provided CMake could find a sufficiently new version of it
|
||||
during configuration.
|
||||
|
||||
|
||||
## Using GLFW
|
||||
|
||||
See the [HTML documentation](https://www.glfw.org/docs/latest/) for a tutorial,
|
||||
guides and the API reference.
|
||||
|
||||
|
||||
## Contributing to GLFW
|
||||
|
||||
See the [contribution
|
||||
guide](https://github.com/glfw/glfw/blob/master/docs/CONTRIBUTING.md) for
|
||||
more information.
|
||||
|
||||
The `master` branch is the stable integration branch and _should_ always compile
|
||||
and run on all supported platforms. Details of a newly added feature,
|
||||
including the public API, may change until it has been included in a release.
|
||||
|
||||
The `latest` branch is equivalent to the [highest numbered](https://semver.org/)
|
||||
release, although it may not always point to the same commit as the tag for that
|
||||
release.
|
||||
|
||||
The `ci` branch is used to trigger continuous integration jobs for code under
|
||||
testing and should never be relied on for any purpose.
|
||||
|
||||
|
||||
## Reporting bugs
|
||||
@ -123,6 +122,8 @@ information on what to include when reporting a bug.
|
||||
|
||||
- Added `GLFW_UNLIMITED_MOUSE_BUTTONS` input mode that allows mouse buttons beyond
|
||||
the limit of the mouse button tokens to be reported (#2423)
|
||||
- Added `glfwGetEGLConfig` function to query the `EGLConfig` of a window (#2045)
|
||||
- Added `glfwGetGLXFBConfig` function to query the `GLXFBConfig` of a window (#1925)
|
||||
- Updated minimum CMake version to 3.16 (#2541)
|
||||
- Removed support for building with original MinGW (#2540)
|
||||
- [Win32] Removed support for Windows XP and Vista (#2505)
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
|
||||
# Because of bugs and limitations in its Markdown support, only fairly recent
|
||||
# versions of Doxygen can produce acceptable output
|
||||
set(MINIMUM_DOXYGEN_VERSION 1.9.8)
|
||||
|
||||
# NOTE: The order of this list determines the order of items in the Guides
|
||||
# (i.e. Pages) list in the generated documentation
|
||||
set(source_files
|
||||
@ -32,10 +36,10 @@ foreach(file IN LISTS source_files)
|
||||
endforeach()
|
||||
|
||||
set(DOXYGEN_SKIP_DOT TRUE)
|
||||
find_package(Doxygen)
|
||||
find_package(Doxygen ${MINIMUM_DOXYGEN_VERSION} QUIET)
|
||||
|
||||
if (NOT DOXYGEN_FOUND OR DOXYGEN_VERSION VERSION_LESS "1.9.8")
|
||||
message(STATUS "Documentation generation requires Doxygen 1.9.8 or later")
|
||||
if (NOT DOXYGEN_FOUND)
|
||||
message(STATUS "Documentation generation requires Doxygen ${MINIMUM_DOXYGEN_VERSION} or later")
|
||||
else()
|
||||
configure_file(Doxyfile.in Doxyfile @ONLY)
|
||||
add_custom_command(OUTPUT "html/index.html"
|
||||
@ -46,7 +50,7 @@ else()
|
||||
COMMENT "Generating HTML documentation"
|
||||
VERBATIM)
|
||||
|
||||
add_custom_target(docs ALL SOURCES "html/index.html")
|
||||
add_custom_target(docs ALL SOURCES ${source_files} DEPENDS "html/index.html")
|
||||
set_target_properties(docs PROPERTIES FOLDER "GLFW3")
|
||||
|
||||
if (GLFW_INSTALL)
|
||||
|
||||
@ -278,13 +278,7 @@ ALIASES = "thread_safety=@par Thread safety^^" \
|
||||
"analysis=@par Analysis^^" \
|
||||
"reentrancy=@par Reentrancy^^" \
|
||||
"errors=@par Errors^^" \
|
||||
"callback_signature=@par Callback signature^^" \
|
||||
"glfw3=__GLFW 3:__" \
|
||||
"x11=__X11:__" \
|
||||
"wayland=__Wayland:__" \
|
||||
"win32=__Windows:__" \
|
||||
"macos=__macOS:__" \
|
||||
"linux=__Linux:__"
|
||||
"callback_signature=@par Callback signature^^"
|
||||
|
||||
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
|
||||
# only. Doxygen will then generate output that is more tailored for C. For
|
||||
|
||||
@ -50,10 +50,11 @@ compositing window manager to un-redirect full screen GLFW windows. If the
|
||||
running window manager uses compositing but does not support this property then
|
||||
additional copying may be performed for each buffer swap of full screen windows.
|
||||
|
||||
GLFW uses the [clipboard manager protocol][ClipboardManager] to push a clipboard
|
||||
string (i.e. selection) owned by a GLFW window about to be destroyed to the
|
||||
clipboard manager. If there is no running clipboard manager, the clipboard
|
||||
string will be unavailable once the window has been destroyed.
|
||||
GLFW uses the [clipboard manager protocol][ClipboardManager] to keep the
|
||||
clipboard string availble for the user after the libary has been terminated. If
|
||||
there is no running clipboard manager and the clipboard contents has been set
|
||||
with @ref glfwSetClipboardString, the clipboard will be emptied when the library
|
||||
is terminated.
|
||||
|
||||
[clipboardManager]: https://www.freedesktop.org/wiki/ClipboardManager/
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ before the application exits. Modern systems are very good at freeing resources
|
||||
allocated by programs that exit, but GLFW sometimes has to change global system
|
||||
settings and these might not be restored without termination.
|
||||
|
||||
@macos When the library is initialized the main menu and dock icon are created.
|
||||
__macOS:__ When the library is initialized the main menu and dock icon are created.
|
||||
These are not desirable for a command-line only program. The creation of the
|
||||
main menu and dock icon can be disabled with the @ref GLFW_COCOA_MENUBAR init
|
||||
hint.
|
||||
|
||||
@ -255,7 +255,7 @@ hardware gamma correction, which today is typically an approximation of sRGB
|
||||
gamma. This means that setting a perfectly linear ramp, or gamma 1.0, will
|
||||
produce the default (usually sRGB-like) behavior.
|
||||
|
||||
@note @wayland An application cannot read or modify the monitor gamma ramp. The
|
||||
@ref glfwGetGammaRamp, @ref glfwSetGammaRamp and @ref glfwSetGamma functions
|
||||
@note __Wayland:__ An application cannot read or modify the monitor gamma ramp.
|
||||
The @ref glfwGetGammaRamp, @ref glfwSetGammaRamp and @ref glfwSetGamma functions
|
||||
emit @ref GLFW_FEATURE_UNAVAILABLE.
|
||||
|
||||
|
||||
17
docs/news.md
17
docs/news.md
@ -14,6 +14,19 @@ values over 8. For compatibility with older versions, the
|
||||
@ref GLFW_UNLIMITED_MOUSE_BUTTONS input mode needs to be set to make use of
|
||||
this.
|
||||
|
||||
|
||||
### EGLConfig native access function {#eglconfig}
|
||||
|
||||
GLFW now provides the @ref glfwGetEGLConfig native access function for querying
|
||||
the `EGLConfig` of a window that has a `EGLSurface`.
|
||||
|
||||
|
||||
### GLXFBConfig native access function {#glxfbconfig}
|
||||
|
||||
GLFW now provides the @ref glfwGetGLXFBConfig native access function for
|
||||
querying the `GLXFBConfig` of a window that has a `GLXWindow`.
|
||||
|
||||
|
||||
## Caveats {#caveats}
|
||||
|
||||
## Deprecations {#deprecations}
|
||||
@ -39,6 +52,10 @@ actively maintained and available on many platforms.
|
||||
|
||||
### New functions {#new_functions}
|
||||
|
||||
- @ref glfwGetEGLConfig
|
||||
- @ref glfwGetGLXFBConfig
|
||||
|
||||
|
||||
### New types {#new_types}
|
||||
|
||||
### New constants {#new_constants}
|
||||
|
||||
@ -35,7 +35,7 @@ By default, GLFW will load the Vulkan loader dynamically at runtime via its stan
|
||||
`vulkan-1.dll` on Windows, `libvulkan.so.1` on Linux and other Unix-like systems and
|
||||
`libvulkan.1.dylib` on macOS.
|
||||
|
||||
@macos GLFW will also look up and search the `Frameworks` subdirectory of your
|
||||
__macOS:__ GLFW will also look up and search the `Frameworks` subdirectory of your
|
||||
application bundle.
|
||||
|
||||
If your code is using a Vulkan loader with a different name or in a non-standard location
|
||||
@ -47,7 +47,7 @@ entry point retrieval. This prevents GLFW from dynamically loading the Vulkan l
|
||||
glfwInitVulkanLoader(vkGetInstanceProcAddr);
|
||||
```
|
||||
|
||||
@macos To make your application be redistributable you will need to set up the application
|
||||
__macOS:__ To make your application be redistributable you will need to set up the application
|
||||
bundle according to the LunarG SDK documentation. This is explained in more detail in the
|
||||
[SDK documentation for macOS](https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html).
|
||||
|
||||
@ -186,7 +186,7 @@ check whether any extensions you wish to enable are already in the returned
|
||||
array, as it is an error to specify an extension more than once in the
|
||||
`VkInstanceCreateInfo` struct.
|
||||
|
||||
@macos MoltenVK is (as of July 2022) not yet a fully conformant implementation
|
||||
__macOS:__ MoltenVK is (as of July 2022) not yet a fully conformant implementation
|
||||
of Vulkan. As of Vulkan SDK 1.3.216.0, this means you must also enable the
|
||||
`VK_KHR_portability_enumeration` instance extension and set the
|
||||
`VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR` bit in the instance creation
|
||||
|
||||
@ -363,10 +363,10 @@ which API was used to create the current context may fail if you change this
|
||||
hint. This can be resolved by having it load functions via @ref
|
||||
glfwGetProcAddress.
|
||||
|
||||
@note @wayland The EGL API _is_ the native context creation API, so this hint
|
||||
@note __Wayland:__ The EGL API _is_ the native context creation API, so this hint
|
||||
will have no effect.
|
||||
|
||||
@note @x11 On some Linux systems, creating contexts via both the native and EGL
|
||||
@note __X11:__ On some Linux systems, creating contexts via both the native and EGL
|
||||
APIs in a single process will cause the application to segfault. Stick to one
|
||||
API or the other on Linux for now.
|
||||
|
||||
@ -400,7 +400,7 @@ requested. 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, but OpenGL ES 2.0 is not backward compatible with 1.x.
|
||||
|
||||
@note @macos The OS only supports core profile contexts for OpenGL versions 3.2
|
||||
@note __macOS:__ The OS only supports core profile contexts for OpenGL versions 3.2
|
||||
and later. Before creating an OpenGL context of version 3.2 or later you must
|
||||
set the [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hint accordingly.
|
||||
OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.
|
||||
@ -893,7 +893,7 @@ int xpos, ypos;
|
||||
glfwGetWindowPos(window, &xpos, &ypos);
|
||||
```
|
||||
|
||||
@note @wayland An applications cannot know the positions of its windows or
|
||||
@note __Wayland:__ An applications cannot know the positions of its windows or
|
||||
whether one has been moved. The @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y
|
||||
window hints are ignored. The @ref glfwGetWindowPos and @ref glfwSetWindowPos
|
||||
functions emit @ref GLFW_FEATURE_UNAVAILABLE. The window position callback will
|
||||
@ -1044,7 +1044,7 @@ You can also get the current iconification state with @ref glfwGetWindowAttrib.
|
||||
int iconified = glfwGetWindowAttrib(window, GLFW_ICONIFIED);
|
||||
```
|
||||
|
||||
@note @wayland An application cannot know if any of its windows have been
|
||||
@note __Wayland:__ An application cannot know if any of its windows have been
|
||||
iconified or restore one from iconification. The @ref glfwRestoreWindow
|
||||
function can only restore windows from maximization and the iconify callback
|
||||
will not be called. The [GLFW_ICONIFIED](@ref GLFW_ICONIFIED_attrib) attribute
|
||||
|
||||
@ -1131,7 +1131,7 @@ extern "C" {
|
||||
#define GLFW_WIN32_SHOWDEFAULT 0x00025002
|
||||
/*! @brief Wayland specific
|
||||
* [window hint](@ref GLFW_WAYLAND_APP_ID_hint).
|
||||
*
|
||||
*
|
||||
* Allows specification of the Wayland app_id.
|
||||
*/
|
||||
#define GLFW_WAYLAND_APP_ID 0x00026001
|
||||
@ -1228,13 +1228,13 @@ extern "C" {
|
||||
* 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
|
||||
* @note __macOS:__ This shape is provided by a private system API and may fail
|
||||
* with @ref GLFW_CURSOR_UNAVAILABLE in the future.
|
||||
*
|
||||
* @note @wayland This shape is provided by a newer standard not supported by
|
||||
* @note __Wayland:__ This shape is provided by a newer standard not supported by
|
||||
* all cursor themes.
|
||||
*
|
||||
* @note @x11 This shape is provided by a newer standard not supported by all
|
||||
* @note __X11:__ This shape is provided by a newer standard not supported by all
|
||||
* cursor themes.
|
||||
*/
|
||||
#define GLFW_RESIZE_NWSE_CURSOR 0x00036007
|
||||
@ -1243,13 +1243,13 @@ extern "C" {
|
||||
* 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
|
||||
* @note __macOS:__ This shape is provided by a private system API and may fail
|
||||
* with @ref GLFW_CURSOR_UNAVAILABLE in the future.
|
||||
*
|
||||
* @note @wayland This shape is provided by a newer standard not supported by
|
||||
* @note __Wayland:__ This shape is provided by a newer standard not supported by
|
||||
* all cursor themes.
|
||||
*
|
||||
* @note @x11 This shape is provided by a newer standard not supported by all
|
||||
* @note __X11:__ This shape is provided by a newer standard not supported by all
|
||||
* cursor themes.
|
||||
*/
|
||||
#define GLFW_RESIZE_NESW_CURSOR 0x00036008
|
||||
@ -1264,10 +1264,10 @@ extern "C" {
|
||||
* The operation-not-allowed shape. This is usually a circle with a diagonal
|
||||
* line through it.
|
||||
*
|
||||
* @note @wayland This shape is provided by a newer standard not supported by
|
||||
* @note __Wayland:__ This shape is provided by a newer standard not supported by
|
||||
* all cursor themes.
|
||||
*
|
||||
* @note @x11 This shape is provided by a newer standard not supported by all
|
||||
* @note __X11:__ This shape is provided by a newer standard not supported by all
|
||||
* cursor themes.
|
||||
*/
|
||||
#define GLFW_NOT_ALLOWED_CURSOR 0x0003600A
|
||||
@ -1341,7 +1341,8 @@ extern "C" {
|
||||
#define GLFW_PLATFORM_COCOA 0x00060002
|
||||
#define GLFW_PLATFORM_WAYLAND 0x00060003
|
||||
#define GLFW_PLATFORM_X11 0x00060004
|
||||
#define GLFW_PLATFORM_NULL 0x00060005
|
||||
#define GLFW_PLATFORM_ANDROID 0x00060005
|
||||
#define GLFW_PLATFORM_NULL 0x00060006
|
||||
/*! @} */
|
||||
|
||||
#define GLFW_DONT_CARE -1
|
||||
@ -1629,7 +1630,7 @@ typedef void (* GLFWwindowposfun)(GLFWwindow* window, int xpos, int ypos);
|
||||
* @sa @ref glfwSetWindowSizeCallback
|
||||
*
|
||||
* @since Added in version 1.0.
|
||||
* @glfw3 Added window handle parameter.
|
||||
* __GLFW 3:__ Added window handle parameter.
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
@ -1649,7 +1650,7 @@ typedef void (* GLFWwindowsizefun)(GLFWwindow* window, int width, int height);
|
||||
* @sa @ref glfwSetWindowCloseCallback
|
||||
*
|
||||
* @since Added in version 2.5.
|
||||
* @glfw3 Added window handle parameter.
|
||||
* __GLFW 3:__ Added window handle parameter.
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
@ -1669,7 +1670,7 @@ typedef void (* GLFWwindowclosefun)(GLFWwindow* window);
|
||||
* @sa @ref glfwSetWindowRefreshCallback
|
||||
*
|
||||
* @since Added in version 2.5.
|
||||
* @glfw3 Added window handle parameter.
|
||||
* __GLFW 3:__ Added window handle parameter.
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
@ -1800,7 +1801,7 @@ typedef void (* GLFWwindowcontentscalefun)(GLFWwindow* window, float xscale, flo
|
||||
* @sa @ref glfwSetMouseButtonCallback
|
||||
*
|
||||
* @since Added in version 1.0.
|
||||
* @glfw3 Added window handle and modifier mask parameters.
|
||||
* __GLFW 3:__ Added window handle and modifier mask parameters.
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
@ -1891,7 +1892,7 @@ typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffse
|
||||
* @sa @ref glfwSetKeyCallback
|
||||
*
|
||||
* @since Added in version 1.0.
|
||||
* @glfw3 Added window handle, scancode and modifier mask parameters.
|
||||
* __GLFW 3:__ Added window handle, scancode and modifier mask parameters.
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
@ -1912,7 +1913,7 @@ typedef void (* GLFWkeyfun)(GLFWwindow* window, int key, int scancode, int actio
|
||||
* @sa @ref glfwSetCharCallback
|
||||
*
|
||||
* @since Added in version 2.4.
|
||||
* @glfw3 Added window handle parameter.
|
||||
* __GLFW 3:__ Added window handle parameter.
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
@ -2020,7 +2021,7 @@ typedef void (* GLFWjoystickfun)(int jid, int event);
|
||||
* @sa @ref glfwGetVideoModes
|
||||
*
|
||||
* @since Added in version 1.0.
|
||||
* @glfw3 Added refresh rate member.
|
||||
* __GLFW 3:__ Added refresh rate member.
|
||||
*
|
||||
* @ingroup monitor
|
||||
*/
|
||||
@ -2083,7 +2084,7 @@ typedef struct GLFWgammaramp
|
||||
* @sa @ref window_icon
|
||||
*
|
||||
* @since Added in version 2.1.
|
||||
* @glfw3 Removed format and bytes-per-pixel members.
|
||||
* __GLFW 3:__ Removed format and bytes-per-pixel members.
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
@ -2183,12 +2184,12 @@ typedef struct GLFWallocator
|
||||
* @errors Possible errors include @ref GLFW_PLATFORM_UNAVAILABLE and @ref
|
||||
* GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark @macos This function will change the current directory of the
|
||||
* @remark __macOS:__ This function will change the current directory of the
|
||||
* application to the `Contents/Resources` subdirectory of the application's
|
||||
* bundle, if present. This can be disabled with the @ref
|
||||
* GLFW_COCOA_CHDIR_RESOURCES init hint.
|
||||
*
|
||||
* @remark @macos This function will create the main menu and dock icon for the
|
||||
* @remark __macOS:__ This function will create the main menu and dock icon for the
|
||||
* application. If GLFW finds a `MainMenu.nib` it is loaded and assumed to
|
||||
* contain a menu bar. Otherwise a minimal menu bar is created manually with
|
||||
* common commands like Hide, Quit and About. The About entry opens a minimal
|
||||
@ -2203,7 +2204,7 @@ typedef struct GLFWallocator
|
||||
* to something other than `wayland` or `x11`, the regular detection mechanism
|
||||
* will be used instead.
|
||||
*
|
||||
* @remark @x11 This function will set the `LC_CTYPE` category of the
|
||||
* @remark __X11:__ This function will set the `LC_CTYPE` category of the
|
||||
* application locale according to the current environment if that category is
|
||||
* still "C". This is because the "C" locale breaks Unicode text input.
|
||||
*
|
||||
@ -2679,7 +2680,7 @@ GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos,
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @remark @win32 On Windows 8 and earlier the physical size is calculated from
|
||||
* @remark __Win32:__ On Windows 8 and earlier the physical size is calculated from
|
||||
* the current resolution and system DPI instead of querying the monitor EDID data.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
@ -2713,7 +2714,7 @@ GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark @wayland Fractional scaling information is not yet available for
|
||||
* @remark __Wayland:__ Fractional scaling information is not yet available for
|
||||
* monitors, so this function only returns integer content scales.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
@ -2861,7 +2862,7 @@ GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback);
|
||||
* @sa @ref glfwGetVideoMode
|
||||
*
|
||||
* @since Added in version 1.0.
|
||||
* @glfw3 Changed to return an array of modes for a specific monitor.
|
||||
* __GLFW 3:__ Changed to return an array of modes for a specific monitor.
|
||||
*
|
||||
* @ingroup monitor
|
||||
*/
|
||||
@ -2915,7 +2916,7 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_INVALID_VALUE,
|
||||
* @ref GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
|
||||
*
|
||||
* @remark @wayland Monitor gamma is a privileged protocol, so this function
|
||||
* @remark __Wayland:__ Monitor gamma is a privileged protocol, so this function
|
||||
* cannot be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
@ -2939,7 +2940,7 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR
|
||||
* and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
|
||||
*
|
||||
* @remark @wayland Monitor gamma is a privileged protocol, so this function
|
||||
* @remark __Wayland:__ Monitor gamma is a privileged protocol, so this function
|
||||
* cannot be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE while
|
||||
* returning `NULL`.
|
||||
*
|
||||
@ -2981,9 +2982,9 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
|
||||
* @remark The size of the specified gamma ramp should match the size of the
|
||||
* current ramp for that monitor.
|
||||
*
|
||||
* @remark @win32 The gamma ramp size must be 256.
|
||||
* @remark __Win32:__ The gamma ramp size must be 256.
|
||||
*
|
||||
* @remark @wayland Monitor gamma is a privileged protocol, so this function
|
||||
* @remark __Wayland:__ Monitor gamma is a privileged protocol, so this function
|
||||
* cannot be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE.
|
||||
*
|
||||
* @pointer_lifetime The specified gamma ramp is copied before this function
|
||||
@ -3159,32 +3160,32 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
|
||||
* GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE, @ref
|
||||
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark @win32 Window creation will fail if the Microsoft GDI software
|
||||
* @remark __Win32:__ Window creation will fail if the Microsoft GDI software
|
||||
* OpenGL implementation is the only one available.
|
||||
*
|
||||
* @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it
|
||||
* @remark __Win32:__ If the executable has an icon resource named `GLFW_ICON,` it
|
||||
* will be set as the initial icon for the window. If no such icon is present,
|
||||
* the `IDI_APPLICATION` icon will be used instead. To set a different icon,
|
||||
* see @ref glfwSetWindowIcon.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @remark @macos The OS only supports core profile contexts for OpenGL
|
||||
* @remark __macOS:__ The OS only supports core profile contexts for OpenGL
|
||||
* versions 3.2 and later. Before creating an OpenGL context of version 3.2 or
|
||||
* later you must set the [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint)
|
||||
* hint accordingly. 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.
|
||||
* For more information on bundles, see the
|
||||
* [Bundle Programming Guide][bundle-guide] in the Mac Developer Library.
|
||||
*
|
||||
* [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/
|
||||
*
|
||||
* @remark @macos The window frame will not be rendered at full resolution on
|
||||
* Retina displays unless the
|
||||
* @remark __macOS:__ The window frame will not be rendered at full resolution
|
||||
* on Retina displays unless the
|
||||
* [GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint)
|
||||
* hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the
|
||||
* application bundle's `Info.plist`. For more information, see
|
||||
@ -3195,11 +3196,11 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
|
||||
*
|
||||
* [hidpi-guide]: https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html
|
||||
*
|
||||
* @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
|
||||
* window size and position may be overridden by previously saved values.
|
||||
*
|
||||
* @remark @wayland GLFW uses [libdecor][] where available to create its window
|
||||
* @remark __Wayland:__ GLFW uses [libdecor][] where available to create its window
|
||||
* decorations. This in turn uses server-side XDG decorations where available
|
||||
* and provides high quality client-side decorations on compositors like GNOME.
|
||||
* If both XDG decorations and libdecor are unavailable, GLFW falls back to
|
||||
@ -3208,15 +3209,15 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
|
||||
*
|
||||
* [libdecor]: https://gitlab.freedesktop.org/libdecor/libdecor
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @remark @x11 Due to the asynchronous nature of X11, it may take a moment for
|
||||
* @remark __X11:__ Due to the asynchronous nature of X11, it may take a moment for
|
||||
* a window to reach its requested state. This means you may not be able to
|
||||
* query the final size, position or other attributes directly after window
|
||||
* creation.
|
||||
*
|
||||
* @remark @x11 The class part of the `WM_CLASS` window property will by
|
||||
* @remark __X11:__ The class part of the `WM_CLASS` window property will by
|
||||
* default be set to the window title passed to this function. The instance
|
||||
* part will use the contents of the `RESOURCE_NAME` environment variable, if
|
||||
* present and not empty, or fall back to the window title. Set the
|
||||
@ -3349,7 +3350,7 @@ GLFWAPI const char* glfwGetWindowTitle(GLFWwindow* window);
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark @macos The window title will not be updated until the next time you
|
||||
* @remark __macOS:__ The window title will not be updated until the next time you
|
||||
* process events.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
@ -3358,7 +3359,7 @@ GLFWAPI const char* glfwGetWindowTitle(GLFWwindow* window);
|
||||
* @sa @ref glfwGetWindowTitle
|
||||
*
|
||||
* @since Added in version 1.0.
|
||||
* @glfw3 Added window handle parameter.
|
||||
* __GLFW 3:__ Added window handle parameter.
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
@ -3392,14 +3393,14 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
|
||||
* @pointer_lifetime The specified image data is copied before this function
|
||||
* returns.
|
||||
*
|
||||
* @remark @macos Regular windows do not have icons on macOS. This function
|
||||
* @remark __macOS:__ Regular windows do not have icons on macOS. This function
|
||||
* will emit @ref GLFW_FEATURE_UNAVAILABLE. The dock icon will be the same as
|
||||
* the application bundle's icon. For more information on bundles, see the
|
||||
* [Bundle Programming Guide][bundle-guide] in the Mac Developer Library.
|
||||
*
|
||||
* [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/
|
||||
*
|
||||
* @remark @wayland There is no existing protocol to change an icon, the
|
||||
* @remark __Wayland:__ There is no existing protocol to change an icon, the
|
||||
* window will thus inherit the one defined in the application's desktop file.
|
||||
* This function will emit @ref GLFW_FEATURE_UNAVAILABLE.
|
||||
*
|
||||
@ -3430,7 +3431,7 @@ GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* i
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
|
||||
*
|
||||
* @remark @wayland Window positions are not currently part of any common
|
||||
* @remark __Wayland:__ Window positions are not currently part of any common
|
||||
* Wayland protocol, so this function cannot be implemented and will emit @ref
|
||||
* GLFW_FEATURE_UNAVAILABLE.
|
||||
*
|
||||
@ -3464,7 +3465,7 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
|
||||
*
|
||||
* @remark @wayland Window positions are not currently part of any common
|
||||
* @remark __Wayland:__ Window positions are not currently part of any common
|
||||
* Wayland protocol, so this function cannot be implemented and will emit @ref
|
||||
* GLFW_FEATURE_UNAVAILABLE.
|
||||
*
|
||||
@ -3474,7 +3475,7 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
|
||||
* @sa @ref glfwGetWindowPos
|
||||
*
|
||||
* @since Added in version 1.0.
|
||||
* @glfw3 Added window handle parameter.
|
||||
* __GLFW 3:__ Added window handle parameter.
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
@ -3504,7 +3505,7 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
|
||||
* @sa @ref glfwSetWindowSize
|
||||
*
|
||||
* @since Added in version 1.0.
|
||||
* @glfw3 Added window handle parameter.
|
||||
* __GLFW 3:__ Added window handle parameter.
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
@ -3539,7 +3540,7 @@ GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
|
||||
* @remark If you set size limits and an aspect ratio that conflict, the
|
||||
* results are undefined.
|
||||
*
|
||||
* @remark @wayland The size limits will not be applied until the window is
|
||||
* @remark __Wayland:__ The size limits will not be applied until the window is
|
||||
* actually resized, either by the user or by the compositor.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
@ -3582,7 +3583,7 @@ GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minhe
|
||||
* @remark If you set size limits and an aspect ratio that conflict, the
|
||||
* results are undefined.
|
||||
*
|
||||
* @remark @wayland The aspect ratio will not be applied until the window is
|
||||
* @remark __Wayland:__ The aspect ratio will not be applied until the window is
|
||||
* actually resized, either by the user or by the compositor.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
@ -3628,7 +3629,7 @@ GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
|
||||
* @sa @ref glfwSetWindowMonitor
|
||||
*
|
||||
* @since Added in version 1.0.
|
||||
* @glfw3 Added window handle parameter.
|
||||
* __GLFW 3:__ Added window handle parameter.
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
@ -3778,7 +3779,7 @@ GLFWAPI float glfwGetWindowOpacity(GLFWwindow* window);
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
|
||||
*
|
||||
* @remark @wayland There is no way to set an opacity factor for a window.
|
||||
* @remark __Wayland:__ There is no way to set an opacity factor for a window.
|
||||
* This function will emit @ref GLFW_FEATURE_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
@ -3814,7 +3815,7 @@ GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity);
|
||||
* @sa @ref glfwMaximizeWindow
|
||||
*
|
||||
* @since Added in version 2.1.
|
||||
* @glfw3 Added window handle parameter.
|
||||
* __GLFW 3:__ Added window handle parameter.
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
@ -3834,9 +3835,9 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark @wayland Restoring a window from maximization is not currently part
|
||||
* of any common Wayland protocol, so this function can only restore windows
|
||||
* from maximization.
|
||||
* @remark __Wayland:__ Restoring a window from maximization is not currently
|
||||
* part of any common Wayland protocol, so this function can only restore
|
||||
* windows from maximization.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
*
|
||||
@ -3845,7 +3846,7 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
|
||||
* @sa @ref glfwMaximizeWindow
|
||||
*
|
||||
* @since Added in version 2.1.
|
||||
* @glfw3 Added window handle parameter.
|
||||
* __GLFW 3:__ Added window handle parameter.
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
@ -3892,7 +3893,7 @@ GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark @wayland Because Wayland wants every frame of the desktop to be
|
||||
* @remark __Wayland:__ Because Wayland wants every frame of the desktop to be
|
||||
* complete, this function does not immediately make the window visible.
|
||||
* Instead it will become visible the next time the window framebuffer is
|
||||
* updated after this call.
|
||||
@ -3955,7 +3956,7 @@ GLFWAPI void glfwHideWindow(GLFWwindow* window);
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark @wayland The compositor will likely ignore focus requests unless
|
||||
* @remark __Wayland:__ The compositor will likely ignore focus requests unless
|
||||
* another window created by the same application already has input focus.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
@ -3983,7 +3984,7 @@ GLFWAPI void glfwFocusWindow(GLFWwindow* window);
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark @macos Attention is requested to the application as a whole, not the
|
||||
* @remark __macOS:__ Attention is requested to the application as a whole, not the
|
||||
* specific window.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
@ -4058,7 +4059,7 @@ GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
|
||||
* affected by any resizing or mode switching, although you may need to update
|
||||
* your viewport if the framebuffer size has changed.
|
||||
*
|
||||
* @remark @wayland Window positions are not currently part of any common
|
||||
* @remark __Wayland:__ Window positions are not currently part of any common
|
||||
* Wayland protocol. The window position arguments are ignored.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
@ -4096,7 +4097,7 @@ GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int
|
||||
* errors. However, this function should not fail as long as it is passed
|
||||
* valid arguments and the library has been [initialized](@ref intro_init).
|
||||
*
|
||||
* @remark @wayland Checking whether a window is iconified is not currently
|
||||
* @remark __Wayland:__ Checking whether a window is iconified is not currently
|
||||
* part of any common Wayland protocol, so the @ref GLFW_ICONIFIED attribute
|
||||
* cannot be implemented and is always `GLFW_FALSE`.
|
||||
*
|
||||
@ -4140,7 +4141,7 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
|
||||
* @remark Calling @ref glfwGetWindowAttrib will always return the latest
|
||||
* value, even if that value is ignored by the current mode of the window.
|
||||
*
|
||||
* @remark @wayland The [GLFW_FLOATING](@ref GLFW_FLOATING_attrib) window attribute is
|
||||
* @remark __Wayland:__ The [GLFW_FLOATING](@ref GLFW_FLOATING_attrib) window attribute is
|
||||
* not supported. Setting this will emit @ref GLFW_FEATURE_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
@ -4220,7 +4221,7 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @remark @wayland This callback will not be called. The Wayland protocol
|
||||
* @remark __Wayland:__ This callback will not be called. The Wayland protocol
|
||||
* provides no way to be notified of when a window is moved.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
@ -4259,7 +4260,7 @@ GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindow
|
||||
* @sa @ref window_size
|
||||
*
|
||||
* @since Added in version 1.0.
|
||||
* @glfw3 Added window handle parameter and return value.
|
||||
* __GLFW 3:__ Added window handle parameter and return value.
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
@ -4291,7 +4292,7 @@ GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwind
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @remark @macos Selecting Quit from the application menu will trigger the
|
||||
* @remark __macOS:__ Selecting Quit from the application menu will trigger the
|
||||
* close callback for all windows.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
@ -4299,7 +4300,7 @@ GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwind
|
||||
* @sa @ref window_close
|
||||
*
|
||||
* @since Added in version 2.5.
|
||||
* @glfw3 Added window handle parameter and return value.
|
||||
* __GLFW 3:__ Added window handle parameter and return value.
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
@ -4335,7 +4336,7 @@ GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwi
|
||||
* @sa @ref window_refresh
|
||||
*
|
||||
* @since Added in version 2.5.
|
||||
* @glfw3 Added window handle parameter and return value.
|
||||
* __GLFW 3:__ Added window handle parameter and return value.
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
@ -4396,7 +4397,7 @@ GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwi
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @remark @wayland This callback will not be called. The Wayland protocol
|
||||
* @remark __Wayland:__ This callback will not be called. The Wayland protocol
|
||||
* provides no way to be notified of when a window is iconified, and no way to
|
||||
* check whether a window is currently iconified.
|
||||
*
|
||||
@ -4905,7 +4906,7 @@ GLFWAPI int glfwGetKeyScancode(int key);
|
||||
* @sa @ref input_key
|
||||
*
|
||||
* @since Added in version 1.0.
|
||||
* @glfw3 Added window handle parameter.
|
||||
* __GLFW 3:__ Added window handle parameter.
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
@ -4937,7 +4938,7 @@ GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
|
||||
* @sa @ref input_mouse_button
|
||||
*
|
||||
* @since Added in version 1.0.
|
||||
* @glfw3 Added window handle parameter.
|
||||
* __GLFW 3:__ Added window handle parameter.
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
@ -5007,7 +5008,7 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
|
||||
*
|
||||
* @remark @wayland This function will only work when the cursor mode is
|
||||
* @remark __Wayland:__ This function will only work when the cursor mode is
|
||||
* `GLFW_CURSOR_DISABLED`, otherwise it will emit @ref GLFW_FEATURE_UNAVAILABLE.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
@ -5205,7 +5206,7 @@ GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
|
||||
* @sa @ref input_key
|
||||
*
|
||||
* @since Added in version 1.0.
|
||||
* @glfw3 Added window handle parameter and return value.
|
||||
* __GLFW 3:__ Added window handle parameter and return value.
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
@ -5248,7 +5249,7 @@ GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun callback);
|
||||
* @sa @ref input_char
|
||||
*
|
||||
* @since Added in version 2.4.
|
||||
* @glfw3 Added window handle parameter and return value.
|
||||
* __GLFW 3:__ Added window handle parameter and return value.
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
@ -5332,7 +5333,7 @@ GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmods
|
||||
* @sa @ref input_mouse_button
|
||||
*
|
||||
* @since Added in version 1.0.
|
||||
* @glfw3 Added window handle parameter and return value.
|
||||
* __GLFW 3:__ Added window handle parameter and return value.
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
@ -5562,7 +5563,7 @@ GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count);
|
||||
* @sa @ref joystick_button
|
||||
*
|
||||
* @since Added in version 2.2.
|
||||
* @glfw3 Changed to return a dynamic array.
|
||||
* __GLFW 3:__ Changed to return a dynamic array.
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
@ -5926,7 +5927,7 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark @win32 The clipboard on Windows has a single global lock for reading and
|
||||
* @remark __Win32:__ The clipboard on Windows has a single global lock for reading and
|
||||
* writing. GLFW tries to acquire it a few times, which is almost always enough. If it
|
||||
* cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns.
|
||||
* It is safe to try this multiple times.
|
||||
@ -5959,7 +5960,7 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark @win32 The clipboard on Windows has a single global lock for reading and
|
||||
* @remark __Win32:__ The clipboard on Windows has a single global lock for reading and
|
||||
* writing. GLFW tries to acquire it a few times, which is almost always enough. If it
|
||||
* cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns.
|
||||
* It is safe to try this multiple times.
|
||||
@ -6176,7 +6177,7 @@ GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
|
||||
* @sa @ref glfwSwapInterval
|
||||
*
|
||||
* @since Added in version 1.0.
|
||||
* @glfw3 Added window handle parameter.
|
||||
* __GLFW 3:__ Added window handle parameter.
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
@ -6443,7 +6444,7 @@ GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* p
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark @macos This function currently always returns `GLFW_TRUE`, as the
|
||||
* @remark __macOS:__ This function currently always returns `GLFW_TRUE`, as the
|
||||
* `VK_MVK_macos_surface` and `VK_EXT_metal_surface` extensions do not provide
|
||||
* a `vkGetPhysicalDevice*PresentationSupport` type function.
|
||||
*
|
||||
@ -6501,15 +6502,15 @@ GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhys
|
||||
* @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
|
||||
* eliminate almost all occurrences of these errors.
|
||||
*
|
||||
* @remark @macos GLFW prefers the `VK_EXT_metal_surface` extension, with the
|
||||
* @remark __macOS:__ GLFW prefers the `VK_EXT_metal_surface` extension, with the
|
||||
* `VK_MVK_macos_surface` extension as a fallback. The name of the selected
|
||||
* extension, if any, is included in the array returned by @ref
|
||||
* glfwGetRequiredInstanceExtensions.
|
||||
*
|
||||
* @remark @macos This function creates and sets a `CAMetalLayer` instance for
|
||||
* @remark __macOS:__ This function creates and sets a `CAMetalLayer` instance for
|
||||
* the window content view, which is required for MoltenVK to function.
|
||||
*
|
||||
* @remark @x11 By default GLFW prefers the `VK_KHR_xcb_surface` extension,
|
||||
* @remark __X11:__ By default GLFW prefers the `VK_KHR_xcb_surface` extension,
|
||||
* with the `VK_KHR_xlib_surface` extension as a fallback. You can make
|
||||
* `VK_KHR_xlib_surface` the preferred extension by setting the
|
||||
* [GLFW_X11_XCB_VULKAN_SURFACE](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint) init
|
||||
|
||||
@ -155,6 +155,10 @@ extern "C" {
|
||||
#include <GL/osmesa.h>
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_ANDROID)
|
||||
#include <android_native_app_glue.h>
|
||||
#endif
|
||||
|
||||
#endif /*GLFW_NATIVE_INCLUDE_NONE*/
|
||||
|
||||
|
||||
@ -478,6 +482,29 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
|
||||
* @ingroup native
|
||||
*/
|
||||
GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
|
||||
|
||||
/*! @brief Retrieves the `GLXFBConfig` of the specified window's `GLXWindow`.
|
||||
*
|
||||
* @param[in] window The window whose `GLXWindow` to query.
|
||||
* @param[out] config The `GLXFBConfig` of the window `GLXWindow`, if available.
|
||||
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
|
||||
*
|
||||
* @remark `GLXFBConfig` is an opaque type. Unlike other GLFW functions, the
|
||||
* @p config out parameter is not cleared on error, as core GLX does not define
|
||||
* any invalid value.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
* @since Added in version 3.5
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
GLFWAPI int glfwGetGLXFBConfig(GLFWwindow* window, GLXFBConfig* config);
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
|
||||
@ -586,6 +613,29 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
|
||||
* @ingroup native
|
||||
*/
|
||||
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
|
||||
|
||||
/*! @brief Retrieves the `EGLConfig` of the specified window's `EGLSurface`.
|
||||
*
|
||||
* @param[in] window The window whose `EGLSurface` to query.
|
||||
* @param[out] config The `EGLConfig` of the window `EGLSurface`, if available.
|
||||
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_NO_WINDOW_CONTEXT.
|
||||
*
|
||||
* @remark `EGLConfig` is an opaque type. Unlike other GLFW functions, the @p
|
||||
* config out parameter is not cleared on error, as core EGL does not define
|
||||
* any invalid value.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
* @since Added in version 3.5.
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
GLFWAPI int glfwGetEGLConfig(GLFWwindow* window, EGLConfig* config);
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
|
||||
@ -655,6 +705,24 @@ GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height
|
||||
GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* window);
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_ANDROID)
|
||||
/*! @brief Returns the `struct android_app` of the current application.
|
||||
*
|
||||
* @return The `struct android_app` of the current, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
* @since Added in version 3.5.
|
||||
*
|
||||
* @ingroup native
|
||||
*/
|
||||
GLFWAPI struct android_app* glfwGetAndroidApp(void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -57,6 +57,14 @@ if (GLFW_BUILD_WAYLAND)
|
||||
wl_monitor.c wl_window.c)
|
||||
endif()
|
||||
|
||||
if (GLFW_BUILD_ANDROID)
|
||||
target_compile_definitions(glfw PRIVATE _GLFW_ANDROID)
|
||||
target_include_directories(glfw PRIVATE "${ANDROID_NDK}/sources/android/native_app_glue")
|
||||
target_sources(glfw PRIVATE android_platform.h android_joystick.h android_init.c
|
||||
android_monitor.c android_window.c android_joystick.c
|
||||
"${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c")
|
||||
endif()
|
||||
|
||||
if (GLFW_BUILD_X11 OR GLFW_BUILD_WAYLAND)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
target_sources(glfw PRIVATE linux_joystick.h linux_joystick.c)
|
||||
|
||||
203
src/android_init.c
Normal file
203
src/android_init.c
Normal file
@ -0,0 +1,203 @@
|
||||
//========================================================================
|
||||
// GLFW 3.5 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2024 kunitoki <kunitoki@gmail.com>
|
||||
// Copyright (c) 2017 Curi0 <curi0minecraft@gmail.com>
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would
|
||||
// be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such, and must not
|
||||
// be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <android_native_app_glue.h>
|
||||
#include <android/native_window.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
struct android_app* _globalAndroidApp = NULL;
|
||||
|
||||
extern int main();
|
||||
|
||||
void handleAppCmd(struct android_app* app, int32_t cmd)
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
case APP_CMD_START:
|
||||
break;
|
||||
|
||||
case APP_CMD_RESUME:
|
||||
//_glfwInputWindowIconify(_glfw.windowListHead, GLFW_FALSE);
|
||||
break;
|
||||
|
||||
case APP_CMD_PAUSE:
|
||||
//_glfwInputWindowIconify(_glfw.windowListHead, GLFW_TRUE);
|
||||
break;
|
||||
|
||||
case APP_CMD_STOP:
|
||||
break;
|
||||
|
||||
case APP_CMD_DESTROY:
|
||||
break;
|
||||
|
||||
case APP_CMD_INIT_WINDOW:
|
||||
break;
|
||||
|
||||
case APP_CMD_TERM_WINDOW:
|
||||
//_glfwInputWindowCloseRequest(_glfw.windowListHead);
|
||||
break;
|
||||
|
||||
case APP_CMD_LOST_FOCUS:
|
||||
//_glfwInputWindowFocus(_glfw.windowListHead, GLFW_FALSE);
|
||||
break;
|
||||
|
||||
case APP_CMD_GAINED_FOCUS:
|
||||
//_glfwInputWindowFocus(_glfw.windowListHead, GLFW_TRUE);
|
||||
break;
|
||||
|
||||
case APP_CMD_WINDOW_RESIZED:
|
||||
_glfwInputWindowSize(_glfw.windowListHead, ANativeWindow_getWidth(app->window), ANativeWindow_getHeight(app->window));
|
||||
break;
|
||||
|
||||
case APP_CMD_WINDOW_REDRAW_NEEDED:
|
||||
_glfwInputWindowDamage(_glfw.windowListHead);
|
||||
break;
|
||||
|
||||
case APP_CMD_CONTENT_RECT_CHANGED:
|
||||
_glfwInputFramebufferSize(_glfw.windowListHead, ANativeWindow_getWidth(app->window), ANativeWindow_getHeight(app->window));
|
||||
break;
|
||||
|
||||
case APP_CMD_CONFIG_CHANGED:
|
||||
break;
|
||||
|
||||
case APP_CMD_INPUT_CHANGED:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Android Entry Point
|
||||
void android_main(struct android_app* app)
|
||||
{
|
||||
app_dummy();
|
||||
|
||||
app->onAppCmd = handleAppCmd;
|
||||
|
||||
_globalAndroidApp = app;
|
||||
|
||||
main();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW platform API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GLFWbool _glfwConnectAndroid(int platformID, _GLFWplatform* platform)
|
||||
{
|
||||
const _GLFWplatform android =
|
||||
{
|
||||
.platformID = GLFW_PLATFORM_ANDROID,
|
||||
.init = _glfwInitAndroid,
|
||||
.terminate = _glfwTerminateAndroid,
|
||||
.getCursorPos = _glfwGetCursorPosAndroid,
|
||||
.setCursorPos = _glfwSetCursorPosAndroid,
|
||||
.setCursorMode = _glfwSetCursorModeAndroid,
|
||||
.setRawMouseMotion = _glfwSetRawMouseMotionAndroid,
|
||||
.rawMouseMotionSupported = _glfwRawMouseMotionSupportedAndroid,
|
||||
.createCursor = _glfwCreateCursorAndroid,
|
||||
.createStandardCursor = _glfwCreateStandardCursorAndroid,
|
||||
.destroyCursor = _glfwDestroyCursorAndroid,
|
||||
.setCursor = _glfwSetCursorAndroid,
|
||||
.getScancodeName = _glfwGetScancodeNameAndroid,
|
||||
.getKeyScancode = _glfwGetKeyScancodeAndroid,
|
||||
.setClipboardString = _glfwSetClipboardStringAndroid,
|
||||
.getClipboardString = _glfwGetClipboardStringAndroid,
|
||||
.initJoysticks = _glfwInitJoysticksAndroid,
|
||||
.terminateJoysticks = _glfwTerminateJoysticksAndroid,
|
||||
.pollJoystick = _glfwPollJoystickAndroid,
|
||||
.getMappingName = _glfwGetMappingNameAndroid,
|
||||
.updateGamepadGUID = _glfwUpdateGamepadGUIDAndroid,
|
||||
.freeMonitor = _glfwFreeMonitorAndroid,
|
||||
.getMonitorPos = _glfwGetMonitorPosAndroid,
|
||||
.getMonitorContentScale = _glfwGetMonitorContentScaleAndroid,
|
||||
.getMonitorWorkarea = _glfwGetMonitorWorkareaAndroid,
|
||||
.getVideoModes = _glfwGetVideoModesAndroid,
|
||||
.getVideoMode = _glfwGetVideoModeAndroid,
|
||||
.getGammaRamp = _glfwGetGammaRampAndroid,
|
||||
.setGammaRamp = _glfwSetGammaRampAndroid,
|
||||
.createWindow = _glfwCreateWindowAndroid,
|
||||
.destroyWindow = _glfwDestroyWindowAndroid,
|
||||
.setWindowTitle = _glfwSetWindowTitleAndroid,
|
||||
.setWindowIcon = _glfwSetWindowIconAndroid,
|
||||
.getWindowPos = _glfwGetWindowPosAndroid,
|
||||
.setWindowPos = _glfwSetWindowPosAndroid,
|
||||
.getWindowSize = _glfwGetWindowSizeAndroid,
|
||||
.setWindowSize = _glfwSetWindowSizeAndroid,
|
||||
.setWindowSizeLimits = _glfwSetWindowSizeLimitsAndroid,
|
||||
.setWindowAspectRatio = _glfwSetWindowAspectRatioAndroid,
|
||||
.getFramebufferSize = _glfwGetFramebufferSizeAndroid,
|
||||
.getWindowFrameSize = _glfwGetWindowFrameSizeAndroid,
|
||||
.getWindowContentScale = _glfwGetWindowContentScaleAndroid,
|
||||
.iconifyWindow = _glfwIconifyWindowAndroid,
|
||||
.restoreWindow = _glfwRestoreWindowAndroid,
|
||||
.maximizeWindow = _glfwMaximizeWindowAndroid,
|
||||
.showWindow = _glfwShowWindowAndroid,
|
||||
.hideWindow = _glfwHideWindowAndroid,
|
||||
.requestWindowAttention = _glfwRequestWindowAttentionAndroid,
|
||||
.focusWindow = _glfwFocusWindowAndroid,
|
||||
.setWindowMonitor = _glfwSetWindowMonitorAndroid,
|
||||
.windowFocused = _glfwWindowFocusedAndroid,
|
||||
.windowIconified = _glfwWindowIconifiedAndroid,
|
||||
.windowVisible = _glfwWindowVisibleAndroid,
|
||||
.windowMaximized = _glfwWindowMaximizedAndroid,
|
||||
.windowHovered = _glfwWindowHoveredAndroid,
|
||||
.framebufferTransparent = _glfwFramebufferTransparentAndroid,
|
||||
.getWindowOpacity = _glfwGetWindowOpacityAndroid,
|
||||
.setWindowResizable = _glfwSetWindowResizableAndroid,
|
||||
.setWindowDecorated = _glfwSetWindowDecoratedAndroid,
|
||||
.setWindowFloating = _glfwSetWindowFloatingAndroid,
|
||||
.setWindowOpacity = _glfwSetWindowOpacityAndroid,
|
||||
.setWindowMousePassthrough = _glfwSetWindowMousePassthroughAndroid,
|
||||
.pollEvents = _glfwPollEventsAndroid,
|
||||
.waitEvents = _glfwWaitEventsAndroid,
|
||||
.waitEventsTimeout = _glfwWaitEventsTimeoutAndroid,
|
||||
.postEmptyEvent = _glfwPostEmptyEventAndroid,
|
||||
.getEGLPlatform = _glfwGetEGLPlatformAndroid,
|
||||
.getEGLNativeDisplay = _glfwGetEGLNativeDisplayAndroid,
|
||||
.getEGLNativeWindow = _glfwGetEGLNativeWindowAndroid,
|
||||
.getRequiredInstanceExtensions = _glfwGetRequiredInstanceExtensionsAndroid,
|
||||
.getPhysicalDevicePresentationSupport = _glfwGetPhysicalDevicePresentationSupportAndroid,
|
||||
.createWindowSurface = _glfwCreateWindowSurfaceAndroid
|
||||
};
|
||||
|
||||
*platform = android;
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
int _glfwInitAndroid(void)
|
||||
{
|
||||
_glfw.gstate.app = _globalAndroidApp;
|
||||
_glfw.gstate.source = NULL;
|
||||
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
void _glfwTerminateAndroid(void)
|
||||
{
|
||||
_glfw.gstate.app = NULL;
|
||||
}
|
||||
56
src/android_joystick.c
Normal file
56
src/android_joystick.c
Normal file
@ -0,0 +1,56 @@
|
||||
//========================================================================
|
||||
// GLFW 3.5 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2024 kunitoki <kunitoki@gmail.com>
|
||||
// Copyright (c) 2017 Curi0 <curi0minecraft@gmail.com>
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would
|
||||
// be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such, and must not
|
||||
// be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW platform API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GLFWbool _glfwInitJoysticksAndroid(void)
|
||||
{
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
void _glfwTerminateJoysticksAndroid(void)
|
||||
{
|
||||
}
|
||||
|
||||
GLFWbool _glfwPollJoystickAndroid(_GLFWjoystick* js, int mode)
|
||||
{
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
const char* _glfwGetMappingNameAndroid(void)
|
||||
{
|
||||
return "Android";
|
||||
}
|
||||
|
||||
void _glfwUpdateGamepadGUIDAndroid(char* guid)
|
||||
{
|
||||
}
|
||||
35
src/android_joystick.h
Normal file
35
src/android_joystick.h
Normal file
@ -0,0 +1,35 @@
|
||||
//========================================================================
|
||||
// GLFW 3.5 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2024 kunitoki <kunitoki@gmail.com>
|
||||
// Copyright (c) 2017 Curi0 <curi0minecraft@gmail.com>
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would
|
||||
// be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such, and must not
|
||||
// be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#define GLFW_ANDROID_JOYSTICK_STATE
|
||||
#define GLFW_ANDROID_LIBRARY_JOYSTICK_STATE
|
||||
|
||||
GLFWbool _glfwInitJoysticksAndroid(void);
|
||||
void _glfwTerminateJoysticksAndroid(void);
|
||||
GLFWbool _glfwPollJoystickAndroid(_GLFWjoystick* js, int mode);
|
||||
const char* _glfwGetMappingNameAndroid(void);
|
||||
void _glfwUpdateGamepadGUIDAndroid(char* guid);
|
||||
82
src/android_monitor.c
Normal file
82
src/android_monitor.c
Normal file
@ -0,0 +1,82 @@
|
||||
//========================================================================
|
||||
// GLFW 3.5 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2024 kunitoki <kunitoki@gmail.com>
|
||||
// Copyright (c) 2017 Curi0 <curi0minecraft@gmail.com>
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would
|
||||
// be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such, and must not
|
||||
// be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW platform API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void _glfwPollMonitorsAndroid(void)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwSetVideoModeAndroid(_GLFWmonitor* monitor, const GLFWvidmode* desired)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwRestoreVideoModeAndroid(_GLFWmonitor* monitor)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwFreeMonitorAndroid(_GLFWmonitor* monitor)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwGetMonitorPosAndroid(_GLFWmonitor* monitor, int* xpos, int* ypos)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwGetMonitorContentScaleAndroid(_GLFWmonitor* monitor,
|
||||
float* xscale, float* yscale)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwGetMonitorWorkareaAndroid(_GLFWmonitor* monitor,
|
||||
int* xpos, int* ypos,
|
||||
int* width, int* height)
|
||||
{
|
||||
}
|
||||
|
||||
GLFWvidmode* _glfwGetVideoModesAndroid(_GLFWmonitor* monitor, int* count)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GLFWbool _glfwGetVideoModeAndroid(_GLFWmonitor* monitor, GLFWvidmode *mode)
|
||||
{
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
GLFWbool _glfwGetGammaRampAndroid(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
|
||||
{
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
void _glfwSetGammaRampAndroid(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
||||
{
|
||||
}
|
||||
134
src/android_platform.h
Normal file
134
src/android_platform.h
Normal file
@ -0,0 +1,134 @@
|
||||
//========================================================================
|
||||
// GLFW 3.5 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2024 kunitoki <kunitoki@gmail.com>
|
||||
// Copyright (c) 2017 Curi0 <curi0minecraft@gmail.com>
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would
|
||||
// be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such, and must not
|
||||
// be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <android_native_app_glue.h>
|
||||
#include <android/native_window.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#define GLFW_ANDROID_WINDOW_STATE struct android_app* android;
|
||||
#define GLFW_ANDROID_LIBRARY_WINDOW_STATE android_gstate gstate;
|
||||
#define GLFW_ANDROID_MONITOR_STATE
|
||||
|
||||
#define GLFW_ANDROID_CONTEXT_STATE
|
||||
#define GLFW_ANDROID_CURSOR_STATE
|
||||
#define GLFW_ANDROID_LIBRARY_CONTEXT_STATE
|
||||
|
||||
#define GLFW_ANDROID_JOYSTICK_STATE
|
||||
#define GLFW_ANDROID_LIBRARY_JOYSTICK_STATE
|
||||
|
||||
typedef struct android_gstate
|
||||
{
|
||||
struct android_app* app;
|
||||
struct android_poll_source* source;
|
||||
} android_gstate;
|
||||
|
||||
typedef VkFlags VkAndroidSurfaceCreateFlagsKHR;
|
||||
|
||||
typedef struct VkAndroidSurfaceCreateInfoKHR
|
||||
{
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkAndroidSurfaceCreateFlagsKHR flags;
|
||||
ANativeWindow* window;
|
||||
} VkAndroidSurfaceCreateInfoKHR;
|
||||
|
||||
typedef VkResult (APIENTRY *PFN_vkCreateAndroidSurfaceKHR)(VkInstance, const VkAndroidSurfaceCreateInfoKHR*, const VkAllocationCallbacks*, VkSurfaceKHR*);
|
||||
|
||||
GLFWbool _glfwConnectAndroid(int platformID, _GLFWplatform* platform);
|
||||
int _glfwInitAndroid(void);
|
||||
void _glfwTerminateAndroid(void);
|
||||
|
||||
void _glfwFreeMonitorAndroid(_GLFWmonitor* monitor);
|
||||
void _glfwGetMonitorPosAndroid(_GLFWmonitor* monitor, int* xpos, int* ypos);
|
||||
void _glfwGetMonitorContentScaleAndroid(_GLFWmonitor* monitor, float* xscale, float* yscale);
|
||||
void _glfwGetMonitorWorkareaAndroid(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
|
||||
GLFWvidmode* _glfwGetVideoModesAndroid(_GLFWmonitor* monitor, int* found);
|
||||
GLFWbool _glfwGetVideoModeAndroid(_GLFWmonitor* monitor, GLFWvidmode* mode);
|
||||
GLFWbool _glfwGetGammaRampAndroid(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
|
||||
void _glfwSetGammaRampAndroid(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
|
||||
void _glfwPollMonitorsAndroid(void);
|
||||
|
||||
GLFWbool _glfwCreateWindowAndroid(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig);
|
||||
void _glfwDestroyWindowAndroid(_GLFWwindow* window);
|
||||
void _glfwSetWindowTitleAndroid(_GLFWwindow* window, const char* title);
|
||||
void _glfwSetWindowIconAndroid(_GLFWwindow* window, int count, const GLFWimage* images);
|
||||
void _glfwSetWindowMonitorAndroid(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
|
||||
void _glfwGetWindowPosAndroid(_GLFWwindow* window, int* xpos, int* ypos);
|
||||
void _glfwSetWindowPosAndroid(_GLFWwindow* window, int xpos, int ypos);
|
||||
void _glfwGetWindowSizeAndroid(_GLFWwindow* window, int* width, int* height);
|
||||
void _glfwSetWindowSizeAndroid(_GLFWwindow* window, int width, int height);
|
||||
void _glfwSetWindowSizeLimitsAndroid(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
|
||||
void _glfwSetWindowAspectRatioAndroid(_GLFWwindow* window, int n, int d);
|
||||
void _glfwGetFramebufferSizeAndroid(_GLFWwindow* window, int* width, int* height);
|
||||
void _glfwGetWindowFrameSizeAndroid(_GLFWwindow* window, int* left, int* top, int* right, int* bottom);
|
||||
void _glfwGetWindowContentScaleAndroid(_GLFWwindow* window, float* xscale, float* yscale);
|
||||
void _glfwIconifyWindowAndroid(_GLFWwindow* window);
|
||||
void _glfwRestoreWindowAndroid(_GLFWwindow* window);
|
||||
void _glfwMaximizeWindowAndroid(_GLFWwindow* window);
|
||||
GLFWbool _glfwWindowMaximizedAndroid(_GLFWwindow* window);
|
||||
GLFWbool _glfwWindowHoveredAndroid(_GLFWwindow* window);
|
||||
GLFWbool _glfwFramebufferTransparentAndroid(_GLFWwindow* window);
|
||||
void _glfwSetWindowResizableAndroid(_GLFWwindow* window, GLFWbool enabled);
|
||||
void _glfwSetWindowDecoratedAndroid(_GLFWwindow* window, GLFWbool enabled);
|
||||
void _glfwSetWindowFloatingAndroid(_GLFWwindow* window, GLFWbool enabled);
|
||||
void _glfwSetWindowMousePassthroughAndroid(_GLFWwindow* window, GLFWbool enabled);
|
||||
float _glfwGetWindowOpacityAndroid(_GLFWwindow* window);
|
||||
void _glfwSetWindowOpacityAndroid(_GLFWwindow* window, float opacity);
|
||||
void _glfwSetRawMouseMotionAndroid(_GLFWwindow *window, GLFWbool enabled);
|
||||
GLFWbool _glfwRawMouseMotionSupportedAndroid(void);
|
||||
void _glfwShowWindowAndroid(_GLFWwindow* window);
|
||||
void _glfwRequestWindowAttentionAndroid(_GLFWwindow* window);
|
||||
void _glfwHideWindowAndroid(_GLFWwindow* window);
|
||||
void _glfwFocusWindowAndroid(_GLFWwindow* window);
|
||||
GLFWbool _glfwWindowFocusedAndroid(_GLFWwindow* window);
|
||||
GLFWbool _glfwWindowIconifiedAndroid(_GLFWwindow* window);
|
||||
GLFWbool _glfwWindowVisibleAndroid(_GLFWwindow* window);
|
||||
void _glfwPollEventsAndroid(void);
|
||||
void _glfwWaitEventsAndroid(void);
|
||||
void _glfwWaitEventsTimeoutAndroid(double timeout);
|
||||
void _glfwPostEmptyEventAndroid(void);
|
||||
void _glfwGetCursorPosAndroid(_GLFWwindow* window, double* xpos, double* ypos);
|
||||
void _glfwSetCursorPosAndroid(_GLFWwindow* window, double x, double y);
|
||||
void _glfwSetCursorModeAndroid(_GLFWwindow* window, int mode);
|
||||
GLFWbool _glfwCreateCursorAndroid(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot);
|
||||
GLFWbool _glfwCreateStandardCursorAndroid(_GLFWcursor* cursor, int shape);
|
||||
void _glfwDestroyCursorAndroid(_GLFWcursor* cursor);
|
||||
void _glfwSetCursorAndroid(_GLFWwindow* window, _GLFWcursor* cursor);
|
||||
void _glfwSetClipboardStringAndroid(const char* string);
|
||||
const char* _glfwGetClipboardStringAndroid(void);
|
||||
const char* _glfwGetScancodeNameAndroid(int scancode);
|
||||
int _glfwGetKeyScancodeAndroid(int key);
|
||||
|
||||
EGLenum _glfwGetEGLPlatformAndroid(EGLint** attribs);
|
||||
EGLNativeDisplayType _glfwGetEGLNativeDisplayAndroid(void);
|
||||
EGLNativeWindowType _glfwGetEGLNativeWindowAndroid(_GLFWwindow* window);
|
||||
|
||||
void _glfwGetRequiredInstanceExtensionsAndroid(char** extensions);
|
||||
GLFWbool _glfwGetPhysicalDevicePresentationSupportAndroid(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
|
||||
VkResult _glfwCreateWindowSurfaceAndroid(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
|
||||
|
||||
GLFWAPI struct android_app* glfwGetAndroidApp(void);
|
||||
562
src/android_window.c
Normal file
562
src/android_window.c
Normal file
@ -0,0 +1,562 @@
|
||||
//========================================================================
|
||||
// GLFW 3.5 - www.glfw.org
|
||||
//------------------------------------------------------------------------
|
||||
// Copyright (c) 2024 kunitoki <kunitoki@gmail.com>
|
||||
// Copyright (c) 2017 Curi0 <curi0minecraft@gmail.com>
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would
|
||||
// be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such, and must not
|
||||
// be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
#include <android/native_activity.h>
|
||||
#include <android/configuration.h>
|
||||
#include <android/window.h>
|
||||
#include <android/input.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static float lastCursorPosX = 0.0f;
|
||||
static float lastCursorPosY = 0.0f;
|
||||
|
||||
static void moveNativeWindowToBackground(ANativeActivity* nativeActivity)
|
||||
{
|
||||
JNIEnv* env = NULL;
|
||||
(*nativeActivity->vm)->AttachCurrentThread(nativeActivity->vm, &env, NULL);
|
||||
|
||||
jmethodID moveTaskToBackMethod = (*env)->GetMethodID(env, nativeActivity->clazz, "moveTaskToBack", "(Z)Z");
|
||||
if (moveTaskToBackMethod == NULL)
|
||||
return;
|
||||
|
||||
(*env)->CallBooleanMethod(env, nativeActivity->clazz, moveTaskToBackMethod, JNI_TRUE);
|
||||
}
|
||||
|
||||
static int32_t handleInput(struct android_app* app, AInputEvent* event)
|
||||
{
|
||||
if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION)
|
||||
{
|
||||
size_t pointerCount = AMotionEvent_getPointerCount(event);
|
||||
|
||||
for (size_t i = 0; i < pointerCount; ++i)
|
||||
{
|
||||
lastCursorPosX = AMotionEvent_getX(event, i);
|
||||
lastCursorPosY = AMotionEvent_getY(event, i);
|
||||
int32_t action = AMotionEvent_getAction(event) & AMOTION_EVENT_ACTION_MASK;
|
||||
|
||||
// Map Android touch events to GLFW touch events
|
||||
switch (action)
|
||||
{
|
||||
case AMOTION_EVENT_ACTION_DOWN:
|
||||
case AMOTION_EVENT_ACTION_POINTER_DOWN:
|
||||
_glfwInputMouseClick(_glfw.windowListHead, GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS, 0);
|
||||
break;
|
||||
|
||||
case AMOTION_EVENT_ACTION_UP:
|
||||
case AMOTION_EVENT_ACTION_POINTER_UP:
|
||||
_glfwInputMouseClick(_glfw.windowListHead, GLFW_MOUSE_BUTTON_LEFT, GLFW_RELEASE, 0);
|
||||
break;
|
||||
|
||||
case AMOTION_EVENT_ACTION_MOVE:
|
||||
_glfwInputCursorPos(_glfw.windowListHead, lastCursorPosX, lastCursorPosY);
|
||||
break;
|
||||
|
||||
case AMOTION_EVENT_ACTION_CANCEL:
|
||||
// Handle cancel if necessary
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
else if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_KEY)
|
||||
{
|
||||
_glfwInputKey(_glfw.windowListHead, 0 , AKeyEvent_getKeyCode(event), GLFW_PRESS, 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void handleEvents(int timeout)
|
||||
{
|
||||
ALooper_pollOnce(timeout, NULL, NULL, (void**)&_glfw.gstate.source);
|
||||
|
||||
if (_glfw.gstate.source != NULL)
|
||||
_glfw.gstate.source->process(_glfw.gstate.app, _glfw.gstate.source);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW platform API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GLFWbool _glfwCreateWindowAndroid(_GLFWwindow* window,
|
||||
const _GLFWwndconfig* wndconfig,
|
||||
const _GLFWctxconfig* ctxconfig,
|
||||
const _GLFWfbconfig* fbconfig)
|
||||
{
|
||||
// wait for window to become ready
|
||||
while (_glfw.gstate.app->window == NULL)
|
||||
handleEvents(-1);
|
||||
|
||||
// hmmm maybe should be ANative_Window only?
|
||||
window->android = _glfw.gstate.app;
|
||||
window->android->onInputEvent = handleInput;
|
||||
|
||||
if (ctxconfig->client != GLFW_NO_API)
|
||||
{
|
||||
if ((ctxconfig->source == GLFW_NATIVE_CONTEXT_API) |
|
||||
(ctxconfig->source == GLFW_EGL_CONTEXT_API))
|
||||
{
|
||||
if (!_glfwInitEGL())
|
||||
return GLFW_FALSE;
|
||||
|
||||
if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig))
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
else if (ctxconfig->source == GLFW_OSMESA_CONTEXT_API)
|
||||
{
|
||||
if (!_glfwInitOSMesa())
|
||||
return GLFW_FALSE;
|
||||
|
||||
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (!_glfwRefreshContextAttribs(window, ctxconfig))
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
void _glfwDestroyWindowAndroid(_GLFWwindow* window)
|
||||
{
|
||||
if (window->context.destroy)
|
||||
window->context.destroy(window);
|
||||
|
||||
ANativeActivity_finish(window->android->activity);
|
||||
}
|
||||
|
||||
void _glfwSetWindowTitleAndroid(_GLFWwindow* window, const char* title)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwSetWindowIconAndroid(_GLFWwindow* window, int count,
|
||||
const GLFWimage* images)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwSetWindowMonitorAndroid(_GLFWwindow* window,
|
||||
_GLFWmonitor* monitor,
|
||||
int xpos, int ypos,
|
||||
int width, int height,
|
||||
int refreshRate)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwGetWindowPosAndroid(_GLFWwindow* window, int* xpos, int* ypos)
|
||||
{
|
||||
if (xpos)
|
||||
*xpos = 0;
|
||||
|
||||
if (ypos)
|
||||
*ypos = 0;
|
||||
}
|
||||
|
||||
void _glfwSetWindowPosAndroid(_GLFWwindow* window, int xpos, int ypos)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwGetWindowSizeAndroid(_GLFWwindow* window, int* width, int* height)
|
||||
{
|
||||
if (width)
|
||||
{
|
||||
*width = (window->android->window != NULL)
|
||||
? ANativeWindow_getWidth(window->android->window)
|
||||
: 0;
|
||||
}
|
||||
|
||||
if (height)
|
||||
{
|
||||
*height = (window->android->window != NULL)
|
||||
? ANativeWindow_getHeight(window->android->window)
|
||||
: 0;
|
||||
}
|
||||
}
|
||||
|
||||
void _glfwSetWindowSizeAndroid(_GLFWwindow* window, int width, int height)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwSetWindowSizeLimitsAndroid(_GLFWwindow* window,
|
||||
int minwidth, int minheight,
|
||||
int maxwidth, int maxheight)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwSetWindowAspectRatioAndroid(_GLFWwindow* window, int n, int d)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwGetFramebufferSizeAndroid(_GLFWwindow* window, int* width, int* height)
|
||||
{
|
||||
// the underlying buffer geometry is currently being initialized from the window width and height...
|
||||
// so high resolution displays are currently not supported...so it is safe to just call _glfwGetWindowSizeAndroid() for now
|
||||
_glfwGetWindowSizeAndroid(window, width, height);
|
||||
}
|
||||
|
||||
void _glfwGetWindowFrameSizeAndroid(_GLFWwindow* window,
|
||||
int* left, int* top,
|
||||
int* right, int* bottom)
|
||||
{
|
||||
if (left)
|
||||
*left = window->android->contentRect.left;
|
||||
|
||||
if (top)
|
||||
*top = window->android->contentRect.top;
|
||||
|
||||
if (right)
|
||||
{
|
||||
int windowWidth = (window->android->window != NULL)
|
||||
? ANativeWindow_getWidth(window->android->window)
|
||||
: 0;
|
||||
|
||||
int rightFrame = windowWidth - window->android->contentRect.right;
|
||||
if (rightFrame < 0) rightFrame = 0;
|
||||
|
||||
*right = rightFrame;
|
||||
}
|
||||
|
||||
if (bottom)
|
||||
{
|
||||
int windowHeight = (window->android->window != NULL)
|
||||
? ANativeWindow_getHeight(window->android->window)
|
||||
: 0;
|
||||
|
||||
int bottomFrame = windowHeight - window->android->contentRect.bottom;
|
||||
if (bottomFrame < 0) bottomFrame = 0;
|
||||
|
||||
*bottom = bottomFrame;
|
||||
}
|
||||
}
|
||||
|
||||
void _glfwGetWindowContentScaleAndroid(_GLFWwindow* window, float* xscale, float* yscale)
|
||||
{
|
||||
if (xscale)
|
||||
{
|
||||
int32_t widthDensity = AConfiguration_getScreenWidthDp(window->android->config);
|
||||
if (widthDensity == ACONFIGURATION_SCREEN_WIDTH_DP_ANY)
|
||||
{
|
||||
*xscale = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
int32_t widthPixels = ANativeWindow_getWidth(window->android->window);
|
||||
*xscale = (float)widthPixels / (float)widthDensity;
|
||||
}
|
||||
}
|
||||
|
||||
if (yscale)
|
||||
{
|
||||
int32_t heightDensity = AConfiguration_getScreenHeightDp(window->android->config);
|
||||
if (heightDensity == ACONFIGURATION_SCREEN_HEIGHT_DP_ANY)
|
||||
{
|
||||
*yscale = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
int32_t heightPixels = ANativeWindow_getHeight(window->android->window);
|
||||
*yscale = (float)heightPixels / (float)heightDensity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _glfwIconifyWindowAndroid(_GLFWwindow* window)
|
||||
{
|
||||
moveNativeWindowToBackground(window->android->activity);
|
||||
}
|
||||
|
||||
void _glfwRestoreWindowAndroid(_GLFWwindow* window)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwMaximizeWindowAndroid(_GLFWwindow* window)
|
||||
{
|
||||
}
|
||||
|
||||
GLFWbool _glfwWindowMaximizedAndroid(_GLFWwindow* window)
|
||||
{
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
GLFWbool _glfwWindowHoveredAndroid(_GLFWwindow* window)
|
||||
{
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
GLFWbool _glfwFramebufferTransparentAndroid(_GLFWwindow* window)
|
||||
{
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
void _glfwSetWindowResizableAndroid(_GLFWwindow* window, GLFWbool enabled)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwSetWindowDecoratedAndroid(_GLFWwindow* window, GLFWbool enabled)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwSetWindowFloatingAndroid(_GLFWwindow* window, GLFWbool enabled)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwSetWindowMousePassthroughAndroid(_GLFWwindow* window, GLFWbool enabled)
|
||||
{
|
||||
}
|
||||
|
||||
float _glfwGetWindowOpacityAndroid(_GLFWwindow* window)
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
void _glfwSetWindowOpacityAndroid(_GLFWwindow* window, float opacity)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwSetRawMouseMotionAndroid(_GLFWwindow *window, GLFWbool enabled)
|
||||
{
|
||||
}
|
||||
|
||||
GLFWbool _glfwRawMouseMotionSupportedAndroid(void)
|
||||
{
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
void _glfwShowWindowAndroid(_GLFWwindow* window)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwRequestWindowAttentionAndroid(_GLFWwindow* window)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwHideWindowAndroid(_GLFWwindow* window)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwFocusWindowAndroid(_GLFWwindow* window)
|
||||
{
|
||||
}
|
||||
|
||||
GLFWbool _glfwWindowFocusedAndroid(_GLFWwindow* window)
|
||||
{
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
GLFWbool _glfwWindowIconifiedAndroid(_GLFWwindow* window)
|
||||
{
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
GLFWbool _glfwWindowVisibleAndroid(_GLFWwindow* window)
|
||||
{
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
void _glfwPollEventsAndroid(void)
|
||||
{
|
||||
handleEvents(0);
|
||||
}
|
||||
|
||||
void _glfwWaitEventsAndroid(void)
|
||||
{
|
||||
handleEvents(-1);
|
||||
}
|
||||
|
||||
void _glfwWaitEventsTimeoutAndroid(double timeout)
|
||||
{
|
||||
handleEvents(timeout * 1e3);
|
||||
}
|
||||
|
||||
void _glfwPostEmptyEventAndroid(void)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwGetCursorPosAndroid(_GLFWwindow* window, double* xpos, double* ypos)
|
||||
{
|
||||
if (xpos)
|
||||
*xpos = (double)lastCursorPosX;
|
||||
|
||||
if (ypos)
|
||||
*ypos = (double)lastCursorPosY;
|
||||
}
|
||||
|
||||
void _glfwSetCursorPosAndroid(_GLFWwindow* window, double x, double y)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwSetCursorModeAndroid(_GLFWwindow* window, int mode)
|
||||
{
|
||||
}
|
||||
|
||||
GLFWbool _glfwCreateCursorAndroid(_GLFWcursor* cursor,
|
||||
const GLFWimage* image,
|
||||
int xhot, int yhot)
|
||||
{
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
GLFWbool _glfwCreateStandardCursorAndroid(_GLFWcursor* cursor, int shape)
|
||||
{
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
void _glfwDestroyCursorAndroid(_GLFWcursor* cursor)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwSetCursorAndroid(_GLFWwindow* window, _GLFWcursor* cursor)
|
||||
{
|
||||
}
|
||||
|
||||
void _glfwSetClipboardStringAndroid(const char* string)
|
||||
{
|
||||
}
|
||||
|
||||
const char* _glfwGetClipboardStringAndroid(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* _glfwGetScancodeNameAndroid(int scancode)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int _glfwGetKeyScancodeAndroid(int key)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
EGLenum _glfwGetEGLPlatformAndroid(EGLint** attribs)
|
||||
{
|
||||
if (_glfw.egl.ANGLE_platform_angle)
|
||||
{
|
||||
int type = 0;
|
||||
|
||||
if (_glfw.egl.ANGLE_platform_angle_opengl)
|
||||
{
|
||||
if (_glfw.hints.init.angleType == GLFW_ANGLE_PLATFORM_TYPE_OPENGL)
|
||||
type = EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE;
|
||||
else if (_glfw.hints.init.angleType == GLFW_ANGLE_PLATFORM_TYPE_OPENGLES)
|
||||
type = EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE;
|
||||
}
|
||||
|
||||
if (_glfw.egl.ANGLE_platform_angle_vulkan)
|
||||
{
|
||||
if (_glfw.hints.init.angleType == GLFW_ANGLE_PLATFORM_TYPE_VULKAN)
|
||||
type = EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE;
|
||||
}
|
||||
|
||||
if (type)
|
||||
{
|
||||
*attribs = _glfw_calloc(3, sizeof(EGLint));
|
||||
(*attribs)[0] = EGL_PLATFORM_ANGLE_TYPE_ANGLE;
|
||||
(*attribs)[1] = type;
|
||||
(*attribs)[2] = EGL_NONE;
|
||||
return EGL_PLATFORM_ANGLE_ANGLE;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EGLNativeDisplayType _glfwGetEGLNativeDisplayAndroid(void)
|
||||
{
|
||||
return EGL_DEFAULT_DISPLAY;
|
||||
}
|
||||
|
||||
EGLNativeWindowType _glfwGetEGLNativeWindowAndroid(_GLFWwindow* window)
|
||||
{
|
||||
return ((EGLNativeWindowType) window->android->window);
|
||||
}
|
||||
|
||||
void _glfwGetRequiredInstanceExtensionsAndroid(char** extensions)
|
||||
{
|
||||
if (!_glfw.vk.KHR_surface || !_glfw.vk.KHR_android_surface)
|
||||
return;
|
||||
|
||||
extensions[0] = "VK_KHR_surface";
|
||||
extensions[1] = "VK_KHR_android_surface";
|
||||
}
|
||||
|
||||
GLFWbool _glfwGetPhysicalDevicePresentationSupportAndroid(VkInstance instance,
|
||||
VkPhysicalDevice device,
|
||||
uint32_t queuefamily)
|
||||
{
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
VkResult _glfwCreateWindowSurfaceAndroid(VkInstance instance,
|
||||
_GLFWwindow* window,
|
||||
const VkAllocationCallbacks* allocator,
|
||||
VkSurfaceKHR* surface)
|
||||
{
|
||||
VkResult err;
|
||||
VkAndroidSurfaceCreateInfoKHR sci;
|
||||
PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR;
|
||||
|
||||
vkCreateAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)vkGetInstanceProcAddr(instance, "vkCreateAndroidSurfaceKHR");
|
||||
if (!vkCreateAndroidSurfaceKHR)
|
||||
{
|
||||
_glfwInputError(GLFW_API_UNAVAILABLE,
|
||||
"Android: Vulkan instance missing VK_KHR_android_surface extension");
|
||||
return VK_ERROR_EXTENSION_NOT_PRESENT;
|
||||
}
|
||||
|
||||
memset(&sci, 0, sizeof(sci));
|
||||
sci.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
|
||||
sci.window = window->android->window;
|
||||
|
||||
err = vkCreateAndroidSurfaceKHR(instance, &sci, allocator, surface);
|
||||
if (err)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Android: Failed to create Vulkan surface: %s",
|
||||
_glfwGetVulkanResultString(err));
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
////// GLFW native API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GLFWAPI struct android_app* glfwGetAndroidApp(void)
|
||||
{
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
return _glfw.gstate.app;
|
||||
}
|
||||
@ -884,7 +884,7 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
||||
|
||||
[window->ns.object setContentView:window->ns.view];
|
||||
[window->ns.object makeFirstResponder:window->ns.view];
|
||||
[window->ns.object setTitle:@(wndconfig->title)];
|
||||
[window->ns.object setTitle:@(window->title)];
|
||||
[window->ns.object setDelegate:window->ns.delegate];
|
||||
[window->ns.object setAcceptsMouseMovedEvents:YES];
|
||||
[window->ns.object setRestorable:NO];
|
||||
|
||||
@ -374,6 +374,8 @@ GLFWbool _glfwInitEGL(void)
|
||||
"EGL.dll",
|
||||
#elif defined(_GLFW_COCOA)
|
||||
"libEGL.dylib",
|
||||
#elif defined(_GLFW_ANDROID)
|
||||
"libEGL.so",
|
||||
#elif defined(__CYGWIN__)
|
||||
"libEGL-1.so",
|
||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
@ -773,6 +775,9 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
||||
"libGLES_CM.dll",
|
||||
#elif defined(_GLFW_COCOA)
|
||||
"libGLESv1_CM.dylib",
|
||||
#elif defined(_GLFW_ANDROID)
|
||||
"libGLESv1_CM.so",
|
||||
"libGLES_CM.so",
|
||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
"libGLESv1_CM.so",
|
||||
#else
|
||||
@ -790,6 +795,8 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
||||
"libGLESv2.dll",
|
||||
#elif defined(_GLFW_COCOA)
|
||||
"libGLESv2.dylib",
|
||||
#elif defined(_GLFW_ANDROID)
|
||||
"libGLESv2.so",
|
||||
#elif defined(__CYGWIN__)
|
||||
"libGLESv2-2.so",
|
||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
@ -939,10 +946,32 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle)
|
||||
window->context.source != GLFW_NATIVE_CONTEXT_API)
|
||||
{
|
||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||
return EGL_NO_CONTEXT;
|
||||
return EGL_NO_SURFACE;
|
||||
}
|
||||
}
|
||||
|
||||
return window->context.egl.surface;
|
||||
}
|
||||
|
||||
GLFWAPI int glfwGetEGLConfig(GLFWwindow* handle, EGLConfig* config)
|
||||
{
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
||||
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
assert(config != NULL);
|
||||
|
||||
if (window->context.source != GLFW_EGL_CONTEXT_API)
|
||||
{
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_WAYLAND ||
|
||||
window->context.source != GLFW_NATIVE_CONTEXT_API)
|
||||
{
|
||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
*config = window->context.egl.config;
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -626,6 +626,8 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
window->context.glx.fbconfig = native;
|
||||
|
||||
window->context.makeCurrent = makeContextCurrentGLX;
|
||||
window->context.swapBuffers = swapBuffersGLX;
|
||||
window->context.swapInterval = swapIntervalGLX;
|
||||
@ -719,5 +721,29 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* handle)
|
||||
return window->context.glx.window;
|
||||
}
|
||||
|
||||
GLFWAPI int glfwGetGLXFBConfig(GLFWwindow* handle, GLXFBConfig* config)
|
||||
{
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "GLX: Platform not initialized");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
assert(config != NULL);
|
||||
|
||||
if (window->context.source != GLFW_NATIVE_CONTEXT_API)
|
||||
{
|
||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
*config = window->context.glx.fbconfig;
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
#endif // _GLFW_X11
|
||||
|
||||
|
||||
@ -285,6 +285,7 @@ typedef enum VkStructureType
|
||||
VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000,
|
||||
VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000,
|
||||
VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT = 1000217000,
|
||||
VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000,
|
||||
VK_STRUCTURE_TYPE_HEADLESS_SURFACE_CREATE_INFO_EXT = 1000256000,
|
||||
VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||
} VkStructureType;
|
||||
@ -402,7 +403,6 @@ struct _GLFWwndconfig
|
||||
int ypos;
|
||||
int width;
|
||||
int height;
|
||||
const char* title;
|
||||
GLFWbool resizable;
|
||||
GLFWbool visible;
|
||||
GLFWbool decorated;
|
||||
@ -872,6 +872,7 @@ struct _GLFWlibrary
|
||||
GLFWbool KHR_xlib_surface;
|
||||
GLFWbool KHR_xcb_surface;
|
||||
GLFWbool KHR_wayland_surface;
|
||||
GLFWbool KHR_android_surface;
|
||||
GLFWbool EXT_headless_surface;
|
||||
} vk;
|
||||
|
||||
|
||||
@ -56,6 +56,9 @@ static const struct
|
||||
#if defined(_GLFW_X11)
|
||||
{ GLFW_PLATFORM_X11, _glfwConnectX11 },
|
||||
#endif
|
||||
#if defined(_GLFW_ANDROID)
|
||||
{ GLFW_PLATFORM_ANDROID, _glfwConnectAndroid },
|
||||
#endif
|
||||
};
|
||||
|
||||
GLFWbool _glfwSelectPlatform(int desiredID, _GLFWplatform* platform)
|
||||
@ -68,6 +71,7 @@ GLFWbool _glfwSelectPlatform(int desiredID, _GLFWplatform* platform)
|
||||
desiredID != GLFW_PLATFORM_COCOA &&
|
||||
desiredID != GLFW_PLATFORM_WAYLAND &&
|
||||
desiredID != GLFW_PLATFORM_X11 &&
|
||||
desiredID != GLFW_PLATFORM_ANDROID &&
|
||||
desiredID != GLFW_PLATFORM_NULL)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid platform ID 0x%08X", desiredID);
|
||||
@ -147,6 +151,7 @@ GLFWAPI int glfwPlatformSupported(int platformID)
|
||||
platformID != GLFW_PLATFORM_COCOA &&
|
||||
platformID != GLFW_PLATFORM_WAYLAND &&
|
||||
platformID != GLFW_PLATFORM_X11 &&
|
||||
platformID != GLFW_PLATFORM_ANDROID &&
|
||||
platformID != GLFW_PLATFORM_NULL)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid platform ID 0x%08X", platformID);
|
||||
@ -181,6 +186,9 @@ GLFWAPI const char* glfwGetVersionString(void)
|
||||
#endif
|
||||
#if defined(_GLFW_X11)
|
||||
" X11 GLX"
|
||||
#endif
|
||||
#if defined(_GLFW_ANDROID)
|
||||
" Android"
|
||||
#endif
|
||||
" Null"
|
||||
" EGL"
|
||||
@ -207,4 +215,3 @@ GLFWAPI const char* glfwGetVersionString(void)
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@ -90,6 +90,18 @@
|
||||
#define GLFW_GLX_LIBRARY_CONTEXT_STATE
|
||||
#endif
|
||||
|
||||
#if defined(_GLFW_ANDROID)
|
||||
#include "android_platform.h"
|
||||
#define GLFW_EXPOSE_NATIVE_EGL
|
||||
#else
|
||||
#define GLFW_ANDROID_WINDOW_STATE
|
||||
#define GLFW_ANDROID_MONITOR_STATE
|
||||
#define GLFW_ANDROID_CURSOR_STATE
|
||||
#define GLFW_ANDROID_LIBRARY_WINDOW_STATE
|
||||
#define GLFW_ANDROID_CONTEXT_STATE
|
||||
#define GLFW_ANDROID_LIBRARY_CONTEXT_STATE
|
||||
#endif
|
||||
|
||||
#include "null_joystick.h"
|
||||
|
||||
#if defined(_GLFW_WIN32)
|
||||
@ -106,6 +118,13 @@
|
||||
#define GLFW_COCOA_LIBRARY_JOYSTICK_STATE
|
||||
#endif
|
||||
|
||||
#if defined(_GLFW_ANDROID)
|
||||
#include "android_joystick.h"
|
||||
#else
|
||||
#define GLFW_ANDROID_JOYSTICK_STATE
|
||||
#define GLFW_ANDROID_LIBRARY_JOYSTICK_STATE
|
||||
#endif
|
||||
|
||||
#if (defined(_GLFW_X11) || defined(_GLFW_WAYLAND)) && defined(__linux__)
|
||||
#define GLFW_BUILD_LINUX_JOYSTICK
|
||||
#endif
|
||||
@ -122,6 +141,7 @@
|
||||
GLFW_COCOA_WINDOW_STATE \
|
||||
GLFW_WAYLAND_WINDOW_STATE \
|
||||
GLFW_X11_WINDOW_STATE \
|
||||
GLFW_ANDROID_WINDOW_STATE \
|
||||
GLFW_NULL_WINDOW_STATE \
|
||||
|
||||
#define GLFW_PLATFORM_MONITOR_STATE \
|
||||
@ -129,6 +149,7 @@
|
||||
GLFW_COCOA_MONITOR_STATE \
|
||||
GLFW_WAYLAND_MONITOR_STATE \
|
||||
GLFW_X11_MONITOR_STATE \
|
||||
GLFW_ANDROID_MONITOR_STATE \
|
||||
GLFW_NULL_MONITOR_STATE \
|
||||
|
||||
#define GLFW_PLATFORM_CURSOR_STATE \
|
||||
@ -136,11 +157,13 @@
|
||||
GLFW_COCOA_CURSOR_STATE \
|
||||
GLFW_WAYLAND_CURSOR_STATE \
|
||||
GLFW_X11_CURSOR_STATE \
|
||||
GLFW_ANDROID_CURSOR_STATE \
|
||||
GLFW_NULL_CURSOR_STATE \
|
||||
|
||||
#define GLFW_PLATFORM_JOYSTICK_STATE \
|
||||
GLFW_WIN32_JOYSTICK_STATE \
|
||||
GLFW_COCOA_JOYSTICK_STATE \
|
||||
GLFW_ANDROID_JOYSTICK_STATE \
|
||||
GLFW_LINUX_JOYSTICK_STATE
|
||||
|
||||
#define GLFW_PLATFORM_LIBRARY_WINDOW_STATE \
|
||||
@ -148,12 +171,14 @@
|
||||
GLFW_COCOA_LIBRARY_WINDOW_STATE \
|
||||
GLFW_WAYLAND_LIBRARY_WINDOW_STATE \
|
||||
GLFW_X11_LIBRARY_WINDOW_STATE \
|
||||
GLFW_NULL_LIBRARY_WINDOW_STATE \
|
||||
GLFW_ANDROID_LIBRARY_WINDOW_STATE \
|
||||
GLFW_NULL_LIBRARY_WINDOW_STATE
|
||||
|
||||
#define GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \
|
||||
GLFW_WIN32_LIBRARY_JOYSTICK_STATE \
|
||||
GLFW_COCOA_LIBRARY_JOYSTICK_STATE \
|
||||
GLFW_LINUX_LIBRARY_JOYSTICK_STATE
|
||||
GLFW_LINUX_LIBRARY_JOYSTICK_STATE \
|
||||
GLFW_ANDROID_LIBRARY_JOYSTICK_STATE
|
||||
|
||||
#define GLFW_PLATFORM_CONTEXT_STATE \
|
||||
GLFW_WGL_CONTEXT_STATE \
|
||||
|
||||
@ -61,6 +61,8 @@ GLFWbool _glfwInitVulkan(int mode)
|
||||
_glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.1.dylib");
|
||||
if (!_glfw.vk.handle)
|
||||
_glfw.vk.handle = _glfwLoadLocalVulkanLoaderCocoa();
|
||||
#elif defined(_GLFW_ANDROID)
|
||||
_glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.so");
|
||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
_glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.so");
|
||||
#else
|
||||
@ -142,6 +144,8 @@ GLFWbool _glfwInitVulkan(int mode)
|
||||
_glfw.vk.KHR_xcb_surface = GLFW_TRUE;
|
||||
else if (strcmp(ep[i].extensionName, "VK_KHR_wayland_surface") == 0)
|
||||
_glfw.vk.KHR_wayland_surface = GLFW_TRUE;
|
||||
else if (strcmp(ep[i].extensionName, "VK_KHR_android_surface") == 0)
|
||||
_glfw.vk.KHR_android_surface = GLFW_TRUE;
|
||||
else if (strcmp(ep[i].extensionName, "VK_EXT_headless_surface") == 0)
|
||||
_glfw.vk.EXT_headless_surface = GLFW_TRUE;
|
||||
}
|
||||
|
||||
@ -1377,7 +1377,7 @@ static int createNativeWindow(_GLFWwindow* window,
|
||||
frameHeight = rect.bottom - rect.top;
|
||||
}
|
||||
|
||||
wideTitle = _glfwCreateWideStringFromUTF8Win32(wndconfig->title);
|
||||
wideTitle = _glfwCreateWideStringFromUTF8Win32(window->title);
|
||||
if (!wideTitle)
|
||||
return GLFW_FALSE;
|
||||
|
||||
|
||||
@ -208,7 +208,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
||||
|
||||
wndconfig.width = width;
|
||||
wndconfig.height = height;
|
||||
wndconfig.title = title;
|
||||
ctxconfig.share = (_GLFWwindow*) share;
|
||||
|
||||
if (!_glfwIsValidContextConfig(&ctxconfig))
|
||||
|
||||
@ -470,6 +470,7 @@ typedef struct _GLFWcontextGLX
|
||||
{
|
||||
GLXContext handle;
|
||||
GLXWindow window;
|
||||
GLXFBConfig fbconfig;
|
||||
} _GLFWcontextGLX;
|
||||
|
||||
// GLX-specific global data
|
||||
|
||||
@ -754,13 +754,13 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
||||
const char* resourceName = getenv("RESOURCE_NAME");
|
||||
if (resourceName && strlen(resourceName))
|
||||
hint->res_name = (char*) resourceName;
|
||||
else if (strlen(wndconfig->title))
|
||||
hint->res_name = (char*) wndconfig->title;
|
||||
else if (strlen(window->title))
|
||||
hint->res_name = (char*) window->title;
|
||||
else
|
||||
hint->res_name = (char*) "glfw-application";
|
||||
|
||||
if (strlen(wndconfig->title))
|
||||
hint->res_class = (char*) wndconfig->title;
|
||||
if (strlen(window->title))
|
||||
hint->res_class = (char*) window->title;
|
||||
else
|
||||
hint->res_class = (char*) "GLFW-Application";
|
||||
}
|
||||
@ -780,7 +780,7 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
|
||||
if (_glfw.x11.im)
|
||||
_glfwCreateInputContextX11(window);
|
||||
|
||||
_glfwSetWindowTitleX11(window, wndconfig->title);
|
||||
_glfwSetWindowTitleX11(window, window->title);
|
||||
_glfwGetWindowPosX11(window, &window->x11.xpos, &window->x11.ypos);
|
||||
_glfwGetWindowSizeX11(window, &window->x11.width, &window->x11.height);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user