Merge branch 'glfw:master' into taskbar-progress

This commit is contained in:
GamesTrap 2025-09-23 19:11:16 +02:00
commit 7d23b3c6c1
No known key found for this signature in database
GPG Key ID: 31DFD452434ECDA3
39 changed files with 694 additions and 3442 deletions

View File

@ -29,7 +29,7 @@ for:
only: only:
- GENERATOR: MinGW Makefiles - GENERATOR: MinGW Makefiles
build_script: build_script:
- set PATH=%PATH:C:\Program Files\Git\usr\bin=C:\MinGW\bin% - set PATH=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH:C:\Program Files\Git\usr\bin=%
- cmake -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% - cmake -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
- cmake --build build - cmake --build build
- -

View File

@ -41,12 +41,6 @@ indent_size = 2
indent_style = tab indent_style = tab
indent_size = unset indent_size = unset
[deps/mingw/*.h]
indent_style = space
indent_size = 4
tab_width = 8
trim_trailing_whitespace = false
[deps/getopt.{c,h}] [deps/getopt.{c,h}]
indent_style = space indent_style = space
indent_size = 2 indent_size = 2

View File

@ -1,6 +1,8 @@
# Usage: # Usage:
# cmake -P GenerateMappings.cmake <path/to/mappings.h.in> <path/to/mappings.h> # cmake -P GenerateMappings.cmake <path/to/mappings.h.in> <path/to/mappings.h>
cmake_policy(VERSION 3.16)
set(source_url "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt") set(source_url "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt")
set(source_path "${CMAKE_CURRENT_BINARY_DIR}/gamecontrollerdb.txt") set(source_path "${CMAKE_CURRENT_BINARY_DIR}/gamecontrollerdb.txt")
set(template_path "${CMAKE_ARGV3}") set(template_path "${CMAKE_ARGV3}")
@ -22,24 +24,24 @@ if (status_code)
endif() endif()
file(STRINGS "${source_path}" lines) file(STRINGS "${source_path}" lines)
foreach(line ${lines}) list(FILTER lines INCLUDE REGEX "^[0-9a-fA-F]")
if (line MATCHES "^[0-9a-fA-F]")
if (line MATCHES "platform:Windows") foreach(line IN LISTS lines)
if (GLFW_WIN32_MAPPINGS) if (line MATCHES "platform:Windows")
string(APPEND GLFW_WIN32_MAPPINGS "\n") if (GLFW_WIN32_MAPPINGS)
endif() string(APPEND GLFW_WIN32_MAPPINGS "\n")
string(APPEND GLFW_WIN32_MAPPINGS "\"${line}\",")
elseif (line MATCHES "platform:Mac OS X")
if (GLFW_COCOA_MAPPINGS)
string(APPEND GLFW_COCOA_MAPPINGS "\n")
endif()
string(APPEND GLFW_COCOA_MAPPINGS "\"${line}\",")
elseif (line MATCHES "platform:Linux")
if (GLFW_LINUX_MAPPINGS)
string(APPEND GLFW_LINUX_MAPPINGS "\n")
endif()
string(APPEND GLFW_LINUX_MAPPINGS "\"${line}\",")
endif() endif()
string(APPEND GLFW_WIN32_MAPPINGS "\"${line}\",")
elseif (line MATCHES "platform:Mac OS X")
if (GLFW_COCOA_MAPPINGS)
string(APPEND GLFW_COCOA_MAPPINGS "\n")
endif()
string(APPEND GLFW_COCOA_MAPPINGS "\"${line}\",")
elseif (line MATCHES "platform:Linux")
if (GLFW_LINUX_MAPPINGS)
string(APPEND GLFW_LINUX_MAPPINGS "\n")
endif()
string(APPEND GLFW_LINUX_MAPPINGS "\"${line}\",")
endif() endif()
endforeach() endforeach()

View File

@ -1,18 +0,0 @@
# Try to find OSMesa on a Unix system
#
# This will define:
#
# OSMESA_LIBRARIES - Link these to use OSMesa
# OSMESA_INCLUDE_DIR - Include directory for OSMesa
#
# Copyright (c) 2014 Brandon Schaefer <brandon.schaefer@canonical.com>
if (NOT WIN32)
find_package (PkgConfig)
pkg_check_modules (PKG_OSMESA QUIET osmesa)
set (OSMESA_INCLUDE_DIR ${PKG_OSMESA_INCLUDE_DIRS})
set (OSMESA_LIBRARIES ${PKG_OSMESA_LIBRARIES})
endif ()

View File

@ -1,14 +1,6 @@
cmake_minimum_required(VERSION 3.4...3.28 FATAL_ERROR) cmake_minimum_required(VERSION 3.16...3.28 FATAL_ERROR)
project(GLFW VERSION 3.5.0 LANGUAGES C) project(GLFW VERSION 3.5.0 LANGUAGES C HOMEPAGE_URL "https://www.glfw.org/")
if (POLICY CMP0069)
cmake_policy(SET CMP0069 NEW)
endif()
if (POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
@ -80,24 +72,7 @@ endif()
# This is here because it also applies to tests and examples # This is here because it also applies to tests and examples
#-------------------------------------------------------------------- #--------------------------------------------------------------------
if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL) if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
if (CMAKE_VERSION VERSION_LESS 3.15) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
foreach (flag CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELWITHDEBINFO)
if (flag MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
endif()
if (flag MATCHES "/MDd")
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
endif()
endforeach()
else()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
endif() endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------

View File

@ -23,6 +23,7 @@ video tutorials.
- Denis Bernard - Denis Bernard
- BiBi - BiBi
- Doug Binks - Doug Binks
- bitb4ker
- blanco - blanco
- Waris Boonyasiriwat - Waris Boonyasiriwat
- Kyle Brenneman - Kyle Brenneman
@ -55,6 +56,7 @@ video tutorials.
- Jason Daly - Jason Daly
- danhambleton - danhambleton
- Jarrod Davis - Jarrod Davis
- decce
- Olivier Delannoy - Olivier Delannoy
- Paul R. Deppe - Paul R. Deppe
- Michael Dickens - Michael Dickens
@ -67,6 +69,8 @@ video tutorials.
- Robin Eklind - Robin Eklind
- Jan Ekström - Jan Ekström
- Siavash Eliasi - Siavash Eliasi
- er-azh
- Jan Hendrik Farr
- Ahmad Fatoum - Ahmad Fatoum
- Nikita Fediuchin - Nikita Fediuchin
- Felipe Ferreira - Felipe Ferreira
@ -121,6 +125,7 @@ video tutorials.
- Josh Kilmer - Josh Kilmer
- Byunghoon Kim - Byunghoon Kim
- Cameron King - Cameron King
- knokko
- Peter Knut - Peter Knut
- Christoph Kubisch - Christoph Kubisch
- Yuri Kunde Schlesner - Yuri Kunde Schlesner
@ -230,7 +235,7 @@ video tutorials.
- Sebastian Schuberth - Sebastian Schuberth
- Jan Schuerkamp - Jan Schuerkamp
- Scr3amer - Scr3amer
- Jan Schuerkamp - Jan Schürkamp
- Christian Sdunek - Christian Sdunek
- Matt Sealey - Matt Sealey
- Steve Sexton - Steve Sexton

147
README.md
View File

@ -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 application development. It provides a simple, platform-independent API for
creating windows, contexts and surfaces, reading input, handling events, etc. creating windows, contexts and surfaces, reading input, handling events, etc.
GLFW natively supports Windows, macOS and Linux and other Unix-like systems. On GLFW is written primarily in C99, with parts of macOS support being written in
Linux both Wayland and X11 are supported. 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 GLFW is licensed under the [zlib/libpng
license](https://www.glfw.org/license.html). license](https://www.glfw.org/license.html).
You can [download](https://www.glfw.org/download.html) the latest stable release 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 as source or Windows and macOS binaries. There are [release
a corresponding [annotated tag](https://github.com/glfw/glfw/releases) with tags](https://github.com/glfw/glfw/releases) with source and binary archives
source and binary archives. attached for every version since 3.0.
The [documentation](https://www.glfw.org/docs/latest/) is available online and is The [documentation](https://www.glfw.org/docs/latest/) is available online and is
included in all source and binary archives. See the [release also included in source and binary archives, except those generated
notes](https://www.glfw.org/docs/latest/news.html) for new features, caveats and automatically by Github. The documentation contains guides, a tutorial and the
deprecations in the latest release. For more details see the [version API reference. The [release
history](https://www.glfw.org/changelog.html). notes](https://www.glfw.org/docs/latest/news.html) list the new features,
caveats and deprecations in the latest release. The [version
The `master` branch is the stable integration branch and _should_ always compile history](https://www.glfw.org/changelog.html) lists every user-visible change
and run on all supported platforms, although details of newly added features may for every release.
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.
GLFW exists because of the contributions of [many people](CONTRIBUTORS.md) GLFW exists because of the contributions of [many people](CONTRIBUTORS.md)
around the world, whether by reporting bugs, providing community support, adding 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. 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, MinGW 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 ## System requirements
GLFW supports Windows XP and later and macOS 10.11 and later. Linux and other GLFW supports Windows 7 and later and macOS 10.11 and later. On GNOME Wayland,
Unix-like systems running the X Window System are supported even without window decorations will be very basic unless the
a desktop environment or modern extensions, although some features require [libdecor](https://gitlab.freedesktop.org/libdecor/libdecor) package is
a running window or clipboard manager. The OSMesa backend requires Mesa 6.3. 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) 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.4 or later and the headers and libraries for your GLFW supports compilation with Visual C++ (2013 and later), GCC and Clang. Both
OS and window system. 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 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 - [getopt\_port](https://github.com/kimgr/getopt_port/) for examples
with command-line options 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 - [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 - [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 The documentation is generated with [Doxygen](https://doxygen.org/) when the
find that tool. 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 ## Reporting bugs
@ -124,11 +123,29 @@ information on what to include when reporting a bug.
- Added `glfwSetWindowProgressIndicator` for displaying progress on the dock or taskbar (#2286,#1183) - Added `glfwSetWindowProgressIndicator` for displaying progress on the dock or taskbar (#2286,#1183)
- Added `GLFW_UNLIMITED_MOUSE_BUTTONS` input mode that allows mouse buttons beyond - Added `GLFW_UNLIMITED_MOUSE_BUTTONS` input mode that allows mouse buttons beyond
the limit of the mouse button tokens to be reported (#2423) 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)
- [Cocoa] Added `QuartzCore` framework as link-time dependency - [Cocoa] Added `QuartzCore` framework as link-time dependency
- [Cocoa] Removed support for OS X 10.10 Yosemite and earlier (#2506) - [Cocoa] Removed support for OS X 10.10 Yosemite and earlier (#2506)
- [Wayland] Bugfix: The fractional scaling related objects were not destroyed - [Wayland] Bugfix: The fractional scaling related objects were not destroyed
- [Wayland] Bugfix: `glfwInit` would segfault on compositor with no seat (#2517) - [Wayland] Bugfix: `glfwInit` would segfault on compositor with no seat (#2517)
- [Wayland] Bugfix: A drag entering a non-GLFW surface could cause a segfault - [Wayland] Bugfix: A drag entering a non-GLFW surface could cause a segfault
- [Wayland] Bugfix: Ignore key repeat events when no window has keyboard focus (#2727)
- [Wayland] Bugfix: Reset key repeat timer when window destroyed (#2741,#2727)
- [Wayland] Bugfix: Memory would leak if reading a data offer failed midway
- [Wayland] Bugfix: Retrieved cursor position would be incorrect when hovering over
fallback decorations
- [Wayland] Bugfix: Fallback decorations would report scroll events
- [Wayland] Bugfix: Keyboard repeat events halted when any key is released (#2568)
- [Wayland] Bugfix: Fallback decorations would show menu at wrong position
- [Wayland] Bugfix: The cursor was not updated when clicking through from
a modal to a fallback decoration
- [Wayland] Bugfix: The cursor position was not updated when clicking through
from a modal to the content area
- [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631)
- [Null] Added Vulkan 'window' surface creation via `VK_EXT_headless_surface` - [Null] Added Vulkan 'window' surface creation via `VK_EXT_headless_surface`
- [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless` - [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless`
- [EGL] Allowed native access on Wayland with `GLFW_CONTEXT_CREATION_API` set to - [EGL] Allowed native access on Wayland with `GLFW_CONTEXT_CREATION_API` set to

View File

@ -1,117 +0,0 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
#define NONAMELESSUNION 1
#endif
#if defined(NONAMELESSSTRUCT) && \
!defined(NONAMELESSUNION)
#define NONAMELESSUNION 1
#endif
#if defined(NONAMELESSUNION) && \
!defined(NONAMELESSSTRUCT)
#define NONAMELESSSTRUCT 1
#endif
#if !defined(__GNU_EXTENSION)
#if defined(__GNUC__) || defined(__GNUG__)
#define __GNU_EXTENSION __extension__
#else
#define __GNU_EXTENSION
#endif
#endif /* __extension__ */
#ifndef __ANONYMOUS_DEFINED
#define __ANONYMOUS_DEFINED
#if defined(__GNUC__) || defined(__GNUG__)
#define _ANONYMOUS_UNION __extension__
#define _ANONYMOUS_STRUCT __extension__
#else
#define _ANONYMOUS_UNION
#define _ANONYMOUS_STRUCT
#endif
#ifndef NONAMELESSUNION
#define _UNION_NAME(x)
#define _STRUCT_NAME(x)
#else /* NONAMELESSUNION */
#define _UNION_NAME(x) x
#define _STRUCT_NAME(x) x
#endif
#endif /* __ANONYMOUS_DEFINED */
#ifndef DUMMYUNIONNAME
# ifdef NONAMELESSUNION
# define DUMMYUNIONNAME u
# define DUMMYUNIONNAME1 u1 /* Wine uses this variant */
# define DUMMYUNIONNAME2 u2
# define DUMMYUNIONNAME3 u3
# define DUMMYUNIONNAME4 u4
# define DUMMYUNIONNAME5 u5
# define DUMMYUNIONNAME6 u6
# define DUMMYUNIONNAME7 u7
# define DUMMYUNIONNAME8 u8
# define DUMMYUNIONNAME9 u9
# else /* NONAMELESSUNION */
# define DUMMYUNIONNAME
# define DUMMYUNIONNAME1 /* Wine uses this variant */
# define DUMMYUNIONNAME2
# define DUMMYUNIONNAME3
# define DUMMYUNIONNAME4
# define DUMMYUNIONNAME5
# define DUMMYUNIONNAME6
# define DUMMYUNIONNAME7
# define DUMMYUNIONNAME8
# define DUMMYUNIONNAME9
# endif
#endif /* DUMMYUNIONNAME */
#if !defined(DUMMYUNIONNAME1) /* MinGW does not define this one */
# ifdef NONAMELESSUNION
# define DUMMYUNIONNAME1 u1 /* Wine uses this variant */
# else
# define DUMMYUNIONNAME1 /* Wine uses this variant */
# endif
#endif /* DUMMYUNIONNAME1 */
#ifndef DUMMYSTRUCTNAME
# ifdef NONAMELESSUNION
# define DUMMYSTRUCTNAME s
# define DUMMYSTRUCTNAME1 s1 /* Wine uses this variant */
# define DUMMYSTRUCTNAME2 s2
# define DUMMYSTRUCTNAME3 s3
# define DUMMYSTRUCTNAME4 s4
# define DUMMYSTRUCTNAME5 s5
# else
# define DUMMYSTRUCTNAME
# define DUMMYSTRUCTNAME1 /* Wine uses this variant */
# define DUMMYSTRUCTNAME2
# define DUMMYSTRUCTNAME3
# define DUMMYSTRUCTNAME4
# define DUMMYSTRUCTNAME5
# endif
#endif /* DUMMYSTRUCTNAME */
/* These are for compatibility with the Wine source tree */
#ifndef WINELIB_NAME_AW
# ifdef __MINGW_NAME_AW
# define WINELIB_NAME_AW __MINGW_NAME_AW
# else
# ifdef UNICODE
# define WINELIB_NAME_AW(func) func##W
# else
# define WINELIB_NAME_AW(func) func##A
# endif
# endif
#endif /* WINELIB_NAME_AW */
#ifndef DECL_WINELIB_TYPE_AW
# ifdef __MINGW_TYPEDEF_AW
# define DECL_WINELIB_TYPE_AW __MINGW_TYPEDEF_AW
# else
# define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
# endif
#endif /* DECL_WINELIB_TYPE_AW */

2467
deps/mingw/dinput.h vendored

File diff suppressed because it is too large Load Diff

239
deps/mingw/xinput.h vendored
View File

@ -1,239 +0,0 @@
/*
* The Wine project - Xinput Joystick Library
* Copyright 2008 Andrew Fenn
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_XINPUT_H
#define __WINE_XINPUT_H
#include <windef.h>
/*
* Bitmasks for the joysticks buttons, determines what has
* been pressed on the joystick, these need to be mapped
* to whatever device you're using instead of an xbox 360
* joystick
*/
#define XINPUT_GAMEPAD_DPAD_UP 0x0001
#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
#define XINPUT_GAMEPAD_START 0x0010
#define XINPUT_GAMEPAD_BACK 0x0020
#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
#define XINPUT_GAMEPAD_A 0x1000
#define XINPUT_GAMEPAD_B 0x2000
#define XINPUT_GAMEPAD_X 0x4000
#define XINPUT_GAMEPAD_Y 0x8000
/*
* Defines the flags used to determine if the user is pushing
* down on a button, not holding a button, etc
*/
#define XINPUT_KEYSTROKE_KEYDOWN 0x0001
#define XINPUT_KEYSTROKE_KEYUP 0x0002
#define XINPUT_KEYSTROKE_REPEAT 0x0004
/*
* Defines the codes which are returned by XInputGetKeystroke
*/
#define VK_PAD_A 0x5800
#define VK_PAD_B 0x5801
#define VK_PAD_X 0x5802
#define VK_PAD_Y 0x5803
#define VK_PAD_RSHOULDER 0x5804
#define VK_PAD_LSHOULDER 0x5805
#define VK_PAD_LTRIGGER 0x5806
#define VK_PAD_RTRIGGER 0x5807
#define VK_PAD_DPAD_UP 0x5810
#define VK_PAD_DPAD_DOWN 0x5811
#define VK_PAD_DPAD_LEFT 0x5812
#define VK_PAD_DPAD_RIGHT 0x5813
#define VK_PAD_START 0x5814
#define VK_PAD_BACK 0x5815
#define VK_PAD_LTHUMB_PRESS 0x5816
#define VK_PAD_RTHUMB_PRESS 0x5817
#define VK_PAD_LTHUMB_UP 0x5820
#define VK_PAD_LTHUMB_DOWN 0x5821
#define VK_PAD_LTHUMB_RIGHT 0x5822
#define VK_PAD_LTHUMB_LEFT 0x5823
#define VK_PAD_LTHUMB_UPLEFT 0x5824
#define VK_PAD_LTHUMB_UPRIGHT 0x5825
#define VK_PAD_LTHUMB_DOWNRIGHT 0x5826
#define VK_PAD_LTHUMB_DOWNLEFT 0x5827
#define VK_PAD_RTHUMB_UP 0x5830
#define VK_PAD_RTHUMB_DOWN 0x5831
#define VK_PAD_RTHUMB_RIGHT 0x5832
#define VK_PAD_RTHUMB_LEFT 0x5833
#define VK_PAD_RTHUMB_UPLEFT 0x5834
#define VK_PAD_RTHUMB_UPRIGHT 0x5835
#define VK_PAD_RTHUMB_DOWNRIGHT 0x5836
#define VK_PAD_RTHUMB_DOWNLEFT 0x5837
/*
* Deadzones are for analogue joystick controls on the joypad
* which determine when input should be assumed to be in the
* middle of the pad. This is a threshold to stop a joypad
* controlling the game when the player isn't touching the
* controls.
*/
#define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849
#define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689
#define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30
/*
* Defines what type of abilities the type of joystick has
* DEVTYPE_GAMEPAD is available for all joysticks, however
* there may be more specific identifiers for other joysticks
* which are being used.
*/
#define XINPUT_DEVTYPE_GAMEPAD 0x01
#define XINPUT_DEVSUBTYPE_GAMEPAD 0x01
#define XINPUT_DEVSUBTYPE_WHEEL 0x02
#define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03
#define XINPUT_DEVSUBTYPE_FLIGHT_SICK 0x04
#define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05
#define XINPUT_DEVSUBTYPE_GUITAR 0x06
#define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08
/*
* These are used with the XInputGetCapabilities function to
* determine the abilities to the joystick which has been
* plugged in.
*/
#define XINPUT_CAPS_VOICE_SUPPORTED 0x0004
#define XINPUT_FLAG_GAMEPAD 0x00000001
/*
* Defines the status of the battery if one is used in the
* attached joystick. The first two define if the joystick
* supports a battery. Disconnected means that the joystick
* isn't connected. Wired shows that the joystick is a wired
* joystick.
*/
#define BATTERY_DEVTYPE_GAMEPAD 0x00
#define BATTERY_DEVTYPE_HEADSET 0x01
#define BATTERY_TYPE_DISCONNECTED 0x00
#define BATTERY_TYPE_WIRED 0x01
#define BATTERY_TYPE_ALKALINE 0x02
#define BATTERY_TYPE_NIMH 0x03
#define BATTERY_TYPE_UNKNOWN 0xFF
#define BATTERY_LEVEL_EMPTY 0x00
#define BATTERY_LEVEL_LOW 0x01
#define BATTERY_LEVEL_MEDIUM 0x02
#define BATTERY_LEVEL_FULL 0x03
/*
* How many joysticks can be used with this library. Games that
* use the xinput library will not go over this number.
*/
#define XUSER_MAX_COUNT 4
#define XUSER_INDEX_ANY 0x000000FF
/*
* Defines the structure of an xbox 360 joystick.
*/
typedef struct _XINPUT_GAMEPAD {
WORD wButtons;
BYTE bLeftTrigger;
BYTE bRightTrigger;
SHORT sThumbLX;
SHORT sThumbLY;
SHORT sThumbRX;
SHORT sThumbRY;
} XINPUT_GAMEPAD, *PXINPUT_GAMEPAD;
typedef struct _XINPUT_STATE {
DWORD dwPacketNumber;
XINPUT_GAMEPAD Gamepad;
} XINPUT_STATE, *PXINPUT_STATE;
/*
* Defines the structure of how much vibration is set on both the
* right and left motors in a joystick. If you're not using a 360
* joystick you will have to map these to your device.
*/
typedef struct _XINPUT_VIBRATION {
WORD wLeftMotorSpeed;
WORD wRightMotorSpeed;
} XINPUT_VIBRATION, *PXINPUT_VIBRATION;
/*
* Defines the structure for what kind of abilities the joystick has
* such abilities are things such as if the joystick has the ability
* to send and receive audio, if the joystick is in fact a driving
* wheel or perhaps if the joystick is some kind of dance pad or
* guitar.
*/
typedef struct _XINPUT_CAPABILITIES {
BYTE Type;
BYTE SubType;
WORD Flags;
XINPUT_GAMEPAD Gamepad;
XINPUT_VIBRATION Vibration;
} XINPUT_CAPABILITIES, *PXINPUT_CAPABILITIES;
/*
* Defines the structure for a joystick input event which is
* retrieved using the function XInputGetKeystroke
*/
typedef struct _XINPUT_KEYSTROKE {
WORD VirtualKey;
WCHAR Unicode;
WORD Flags;
BYTE UserIndex;
BYTE HidCode;
} XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE;
typedef struct _XINPUT_BATTERY_INFORMATION
{
BYTE BatteryType;
BYTE BatteryLevel;
} XINPUT_BATTERY_INFORMATION, *PXINPUT_BATTERY_INFORMATION;
#ifdef __cplusplus
extern "C" {
#endif
void WINAPI XInputEnable(WINBOOL);
DWORD WINAPI XInputSetState(DWORD, XINPUT_VIBRATION*);
DWORD WINAPI XInputGetState(DWORD, XINPUT_STATE*);
DWORD WINAPI XInputGetKeystroke(DWORD, DWORD, PXINPUT_KEYSTROKE);
DWORD WINAPI XInputGetCapabilities(DWORD, DWORD, XINPUT_CAPABILITIES*);
DWORD WINAPI XInputGetDSoundAudioDeviceGuids(DWORD, GUID*, GUID*);
DWORD WINAPI XInputGetBatteryInformation(DWORD, BYTE, XINPUT_BATTERY_INFORMATION*);
#ifdef __cplusplus
}
#endif
#endif /* __WINE_XINPUT_H */

5
deps/nuklear.h vendored
View File

@ -423,6 +423,11 @@ NK_STATIC_ASSERT(sizeof(nk_rune) >= 4);
NK_STATIC_ASSERT(sizeof(nk_size) >= sizeof(void*)); NK_STATIC_ASSERT(sizeof(nk_size) >= sizeof(void*));
NK_STATIC_ASSERT(sizeof(nk_ptr) >= sizeof(void*)); NK_STATIC_ASSERT(sizeof(nk_ptr) >= sizeof(void*));
#if defined(_MSC_VER)
/* disable `operands are different enum types` warning on MSVC */
#pragma warning( disable: 5287 )
#endif
/* ============================================================================ /* ============================================================================
* *
* API * API

View File

@ -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 # NOTE: The order of this list determines the order of items in the Guides
# (i.e. Pages) list in the generated documentation # (i.e. Pages) list in the generated documentation
set(source_files set(source_files
@ -32,10 +36,10 @@ foreach(file IN LISTS source_files)
endforeach() endforeach()
set(DOXYGEN_SKIP_DOT TRUE) 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") if (NOT DOXYGEN_FOUND)
message(STATUS "Documentation generation requires Doxygen 1.9.8 or later") message(STATUS "Documentation generation requires Doxygen ${MINIMUM_DOXYGEN_VERSION} or later")
else() else()
configure_file(Doxyfile.in Doxyfile @ONLY) configure_file(Doxyfile.in Doxyfile @ONLY)
add_custom_command(OUTPUT "html/index.html" add_custom_command(OUTPUT "html/index.html"
@ -46,7 +50,7 @@ else()
COMMENT "Generating HTML documentation" COMMENT "Generating HTML documentation"
VERBATIM) 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") set_target_properties(docs PROPERTIES FOLDER "GLFW3")
if (GLFW_INSTALL) if (GLFW_INSTALL)

View File

@ -278,13 +278,7 @@ ALIASES = "thread_safety=@par Thread safety^^" \
"analysis=@par Analysis^^" \ "analysis=@par Analysis^^" \
"reentrancy=@par Reentrancy^^" \ "reentrancy=@par Reentrancy^^" \
"errors=@par Errors^^" \ "errors=@par Errors^^" \
"callback_signature=@par Callback signature^^" \ "callback_signature=@par Callback signature^^"
"glfw3=__GLFW 3:__" \
"x11=__X11:__" \
"wayland=__Wayland:__" \
"win32=__Windows:__" \
"macos=__macOS:__" \
"linux=__Linux:__"
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # 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 # only. Doxygen will then generate output that is more tailored for C. For

View File

@ -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 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. additional copying may be performed for each buffer swap of full screen windows.
GLFW uses the [clipboard manager protocol][ClipboardManager] to push a clipboard GLFW uses the [clipboard manager protocol][ClipboardManager] to keep the
string (i.e. selection) owned by a GLFW window about to be destroyed to the clipboard string availble for the user after the libary has been terminated. If
clipboard manager. If there is no running clipboard manager, the clipboard there is no running clipboard manager and the clipboard contents has been set
string will be unavailable once the window has been destroyed. with @ref glfwSetClipboardString, the clipboard will be emptied when the library
is terminated.
[clipboardManager]: https://www.freedesktop.org/wiki/ClipboardManager/ [clipboardManager]: https://www.freedesktop.org/wiki/ClipboardManager/

View File

@ -36,9 +36,9 @@ specific to GLFW. It may be a useful companion to this one.
### Installing dependencies {#compile_deps} ### Installing dependencies {#compile_deps}
The C/C++ development environments in Visual Studio, Xcode and MinGW come with The C/C++ development environments in Visual Studio, Xcode and MinGW-w64 come
all necessary dependencies for compiling GLFW, but on Unix-like systems like with all necessary dependencies for compiling GLFW, but on Unix-like systems
Linux and FreeBSD you will need a few extra packages. like Linux and FreeBSD you will need a few extra packages.
#### Dependencies for Wayland and X11 {#compile_deps_wayland} #### Dependencies for Wayland and X11 {#compile_deps_wayland}
@ -180,7 +180,7 @@ cd path/to/build
make make
``` ```
With MinGW, it is `mingw32-make`. With MinGW-w64, it is `mingw32-make`.
```sh ```sh
cd path/to/build cd path/to/build
@ -264,8 +264,8 @@ __USE_MSVC_RUNTIME_LIBRARY_DLL__ determines whether to use the DLL version or th
static library version of the Visual C++ runtime library. When enabled, the static library version of the Visual C++ runtime library. When enabled, the
DLL version of the Visual C++ library is used. This is enabled by default. DLL version of the Visual C++ library is used. This is enabled by default.
On CMake 3.15 and later you can set the standard CMake [CMAKE_MSVC_RUNTIME_LIBRARY][] It is recommended to set the standard CMake variable [CMAKE_MSVC_RUNTIME_LIBRARY][]
variable instead of this GLFW-specific option. instead of this GLFW-specific option.
[CMAKE_MSVC_RUNTIME_LIBRARY]: https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html [CMAKE_MSVC_RUNTIME_LIBRARY]: https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html
@ -299,12 +299,12 @@ library. This option is only available when compiling for Linux and other Unix-
systems other than macOS. This is enabled by default. systems other than macOS. This is enabled by default.
## Cross-compilation with CMake and MinGW {#compile_mingw_cross} ## Cross-compilation with CMake and MinGW-w64 {#compile_mingw_cross}
Both Cygwin and many Linux distributions have MinGW or MinGW-w64 packages. For Both Cygwin and many Linux distributions have MinGW-w64 packages. For example,
example, Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages for 32- and
for 32- and 64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives 64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives like Ubuntu
like Ubuntu have the `mingw-w64` package for both. have the `mingw-w64` package for both.
GLFW has CMake toolchain files in the `CMake` subdirectory that set up GLFW has CMake toolchain files in the `CMake` subdirectory that set up
cross-compilation of Windows binaries. To use these files you set the cross-compilation of Windows binaries. To use these files you set the
@ -315,9 +315,9 @@ configuring and generating the build files.
cmake -S path/to/glfw -B path/to/build -D CMAKE_TOOLCHAIN_FILE=path/to/file cmake -S path/to/glfw -B path/to/build -D CMAKE_TOOLCHAIN_FILE=path/to/file
``` ```
The exact toolchain file to use depends on the prefix used by the MinGW or The exact toolchain file to use depends on the prefix used by the MinGW-w64
MinGW-w64 binaries on your system. You can usually see this in the /usr binaries on your system. You can usually see this in the /usr directory. For
directory. For example, both the Ubuntu and Cygwin MinGW-w64 packages have example, both the Ubuntu and Cygwin MinGW-w64 packages have
`/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct invocation `/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct invocation
would be: would be:

View File

@ -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 allocated by programs that exit, but GLFW sometimes has to change global system
settings and these might not be restored without termination. 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 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 main menu and dock icon can be disabled with the @ref GLFW_COCOA_MENUBAR init
hint. hint.
@ -621,11 +621,11 @@ The format of the string is as follows:
- The names of the always supported context creation APIs EGL and OSMesa - The names of the always supported context creation APIs EGL and OSMesa
- Any additional compile-time options, APIs and (on Windows) what compiler was used - Any additional compile-time options, APIs and (on Windows) what compiler was used
For example, compiling GLFW 3.5 with MinGW as a DLL for Windows, may result in a version string For example, compiling GLFW 3.5 with MinGW-64 as a DLL for Windows, may result
like this: in a version string like this:
```c ```c
3.5.0 Win32 WGL Null EGL OSMesa MinGW DLL 3.5.0 Win32 WGL Null EGL OSMesa MinGW-w64 DLL
``` ```
Compiling GLFW as a static library for Linux, with both Wayland and X11 enabled, may Compiling GLFW as a static library for Linux, with both Wayland and X11 enabled, may

View File

@ -255,3 +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 gamma. This means that setting a perfectly linear ramp, or gamma 1.0, will
produce the default (usually sRGB-like) behavior. 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
emit @ref GLFW_FEATURE_UNAVAILABLE.

View File

@ -14,16 +14,48 @@ values over 8. For compatibility with older versions, the
@ref GLFW_UNLIMITED_MOUSE_BUTTONS input mode needs to be set to make use of @ref GLFW_UNLIMITED_MOUSE_BUTTONS input mode needs to be set to make use of
this. 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} ## Caveats {#caveats}
## Deprecations {#deprecations} ## Deprecations {#deprecations}
## Removals {#removals} ## Removals {#removals}
### Windows XP and Vista support has been removed {#winxp_vista}
Support for Windows XP and Vista has been removed. Windows XP has been out of extended
support since 2014.
### Original MinGW support has been removed {#original_mingw}
Support for the now unmaintained original MinGW distribution has been removed.
This does not apply to the much more capable [MinGW-w64](https://www.mingw-w64.org/),
which remains fully supported. MinGW-w64 can build both 32- and 64-bit binaries, is
actively maintained and available on many platforms.
## New symbols {#new_symbols} ## New symbols {#new_symbols}
### New functions {#new_functions} ### New functions {#new_functions}
- @ref glfwGetEGLConfig
- @ref glfwGetGLXFBConfig
### New types {#new_types} ### New types {#new_types}
### New constants {#new_constants} ### New constants {#new_constants}

View File

@ -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 `vulkan-1.dll` on Windows, `libvulkan.so.1` on Linux and other Unix-like systems and
`libvulkan.1.dylib` on macOS. `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. application bundle.
If your code is using a Vulkan loader with a different name or in a non-standard location 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); 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 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). [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 array, as it is an error to specify an extension more than once in the
`VkInstanceCreateInfo` struct. `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 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_KHR_portability_enumeration` instance extension and set the
`VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR` bit in the instance creation `VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR` bit in the instance creation

View File

@ -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 hint. This can be resolved by having it load functions via @ref
glfwGetProcAddress. 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. 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 APIs in a single process will cause the application to segfault. Stick to one
API or the other on Linux for now. 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 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. 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 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. 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. OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.
@ -893,6 +893,12 @@ int xpos, ypos;
glfwGetWindowPos(window, &xpos, &ypos); glfwGetWindowPos(window, &xpos, &ypos);
``` ```
@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
not be called.
### Window title {#window_title} ### Window title {#window_title}
@ -1038,6 +1044,12 @@ You can also get the current iconification state with @ref glfwGetWindowAttrib.
int iconified = glfwGetWindowAttrib(window, GLFW_ICONIFIED); int iconified = glfwGetWindowAttrib(window, GLFW_ICONIFIED);
``` ```
@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
will be false. The @ref glfwIconifyWindow function works normally.
### Window maximization {#window_maximize} ### Window maximization {#window_maximize}

View File

@ -1228,13 +1228,13 @@ extern "C" {
* The top-left to bottom-right diagonal resize/move shape. This is usually * The top-left to bottom-right diagonal resize/move shape. This is usually
* a diagonal double-headed arrow. * 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. * 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. * 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. * cursor themes.
*/ */
#define GLFW_RESIZE_NWSE_CURSOR 0x00036007 #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 * The top-right to bottom-left diagonal resize/move shape. This is usually
* a diagonal double-headed arrow. * 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. * 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. * 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. * cursor themes.
*/ */
#define GLFW_RESIZE_NESW_CURSOR 0x00036008 #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 * The operation-not-allowed shape. This is usually a circle with a diagonal
* line through it. * 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. * 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. * cursor themes.
*/ */
#define GLFW_NOT_ALLOWED_CURSOR 0x0003600A #define GLFW_NOT_ALLOWED_CURSOR 0x0003600A
@ -1682,7 +1682,7 @@ typedef void (* GLFWwindowposfun)(GLFWwindow* window, int xpos, int ypos);
* @sa @ref glfwSetWindowSizeCallback * @sa @ref glfwSetWindowSizeCallback
* *
* @since Added in version 1.0. * @since Added in version 1.0.
* @glfw3 Added window handle parameter. * __GLFW 3:__ Added window handle parameter.
* *
* @ingroup window * @ingroup window
*/ */
@ -1702,7 +1702,7 @@ typedef void (* GLFWwindowsizefun)(GLFWwindow* window, int width, int height);
* @sa @ref glfwSetWindowCloseCallback * @sa @ref glfwSetWindowCloseCallback
* *
* @since Added in version 2.5. * @since Added in version 2.5.
* @glfw3 Added window handle parameter. * __GLFW 3:__ Added window handle parameter.
* *
* @ingroup window * @ingroup window
*/ */
@ -1722,7 +1722,7 @@ typedef void (* GLFWwindowclosefun)(GLFWwindow* window);
* @sa @ref glfwSetWindowRefreshCallback * @sa @ref glfwSetWindowRefreshCallback
* *
* @since Added in version 2.5. * @since Added in version 2.5.
* @glfw3 Added window handle parameter. * __GLFW 3:__ Added window handle parameter.
* *
* @ingroup window * @ingroup window
*/ */
@ -1853,7 +1853,7 @@ typedef void (* GLFWwindowcontentscalefun)(GLFWwindow* window, float xscale, flo
* @sa @ref glfwSetMouseButtonCallback * @sa @ref glfwSetMouseButtonCallback
* *
* @since Added in version 1.0. * @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 * @ingroup input
*/ */
@ -1944,7 +1944,7 @@ typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffse
* @sa @ref glfwSetKeyCallback * @sa @ref glfwSetKeyCallback
* *
* @since Added in version 1.0. * @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 * @ingroup input
*/ */
@ -1965,7 +1965,7 @@ typedef void (* GLFWkeyfun)(GLFWwindow* window, int key, int scancode, int actio
* @sa @ref glfwSetCharCallback * @sa @ref glfwSetCharCallback
* *
* @since Added in version 2.4. * @since Added in version 2.4.
* @glfw3 Added window handle parameter. * __GLFW 3:__ Added window handle parameter.
* *
* @ingroup input * @ingroup input
*/ */
@ -2073,7 +2073,7 @@ typedef void (* GLFWjoystickfun)(int jid, int event);
* @sa @ref glfwGetVideoModes * @sa @ref glfwGetVideoModes
* *
* @since Added in version 1.0. * @since Added in version 1.0.
* @glfw3 Added refresh rate member. * __GLFW 3:__ Added refresh rate member.
* *
* @ingroup monitor * @ingroup monitor
*/ */
@ -2136,7 +2136,7 @@ typedef struct GLFWgammaramp
* @sa @ref window_icon * @sa @ref window_icon
* *
* @since Added in version 2.1. * @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 * @ingroup window
*/ */
@ -2236,12 +2236,12 @@ typedef struct GLFWallocator
* @errors Possible errors include @ref GLFW_PLATFORM_UNAVAILABLE and @ref * @errors Possible errors include @ref GLFW_PLATFORM_UNAVAILABLE and @ref
* GLFW_PLATFORM_ERROR. * 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 * application to the `Contents/Resources` subdirectory of the application's
* bundle, if present. This can be disabled with the @ref * bundle, if present. This can be disabled with the @ref
* GLFW_COCOA_CHDIR_RESOURCES init hint. * 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 * 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 * 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 * common commands like Hide, Quit and About. The About entry opens a minimal
@ -2256,7 +2256,7 @@ typedef struct GLFWallocator
* to something other than `wayland` or `x11`, the regular detection mechanism * to something other than `wayland` or `x11`, the regular detection mechanism
* will be used instead. * 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 * application locale according to the current environment if that category is
* still "C". This is because the "C" locale breaks Unicode text input. * still "C". This is because the "C" locale breaks Unicode text input.
* *
@ -2732,7 +2732,7 @@ GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos,
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @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. * 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. * @thread_safety This function must only be called from the main thread.
@ -2766,7 +2766,7 @@ GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_ERROR.
* *
* @remark @wayland 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. * monitors, so this function only returns integer content scales.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
@ -2914,7 +2914,7 @@ GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback);
* @sa @ref glfwGetVideoMode * @sa @ref glfwGetVideoMode
* *
* @since Added in version 1.0. * @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 * @ingroup monitor
*/ */
@ -2968,8 +2968,8 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_INVALID_VALUE, * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_INVALID_VALUE,
* @ref GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * @ref GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
* *
* @remark @wayland Gamma handling is a privileged protocol, this function * @remark __Wayland:__ Monitor gamma is a privileged protocol, so this function
* will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE. * cannot be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
@ -2992,8 +2992,8 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR
* and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
* *
* @remark @wayland Gamma handling is a privileged protocol, this function * @remark __Wayland:__ Monitor gamma is a privileged protocol, so this function
* will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE while * cannot be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE while
* returning `NULL`. * returning `NULL`.
* *
* @pointer_lifetime The returned structure and its arrays are allocated and * @pointer_lifetime The returned structure and its arrays are allocated and
@ -3034,10 +3034,10 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
* @remark The size of the specified gamma ramp should match the size of the * @remark The size of the specified gamma ramp should match the size of the
* current ramp for that monitor. * 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 Gamma handling is a privileged protocol, this function * @remark __Wayland:__ Monitor gamma is a privileged protocol, so this function
* will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE. * cannot be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE.
* *
* @pointer_lifetime The specified gamma ramp is copied before this function * @pointer_lifetime The specified gamma ramp is copied before this function
* returns. * returns.
@ -3212,32 +3212,32 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
* GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE, @ref * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE, @ref
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. * 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. * 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, * 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, * the `IDI_APPLICATION` icon will be used instead. To set a different icon,
* see @ref glfwSetWindowIcon. * 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. * 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 * 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) * 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 * hint accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all
* on macOS. * on macOS.
* *
* @remark @macos The GLFW window has no icon, as it is not a document * @remark __macOS:__ The GLFW window has no icon, as it is not a document
* window, but the dock icon will be the same as the application bundle's icon. * window, but the dock icon will be the same as the application bundle's icon.
* For more information on bundles, see the * For more information on bundles, see the
* [Bundle Programming Guide][bundle-guide] in the Mac Developer Library. * [Bundle Programming Guide][bundle-guide] in the Mac Developer Library.
* *
* [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/ * [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 * @remark __macOS:__ The window frame will not be rendered at full resolution
* Retina displays unless the * on Retina displays unless the
* [GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint) * [GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint)
* hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the * hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the
* application bundle's `Info.plist`. For more information, see * application bundle's `Info.plist`. For more information, see
@ -3248,11 +3248,11 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
* *
* [hidpi-guide]: https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html * [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 * [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified
* window size and position may be overridden by previously saved values. * 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 * decorations. This in turn uses server-side XDG decorations where available
* and provides high quality client-side decorations on compositors like GNOME. * and provides high quality client-side decorations on compositors like GNOME.
* If both XDG decorations and libdecor are unavailable, GLFW falls back to * If both XDG decorations and libdecor are unavailable, GLFW falls back to
@ -3261,15 +3261,15 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
* *
* [libdecor]: https://gitlab.freedesktop.org/libdecor/libdecor * [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. * 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 * 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 * query the final size, position or other attributes directly after window
* creation. * 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 * 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 * 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 * present and not empty, or fall back to the window title. Set the
@ -3402,7 +3402,7 @@ GLFWAPI const char* glfwGetWindowTitle(GLFWwindow* window);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_ERROR.
* *
* @remark @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. * process events.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
@ -3411,7 +3411,7 @@ GLFWAPI const char* glfwGetWindowTitle(GLFWwindow* window);
* @sa @ref glfwGetWindowTitle * @sa @ref glfwGetWindowTitle
* *
* @since Added in version 1.0. * @since Added in version 1.0.
* @glfw3 Added window handle parameter. * __GLFW 3:__ Added window handle parameter.
* *
* @ingroup window * @ingroup window
*/ */
@ -3445,14 +3445,14 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
* @pointer_lifetime The specified image data is copied before this function * @pointer_lifetime The specified image data is copied before this function
* returns. * 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 * 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 * the application bundle's icon. For more information on bundles, see the
* [Bundle Programming Guide][bundle-guide] in the Mac Developer Library. * [Bundle Programming Guide][bundle-guide] in the Mac Developer Library.
* *
* [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/ * [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. * window will thus inherit the one defined in the application's desktop file.
* This function will emit @ref GLFW_FEATURE_UNAVAILABLE. * This function will emit @ref GLFW_FEATURE_UNAVAILABLE.
* *
@ -3523,8 +3523,8 @@ GLFWAPI void glfwSetWindowProgressIndicator(GLFWwindow* window, int progressStat
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
* *
* @remark @wayland There is no way for an application to retrieve the global * @remark __Wayland:__ Window positions are not currently part of any common
* position of its windows. This function will emit @ref * Wayland protocol, so this function cannot be implemented and will emit @ref
* GLFW_FEATURE_UNAVAILABLE. * GLFW_FEATURE_UNAVAILABLE.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
@ -3557,8 +3557,8 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
* *
* @remark @wayland There is no way for an application to set the global * @remark __Wayland:__ Window positions are not currently part of any common
* position of its windows. This function will emit @ref * Wayland protocol, so this function cannot be implemented and will emit @ref
* GLFW_FEATURE_UNAVAILABLE. * GLFW_FEATURE_UNAVAILABLE.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
@ -3567,7 +3567,7 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
* @sa @ref glfwGetWindowPos * @sa @ref glfwGetWindowPos
* *
* @since Added in version 1.0. * @since Added in version 1.0.
* @glfw3 Added window handle parameter. * __GLFW 3:__ Added window handle parameter.
* *
* @ingroup window * @ingroup window
*/ */
@ -3597,7 +3597,7 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
* @sa @ref glfwSetWindowSize * @sa @ref glfwSetWindowSize
* *
* @since Added in version 1.0. * @since Added in version 1.0.
* @glfw3 Added window handle parameter. * __GLFW 3:__ Added window handle parameter.
* *
* @ingroup window * @ingroup window
*/ */
@ -3632,7 +3632,7 @@ GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
* @remark If you set size limits and an aspect ratio that conflict, the * @remark If you set size limits and an aspect ratio that conflict, the
* results are undefined. * 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. * actually resized, either by the user or by the compositor.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
@ -3675,7 +3675,7 @@ GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minhe
* @remark If you set size limits and an aspect ratio that conflict, the * @remark If you set size limits and an aspect ratio that conflict, the
* results are undefined. * 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. * actually resized, either by the user or by the compositor.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
@ -3721,7 +3721,7 @@ GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
* @sa @ref glfwSetWindowMonitor * @sa @ref glfwSetWindowMonitor
* *
* @since Added in version 1.0. * @since Added in version 1.0.
* @glfw3 Added window handle parameter. * __GLFW 3:__ Added window handle parameter.
* *
* @ingroup window * @ingroup window
*/ */
@ -3871,7 +3871,7 @@ GLFWAPI float glfwGetWindowOpacity(GLFWwindow* window);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * 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. * This function will emit @ref GLFW_FEATURE_UNAVAILABLE.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
@ -3900,10 +3900,6 @@ GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_ERROR.
* *
* @remark @wayland Once a window is iconified, @ref glfwRestoreWindow wont
* be able to restore it. This is a design decision of the xdg-shell
* protocol.
*
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
* @sa @ref window_iconify * @sa @ref window_iconify
@ -3911,7 +3907,7 @@ GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity);
* @sa @ref glfwMaximizeWindow * @sa @ref glfwMaximizeWindow
* *
* @since Added in version 2.1. * @since Added in version 2.1.
* @glfw3 Added window handle parameter. * __GLFW 3:__ Added window handle parameter.
* *
* @ingroup window * @ingroup window
*/ */
@ -3931,6 +3927,10 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_ERROR.
* *
* @remark __Wayland:__ 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. * @thread_safety This function must only be called from the main thread.
* *
* @sa @ref window_iconify * @sa @ref window_iconify
@ -3938,7 +3938,7 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
* @sa @ref glfwMaximizeWindow * @sa @ref glfwMaximizeWindow
* *
* @since Added in version 2.1. * @since Added in version 2.1.
* @glfw3 Added window handle parameter. * __GLFW 3:__ Added window handle parameter.
* *
* @ingroup window * @ingroup window
*/ */
@ -3985,7 +3985,7 @@ GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_ERROR.
* *
* @remark @wayland 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. * complete, this function does not immediately make the window visible.
* Instead it will become visible the next time the window framebuffer is * Instead it will become visible the next time the window framebuffer is
* updated after this call. * updated after this call.
@ -4048,7 +4048,7 @@ GLFWAPI void glfwHideWindow(GLFWwindow* window);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_ERROR.
* *
* @remark @wayland 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. * another window created by the same application already has input focus.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
@ -4076,7 +4076,7 @@ GLFWAPI void glfwFocusWindow(GLFWwindow* window);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_ERROR.
* *
* @remark @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. * specific window.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
@ -4151,8 +4151,8 @@ GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
* affected by any resizing or mode switching, although you may need to update * affected by any resizing or mode switching, although you may need to update
* your viewport if the framebuffer size has changed. * your viewport if the framebuffer size has changed.
* *
* @remark @wayland The desired window position is ignored, as there is no way * @remark __Wayland:__ Window positions are not currently part of any common
* for an application to set this property. * Wayland protocol. The window position arguments are ignored.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
@ -4189,8 +4189,9 @@ GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int
* errors. However, this function should not fail as long as it is passed * errors. However, this function should not fail as long as it is passed
* valid arguments and the library has been [initialized](@ref intro_init). * valid arguments and the library has been [initialized](@ref intro_init).
* *
* @remark @wayland The Wayland protocol provides no way to check whether a * @remark __Wayland:__ Checking whether a window is iconified is not currently
* window is iconfied, so @ref GLFW_ICONIFIED always returns `GLFW_FALSE`. * part of any common Wayland protocol, so the @ref GLFW_ICONIFIED attribute
* cannot be implemented and is always `GLFW_FALSE`.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
@ -4232,7 +4233,7 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
* @remark Calling @ref glfwGetWindowAttrib will always return the latest * @remark Calling @ref glfwGetWindowAttrib will always return the latest
* value, even if that value is ignored by the current mode of the window. * 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. * not supported. Setting this will emit @ref GLFW_FEATURE_UNAVAILABLE.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
@ -4312,8 +4313,8 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* *
* @remark @wayland This callback will never be called, as there is no way for * @remark __Wayland:__ This callback will not be called. The Wayland protocol
* an application to know its global position. * provides no way to be notified of when a window is moved.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
@ -4351,7 +4352,7 @@ GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindow
* @sa @ref window_size * @sa @ref window_size
* *
* @since Added in version 1.0. * @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 * @ingroup window
*/ */
@ -4383,7 +4384,7 @@ GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwind
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @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. * close callback for all windows.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
@ -4391,7 +4392,7 @@ GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwind
* @sa @ref window_close * @sa @ref window_close
* *
* @since Added in version 2.5. * @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 * @ingroup window
*/ */
@ -4427,7 +4428,7 @@ GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwi
* @sa @ref window_refresh * @sa @ref window_refresh
* *
* @since Added in version 2.5. * @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 * @ingroup window
*/ */
@ -4488,6 +4489,10 @@ GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwi
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* *
* @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.
*
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
* @sa @ref window_iconify * @sa @ref window_iconify
@ -4993,7 +4998,7 @@ GLFWAPI int glfwGetKeyScancode(int key);
* @sa @ref input_key * @sa @ref input_key
* *
* @since Added in version 1.0. * @since Added in version 1.0.
* @glfw3 Added window handle parameter. * __GLFW 3:__ Added window handle parameter.
* *
* @ingroup input * @ingroup input
*/ */
@ -5025,7 +5030,7 @@ GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
* @sa @ref input_mouse_button * @sa @ref input_mouse_button
* *
* @since Added in version 1.0. * @since Added in version 1.0.
* @glfw3 Added window handle parameter. * __GLFW 3:__ Added window handle parameter.
* *
* @ingroup input * @ingroup input
*/ */
@ -5095,7 +5100,7 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * 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. * `GLFW_CURSOR_DISABLED`, otherwise it will emit @ref GLFW_FEATURE_UNAVAILABLE.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
@ -5293,7 +5298,7 @@ GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
* @sa @ref input_key * @sa @ref input_key
* *
* @since Added in version 1.0. * @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 * @ingroup input
*/ */
@ -5336,7 +5341,7 @@ GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun callback);
* @sa @ref input_char * @sa @ref input_char
* *
* @since Added in version 2.4. * @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 * @ingroup input
*/ */
@ -5420,7 +5425,7 @@ GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmods
* @sa @ref input_mouse_button * @sa @ref input_mouse_button
* *
* @since Added in version 1.0. * @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 * @ingroup input
*/ */
@ -5650,7 +5655,7 @@ GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count);
* @sa @ref joystick_button * @sa @ref joystick_button
* *
* @since Added in version 2.2. * @since Added in version 2.2.
* @glfw3 Changed to return a dynamic array. * __GLFW 3:__ Changed to return a dynamic array.
* *
* @ingroup input * @ingroup input
*/ */
@ -6014,7 +6019,7 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_ERROR.
* *
* @remark @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 * 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. * cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns.
* It is safe to try this multiple times. * It is safe to try this multiple times.
@ -6047,7 +6052,7 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. * 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 * 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. * cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns.
* It is safe to try this multiple times. * It is safe to try this multiple times.
@ -6264,7 +6269,7 @@ GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
* @sa @ref glfwSwapInterval * @sa @ref glfwSwapInterval
* *
* @since Added in version 1.0. * @since Added in version 1.0.
* @glfw3 Added window handle parameter. * __GLFW 3:__ Added window handle parameter.
* *
* @ingroup window * @ingroup window
*/ */
@ -6531,7 +6536,7 @@ GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* p
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. * 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 * `VK_MVK_macos_surface` and `VK_EXT_metal_surface` extensions do not provide
* a `vkGetPhysicalDevice*PresentationSupport` type function. * a `vkGetPhysicalDevice*PresentationSupport` type function.
* *
@ -6589,15 +6594,15 @@ GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhys
* @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
* eliminate almost all occurrences of these errors. * 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 * `VK_MVK_macos_surface` extension as a fallback. The name of the selected
* extension, if any, is included in the array returned by @ref * extension, if any, is included in the array returned by @ref
* glfwGetRequiredInstanceExtensions. * 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. * 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 * with the `VK_KHR_xlib_surface` extension as a fallback. You can make
* `VK_KHR_xlib_surface` the preferred extension by setting the * `VK_KHR_xlib_surface` the preferred extension by setting the
* [GLFW_X11_XCB_VULKAN_SURFACE](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint) init * [GLFW_X11_XCB_VULKAN_SURFACE](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint) init

View File

@ -478,6 +478,29 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
* @ingroup native * @ingroup native
*/ */
GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window); 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 #endif
#if defined(GLFW_EXPOSE_NATIVE_WAYLAND) #if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
@ -586,6 +609,29 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
* @ingroup native * @ingroup native
*/ */
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window); 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 #endif
#if defined(GLFW_EXPOSE_NATIVE_OSMESA) #if defined(GLFW_EXPOSE_NATIVE_OSMESA)

View File

@ -31,6 +31,7 @@ add_custom_target(update_mappings
set_target_properties(update_mappings PROPERTIES FOLDER "GLFW3") set_target_properties(update_mappings PROPERTIES FOLDER "GLFW3")
if (GLFW_BUILD_COCOA) if (GLFW_BUILD_COCOA)
enable_language(OBJC)
target_compile_definitions(glfw PRIVATE _GLFW_COCOA) target_compile_definitions(glfw PRIVATE _GLFW_COCOA)
target_sources(glfw PRIVATE cocoa_platform.h cocoa_joystick.h cocoa_init.m target_sources(glfw PRIVATE cocoa_platform.h cocoa_joystick.h cocoa_init.m
cocoa_joystick.m cocoa_monitor.m cocoa_window.m cocoa_joystick.m cocoa_monitor.m cocoa_window.m
@ -53,8 +54,8 @@ endif()
if (GLFW_BUILD_WAYLAND) if (GLFW_BUILD_WAYLAND)
target_compile_definitions(glfw PRIVATE _GLFW_WAYLAND) target_compile_definitions(glfw PRIVATE _GLFW_WAYLAND)
target_sources(glfw PRIVATE wl_platform.h xkb_unicode.h wl_init.c target_sources(glfw PRIVATE wl_platform.h wl_init.c
wl_monitor.c wl_window.c xkb_unicode.c) wl_monitor.c wl_window.c)
endif() endif()
if (GLFW_BUILD_X11 OR GLFW_BUILD_WAYLAND) if (GLFW_BUILD_X11 OR GLFW_BUILD_WAYLAND)
@ -138,13 +139,6 @@ target_include_directories(glfw PRIVATE
"${GLFW_BINARY_DIR}/src") "${GLFW_BINARY_DIR}/src")
target_link_libraries(glfw PRIVATE Threads::Threads) target_link_libraries(glfw PRIVATE Threads::Threads)
# Workaround for CMake not knowing about .m files before version 3.16
if (CMAKE_VERSION VERSION_LESS "3.16" AND APPLE)
set_source_files_properties(cocoa_init.m cocoa_joystick.m cocoa_monitor.m
cocoa_window.m nsgl_context.m PROPERTIES
LANGUAGE C)
endif()
if (GLFW_BUILD_WIN32) if (GLFW_BUILD_WIN32)
list(APPEND glfw_PKG_LIBS "-lgdi32") list(APPEND glfw_PKG_LIBS "-lgdi32")
endif() endif()
@ -262,24 +256,6 @@ if (GLFW_BUILD_WIN32)
target_compile_definitions(glfw PRIVATE UNICODE _UNICODE) target_compile_definitions(glfw PRIVATE UNICODE _UNICODE)
endif() endif()
# HACK: When building on MinGW, WINVER and UNICODE need to be defined before
# the inclusion of stddef.h (by glfw3.h), which is itself included before
# win32_platform.h. We define them here until a saner solution can be found
# NOTE: MinGW-w64 and Visual C++ do /not/ need this hack.
if (MINGW)
target_compile_definitions(glfw PRIVATE WINVER=0x0501)
endif()
# Workaround for legacy MinGW not providing XInput and DirectInput
if (MINGW)
include(CheckIncludeFile)
check_include_file(dinput.h DINPUT_H_FOUND)
check_include_file(xinput.h XINPUT_H_FOUND)
if (NOT DINPUT_H_FOUND OR NOT XINPUT_H_FOUND)
target_include_directories(glfw PRIVATE "${GLFW_SOURCE_DIR}/deps/mingw")
endif()
endif()
# Workaround for the MS CRT deprecating parts of the standard library # Workaround for the MS CRT deprecating parts of the standard library
if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC") if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS) target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS)
@ -293,10 +269,6 @@ endif()
if (GLFW_BUILD_SHARED_LIBRARY) if (GLFW_BUILD_SHARED_LIBRARY)
if (WIN32) if (WIN32)
if (MINGW) if (MINGW)
# Remove the dependency on the shared version of libgcc
# NOTE: MinGW-w64 has the correct default but MinGW needs this
target_link_libraries(glfw PRIVATE "-static-libgcc")
# Remove the lib prefix on the DLL (but not the import library) # Remove the lib prefix on the DLL (but not the import library)
set_target_properties(glfw PROPERTIES PREFIX "") set_target_properties(glfw PROPERTIES PREFIX "")
@ -314,30 +286,34 @@ if (GLFW_BUILD_SHARED_LIBRARY)
if (MINGW) if (MINGW)
# Enable link-time exploit mitigation features enabled by default on MSVC # Enable link-time exploit mitigation features enabled by default on MSVC
include(CheckCCompilerFlag) include(CheckCCompilerFlag)
include(CMakePushCheckState)
# Compatibility with data execution prevention (DEP) # Compatibility with data execution prevention (DEP)
cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat") set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat")
check_c_compiler_flag("" _GLFW_HAS_DEP) check_c_compiler_flag("" _GLFW_HAS_DEP)
if (_GLFW_HAS_DEP) if (_GLFW_HAS_DEP)
target_link_libraries(glfw PRIVATE "-Wl,--nxcompat") target_link_libraries(glfw PRIVATE "-Wl,--nxcompat")
endif() endif()
cmake_pop_check_state()
# Compatibility with address space layout randomization (ASLR) # Compatibility with address space layout randomization (ASLR)
cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS "-Wl,--dynamicbase") set(CMAKE_REQUIRED_FLAGS "-Wl,--dynamicbase")
check_c_compiler_flag("" _GLFW_HAS_ASLR) check_c_compiler_flag("" _GLFW_HAS_ASLR)
if (_GLFW_HAS_ASLR) if (_GLFW_HAS_ASLR)
target_link_libraries(glfw PRIVATE "-Wl,--dynamicbase") target_link_libraries(glfw PRIVATE "-Wl,--dynamicbase")
endif() endif()
cmake_pop_check_state()
# Compatibility with 64-bit address space layout randomization (ASLR) # Compatibility with 64-bit address space layout randomization (ASLR)
cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS "-Wl,--high-entropy-va") set(CMAKE_REQUIRED_FLAGS "-Wl,--high-entropy-va")
check_c_compiler_flag("" _GLFW_HAS_64ASLR) check_c_compiler_flag("" _GLFW_HAS_64ASLR)
if (_GLFW_HAS_64ASLR) if (_GLFW_HAS_64ASLR)
target_link_libraries(glfw PRIVATE "-Wl,--high-entropy-va") target_link_libraries(glfw PRIVATE "-Wl,--high-entropy-va")
endif() endif()
cmake_pop_check_state()
# Clear flags again to avoid breaking later tests
set(CMAKE_REQUIRED_FLAGS)
endif() endif()
if (UNIX) if (UNIX)
@ -346,12 +322,8 @@ if (GLFW_BUILD_SHARED_LIBRARY)
endif() endif()
endif() endif()
foreach(arg ${glfw_PKG_DEPS}) list(JOIN glfw_PKG_DEPS " " deps)
string(APPEND deps " ${arg}") list(JOIN glfw_PKG_LIBS " " libs)
endforeach()
foreach(arg ${glfw_PKG_LIBS})
string(APPEND libs " ${arg}")
endforeach()
set(GLFW_PKG_CONFIG_REQUIRES_PRIVATE "${deps}" CACHE INTERNAL set(GLFW_PKG_CONFIG_REQUIRES_PRIVATE "${deps}" CACHE INTERNAL
"GLFW pkg-config Requires.private") "GLFW pkg-config Requires.private")

View File

@ -961,7 +961,7 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
[window->ns.object setContentView:window->ns.view]; [window->ns.object setContentView:window->ns.view];
[window->ns.object makeFirstResponder: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 setDelegate:window->ns.delegate];
[window->ns.object setAcceptsMouseMovedEvents:YES]; [window->ns.object setAcceptsMouseMovedEvents:YES];
[window->ns.object setRestorable:NO]; [window->ns.object setRestorable:NO];

View File

@ -939,10 +939,32 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle)
window->context.source != GLFW_NATIVE_CONTEXT_API) window->context.source != GLFW_NATIVE_CONTEXT_API)
{ {
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return EGL_NO_CONTEXT; return EGL_NO_SURFACE;
} }
} }
return window->context.egl.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;
}

View File

@ -626,6 +626,8 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
return GLFW_FALSE; return GLFW_FALSE;
} }
window->context.glx.fbconfig = native;
window->context.makeCurrent = makeContextCurrentGLX; window->context.makeCurrent = makeContextCurrentGLX;
window->context.swapBuffers = swapBuffersGLX; window->context.swapBuffers = swapBuffersGLX;
window->context.swapInterval = swapIntervalGLX; window->context.swapInterval = swapIntervalGLX;
@ -719,5 +721,29 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* handle)
return window->context.glx.window; 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 #endif // _GLFW_X11

View File

@ -402,7 +402,6 @@ struct _GLFWwndconfig
int ypos; int ypos;
int width; int width;
int height; int height;
const char* title;
GLFWbool resizable; GLFWbool resizable;
GLFWbool visible; GLFWbool visible;
GLFWbool decorated; GLFWbool decorated;

View File

@ -187,8 +187,6 @@ GLFWAPI const char* glfwGetVersionString(void)
" OSMesa" " OSMesa"
#if defined(__MINGW64_VERSION_MAJOR) #if defined(__MINGW64_VERSION_MAJOR)
" MinGW-w64" " MinGW-w64"
#elif defined(__MINGW32__)
" MinGW"
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
" VisualC" " VisualC"
#endif #endif

View File

@ -327,8 +327,8 @@ static void swapBuffersWGL(_GLFWwindow* window)
{ {
if (!window->monitor) if (!window->monitor)
{ {
// HACK: Use DwmFlush when desktop composition is enabled on Windows Vista and 7 // HACK: Use DwmFlush when desktop composition is enabled on Windows 7
if (!IsWindows8OrGreater() && IsWindowsVistaOrGreater()) if (!IsWindows8OrGreater())
{ {
BOOL enabled = FALSE; BOOL enabled = FALSE;
@ -353,9 +353,9 @@ static void swapIntervalWGL(int interval)
if (!window->monitor) if (!window->monitor)
{ {
// HACK: Disable WGL swap interval when desktop composition is enabled on Windows // HACK: Disable WGL swap interval when desktop composition is enabled on
// Vista and 7 to avoid interfering with DWM vsync // Windows 7 to avoid interfering with DWM vsync
if (!IsWindows8OrGreater() && IsWindowsVistaOrGreater()) if (!IsWindows8OrGreater())
{ {
BOOL enabled = FALSE; BOOL enabled = FALSE;

View File

@ -89,10 +89,6 @@ static GLFWbool loadLibraries(void)
return GLFW_FALSE; return GLFW_FALSE;
} }
_glfw.win32.user32.SetProcessDPIAware_ = (PFN_SetProcessDPIAware)
_glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "SetProcessDPIAware");
_glfw.win32.user32.ChangeWindowMessageFilterEx_ = (PFN_ChangeWindowMessageFilterEx)
_glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "ChangeWindowMessageFilterEx");
_glfw.win32.user32.EnableNonClientDpiScaling_ = (PFN_EnableNonClientDpiScaling) _glfw.win32.user32.EnableNonClientDpiScaling_ = (PFN_EnableNonClientDpiScaling)
_glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "EnableNonClientDpiScaling"); _glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "EnableNonClientDpiScaling");
_glfw.win32.user32.SetProcessDpiAwarenessContext_ = (PFN_SetProcessDpiAwarenessContext) _glfw.win32.user32.SetProcessDpiAwarenessContext_ = (PFN_SetProcessDpiAwarenessContext)
@ -693,7 +689,7 @@ int _glfwInitWin32(void)
SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
else if (IsWindows8Point1OrGreater()) else if (IsWindows8Point1OrGreater())
SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE); SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
else if (IsWindowsVistaOrGreater()) else
SetProcessDPIAware(); SetProcessDPIAware();
if (!createHelperWindow()) if (!createHelperWindow())

View File

@ -48,14 +48,14 @@
#define UNICODE #define UNICODE
#endif #endif
// GLFW requires Windows XP or later // GLFW requires Windows 7 or later
#if WINVER < 0x0501 #if WINVER < 0x0601
#undef WINVER #undef WINVER
#define WINVER 0x0501 #define WINVER 0x0601
#endif #endif
#if _WIN32_WINNT < 0x0501 #if _WIN32_WINNT < 0x0601
#undef _WIN32_WINNT #undef _WIN32_WINNT
#define _WIN32_WINNT 0x0501 #define _WIN32_WINNT 0x0601
#endif #endif
// GLFW uses DirectInput8 interfaces // GLFW uses DirectInput8 interfaces
@ -66,41 +66,21 @@
#include <wctype.h> #include <wctype.h>
#include <windows.h> #include <windows.h>
#include <dwmapi.h>
#include <dinput.h> #include <dinput.h>
#include <xinput.h> #include <xinput.h>
#include <dbt.h> #include <dbt.h>
// HACK: Define macros that some windows.h variants don't // HACK: Define macros that some windows.h variants don't
#ifndef WM_MOUSEHWHEEL
#define WM_MOUSEHWHEEL 0x020E
#endif
#ifndef WM_DWMCOMPOSITIONCHANGED
#define WM_DWMCOMPOSITIONCHANGED 0x031E
#endif
#ifndef WM_DWMCOLORIZATIONCOLORCHANGED
#define WM_DWMCOLORIZATIONCOLORCHANGED 0x0320
#endif
#ifndef WM_COPYGLOBALDATA #ifndef WM_COPYGLOBALDATA
#define WM_COPYGLOBALDATA 0x0049 #define WM_COPYGLOBALDATA 0x0049
#endif #endif
#ifndef WM_UNICHAR
#define WM_UNICHAR 0x0109
#endif
#ifndef UNICODE_NOCHAR
#define UNICODE_NOCHAR 0xFFFF
#endif
#ifndef WM_DPICHANGED #ifndef WM_DPICHANGED
#define WM_DPICHANGED 0x02E0 #define WM_DPICHANGED 0x02E0
#endif #endif
#ifndef GET_XBUTTON_WPARAM
#define GET_XBUTTON_WPARAM(w) (HIWORD(w))
#endif
#ifndef EDS_ROTATEDMODE #ifndef EDS_ROTATEDMODE
#define EDS_ROTATEDMODE 0x00000004 #define EDS_ROTATEDMODE 0x00000004
#endif #endif
#ifndef DISPLAY_DEVICE_ACTIVE
#define DISPLAY_DEVICE_ACTIVE 0x00000001
#endif
#ifndef _WIN32_WINNT_WINBLUE #ifndef _WIN32_WINNT_WINBLUE
#define _WIN32_WINNT_WINBLUE 0x0603 #define _WIN32_WINNT_WINBLUE 0x0603
#endif #endif
@ -113,34 +93,6 @@
#ifndef USER_DEFAULT_SCREEN_DPI #ifndef USER_DEFAULT_SCREEN_DPI
#define USER_DEFAULT_SCREEN_DPI 96 #define USER_DEFAULT_SCREEN_DPI 96
#endif #endif
#ifndef OCR_HAND
#define OCR_HAND 32649
#endif
#if WINVER < 0x0601
typedef struct
{
DWORD cbSize;
DWORD ExtStatus;
} CHANGEFILTERSTRUCT;
#ifndef MSGFLT_ALLOW
#define MSGFLT_ALLOW 1
#endif
#endif /*Windows 7*/
#if WINVER < 0x0600
#define DWM_BB_ENABLE 0x00000001
#define DWM_BB_BLURREGION 0x00000002
typedef struct
{
DWORD dwFlags;
BOOL fEnable;
HRGN hRgnBlur;
BOOL fTransitionOnMaximized;
} DWM_BLURBEHIND;
#else
#include <dwmapi.h>
#endif /*Windows Vista*/
#ifndef DPI_ENUMS_DECLARED #ifndef DPI_ENUMS_DECLARED
typedef enum typedef enum
@ -165,12 +117,6 @@ typedef enum
// Replacement for versionhelpers.h macros, as we cannot rely on the // Replacement for versionhelpers.h macros, as we cannot rely on the
// application having a correct embedded manifest // application having a correct embedded manifest
// //
#define IsWindowsVistaOrGreater() \
_glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_VISTA), \
LOBYTE(_WIN32_WINNT_VISTA), 0)
#define IsWindows7OrGreater() \
_glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WIN7), \
LOBYTE(_WIN32_WINNT_WIN7), 0)
#define IsWindows8OrGreater() \ #define IsWindows8OrGreater() \
_glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WIN8), \ _glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WIN8), \
LOBYTE(_WIN32_WINNT_WIN8), 0) LOBYTE(_WIN32_WINNT_WIN8), 0)
@ -281,15 +227,11 @@ typedef HRESULT (WINAPI * PFN_DirectInput8Create)(HINSTANCE,DWORD,REFIID,LPVOID*
#define DirectInput8Create _glfw.win32.dinput8.Create #define DirectInput8Create _glfw.win32.dinput8.Create
// user32.dll function pointer typedefs // user32.dll function pointer typedefs
typedef BOOL (WINAPI * PFN_SetProcessDPIAware)(void);
typedef BOOL (WINAPI * PFN_ChangeWindowMessageFilterEx)(HWND,UINT,DWORD,CHANGEFILTERSTRUCT*);
typedef BOOL (WINAPI * PFN_EnableNonClientDpiScaling)(HWND); typedef BOOL (WINAPI * PFN_EnableNonClientDpiScaling)(HWND);
typedef BOOL (WINAPI * PFN_SetProcessDpiAwarenessContext)(HANDLE); typedef BOOL (WINAPI * PFN_SetProcessDpiAwarenessContext)(HANDLE);
typedef UINT (WINAPI * PFN_GetDpiForWindow)(HWND); typedef UINT (WINAPI * PFN_GetDpiForWindow)(HWND);
typedef BOOL (WINAPI * PFN_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT); typedef BOOL (WINAPI * PFN_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT);
typedef int (WINAPI * PFN_GetSystemMetricsForDpi)(int,UINT); typedef int (WINAPI * PFN_GetSystemMetricsForDpi)(int,UINT);
#define SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware_
#define ChangeWindowMessageFilterEx _glfw.win32.user32.ChangeWindowMessageFilterEx_
#define EnableNonClientDpiScaling _glfw.win32.user32.EnableNonClientDpiScaling_ #define EnableNonClientDpiScaling _glfw.win32.user32.EnableNonClientDpiScaling_
#define SetProcessDpiAwarenessContext _glfw.win32.user32.SetProcessDpiAwarenessContext_ #define SetProcessDpiAwarenessContext _glfw.win32.user32.SetProcessDpiAwarenessContext_
#define GetDpiForWindow _glfw.win32.user32.GetDpiForWindow_ #define GetDpiForWindow _glfw.win32.user32.GetDpiForWindow_
@ -551,8 +493,6 @@ typedef struct _GLFWlibraryWin32
struct { struct {
HINSTANCE instance; HINSTANCE instance;
PFN_SetProcessDPIAware SetProcessDPIAware_;
PFN_ChangeWindowMessageFilterEx ChangeWindowMessageFilterEx_;
PFN_EnableNonClientDpiScaling EnableNonClientDpiScaling_; PFN_EnableNonClientDpiScaling EnableNonClientDpiScaling_;
PFN_SetProcessDpiAwarenessContext SetProcessDpiAwarenessContext_; PFN_SetProcessDpiAwarenessContext SetProcessDpiAwarenessContext_;
PFN_GetDpiForWindow GetDpiForWindow_; PFN_GetDpiForWindow GetDpiForWindow_;

View File

@ -374,9 +374,6 @@ static void updateFramebufferTransparency(const _GLFWwindow* window)
BOOL composition, opaque; BOOL composition, opaque;
DWORD color; DWORD color;
if (!IsWindowsVistaOrGreater())
return;
if (FAILED(DwmIsCompositionEnabled(&composition)) || !composition) if (FAILED(DwmIsCompositionEnabled(&composition)) || !composition)
return; return;
@ -983,7 +980,6 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
case WM_MOUSEHWHEEL: case WM_MOUSEHWHEEL:
{ {
// This message is only sent on Windows Vista and later
// NOTE: The X-axis is inverted for consistency with macOS and X11 // NOTE: The X-axis is inverted for consistency with macOS and X11
_glfwInputScroll(window, -((SHORT) HIWORD(wParam) / (double) WHEEL_DELTA), 0.0); _glfwInputScroll(window, -((SHORT) HIWORD(wParam) / (double) WHEEL_DELTA), 0.0);
return 0; return 0;
@ -1393,7 +1389,7 @@ static int createNativeWindow(_GLFWwindow* window,
frameHeight = rect.bottom - rect.top; frameHeight = rect.bottom - rect.top;
} }
wideTitle = _glfwCreateWideStringFromUTF8Win32(wndconfig->title); wideTitle = _glfwCreateWideStringFromUTF8Win32(window->title);
if (!wideTitle) if (!wideTitle)
return GLFW_FALSE; return GLFW_FALSE;
@ -1419,19 +1415,13 @@ static int createNativeWindow(_GLFWwindow* window,
SetPropW(window->win32.handle, L"GLFW", window); SetPropW(window->win32.handle, L"GLFW", window);
if (IsWindows7OrGreater()) ChangeWindowMessageFilterEx(window->win32.handle, WM_DROPFILES, MSGFLT_ALLOW, NULL);
{ ChangeWindowMessageFilterEx(window->win32.handle, WM_COPYDATA, MSGFLT_ALLOW, NULL);
ChangeWindowMessageFilterEx(window->win32.handle, ChangeWindowMessageFilterEx(window->win32.handle, WM_COPYGLOBALDATA, MSGFLT_ALLOW, NULL);
WM_DROPFILES, MSGFLT_ALLOW, NULL);
ChangeWindowMessageFilterEx(window->win32.handle,
WM_COPYDATA, MSGFLT_ALLOW, NULL);
ChangeWindowMessageFilterEx(window->win32.handle,
WM_COPYGLOBALDATA, MSGFLT_ALLOW, NULL);
window->win32.taskbarListMsgID = RegisterWindowMessageW(L"TaskbarButtonCreated"); window->win32.taskbarListMsgID = RegisterWindowMessageW(L"TaskbarButtonCreated");
if (window->win32.taskbarListMsgID) if (window->win32.taskbarListMsgID)
ChangeWindowMessageFilterEx(window->win32.handle, window->win32.taskbarListMsgID, MSGFLT_ALLOW, NULL); ChangeWindowMessageFilterEx(window->win32.handle, window->win32.taskbarListMsgID, MSGFLT_ALLOW, NULL);
}
window->win32.scaleToMonitor = wndconfig->scaleToMonitor; window->win32.scaleToMonitor = wndconfig->scaleToMonitor;
window->win32.keymenu = wndconfig->win32.keymenu; window->win32.keymenu = wndconfig->win32.keymenu;
@ -2047,9 +2037,6 @@ GLFWbool _glfwFramebufferTransparentWin32(_GLFWwindow* window)
if (!window->win32.transparent) if (!window->win32.transparent)
return GLFW_FALSE; return GLFW_FALSE;
if (!IsWindowsVistaOrGreater())
return GLFW_FALSE;
if (FAILED(DwmIsCompositionEnabled(&composition)) || !composition) if (FAILED(DwmIsCompositionEnabled(&composition)) || !composition)
return GLFW_FALSE; return GLFW_FALSE;

View File

@ -208,7 +208,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
wndconfig.width = width; wndconfig.width = width;
wndconfig.height = height; wndconfig.height = height;
wndconfig.title = title;
ctxconfig.share = (_GLFWwindow*) share; ctxconfig.share = (_GLFWwindow*) share;
if (!_glfwIsValidContextConfig(&ctxconfig)) if (!_glfwIsValidContextConfig(&ctxconfig))

View File

@ -714,6 +714,10 @@ int _glfwInitWayland(void)
_glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_compose_state_get_status"); _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_compose_state_get_status");
_glfw.wl.xkb.compose_state_get_one_sym = (PFN_xkb_compose_state_get_one_sym) _glfw.wl.xkb.compose_state_get_one_sym = (PFN_xkb_compose_state_get_one_sym)
_glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_compose_state_get_one_sym"); _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_compose_state_get_one_sym");
_glfw.wl.xkb.keysym_to_utf32 = (PFN_xkb_keysym_to_utf32)
_glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_keysym_to_utf32");
_glfw.wl.xkb.keysym_to_utf8 = (PFN_xkb_keysym_to_utf8)
_glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_keysym_to_utf8");
if (!_glfw.wl.xkb.context_new || if (!_glfw.wl.xkb.context_new ||
!_glfw.wl.xkb.context_unref || !_glfw.wl.xkb.context_unref ||

View File

@ -42,7 +42,6 @@ typedef struct VkWaylandSurfaceCreateInfoKHR
typedef VkResult (APIENTRY *PFN_vkCreateWaylandSurfaceKHR)(VkInstance,const VkWaylandSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*); typedef VkResult (APIENTRY *PFN_vkCreateWaylandSurfaceKHR)(VkInstance,const VkWaylandSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*);
typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice,uint32_t,struct wl_display*); typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice,uint32_t,struct wl_display*);
#include "xkb_unicode.h"
#include "posix_poll.h" #include "posix_poll.h"
typedef int (* PFN_wl_display_flush)(struct wl_display* display); typedef int (* PFN_wl_display_flush)(struct wl_display* display);
@ -178,6 +177,8 @@ typedef int (* PFN_xkb_state_key_get_syms)(struct xkb_state*, xkb_keycode_t, con
typedef enum xkb_state_component (* PFN_xkb_state_update_mask)(struct xkb_state*, xkb_mod_mask_t, xkb_mod_mask_t, xkb_mod_mask_t, xkb_layout_index_t, xkb_layout_index_t, xkb_layout_index_t); typedef enum xkb_state_component (* PFN_xkb_state_update_mask)(struct xkb_state*, xkb_mod_mask_t, xkb_mod_mask_t, xkb_mod_mask_t, xkb_layout_index_t, xkb_layout_index_t, xkb_layout_index_t);
typedef xkb_layout_index_t (* PFN_xkb_state_key_get_layout)(struct xkb_state*,xkb_keycode_t); typedef xkb_layout_index_t (* PFN_xkb_state_key_get_layout)(struct xkb_state*,xkb_keycode_t);
typedef int (* PFN_xkb_state_mod_index_is_active)(struct xkb_state*,xkb_mod_index_t,enum xkb_state_component); typedef int (* PFN_xkb_state_mod_index_is_active)(struct xkb_state*,xkb_mod_index_t,enum xkb_state_component);
typedef uint32_t (* PFN_xkb_keysym_to_utf32)(xkb_keysym_t);
typedef int (* PFN_xkb_keysym_to_utf8)(xkb_keysym_t, char*, size_t);
#define xkb_context_new _glfw.wl.xkb.context_new #define xkb_context_new _glfw.wl.xkb.context_new
#define xkb_context_unref _glfw.wl.xkb.context_unref #define xkb_context_unref _glfw.wl.xkb.context_unref
#define xkb_keymap_new_from_string _glfw.wl.xkb.keymap_new_from_string #define xkb_keymap_new_from_string _glfw.wl.xkb.keymap_new_from_string
@ -191,6 +192,8 @@ typedef int (* PFN_xkb_state_mod_index_is_active)(struct xkb_state*,xkb_mod_inde
#define xkb_state_update_mask _glfw.wl.xkb.state_update_mask #define xkb_state_update_mask _glfw.wl.xkb.state_update_mask
#define xkb_state_key_get_layout _glfw.wl.xkb.state_key_get_layout #define xkb_state_key_get_layout _glfw.wl.xkb.state_key_get_layout
#define xkb_state_mod_index_is_active _glfw.wl.xkb.state_mod_index_is_active #define xkb_state_mod_index_is_active _glfw.wl.xkb.state_mod_index_is_active
#define xkb_keysym_to_utf32 _glfw.wl.xkb.keysym_to_utf32
#define xkb_keysym_to_utf8 _glfw.wl.xkb.keysym_to_utf8
typedef struct xkb_compose_table* (* PFN_xkb_compose_table_new_from_locale)(struct xkb_context*, const char*, enum xkb_compose_compile_flags); typedef struct xkb_compose_table* (* PFN_xkb_compose_table_new_from_locale)(struct xkb_context*, const char*, enum xkb_compose_compile_flags);
typedef void (* PFN_xkb_compose_table_unref)(struct xkb_compose_table*); typedef void (* PFN_xkb_compose_table_unref)(struct xkb_compose_table*);
@ -214,62 +217,62 @@ struct libdecor_configuration;
enum libdecor_error enum libdecor_error
{ {
LIBDECOR_ERROR_COMPOSITOR_INCOMPATIBLE, LIBDECOR_ERROR_COMPOSITOR_INCOMPATIBLE,
LIBDECOR_ERROR_INVALID_FRAME_CONFIGURATION, LIBDECOR_ERROR_INVALID_FRAME_CONFIGURATION,
}; };
enum libdecor_window_state enum libdecor_window_state
{ {
LIBDECOR_WINDOW_STATE_NONE = 0, LIBDECOR_WINDOW_STATE_NONE = 0,
LIBDECOR_WINDOW_STATE_ACTIVE = 1, LIBDECOR_WINDOW_STATE_ACTIVE = 1,
LIBDECOR_WINDOW_STATE_MAXIMIZED = 2, LIBDECOR_WINDOW_STATE_MAXIMIZED = 2,
LIBDECOR_WINDOW_STATE_FULLSCREEN = 4, LIBDECOR_WINDOW_STATE_FULLSCREEN = 4,
LIBDECOR_WINDOW_STATE_TILED_LEFT = 8, LIBDECOR_WINDOW_STATE_TILED_LEFT = 8,
LIBDECOR_WINDOW_STATE_TILED_RIGHT = 16, LIBDECOR_WINDOW_STATE_TILED_RIGHT = 16,
LIBDECOR_WINDOW_STATE_TILED_TOP = 32, LIBDECOR_WINDOW_STATE_TILED_TOP = 32,
LIBDECOR_WINDOW_STATE_TILED_BOTTOM = 64 LIBDECOR_WINDOW_STATE_TILED_BOTTOM = 64
}; };
enum libdecor_capabilities enum libdecor_capabilities
{ {
LIBDECOR_ACTION_MOVE = 1, LIBDECOR_ACTION_MOVE = 1,
LIBDECOR_ACTION_RESIZE = 2, LIBDECOR_ACTION_RESIZE = 2,
LIBDECOR_ACTION_MINIMIZE = 4, LIBDECOR_ACTION_MINIMIZE = 4,
LIBDECOR_ACTION_FULLSCREEN = 8, LIBDECOR_ACTION_FULLSCREEN = 8,
LIBDECOR_ACTION_CLOSE = 16 LIBDECOR_ACTION_CLOSE = 16
}; };
struct libdecor_interface struct libdecor_interface
{ {
void (* error)(struct libdecor*,enum libdecor_error,const char*); void (* error)(struct libdecor*,enum libdecor_error,const char*);
void (* reserved0)(void); void (* reserved0)(void);
void (* reserved1)(void); void (* reserved1)(void);
void (* reserved2)(void); void (* reserved2)(void);
void (* reserved3)(void); void (* reserved3)(void);
void (* reserved4)(void); void (* reserved4)(void);
void (* reserved5)(void); void (* reserved5)(void);
void (* reserved6)(void); void (* reserved6)(void);
void (* reserved7)(void); void (* reserved7)(void);
void (* reserved8)(void); void (* reserved8)(void);
void (* reserved9)(void); void (* reserved9)(void);
}; };
struct libdecor_frame_interface struct libdecor_frame_interface
{ {
void (* configure)(struct libdecor_frame*,struct libdecor_configuration*,void*); void (* configure)(struct libdecor_frame*,struct libdecor_configuration*,void*);
void (* close)(struct libdecor_frame*,void*); void (* close)(struct libdecor_frame*,void*);
void (* commit)(struct libdecor_frame*,void*); void (* commit)(struct libdecor_frame*,void*);
void (* dismiss_popup)(struct libdecor_frame*,const char*,void*); void (* dismiss_popup)(struct libdecor_frame*,const char*,void*);
void (* reserved0)(void); void (* reserved0)(void);
void (* reserved1)(void); void (* reserved1)(void);
void (* reserved2)(void); void (* reserved2)(void);
void (* reserved3)(void); void (* reserved3)(void);
void (* reserved4)(void); void (* reserved4)(void);
void (* reserved5)(void); void (* reserved5)(void);
void (* reserved6)(void); void (* reserved6)(void);
void (* reserved7)(void); void (* reserved7)(void);
void (* reserved8)(void); void (* reserved8)(void);
void (* reserved9)(void); void (* reserved9)(void);
}; };
typedef struct libdecor* (* PFN_libdecor_new)(struct wl_display*,const struct libdecor_interface*); typedef struct libdecor* (* PFN_libdecor_new)(struct wl_display*,const struct libdecor_interface*);
@ -410,6 +413,8 @@ typedef struct _GLFWwindowWayland
struct wl_buffer* buffer; struct wl_buffer* buffer;
_GLFWfallbackEdgeWayland top, left, right, bottom; _GLFWfallbackEdgeWayland top, left, right, bottom;
struct wl_surface* focus; struct wl_surface* focus;
wl_fixed_t pointerX, pointerY;
const char* cursorName;
} fallback; } fallback;
} _GLFWwindowWayland; } _GLFWwindowWayland;
@ -451,7 +456,6 @@ typedef struct _GLFWlibraryWayland
struct wl_cursor_theme* cursorTheme; struct wl_cursor_theme* cursorTheme;
struct wl_cursor_theme* cursorThemeHiDPI; struct wl_cursor_theme* cursorThemeHiDPI;
struct wl_surface* cursorSurface; struct wl_surface* cursorSurface;
const char* cursorPreviousName;
int cursorTimerfd; int cursorTimerfd;
uint32_t serial; uint32_t serial;
uint32_t pointerEnterSerial; uint32_t pointerEnterSerial;
@ -495,6 +499,8 @@ typedef struct _GLFWlibraryWayland
PFN_xkb_state_update_mask state_update_mask; PFN_xkb_state_update_mask state_update_mask;
PFN_xkb_state_key_get_layout state_key_get_layout; PFN_xkb_state_key_get_layout state_key_get_layout;
PFN_xkb_state_mod_index_is_active state_mod_index_is_active; PFN_xkb_state_mod_index_is_active state_mod_index_is_active;
PFN_xkb_keysym_to_utf32 keysym_to_utf32;
PFN_xkb_keysym_to_utf8 keysym_to_utf8;
PFN_xkb_compose_table_new_from_locale compose_table_new_from_locale; PFN_xkb_compose_table_new_from_locale compose_table_new_from_locale;
PFN_xkb_compose_table_unref compose_table_unref; PFN_xkb_compose_table_unref compose_table_unref;

View File

@ -275,6 +275,152 @@ static void destroyFallbackDecorations(_GLFWwindow* window)
destroyFallbackEdge(&window->wl.fallback.bottom); destroyFallbackEdge(&window->wl.fallback.bottom);
} }
static void updateFallbackDecorationCursor(_GLFWwindow* window,
wl_fixed_t sx,
wl_fixed_t sy)
{
window->wl.fallback.pointerX = sx;
window->wl.fallback.pointerY = sy;
const double xpos = wl_fixed_to_double(sx);
const double ypos = wl_fixed_to_double(sy);
const char* cursorName = "left_ptr";
if (window->resizable)
{
if (window->wl.fallback.focus == window->wl.fallback.top.surface)
{
if (ypos < GLFW_BORDER_SIZE)
cursorName = "n-resize";
}
else if (window->wl.fallback.focus == window->wl.fallback.left.surface)
{
if (ypos < GLFW_BORDER_SIZE)
cursorName = "nw-resize";
else
cursorName = "w-resize";
}
else if (window->wl.fallback.focus == window->wl.fallback.right.surface)
{
if (ypos < GLFW_BORDER_SIZE)
cursorName = "ne-resize";
else
cursorName = "e-resize";
}
else if (window->wl.fallback.focus == window->wl.fallback.bottom.surface)
{
if (xpos < GLFW_BORDER_SIZE)
cursorName = "sw-resize";
else if (xpos > window->wl.width + GLFW_BORDER_SIZE)
cursorName = "se-resize";
else
cursorName = "s-resize";
}
}
if (window->wl.fallback.cursorName != cursorName)
{
struct wl_surface* surface = _glfw.wl.cursorSurface;
struct wl_cursor_theme* theme = _glfw.wl.cursorTheme;
int scale = 1;
if (window->wl.bufferScale > 1 && _glfw.wl.cursorThemeHiDPI)
{
// We only support up to scale=2 for now, since libwayland-cursor
// requires us to load a different theme for each size.
scale = 2;
theme = _glfw.wl.cursorThemeHiDPI;
}
struct wl_cursor* cursor = wl_cursor_theme_get_cursor(theme, cursorName);
if (!cursor)
return;
// TODO: handle animated cursors too.
struct wl_cursor_image* image = cursor->images[0];
if (!image)
return;
struct wl_buffer* buffer = wl_cursor_image_get_buffer(image);
if (!buffer)
return;
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
surface,
image->hotspot_x / scale,
image->hotspot_y / scale);
wl_surface_set_buffer_scale(surface, scale);
wl_surface_attach(surface, buffer, 0, 0);
wl_surface_damage(surface, 0, 0, image->width, image->height);
wl_surface_commit(surface);
window->wl.fallback.cursorName = cursorName;
}
}
static void handleFallbackDecorationButton(_GLFWwindow* window,
uint32_t serial,
uint32_t button)
{
const double xpos = wl_fixed_to_double(window->wl.fallback.pointerX);
const double ypos = wl_fixed_to_double(window->wl.fallback.pointerY);
if (button == BTN_LEFT)
{
uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_NONE;
if (window->wl.fallback.focus == window->wl.fallback.top.surface)
{
if (ypos < GLFW_BORDER_SIZE)
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP;
else
xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial);
}
else if (window->wl.fallback.focus == window->wl.fallback.left.surface)
{
if (ypos < GLFW_BORDER_SIZE)
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT;
else
edges = XDG_TOPLEVEL_RESIZE_EDGE_LEFT;
}
else if (window->wl.fallback.focus == window->wl.fallback.right.surface)
{
if (ypos < GLFW_BORDER_SIZE)
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT;
else
edges = XDG_TOPLEVEL_RESIZE_EDGE_RIGHT;
}
else if (window->wl.fallback.focus == window->wl.fallback.bottom.surface)
{
if (xpos < GLFW_BORDER_SIZE)
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT;
else if (xpos > window->wl.width + GLFW_BORDER_SIZE)
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT;
else
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM;
}
if (edges != XDG_TOPLEVEL_RESIZE_EDGE_NONE)
xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat, serial, edges);
}
else if (button == BTN_RIGHT)
{
if (!window->wl.xdg.toplevel)
return;
if (window->wl.fallback.focus != window->wl.fallback.top.surface)
return;
if (ypos < GLFW_BORDER_SIZE)
return;
xdg_toplevel_show_window_menu(window->wl.xdg.toplevel,
_glfw.wl.seat, serial,
xpos,
ypos - GLFW_CAPTION_HEIGHT - GLFW_BORDER_SIZE);
}
}
static void xdgDecorationHandleConfigure(void* userData, static void xdgDecorationHandleConfigure(void* userData,
struct zxdg_toplevel_decoration_v1* decoration, struct zxdg_toplevel_decoration_v1* decoration,
uint32_t mode) uint32_t mode)
@ -1192,8 +1338,8 @@ static void inputText(_GLFWwindow* window, uint32_t scancode)
if (xkb_state_key_get_syms(_glfw.wl.xkb.state, keycode, &keysyms) == 1) if (xkb_state_key_get_syms(_glfw.wl.xkb.state, keycode, &keysyms) == 1)
{ {
const xkb_keysym_t keysym = composeSymbol(keysyms[0]); const xkb_keysym_t keysym = composeSymbol(keysyms[0]);
const uint32_t codepoint = _glfwKeySym2Unicode(keysym); const uint32_t codepoint = xkb_keysym_to_utf32(keysym);
if (codepoint != GLFW_INVALID_CODEPOINT) if (codepoint != 0)
{ {
const int mods = _glfw.wl.xkb.modifiers; const int mods = _glfw.wl.xkb.modifiers;
const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT)); const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT));
@ -1267,17 +1413,21 @@ static void handleEvents(double* timeout)
if (read(_glfw.wl.keyRepeatTimerfd, &repeats, sizeof(repeats)) == 8) if (read(_glfw.wl.keyRepeatTimerfd, &repeats, sizeof(repeats)) == 8)
{ {
for (uint64_t i = 0; i < repeats; i++) if(_glfw.wl.keyboardFocus)
{ {
_glfwInputKey(_glfw.wl.keyboardFocus, for (uint64_t i = 0; i < repeats; i++)
translateKey(_glfw.wl.keyRepeatScancode), {
_glfw.wl.keyRepeatScancode, _glfwInputKey(_glfw.wl.keyboardFocus,
GLFW_PRESS, translateKey(_glfw.wl.keyRepeatScancode),
_glfw.wl.xkb.modifiers); _glfw.wl.keyRepeatScancode,
inputText(_glfw.wl.keyboardFocus, _glfw.wl.keyRepeatScancode); GLFW_PRESS,
_glfw.wl.xkb.modifiers);
inputText(_glfw.wl.keyboardFocus, _glfw.wl.keyRepeatScancode);
}
event = GLFW_TRUE;
} }
event = GLFW_TRUE;
} }
} }
@ -1329,6 +1479,7 @@ static char* readDataOfferAsString(struct wl_data_offer* offer, const char* mime
if (!longer) if (!longer)
{ {
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL); _glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
_glfw_free(string);
close(fds[0]); close(fds[0]);
return NULL; return NULL;
} }
@ -1348,6 +1499,7 @@ static char* readDataOfferAsString(struct wl_data_offer* offer, const char* mime
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to read from data offer pipe: %s", "Wayland: Failed to read from data offer pipe: %s",
strerror(errno)); strerror(errno));
_glfw_free(string);
close(fds[0]); close(fds[0]);
return NULL; return NULL;
} }
@ -1386,11 +1538,21 @@ static void pointerHandleEnter(void* userData,
window->wl.hovered = GLFW_TRUE; window->wl.hovered = GLFW_TRUE;
_glfwSetCursorWayland(window, window->wl.currentCursor); _glfwSetCursorWayland(window, window->wl.currentCursor);
_glfwInputCursorEnter(window, GLFW_TRUE); _glfwInputCursorEnter(window, GLFW_TRUE);
if (window->cursorMode != GLFW_CURSOR_DISABLED)
{
window->wl.cursorPosX = wl_fixed_to_double(sx);
window->wl.cursorPosY = wl_fixed_to_double(sy);
_glfwInputCursorPos(window, window->wl.cursorPosX, window->wl.cursorPosY);
}
} }
else else
{ {
if (window->wl.fallback.decorations) if (window->wl.fallback.decorations)
{
window->wl.fallback.focus = surface; window->wl.fallback.focus = surface;
updateFallbackDecorationCursor(window, sx, sy);
}
} }
} }
@ -1411,7 +1573,6 @@ static void pointerHandleLeave(void* userData,
_glfw.wl.serial = serial; _glfw.wl.serial = serial;
_glfw.wl.pointerFocus = NULL; _glfw.wl.pointerFocus = NULL;
_glfw.wl.cursorPreviousName = NULL;
if (window->wl.hovered) if (window->wl.hovered)
{ {
@ -1421,7 +1582,10 @@ static void pointerHandleLeave(void* userData,
else else
{ {
if (window->wl.fallback.decorations) if (window->wl.fallback.decorations)
{
window->wl.fallback.focus = NULL; window->wl.fallback.focus = NULL;
window->wl.fallback.cursorName = NULL;
}
} }
} }
@ -1438,92 +1602,16 @@ static void pointerHandleMotion(void* userData,
if (window->cursorMode == GLFW_CURSOR_DISABLED) if (window->cursorMode == GLFW_CURSOR_DISABLED)
return; return;
const double xpos = wl_fixed_to_double(sx);
const double ypos = wl_fixed_to_double(sy);
window->wl.cursorPosX = xpos;
window->wl.cursorPosY = ypos;
if (window->wl.hovered) if (window->wl.hovered)
{ {
_glfw.wl.cursorPreviousName = NULL; window->wl.cursorPosX = wl_fixed_to_double(sx);
_glfwInputCursorPos(window, xpos, ypos); window->wl.cursorPosY = wl_fixed_to_double(sy);
return; _glfwInputCursorPos(window, window->wl.cursorPosX, window->wl.cursorPosY);
} }
else
if (window->wl.fallback.decorations)
{ {
const char* cursorName = "left_ptr"; if (window->wl.fallback.decorations)
updateFallbackDecorationCursor(window, sx, sy);
if (window->resizable)
{
if (window->wl.fallback.focus == window->wl.fallback.top.surface)
{
if (ypos < GLFW_BORDER_SIZE)
cursorName = "n-resize";
}
else if (window->wl.fallback.focus == window->wl.fallback.left.surface)
{
if (ypos < GLFW_BORDER_SIZE)
cursorName = "nw-resize";
else
cursorName = "w-resize";
}
else if (window->wl.fallback.focus == window->wl.fallback.right.surface)
{
if (ypos < GLFW_BORDER_SIZE)
cursorName = "ne-resize";
else
cursorName = "e-resize";
}
else if (window->wl.fallback.focus == window->wl.fallback.bottom.surface)
{
if (xpos < GLFW_BORDER_SIZE)
cursorName = "sw-resize";
else if (xpos > window->wl.width + GLFW_BORDER_SIZE)
cursorName = "se-resize";
else
cursorName = "s-resize";
}
}
if (_glfw.wl.cursorPreviousName != cursorName)
{
struct wl_surface* surface = _glfw.wl.cursorSurface;
struct wl_cursor_theme* theme = _glfw.wl.cursorTheme;
int scale = 1;
if (window->wl.bufferScale > 1 && _glfw.wl.cursorThemeHiDPI)
{
// We only support up to scale=2 for now, since libwayland-cursor
// requires us to load a different theme for each size.
scale = 2;
theme = _glfw.wl.cursorThemeHiDPI;
}
struct wl_cursor* cursor = wl_cursor_theme_get_cursor(theme, cursorName);
if (!cursor)
return;
// TODO: handle animated cursors too.
struct wl_cursor_image* image = cursor->images[0];
if (!image)
return;
struct wl_buffer* buffer = wl_cursor_image_get_buffer(image);
if (!buffer)
return;
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
surface,
image->hotspot_x / scale,
image->hotspot_y / scale);
wl_surface_set_buffer_scale(surface, scale);
wl_surface_attach(surface, buffer, 0, 0);
wl_surface_damage(surface, 0, 0, image->width, image->height);
wl_surface_commit(surface);
_glfw.wl.cursorPreviousName = cursorName;
}
} }
} }
@ -1546,62 +1634,11 @@ static void pointerHandleButton(void* userData,
button - BTN_LEFT, button - BTN_LEFT,
state == WL_POINTER_BUTTON_STATE_PRESSED, state == WL_POINTER_BUTTON_STATE_PRESSED,
_glfw.wl.xkb.modifiers); _glfw.wl.xkb.modifiers);
return;
} }
else
if (window->wl.fallback.decorations)
{ {
if (button == BTN_LEFT) if (window->wl.fallback.decorations)
{ handleFallbackDecorationButton(window, serial, button);
uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_NONE;
if (window->wl.fallback.focus == window->wl.fallback.top.surface)
{
if (window->wl.cursorPosY < GLFW_BORDER_SIZE)
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP;
else
xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial);
}
else if (window->wl.fallback.focus == window->wl.fallback.left.surface)
{
if (window->wl.cursorPosY < GLFW_BORDER_SIZE)
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT;
else
edges = XDG_TOPLEVEL_RESIZE_EDGE_LEFT;
}
else if (window->wl.fallback.focus == window->wl.fallback.right.surface)
{
if (window->wl.cursorPosY < GLFW_BORDER_SIZE)
edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT;
else
edges = XDG_TOPLEVEL_RESIZE_EDGE_RIGHT;
}
else if (window->wl.fallback.focus == window->wl.fallback.bottom.surface)
{
if (window->wl.cursorPosX < GLFW_BORDER_SIZE)
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT;
else if (window->wl.cursorPosX > window->wl.width + GLFW_BORDER_SIZE)
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT;
else
edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM;
}
if (edges != XDG_TOPLEVEL_RESIZE_EDGE_NONE)
{
xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat,
serial, edges);
}
}
else if (button == BTN_RIGHT)
{
if (window->wl.xdg.toplevel)
{
xdg_toplevel_show_window_menu(window->wl.xdg.toplevel,
_glfw.wl.seat, serial,
window->wl.cursorPosX,
window->wl.cursorPosY);
}
}
} }
} }
@ -1615,11 +1652,14 @@ static void pointerHandleAxis(void* userData,
if (!window) if (!window)
return; return;
// NOTE: 10 units of motion per mouse wheel step seems to be a common ratio if (window->wl.hovered)
if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) {
_glfwInputScroll(window, -wl_fixed_to_double(value) / 10.0, 0.0); // NOTE: 10 units of motion per mouse wheel step seems to be a common ratio
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL)
_glfwInputScroll(window, 0.0, -wl_fixed_to_double(value) / 10.0); _glfwInputScroll(window, -wl_fixed_to_double(value) / 10.0, 0.0);
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
_glfwInputScroll(window, 0.0, -wl_fixed_to_double(value) / 10.0);
}
} }
static const struct wl_pointer_listener pointerListener = static const struct wl_pointer_listener pointerListener =
@ -1796,11 +1836,12 @@ static void keyboardHandleKey(void* userData,
timer.it_value.tv_sec = _glfw.wl.keyRepeatDelay / 1000; timer.it_value.tv_sec = _glfw.wl.keyRepeatDelay / 1000;
timer.it_value.tv_nsec = (_glfw.wl.keyRepeatDelay % 1000) * 1000000; timer.it_value.tv_nsec = (_glfw.wl.keyRepeatDelay % 1000) * 1000000;
timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL);
} }
} else if (scancode == _glfw.wl.keyRepeatScancode) {
timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL);
} }
timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL);
_glfwInputKey(window, key, scancode, action, _glfw.wl.xkb.modifiers); _glfwInputKey(window, key, scancode, action, _glfw.wl.xkb.modifiers);
if (action == GLFW_PRESS) if (action == GLFW_PRESS)
@ -2191,7 +2232,12 @@ void _glfwDestroyWindowWayland(_GLFWwindow* window)
_glfw.wl.pointerFocus = NULL; _glfw.wl.pointerFocus = NULL;
if (window == _glfw.wl.keyboardFocus) if (window == _glfw.wl.keyboardFocus)
{
struct itimerspec timer = {0};
timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL);
_glfw.wl.keyboardFocus = NULL; _glfw.wl.keyboardFocus = NULL;
}
if (window->wl.fractionalScale) if (window->wl.fractionalScale)
wp_fractional_scale_v1_destroy(window->wl.fractionalScale); wp_fractional_scale_v1_destroy(window->wl.fractionalScale);
@ -2738,23 +2784,23 @@ const char* _glfwGetScancodeNameWayland(int scancode)
return NULL; return NULL;
} }
const uint32_t codepoint = _glfwKeySym2Unicode(keysyms[0]); // WORKAROUND: xkb_keysym_to_utf8() requires the third parameter (size of the output buffer)
if (codepoint == GLFW_INVALID_CODEPOINT) // to be at least 7 (6 bytes + a null terminator), because it was written when UTF-8
// sequences could be up to 6 bytes long. The _glfw.wl.keynames buffers are only 5 bytes
// long, because UTF-8 sequences are now limited to 4 bytes and no codepoints were ever assigned
// that needed more than that. To work around this, we first copy to a temporary buffer.
//
// See: https://github.com/xkbcommon/libxkbcommon/issues/418
char temp_buffer[7];
const int bytes_written = xkb_keysym_to_utf8(keysyms[0], temp_buffer, sizeof(temp_buffer));
if (bytes_written <= 0 || bytes_written > 5)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to retrieve codepoint for key name"); "Wayland: Failed to encode keysym as UTF-8");
return NULL; return NULL;
} }
memcpy(_glfw.wl.keynames[key], temp_buffer, bytes_written);
const size_t count = _glfwEncodeUTF8(_glfw.wl.keynames[key], codepoint);
if (count == 0)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to encode codepoint for key name");
return NULL;
}
_glfw.wl.keynames[key][count] = '\0';
return _glfw.wl.keynames[key]; return _glfw.wl.keynames[key];
} }

View File

@ -535,6 +535,7 @@ static void detectEWMH(void)
XA_WINDOW, XA_WINDOW,
(unsigned char**) &windowFromChild)) (unsigned char**) &windowFromChild))
{ {
_glfwReleaseErrorHandlerX11();
XFree(windowFromRoot); XFree(windowFromRoot);
return; return;
} }

View File

@ -470,6 +470,7 @@ typedef struct _GLFWcontextGLX
{ {
GLXContext handle; GLXContext handle;
GLXWindow window; GLXWindow window;
GLXFBConfig fbconfig;
} _GLFWcontextGLX; } _GLFWcontextGLX;
// GLX-specific global data // GLX-specific global data

View File

@ -754,13 +754,13 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
const char* resourceName = getenv("RESOURCE_NAME"); const char* resourceName = getenv("RESOURCE_NAME");
if (resourceName && strlen(resourceName)) if (resourceName && strlen(resourceName))
hint->res_name = (char*) resourceName; hint->res_name = (char*) resourceName;
else if (strlen(wndconfig->title)) else if (strlen(window->title))
hint->res_name = (char*) wndconfig->title; hint->res_name = (char*) window->title;
else else
hint->res_name = (char*) "glfw-application"; hint->res_name = (char*) "glfw-application";
if (strlen(wndconfig->title)) if (strlen(window->title))
hint->res_class = (char*) wndconfig->title; hint->res_class = (char*) window->title;
else else
hint->res_class = (char*) "GLFW-Application"; hint->res_class = (char*) "GLFW-Application";
} }
@ -780,7 +780,7 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
if (_glfw.x11.im) if (_glfw.x11.im)
_glfwCreateInputContextX11(window); _glfwCreateInputContextX11(window);
_glfwSetWindowTitleX11(window, wndconfig->title); _glfwSetWindowTitleX11(window, window->title);
_glfwGetWindowPosX11(window, &window->x11.xpos, &window->x11.ypos); _glfwGetWindowPosX11(window, &window->x11.xpos, &window->x11.ypos);
_glfwGetWindowSizeX11(window, &window->x11.width, &window->x11.height); _glfwGetWindowSizeX11(window, &window->x11.width, &window->x11.height);