Merge branch 'master' into multi-context-windows-merge-master

This commit is contained in:
Doug Binks 2024-01-25 17:44:13 +00:00
commit 6148990427
75 changed files with 7400 additions and 1196 deletions

View File

@ -15,10 +15,10 @@ environment:
- GENERATOR: MinGW Makefiles - GENERATOR: MinGW Makefiles
BUILD_SHARED_LIBS: OFF BUILD_SHARED_LIBS: OFF
CFLAGS: -Werror CFLAGS: -Werror
- GENERATOR: Visual Studio 10 2010 - GENERATOR: Visual Studio 12 2013
BUILD_SHARED_LIBS: ON BUILD_SHARED_LIBS: ON
CFLAGS: /WX CFLAGS: /WX
- GENERATOR: Visual Studio 10 2010 - GENERATOR: Visual Studio 12 2013
BUILD_SHARED_LIBS: OFF BUILD_SHARED_LIBS: OFF
CFLAGS: /WX CFLAGS: /WX
matrix: matrix:
@ -30,14 +30,14 @@ for:
- GENERATOR: MinGW Makefiles - GENERATOR: MinGW Makefiles
build_script: build_script:
- set PATH=%PATH:C:\Program Files\Git\usr\bin=C:\MinGW\bin% - set PATH=%PATH:C:\Program Files\Git\usr\bin=C:\MinGW\bin%
- cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% - cmake -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
- cmake --build build - cmake --build build
- -
matrix: matrix:
only: only:
- GENERATOR: Visual Studio 10 2010 - GENERATOR: Visual Studio 12 2013
build_script: build_script:
- cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% - cmake -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
- cmake --build build --target glfw - cmake --build build --target glfw
notifications: notifications:
- provider: Email - provider: Email

67
.editorconfig Normal file
View File

@ -0,0 +1,67 @@
# EditorConfig for GLFW and its internal dependencies
#
# All files created by GLFW should indent with four spaces unless their format requires
# otherwise. A few files still use other indent styles for historical reasons.
#
# Dependencies have (what seemed to be) their existing styles described. Those with
# existing trailing whitespace have it preserved to avoid cluttering future commits.
root = true
[*]
charset = utf-8
end_of_line = lf
[include/GLFW/*.h]
indent_style = space
indent_size = 4
[{src,examples,tests}/*.{c,m,h,rc,in}]
indent_style = space
indent_size = 4
[CMakeLists.txt]
indent_style = space
indent_size = 4
[CMake/**.{cmake,in}]
indent_style = space
indent_size = 4
[*.{dox,md}]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false
[DoxygenLayout.xml]
indent_style = space
indent_size = 2
[docs/*.{scss,html}]
indent_style = tab
indent_size = unset
[deps/mingw/*.h]
indent_style = space
indent_size = 4
tab_width = 8
trim_trailing_whitespace = false
[deps/getopt.{c,h}]
indent_style = space
indent_size = 2
[deps/linmath.h]
indent_style = tab
tab_width = 4
indent_size = 4
trim_trailing_whitespace = false
[deps/nuklear*.h]
indent_style = space
indent_size = 4
[deps/tinycthread.{c,h}]
indent_style = space
indent_size = 2

2
.github/CODEOWNERS vendored
View File

@ -1,8 +1,6 @@
* @elmindreda * @elmindreda
src/wl_* @linkmauve
docs/*.css @glfw/webdev docs/*.css @glfw/webdev
docs/*.scss @glfw/webdev docs/*.scss @glfw/webdev
docs/*.html @glfw/webdev docs/*.html @glfw/webdev

View File

@ -3,91 +3,98 @@ on:
pull_request: pull_request:
push: push:
branches: [ ci, master, latest, 3.3-stable ] branches: [ ci, master, latest, 3.3-stable ]
workflow_dispatch:
permissions: permissions:
statuses: write statuses: write
contents: read contents: read
jobs: jobs:
build-linux-x11-clang: build-linux-clang:
name: X11 (Linux, Clang) name: Linux (Clang)
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 4
env: env:
CC: clang CC: clang
CFLAGS: -Werror CFLAGS: -Werror
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt update sudo apt update
sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev libwayland-dev libxkbcommon-dev
- name: Configure static library - name: Configure Null shared library
run: cmake -S . -B build-static run: cmake -B build-null-shared -D GLFW_BUILD_WAYLAND=OFF -D GLFW_BUILD_X11=OFF -D BUILD_SHARED_LIBS=ON
- name: Build static library - name: Build Null shared library
run: cmake --build build-static --parallel run: cmake --build build-null-shared --parallel
- name: Configure shared library - name: Configure X11 shared library
run: cmake -S . -B build-shared -D BUILD_SHARED_LIBS=ON run: cmake -B build-x11-shared -D GLFW_BUILD_WAYLAND=OFF -D GLFW_BUILD_X11=ON -D BUILD_SHARED_LIBS=ON
- name: Build shared library - name: Build X11 shared library
run: cmake --build build-shared --parallel run: cmake --build build-x11-shared --parallel
build-linux-full-clang: - name: Configure Wayland shared library
name: X11+Wayland (Linux, Clang) run: cmake -B build-wayland-shared -D GLFW_BUILD_WAYLAND=ON -D GLFW_BUILD_X11=OFF -D BUILD_SHARED_LIBS=ON
runs-on: ubuntu-latest - name: Build Wayland shared library
env: run: cmake --build build-wayland-shared --parallel
CC: clang
CFLAGS: -Werror
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt update
sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev wayland-protocols libwayland-dev libxkbcommon-dev
- name: Configure static library - name: Configure Wayland+X11 static library
run: cmake -S . -B build-static -D GLFW_BUILD_WAYLAND=ON run: cmake -B build-full-static -D GLFW_BUILD_WAYLAND=ON -D GLFW_BUILD_X11=ON
- name: Build static library - name: Build Wayland+X11 static library
run: cmake --build build-static --parallel run: cmake --build build-full-static --parallel
- name: Configure shared library - name: Configure Wayland+X11 shared library
run: cmake -S . -B build-shared -D GLFW_BUILD_WAYLAND=ON -D BUILD_SHARED_LIBS=ON run: cmake -B build-full-shared -D GLFW_BUILD_WAYLAND=ON -D BUILD_SHARED_LIBS=ON -D GLFW_BUILD_X11=ON
- name: Build shared library - name: Build Wayland+X11 shared library
run: cmake --build build-shared --parallel run: cmake --build build-full-shared --parallel
build-macos-cocoa-clang: build-macos-clang:
name: Cocoa (macOS, Clang) name: macOS (Clang)
runs-on: macos-latest runs-on: macos-latest
timeout-minutes: 4
env: env:
CFLAGS: -Werror CFLAGS: -Werror
MACOSX_DEPLOYMENT_TARGET: 10.8 MACOSX_DEPLOYMENT_TARGET: 10.8
CMAKE_OSX_ARCHITECTURES: x86_64;arm64
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Configure static library - name: Configure Null shared library
run: cmake -S . -B build-static run: cmake -B build-null-shared -D GLFW_BUILD_COCOA=OFF -D BUILD_SHARED_LIBS=ON
- name: Build static library - name: Build Null shared library
run: cmake --build build-static --parallel run: cmake --build build-null-shared --parallel
- name: Configure shared library - name: Configure Cocoa static library
run: cmake -S . -B build-shared -D BUILD_SHARED_LIBS=ON run: cmake -B build-cocoa-static
- name: Build shared library - name: Build Cocoa static library
run: cmake --build build-shared --parallel run: cmake --build build-cocoa-static --parallel
build-windows-win32-vs2022: - name: Configure Cocoa shared library
name: Win32 (Windows, VS2022) run: cmake -B build-cocoa-shared -D BUILD_SHARED_LIBS=ON
- name: Build Cocoa shared library
run: cmake --build build-cocoa-shared --parallel
build-windows-vs2022:
name: Windows (VS2022)
runs-on: windows-latest runs-on: windows-latest
timeout-minutes: 4
env: env:
CFLAGS: /WX CFLAGS: /WX
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Configure static library - name: Configure Win32 shared x86 library
run: cmake -S . -B build-static -G "Visual Studio 17 2022" run: cmake -B build-win32-shared-x86 -G "Visual Studio 17 2022" -A Win32 -D BUILD_SHARED_LIBS=ON
- name: Build static library - name: Build Win32 shared x86 library
run: cmake --build build-static --parallel run: cmake --build build-win32-shared-x86 --parallel
- name: Configure shared library - name: Configure Win32 static x64 library
run: cmake -S . -B build-shared -G "Visual Studio 17 2022" -D BUILD_SHARED_LIBS=ON run: cmake -B build-win32-static-x64 -G "Visual Studio 17 2022" -A x64
- name: Build shared library - name: Build Win32 static x64 library
run: cmake --build build-shared --parallel run: cmake --build build-win32-static-x64 --parallel
- name: Configure Win32 shared x64 library
run: cmake -B build-win32-shared-x64 -G "Visual Studio 17 2022" -A x64 -D BUILD_SHARED_LIBS=ON
- name: Build Win32 shared x64 library
run: cmake --build build-win32-shared-x64 --parallel

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
# The canonical out-of-tree build subdirectory # The canonical out-of-tree build subdirectory
build build
build-*
# Visual Studio clutter # Visual Studio clutter
_ReSharper* _ReSharper*

View File

@ -8,6 +8,6 @@ Description: A multi-platform library for OpenGL, window and input
Version: @GLFW_VERSION@ Version: @GLFW_VERSION@
URL: https://www.glfw.org/ URL: https://www.glfw.org/
Requires.private: @GLFW_PKG_CONFIG_REQUIRES_PRIVATE@ Requires.private: @GLFW_PKG_CONFIG_REQUIRES_PRIVATE@
Libs: -L${libdir} -l@GLFW_LIB_NAME@ Libs: -L${libdir} -l@GLFW_LIB_NAME@@GLFW_LIB_NAME_SUFFIX@
Libs.private: @GLFW_PKG_CONFIG_LIBS_PRIVATE@ Libs.private: @GLFW_PKG_CONFIG_LIBS_PRIVATE@
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@ -2,12 +2,6 @@ cmake_minimum_required(VERSION 3.4...3.20 FATAL_ERROR)
project(GLFW VERSION 3.4.0 LANGUAGES C) project(GLFW VERSION 3.4.0 LANGUAGES C)
set(CMAKE_LEGACY_CYGWIN_WIN32 OFF)
if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
if (POLICY CMP0069) if (POLICY CMP0069)
cmake_policy(SET CMP0069 NEW) cmake_policy(SET CMP0069 NEW)
endif() endif()
@ -18,9 +12,7 @@ endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) string(COMPARE EQUAL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}" GLFW_STANDALONE)
set(GLFW_STANDALONE TRUE)
endif()
option(BUILD_SHARED_LIBS "Build shared libraries" OFF) option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ${GLFW_STANDALONE}) option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ${GLFW_STANDALONE})

View File

@ -66,11 +66,13 @@ video tutorials.
- Nikita Fediuchin - Nikita Fediuchin
- Felipe Ferreira - Felipe Ferreira
- Michael Fogleman - Michael Fogleman
- forworldm
- Jason Francis - Jason Francis
- Gerald Franz - Gerald Franz
- Mário Freitas - Mário Freitas
- GeO4d - GeO4d
- Marcus Geelnard - Marcus Geelnard
- Gegy
- ghuser404 - ghuser404
- Charles Giessen - Charles Giessen
- Ryan C. Gordon - Ryan C. Gordon
@ -78,11 +80,14 @@ video tutorials.
- Kovid Goyal - Kovid Goyal
- Kevin Grandemange - Kevin Grandemange
- Eloi Marín Gratacós - Eloi Marín Gratacós
- Grzesiek11
- Stefan Gustavson - Stefan Gustavson
- Andrew Gutekanst - Andrew Gutekanst
- Stephen Gutekanst - Stephen Gutekanst
- Jonathan Hale - Jonathan Hale
- Daniel Hauser
- hdf89shfdfs - hdf89shfdfs
- Moritz Heinemann
- Sylvain Hellegouarch - Sylvain Hellegouarch
- Björn Hempel - Björn Hempel
- Matthew Henry - Matthew Henry
@ -100,6 +105,7 @@ video tutorials.
- JannikGM - JannikGM
- Erik S. V. Jansson - Erik S. V. Jansson
- jjYBdx4IL - jjYBdx4IL
- Peter Johnson
- Toni Jovanoski - Toni Jovanoski
- Arseny Kapoulkine - Arseny Kapoulkine
- Cem Karan - Cem Karan
@ -122,11 +128,14 @@ video tutorials.
- Anders Lindqvist - Anders Lindqvist
- Leon Linhart - Leon Linhart
- Marco Lizza - Marco Lizza
- lo-v-ol
- Eyal Lotem - Eyal Lotem
- Aaron Loucks - Aaron Loucks
- Ned Loynd
- Luflosi - Luflosi
- lukect - lukect
- Tristam MacDonald - Tristam MacDonald
- Jean-Luc Mackail
- Hans Mackowiak - Hans Mackowiak
- Ramiro Magno - Ramiro Magno
- Дмитри Малышев - Дмитри Малышев
@ -141,6 +150,7 @@ video tutorials.
- Marcel Metz - Marcel Metz
- Liam Middlebrook - Liam Middlebrook
- Ave Milia - Ave Milia
- Icyllis Milica
- Jonathan Miller - Jonathan Miller
- Kenneth Miller - Kenneth Miller
- Bruce Mitchener - Bruce Mitchener
@ -188,6 +198,7 @@ video tutorials.
- pthom - pthom
- Martin Pulec - Martin Pulec
- Guillaume Racicot - Guillaume Racicot
- Juan Ramos
- Christian Rauch - Christian Rauch
- Philip Rideout - Philip Rideout
- Eddie Ringle - Eddie Ringle
@ -200,17 +211,22 @@ video tutorials.
- Aleksey Rybalkin - Aleksey Rybalkin
- Mikko Rytkönen - Mikko Rytkönen
- Riku Salminen - Riku Salminen
- Yoshinori Sano
- Brandon Schaefer - Brandon Schaefer
- Sebastian Schuberth - Sebastian Schuberth
- Scr3amer
- Christian Sdunek - Christian Sdunek
- Matt Sealey - Matt Sealey
- Steve Sexton - Steve Sexton
- Arkady Shapkin - Arkady Shapkin
- Mingjie Shen
- Ali Sherief - Ali Sherief
- Yoshiki Shibukawa - Yoshiki Shibukawa
- Dmitri Shuralyov - Dmitri Shuralyov
- Joao da Silva - Joao da Silva
- Daniel Sieger - Daniel Sieger
- Daljit Singh
- Michael Skec
- Daniel Skorupski - Daniel Skorupski
- Slemmie - Slemmie
- Anthony Smith - Anthony Smith
@ -241,10 +257,12 @@ video tutorials.
- Jari Vetoniemi - Jari Vetoniemi
- Ricardo Vieira - Ricardo Vieira
- Nicholas Vitovitch - Nicholas Vitovitch
- Vladimír Vondruš
- Simon Voordouw - Simon Voordouw
- Corentin Wallez - Corentin Wallez
- Torsten Walluhn - Torsten Walluhn
- Patrick Walton - Patrick Walton
- Jim Wang
- Xo Wang - Xo Wang
- Andre Weissflog - Andre Weissflog
- Jay Weisskopf - Jay Weisskopf

View File

@ -79,6 +79,8 @@ more information.
## System requirements ## System requirements
GLFW is written in C99 and does not support Visual Studio 2012 or earlier.
GLFW supports Windows XP and later and macOS 10.8 and later. Linux and other GLFW supports Windows XP and later and macOS 10.8 and later. Linux and other
Unix-like systems running the X Window System are supported even without Unix-like systems running the X Window System are supported even without
a desktop environment or modern extensions, although some features require a desktop environment or modern extensions, although some features require
@ -187,6 +189,8 @@ information on what to include when reporting a bug.
- Bugfix: `glfwMakeContextCurrent` would access TLS slot before initialization - Bugfix: `glfwMakeContextCurrent` would access TLS slot before initialization
- Bugfix: `glfwSetGammaRamp` could emit `GLFW_INVALID_VALUE` before initialization - Bugfix: `glfwSetGammaRamp` could emit `GLFW_INVALID_VALUE` before initialization
- Bugfix: `glfwGetJoystickUserPointer` returned `NULL` during disconnection (#2092) - Bugfix: `glfwGetJoystickUserPointer` returned `NULL` during disconnection (#2092)
- Bugfix: `glfwGetKeyScancode` returned `0` on error when initialized instead of `-1`
- Bugfix: Failure to make a newly created context current could cause segfault (#2327)
- [Win32] Added the `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access - [Win32] Added the `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access
to the window menu to the window menu
- [Win32] Added a version info resource to the GLFW DLL - [Win32] Added a version info resource to the GLFW DLL
@ -233,6 +237,10 @@ information on what to include when reporting a bug.
- [Win32] Bugfix: Instance-local operations used executable instance (#469,#1296,#1395) - [Win32] Bugfix: Instance-local operations used executable instance (#469,#1296,#1395)
- [Win32] Bugfix: The OSMesa library was not unloaded on termination - [Win32] Bugfix: The OSMesa library was not unloaded on termination
- [Win32] Bugfix: Right shift emitted `GLFW_KEY_UNKNOWN` when using a CJK IME (#2050) - [Win32] Bugfix: Right shift emitted `GLFW_KEY_UNKNOWN` when using a CJK IME (#2050)
- [Win32] Bugfix: `glfwWaitEventsTimeout` did not return for some sent messages (#2408)
- [Win32] Bugfix: Fix pkg-config for dynamic library on Windows (#2386, #2420)
- [Win32] Bugfix: XInput could reportedly provide invalid DPad bit masks (#2291)
- [Win32] Bugfix: Rapid clipboard calls could fail due to Clipboard History
- [Cocoa] Added support for `VK_EXT_metal_surface` (#1619) - [Cocoa] Added support for `VK_EXT_metal_surface` (#1619)
- [Cocoa] Added locating the Vulkan loader at runtime in an application bundle - [Cocoa] Added locating the Vulkan loader at runtime in an application bundle
- [Cocoa] Moved main menu creation to GLFW initialization time (#1649) - [Cocoa] Moved main menu creation to GLFW initialization time (#1649)
@ -273,6 +281,10 @@ information on what to include when reporting a bug.
application (#2110) application (#2110)
- [Cocoa] Bugfix: The Vulkan loader was not loaded from the `Frameworks` bundle - [Cocoa] Bugfix: The Vulkan loader was not loaded from the `Frameworks` bundle
subdirectory (#2113,#2120) subdirectory (#2113,#2120)
- [Cocoa] Bugfix: Compilation failed on OS X 10.8 due to unconditional use of 10.9+
symbols (#2161)
- [Cocoa] Bugfix: Querying joystick elements could reportedly segfault on macOS
13 Ventura (#2320)
- [X11] Bugfix: The CMake files did not check for the XInput headers (#1480) - [X11] Bugfix: The CMake files did not check for the XInput headers (#1480)
- [X11] Bugfix: Key names were not updated when the keyboard layout changed - [X11] Bugfix: Key names were not updated when the keyboard layout changed
(#1462,#1528) (#1462,#1528)
@ -315,6 +327,7 @@ information on what to include when reporting a bug.
- [X11] Bugfix: The OSMesa libray was not unloaded on termination - [X11] Bugfix: The OSMesa libray was not unloaded on termination
- [X11] Bugfix: A malformed response during selection transfer could cause a segfault - [X11] Bugfix: A malformed response during selection transfer could cause a segfault
- [X11] Bugfix: Some calls would reset Xlib to the default error handler (#2108) - [X11] Bugfix: Some calls would reset Xlib to the default error handler (#2108)
- [Wayland] Added improved fallback window decorations via libdecor (#1639,#1693)
- [Wayland] Added dynamic loading of all Wayland libraries - [Wayland] Added dynamic loading of all Wayland libraries
- [Wayland] Added support for key names via xkbcommon - [Wayland] Added support for key names via xkbcommon
- [Wayland] Added support for file path drop events (#2040) - [Wayland] Added support for file path drop events (#2040)
@ -386,9 +399,12 @@ information on what to include when reporting a bug.
- [Wayland] Bugfix: `GLFW_DECORATED` was ignored when showing a window with XDG - [Wayland] Bugfix: `GLFW_DECORATED` was ignored when showing a window with XDG
decorations decorations
- [Wayland] Bugfix: Connecting a mouse after `glfwInit` would segfault (#1450) - [Wayland] Bugfix: Connecting a mouse after `glfwInit` would segfault (#1450)
- [Wayland] Bugfix: Joysticks connected after `glfwInit` were not detected (#2198)
- [Wayland] Bugfix: Fallback decorations emitted `GLFW_CURSOR_UNAVAILABLE` errors
- [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Removed use of deprecated function `gettimeofday`
- [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled
- [Linux] Bugfix: Joysticks without buttons were ignored (#2042,#2043) - [Linux] Bugfix: Joysticks without buttons were ignored (#2042,#2043)
- [Linux] Bugfix: A small amount of memory could leak if initialization failed (#2229)
- [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072)
- [NSGL] Removed enforcement of forward-compatible flag for core contexts - [NSGL] Removed enforcement of forward-compatible flag for core contexts
- [NSGL] Bugfix: `GLFW_COCOA_RETINA_FRAMEBUFFER` had no effect on newer - [NSGL] Bugfix: `GLFW_COCOA_RETINA_FRAMEBUFFER` had no effect on newer
@ -400,8 +416,9 @@ information on what to include when reporting a bug.
(#442) (#442)
- [EGL] Added ANGLE backend selection via `EGL_ANGLE_platform_angle` extension - [EGL] Added ANGLE backend selection via `EGL_ANGLE_platform_angle` extension
(#1380) (#1380)
[EGL] Added loading of glvnd `libOpenGL.so.0` where available for OpenGL - [EGL] Added loading of glvnd `libOpenGL.so.0` where available for OpenGL
- [EGL] Bugfix: The `GLFW_DOUBLEBUFFER` context attribute was ignored (#1843) - [EGL] Bugfix: The `GLFW_DOUBLEBUFFER` context attribute was ignored (#1843)
- [EGL] Bugfix: Setting `GLFW_CONTEXT_DEBUG` caused creation to fail (#2348)
- [GLX] Added loading of glvnd `libGLX.so.0` where available - [GLX] Added loading of glvnd `libGLX.so.0` where available
- [GLX] Bugfix: Context creation failed if GLX 1.4 was not exported by GLX library - [GLX] Bugfix: Context creation failed if GLX 1.4 was not exported by GLX library

247
deps/vs2008/stdint.h vendored
View File

@ -1,247 +0,0 @@
// ISO C9x compliant stdint.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006-2008 Alexander Chemeris
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. The name of the author may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
#ifndef _MSC_STDINT_H_ // [
#define _MSC_STDINT_H_
#if _MSC_VER > 1000
#pragma once
#endif
#include <limits.h>
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
// or compiler give many errors like this:
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
#ifdef __cplusplus
extern "C" {
#endif
# include <wchar.h>
#ifdef __cplusplus
}
#endif
// Define _W64 macros to mark types changing their size, like intptr_t.
#ifndef _W64
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
# define _W64 __w64
# else
# define _W64
# endif
#endif
// 7.18.1 Integer types
// 7.18.1.1 Exact-width integer types
// Visual Studio 6 and Embedded Visual C++ 4 doesn't
// realize that, e.g. char has the same size as __int8
// so we give up on __intX for them.
#if (_MSC_VER < 1300)
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#else
typedef signed __int8 int8_t;
typedef signed __int16 int16_t;
typedef signed __int32 int32_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
#endif
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
// 7.18.1.2 Minimum-width integer types
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
typedef int64_t int_least64_t;
typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
typedef uint64_t uint_least64_t;
// 7.18.1.3 Fastest minimum-width integer types
typedef int8_t int_fast8_t;
typedef int16_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef int64_t int_fast64_t;
typedef uint8_t uint_fast8_t;
typedef uint16_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
typedef uint64_t uint_fast64_t;
// 7.18.1.4 Integer types capable of holding object pointers
#ifdef _WIN64 // [
typedef signed __int64 intptr_t;
typedef unsigned __int64 uintptr_t;
#else // _WIN64 ][
typedef _W64 signed int intptr_t;
typedef _W64 unsigned int uintptr_t;
#endif // _WIN64 ]
// 7.18.1.5 Greatest-width integer types
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
// 7.18.2 Limits of specified-width integer types
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
// 7.18.2.1 Limits of exact-width integer types
#define INT8_MIN ((int8_t)_I8_MIN)
#define INT8_MAX _I8_MAX
#define INT16_MIN ((int16_t)_I16_MIN)
#define INT16_MAX _I16_MAX
#define INT32_MIN ((int32_t)_I32_MIN)
#define INT32_MAX _I32_MAX
#define INT64_MIN ((int64_t)_I64_MIN)
#define INT64_MAX _I64_MAX
#define UINT8_MAX _UI8_MAX
#define UINT16_MAX _UI16_MAX
#define UINT32_MAX _UI32_MAX
#define UINT64_MAX _UI64_MAX
// 7.18.2.2 Limits of minimum-width integer types
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST16_MAX INT16_MAX
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST32_MAX INT32_MAX
#define INT_LEAST64_MIN INT64_MIN
#define INT_LEAST64_MAX INT64_MAX
#define UINT_LEAST8_MAX UINT8_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#define UINT_LEAST64_MAX UINT64_MAX
// 7.18.2.3 Limits of fastest minimum-width integer types
#define INT_FAST8_MIN INT8_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MIN INT16_MIN
#define INT_FAST16_MAX INT16_MAX
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT16_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
// 7.18.2.4 Limits of integer types capable of holding object pointers
#ifdef _WIN64 // [
# define INTPTR_MIN INT64_MIN
# define INTPTR_MAX INT64_MAX
# define UINTPTR_MAX UINT64_MAX
#else // _WIN64 ][
# define INTPTR_MIN INT32_MIN
# define INTPTR_MAX INT32_MAX
# define UINTPTR_MAX UINT32_MAX
#endif // _WIN64 ]
// 7.18.2.5 Limits of greatest-width integer types
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
// 7.18.3 Limits of other integer types
#ifdef _WIN64 // [
# define PTRDIFF_MIN _I64_MIN
# define PTRDIFF_MAX _I64_MAX
#else // _WIN64 ][
# define PTRDIFF_MIN _I32_MIN
# define PTRDIFF_MAX _I32_MAX
#endif // _WIN64 ]
#define SIG_ATOMIC_MIN INT_MIN
#define SIG_ATOMIC_MAX INT_MAX
#ifndef SIZE_MAX // [
# ifdef _WIN64 // [
# define SIZE_MAX _UI64_MAX
# else // _WIN64 ][
# define SIZE_MAX _UI32_MAX
# endif // _WIN64 ]
#endif // SIZE_MAX ]
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
#ifndef WCHAR_MIN // [
# define WCHAR_MIN 0
#endif // WCHAR_MIN ]
#ifndef WCHAR_MAX // [
# define WCHAR_MAX _UI16_MAX
#endif // WCHAR_MAX ]
#define WINT_MIN 0
#define WINT_MAX _UI16_MAX
#endif // __STDC_LIMIT_MACROS ]
// 7.18.4 Limits of other integer types
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
// 7.18.4.1 Macros for minimum-width integer constants
#define INT8_C(val) val##i8
#define INT16_C(val) val##i16
#define INT32_C(val) val##i32
#define INT64_C(val) val##i64
#define UINT8_C(val) val##ui8
#define UINT16_C(val) val##ui16
#define UINT32_C(val) val##ui32
#define UINT64_C(val) val##ui64
// 7.18.4.2 Macros for greatest-width integer constants
#define INTMAX_C INT64_C
#define UINTMAX_C UINT64_C
#endif // __STDC_CONSTANT_MACROS ]
#endif // _MSC_STDINT_H_ ]

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="idle_inhibit_unstable_v1">
<copyright>
Copyright © 2015 Samsung Electronics Co., Ltd
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</copyright>
<interface name="zwp_idle_inhibit_manager_v1" version="1">
<description summary="control behavior when display idles">
This interface permits inhibiting the idle behavior such as screen
blanking, locking, and screensaving. The client binds the idle manager
globally, then creates idle-inhibitor objects for each surface.
Warning! The protocol described in this file is experimental and
backward incompatible changes may be made. Backward compatible changes
may be added together with the corresponding interface version bump.
Backward incompatible changes are done by bumping the version number in
the protocol and interface names and resetting the interface version.
Once the protocol is to be declared stable, the 'z' prefix and the
version number in the protocol and interface names are removed and the
interface version number is reset.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the idle inhibitor object">
Destroy the inhibit manager.
</description>
</request>
<request name="create_inhibitor">
<description summary="create a new inhibitor object">
Create a new inhibitor object associated with the given surface.
</description>
<arg name="id" type="new_id" interface="zwp_idle_inhibitor_v1"/>
<arg name="surface" type="object" interface="wl_surface"
summary="the surface that inhibits the idle behavior"/>
</request>
</interface>
<interface name="zwp_idle_inhibitor_v1" version="1">
<description summary="context object for inhibiting idle behavior">
An idle inhibitor prevents the output that the associated surface is
visible on from being set to a state where it is not visually usable due
to lack of user interaction (e.g. blanked, dimmed, locked, set to power
save, etc.) Any screensaver processes are also blocked from displaying.
If the surface is destroyed, unmapped, becomes occluded, loses
visibility, or otherwise becomes not visually relevant for the user, the
idle inhibitor will not be honored by the compositor; if the surface
subsequently regains visibility the inhibitor takes effect once again.
Likewise, the inhibitor isn't honored if the system was already idled at
the time the inhibitor was established, although if the system later
de-idles and re-idles the inhibitor will take effect.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the idle inhibitor object">
Remove the inhibitor effect from the associated wl_surface.
</description>
</request>
</interface>
</protocol>

View File

@ -0,0 +1,339 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="pointer_constraints_unstable_v1">
<copyright>
Copyright © 2014 Jonas Ådahl
Copyright © 2015 Red Hat Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</copyright>
<description summary="protocol for constraining pointer motions">
This protocol specifies a set of interfaces used for adding constraints to
the motion of a pointer. Possible constraints include confining pointer
motions to a given region, or locking it to its current position.
In order to constrain the pointer, a client must first bind the global
interface "wp_pointer_constraints" which, if a compositor supports pointer
constraints, is exposed by the registry. Using the bound global object, the
client uses the request that corresponds to the type of constraint it wants
to make. See wp_pointer_constraints for more details.
Warning! The protocol described in this file is experimental and backward
incompatible changes may be made. Backward compatible changes may be added
together with the corresponding interface version bump. Backward
incompatible changes are done by bumping the version number in the protocol
and interface names and resetting the interface version. Once the protocol
is to be declared stable, the 'z' prefix and the version number in the
protocol and interface names are removed and the interface version number is
reset.
</description>
<interface name="zwp_pointer_constraints_v1" version="1">
<description summary="constrain the movement of a pointer">
The global interface exposing pointer constraining functionality. It
exposes two requests: lock_pointer for locking the pointer to its
position, and confine_pointer for locking the pointer to a region.
The lock_pointer and confine_pointer requests create the objects
wp_locked_pointer and wp_confined_pointer respectively, and the client can
use these objects to interact with the lock.
For any surface, only one lock or confinement may be active across all
wl_pointer objects of the same seat. If a lock or confinement is requested
when another lock or confinement is active or requested on the same surface
and with any of the wl_pointer objects of the same seat, an
'already_constrained' error will be raised.
</description>
<enum name="error">
<description summary="wp_pointer_constraints error values">
These errors can be emitted in response to wp_pointer_constraints
requests.
</description>
<entry name="already_constrained" value="1"
summary="pointer constraint already requested on that surface"/>
</enum>
<enum name="lifetime">
<description summary="constraint lifetime">
These values represent different lifetime semantics. They are passed
as arguments to the factory requests to specify how the constraint
lifetimes should be managed.
</description>
<entry name="oneshot" value="1">
<description summary="the pointer constraint is defunct once deactivated">
A oneshot pointer constraint will never reactivate once it has been
deactivated. See the corresponding deactivation event
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
details.
</description>
</entry>
<entry name="persistent" value="2">
<description summary="the pointer constraint may reactivate">
A persistent pointer constraint may again reactivate once it has
been deactivated. See the corresponding deactivation event
(wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
details.
</description>
</entry>
</enum>
<request name="destroy" type="destructor">
<description summary="destroy the pointer constraints manager object">
Used by the client to notify the server that it will no longer use this
pointer constraints object.
</description>
</request>
<request name="lock_pointer">
<description summary="lock pointer to a position">
The lock_pointer request lets the client request to disable movements of
the virtual pointer (i.e. the cursor), effectively locking the pointer
to a position. This request may not take effect immediately; in the
future, when the compositor deems implementation-specific constraints
are satisfied, the pointer lock will be activated and the compositor
sends a locked event.
The protocol provides no guarantee that the constraints are ever
satisfied, and does not require the compositor to send an error if the
constraints cannot ever be satisfied. It is thus possible to request a
lock that will never activate.
There may not be another pointer constraint of any kind requested or
active on the surface for any of the wl_pointer objects of the seat of
the passed pointer when requesting a lock. If there is, an error will be
raised. See general pointer lock documentation for more details.
The intersection of the region passed with this request and the input
region of the surface is used to determine where the pointer must be
in order for the lock to activate. It is up to the compositor whether to
warp the pointer or require some kind of user interaction for the lock
to activate. If the region is null the surface input region is used.
A surface may receive pointer focus without the lock being activated.
The request creates a new object wp_locked_pointer which is used to
interact with the lock as well as receive updates about its state. See
the the description of wp_locked_pointer for further information.
Note that while a pointer is locked, the wl_pointer objects of the
corresponding seat will not emit any wl_pointer.motion events, but
relative motion events will still be emitted via wp_relative_pointer
objects of the same seat. wl_pointer.axis and wl_pointer.button events
are unaffected.
</description>
<arg name="id" type="new_id" interface="zwp_locked_pointer_v1"/>
<arg name="surface" type="object" interface="wl_surface"
summary="surface to lock pointer to"/>
<arg name="pointer" type="object" interface="wl_pointer"
summary="the pointer that should be locked"/>
<arg name="region" type="object" interface="wl_region" allow-null="true"
summary="region of surface"/>
<arg name="lifetime" type="uint" enum="lifetime" summary="lock lifetime"/>
</request>
<request name="confine_pointer">
<description summary="confine pointer to a region">
The confine_pointer request lets the client request to confine the
pointer cursor to a given region. This request may not take effect
immediately; in the future, when the compositor deems implementation-
specific constraints are satisfied, the pointer confinement will be
activated and the compositor sends a confined event.
The intersection of the region passed with this request and the input
region of the surface is used to determine where the pointer must be
in order for the confinement to activate. It is up to the compositor
whether to warp the pointer or require some kind of user interaction for
the confinement to activate. If the region is null the surface input
region is used.
The request will create a new object wp_confined_pointer which is used
to interact with the confinement as well as receive updates about its
state. See the the description of wp_confined_pointer for further
information.
</description>
<arg name="id" type="new_id" interface="zwp_confined_pointer_v1"/>
<arg name="surface" type="object" interface="wl_surface"
summary="surface to lock pointer to"/>
<arg name="pointer" type="object" interface="wl_pointer"
summary="the pointer that should be confined"/>
<arg name="region" type="object" interface="wl_region" allow-null="true"
summary="region of surface"/>
<arg name="lifetime" type="uint" enum="lifetime" summary="confinement lifetime"/>
</request>
</interface>
<interface name="zwp_locked_pointer_v1" version="1">
<description summary="receive relative pointer motion events">
The wp_locked_pointer interface represents a locked pointer state.
While the lock of this object is active, the wl_pointer objects of the
associated seat will not emit any wl_pointer.motion events.
This object will send the event 'locked' when the lock is activated.
Whenever the lock is activated, it is guaranteed that the locked surface
will already have received pointer focus and that the pointer will be
within the region passed to the request creating this object.
To unlock the pointer, send the destroy request. This will also destroy
the wp_locked_pointer object.
If the compositor decides to unlock the pointer the unlocked event is
sent. See wp_locked_pointer.unlock for details.
When unlocking, the compositor may warp the cursor position to the set
cursor position hint. If it does, it will not result in any relative
motion events emitted via wp_relative_pointer.
If the surface the lock was requested on is destroyed and the lock is not
yet activated, the wp_locked_pointer object is now defunct and must be
destroyed.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the locked pointer object">
Destroy the locked pointer object. If applicable, the compositor will
unlock the pointer.
</description>
</request>
<request name="set_cursor_position_hint">
<description summary="set the pointer cursor position hint">
Set the cursor position hint relative to the top left corner of the
surface.
If the client is drawing its own cursor, it should update the position
hint to the position of its own cursor. A compositor may use this
information to warp the pointer upon unlock in order to avoid pointer
jumps.
The cursor position hint is double buffered. The new hint will only take
effect when the associated surface gets it pending state applied. See
wl_surface.commit for details.
</description>
<arg name="surface_x" type="fixed"
summary="surface-local x coordinate"/>
<arg name="surface_y" type="fixed"
summary="surface-local y coordinate"/>
</request>
<request name="set_region">
<description summary="set a new lock region">
Set a new region used to lock the pointer.
The new lock region is double-buffered. The new lock region will
only take effect when the associated surface gets its pending state
applied. See wl_surface.commit for details.
For details about the lock region, see wp_locked_pointer.
</description>
<arg name="region" type="object" interface="wl_region" allow-null="true"
summary="region of surface"/>
</request>
<event name="locked">
<description summary="lock activation event">
Notification that the pointer lock of the seat's pointer is activated.
</description>
</event>
<event name="unlocked">
<description summary="lock deactivation event">
Notification that the pointer lock of the seat's pointer is no longer
active. If this is a oneshot pointer lock (see
wp_pointer_constraints.lifetime) this object is now defunct and should
be destroyed. If this is a persistent pointer lock (see
wp_pointer_constraints.lifetime) this pointer lock may again
reactivate in the future.
</description>
</event>
</interface>
<interface name="zwp_confined_pointer_v1" version="1">
<description summary="confined pointer object">
The wp_confined_pointer interface represents a confined pointer state.
This object will send the event 'confined' when the confinement is
activated. Whenever the confinement is activated, it is guaranteed that
the surface the pointer is confined to will already have received pointer
focus and that the pointer will be within the region passed to the request
creating this object. It is up to the compositor to decide whether this
requires some user interaction and if the pointer will warp to within the
passed region if outside.
To unconfine the pointer, send the destroy request. This will also destroy
the wp_confined_pointer object.
If the compositor decides to unconfine the pointer the unconfined event is
sent. The wp_confined_pointer object is at this point defunct and should
be destroyed.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the confined pointer object">
Destroy the confined pointer object. If applicable, the compositor will
unconfine the pointer.
</description>
</request>
<request name="set_region">
<description summary="set a new confine region">
Set a new region used to confine the pointer.
The new confine region is double-buffered. The new confine region will
only take effect when the associated surface gets its pending state
applied. See wl_surface.commit for details.
If the confinement is active when the new confinement region is applied
and the pointer ends up outside of newly applied region, the pointer may
warped to a position within the new confinement region. If warped, a
wl_pointer.motion event will be emitted, but no
wp_relative_pointer.relative_motion event.
The compositor may also, instead of using the new region, unconfine the
pointer.
For details about the confine region, see wp_confined_pointer.
</description>
<arg name="region" type="object" interface="wl_region" allow-null="true"
summary="region of surface"/>
</request>
<event name="confined">
<description summary="pointer confined">
Notification that the pointer confinement of the seat's pointer is
activated.
</description>
</event>
<event name="unconfined">
<description summary="pointer unconfined">
Notification that the pointer confinement of the seat's pointer is no
longer active. If this is a oneshot pointer confinement (see
wp_pointer_constraints.lifetime) this object is now defunct and should
be destroyed. If this is a persistent pointer confinement (see
wp_pointer_constraints.lifetime) this pointer confinement may again
reactivate in the future.
</description>
</event>
</interface>
</protocol>

View File

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="relative_pointer_unstable_v1">
<copyright>
Copyright © 2014 Jonas Ådahl
Copyright © 2015 Red Hat Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</copyright>
<description summary="protocol for relative pointer motion events">
This protocol specifies a set of interfaces used for making clients able to
receive relative pointer events not obstructed by barriers (such as the
monitor edge or other pointer barriers).
To start receiving relative pointer events, a client must first bind the
global interface "wp_relative_pointer_manager" which, if a compositor
supports relative pointer motion events, is exposed by the registry. After
having created the relative pointer manager proxy object, the client uses
it to create the actual relative pointer object using the
"get_relative_pointer" request given a wl_pointer. The relative pointer
motion events will then, when applicable, be transmitted via the proxy of
the newly created relative pointer object. See the documentation of the
relative pointer interface for more details.
Warning! The protocol described in this file is experimental and backward
incompatible changes may be made. Backward compatible changes may be added
together with the corresponding interface version bump. Backward
incompatible changes are done by bumping the version number in the protocol
and interface names and resetting the interface version. Once the protocol
is to be declared stable, the 'z' prefix and the version number in the
protocol and interface names are removed and the interface version number is
reset.
</description>
<interface name="zwp_relative_pointer_manager_v1" version="1">
<description summary="get relative pointer objects">
A global interface used for getting the relative pointer object for a
given pointer.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the relative pointer manager object">
Used by the client to notify the server that it will no longer use this
relative pointer manager object.
</description>
</request>
<request name="get_relative_pointer">
<description summary="get a relative pointer object">
Create a relative pointer interface given a wl_pointer object. See the
wp_relative_pointer interface for more details.
</description>
<arg name="id" type="new_id" interface="zwp_relative_pointer_v1"/>
<arg name="pointer" type="object" interface="wl_pointer"/>
</request>
</interface>
<interface name="zwp_relative_pointer_v1" version="1">
<description summary="relative pointer object">
A wp_relative_pointer object is an extension to the wl_pointer interface
used for emitting relative pointer events. It shares the same focus as
wl_pointer objects of the same seat and will only emit events when it has
focus.
</description>
<request name="destroy" type="destructor">
<description summary="release the relative pointer object"/>
</request>
<event name="relative_motion">
<description summary="relative pointer motion">
Relative x/y pointer motion from the pointer of the seat associated with
this object.
A relative motion is in the same dimension as regular wl_pointer motion
events, except they do not represent an absolute position. For example,
moving a pointer from (x, y) to (x', y') would have the equivalent
relative motion (x' - x, y' - y). If a pointer motion caused the
absolute pointer position to be clipped by for example the edge of the
monitor, the relative motion is unaffected by the clipping and will
represent the unclipped motion.
This event also contains non-accelerated motion deltas. The
non-accelerated delta is, when applicable, the regular pointer motion
delta as it was before having applied motion acceleration and other
transformations such as normalization.
Note that the non-accelerated delta does not represent 'raw' events as
they were read from some device. Pointer motion acceleration is device-
and configuration-specific and non-accelerated deltas and accelerated
deltas may have the same value on some devices.
Relative motions are not coupled to wl_pointer.motion events, and can be
sent in combination with such events, but also independently. There may
also be scenarios where wl_pointer.motion is sent, but there is no
relative motion. The order of an absolute and relative motion event
originating from the same physical motion is not guaranteed.
If the client needs button events or focus state, it can receive them
from a wl_pointer object of the same seat that the wp_relative_pointer
object is associated with.
</description>
<arg name="utime_hi" type="uint"
summary="high 32 bits of a 64 bit timestamp with microsecond granularity"/>
<arg name="utime_lo" type="uint"
summary="low 32 bits of a 64 bit timestamp with microsecond granularity"/>
<arg name="dx" type="fixed"
summary="the x component of the motion vector"/>
<arg name="dy" type="fixed"
summary="the y component of the motion vector"/>
<arg name="dx_unaccel" type="fixed"
summary="the x component of the unaccelerated motion vector"/>
<arg name="dy_unaccel" type="fixed"
summary="the y component of the unaccelerated motion vector"/>
</event>
</interface>
</protocol>

180
deps/wayland/viewporter.xml vendored Normal file
View File

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="viewporter">
<copyright>
Copyright © 2013-2016 Collabora, Ltd.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</copyright>
<interface name="wp_viewporter" version="1">
<description summary="surface cropping and scaling">
The global interface exposing surface cropping and scaling
capabilities is used to instantiate an interface extension for a
wl_surface object. This extended interface will then allow
cropping and scaling the surface contents, effectively
disconnecting the direct relationship between the buffer and the
surface size.
</description>
<request name="destroy" type="destructor">
<description summary="unbind from the cropping and scaling interface">
Informs the server that the client will not be using this
protocol object anymore. This does not affect any other objects,
wp_viewport objects included.
</description>
</request>
<enum name="error">
<entry name="viewport_exists" value="0"
summary="the surface already has a viewport object associated"/>
</enum>
<request name="get_viewport">
<description summary="extend surface interface for crop and scale">
Instantiate an interface extension for the given wl_surface to
crop and scale its content. If the given wl_surface already has
a wp_viewport object associated, the viewport_exists
protocol error is raised.
</description>
<arg name="id" type="new_id" interface="wp_viewport"
summary="the new viewport interface id"/>
<arg name="surface" type="object" interface="wl_surface"
summary="the surface"/>
</request>
</interface>
<interface name="wp_viewport" version="1">
<description summary="crop and scale interface to a wl_surface">
An additional interface to a wl_surface object, which allows the
client to specify the cropping and scaling of the surface
contents.
This interface works with two concepts: the source rectangle (src_x,
src_y, src_width, src_height), and the destination size (dst_width,
dst_height). The contents of the source rectangle are scaled to the
destination size, and content outside the source rectangle is ignored.
This state is double-buffered, and is applied on the next
wl_surface.commit.
The two parts of crop and scale state are independent: the source
rectangle, and the destination size. Initially both are unset, that
is, no scaling is applied. The whole of the current wl_buffer is
used as the source, and the surface size is as defined in
wl_surface.attach.
If the destination size is set, it causes the surface size to become
dst_width, dst_height. The source (rectangle) is scaled to exactly
this size. This overrides whatever the attached wl_buffer size is,
unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
has no content and therefore no size. Otherwise, the size is always
at least 1x1 in surface local coordinates.
If the source rectangle is set, it defines what area of the wl_buffer is
taken as the source. If the source rectangle is set and the destination
size is not set, then src_width and src_height must be integers, and the
surface size becomes the source rectangle size. This results in cropping
without scaling. If src_width or src_height are not integers and
destination size is not set, the bad_size protocol error is raised when
the surface state is applied.
The coordinate transformations from buffer pixel coordinates up to
the surface-local coordinates happen in the following order:
1. buffer_transform (wl_surface.set_buffer_transform)
2. buffer_scale (wl_surface.set_buffer_scale)
3. crop and scale (wp_viewport.set*)
This means, that the source rectangle coordinates of crop and scale
are given in the coordinates after the buffer transform and scale,
i.e. in the coordinates that would be the surface-local coordinates
if the crop and scale was not applied.
If src_x or src_y are negative, the bad_value protocol error is raised.
Otherwise, if the source rectangle is partially or completely outside of
the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
when the surface state is applied. A NULL wl_buffer does not raise the
out_of_buffer error.
If the wl_surface associated with the wp_viewport is destroyed,
all wp_viewport requests except 'destroy' raise the protocol error
no_surface.
If the wp_viewport object is destroyed, the crop and scale
state is removed from the wl_surface. The change will be applied
on the next wl_surface.commit.
</description>
<request name="destroy" type="destructor">
<description summary="remove scaling and cropping from the surface">
The associated wl_surface's crop and scale state is removed.
The change is applied on the next wl_surface.commit.
</description>
</request>
<enum name="error">
<entry name="bad_value" value="0"
summary="negative or zero values in width or height"/>
<entry name="bad_size" value="1"
summary="destination size is not integer"/>
<entry name="out_of_buffer" value="2"
summary="source rectangle extends outside of the content area"/>
<entry name="no_surface" value="3"
summary="the wl_surface was destroyed"/>
</enum>
<request name="set_source">
<description summary="set the source rectangle for cropping">
Set the source rectangle of the associated wl_surface. See
wp_viewport for the description, and relation to the wl_buffer
size.
If all of x, y, width and height are -1.0, the source rectangle is
unset instead. Any other set of values where width or height are zero
or negative, or x or y are negative, raise the bad_value protocol
error.
The crop and scale state is double-buffered state, and will be
applied on the next wl_surface.commit.
</description>
<arg name="x" type="fixed" summary="source rectangle x"/>
<arg name="y" type="fixed" summary="source rectangle y"/>
<arg name="width" type="fixed" summary="source rectangle width"/>
<arg name="height" type="fixed" summary="source rectangle height"/>
</request>
<request name="set_destination">
<description summary="set the surface size for scaling">
Set the destination size of the associated wl_surface. See
wp_viewport for the description, and relation to the wl_buffer
size.
If width is -1 and height is -1, the destination size is unset
instead. Any other pair of values for width and height that
contains zero or negative values raises the bad_value protocol
error.
The crop and scale state is double-buffered state, and will be
applied on the next wl_surface.commit.
</description>
<arg name="width" type="int" summary="surface width"/>
<arg name="height" type="int" summary="surface height"/>
</request>
</interface>
</protocol>

3151
deps/wayland/wayland.xml vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="xdg_decoration_unstable_v1">
<copyright>
Copyright © 2018 Simon Ser
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</copyright>
<interface name="zxdg_decoration_manager_v1" version="1">
<description summary="window decoration manager">
This interface allows a compositor to announce support for server-side
decorations.
A window decoration is a set of window controls as deemed appropriate by
the party managing them, such as user interface components used to move,
resize and change a window's state.
A client can use this protocol to request being decorated by a supporting
compositor.
If compositor and client do not negotiate the use of a server-side
decoration using this protocol, clients continue to self-decorate as they
see fit.
Warning! The protocol described in this file is experimental and
backward incompatible changes may be made. Backward compatible changes
may be added together with the corresponding interface version bump.
Backward incompatible changes are done by bumping the version number in
the protocol and interface names and resetting the interface version.
Once the protocol is to be declared stable, the 'z' prefix and the
version number in the protocol and interface names are removed and the
interface version number is reset.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the decoration manager object">
Destroy the decoration manager. This doesn't destroy objects created
with the manager.
</description>
</request>
<request name="get_toplevel_decoration">
<description summary="create a new toplevel decoration object">
Create a new decoration object associated with the given toplevel.
Creating an xdg_toplevel_decoration from an xdg_toplevel which has a
buffer attached or committed is a client error, and any attempts by a
client to attach or manipulate a buffer prior to the first
xdg_toplevel_decoration.configure event must also be treated as
errors.
</description>
<arg name="id" type="new_id" interface="zxdg_toplevel_decoration_v1"/>
<arg name="toplevel" type="object" interface="xdg_toplevel"/>
</request>
</interface>
<interface name="zxdg_toplevel_decoration_v1" version="1">
<description summary="decoration object for a toplevel surface">
The decoration object allows the compositor to toggle server-side window
decorations for a toplevel surface. The client can request to switch to
another mode.
The xdg_toplevel_decoration object must be destroyed before its
xdg_toplevel.
</description>
<enum name="error">
<entry name="unconfigured_buffer" value="0"
summary="xdg_toplevel has a buffer attached before configure"/>
<entry name="already_constructed" value="1"
summary="xdg_toplevel already has a decoration object"/>
<entry name="orphaned" value="2"
summary="xdg_toplevel destroyed before the decoration object"/>
</enum>
<request name="destroy" type="destructor">
<description summary="destroy the decoration object">
Switch back to a mode without any server-side decorations at the next
commit.
</description>
</request>
<enum name="mode">
<description summary="window decoration modes">
These values describe window decoration modes.
</description>
<entry name="client_side" value="1"
summary="no server-side window decoration"/>
<entry name="server_side" value="2"
summary="server-side window decoration"/>
</enum>
<request name="set_mode">
<description summary="set the decoration mode">
Set the toplevel surface decoration mode. This informs the compositor
that the client prefers the provided decoration mode.
After requesting a decoration mode, the compositor will respond by
emitting an xdg_surface.configure event. The client should then update
its content, drawing it without decorations if the received mode is
server-side decorations. The client must also acknowledge the configure
when committing the new content (see xdg_surface.ack_configure).
The compositor can decide not to use the client's mode and enforce a
different mode instead.
Clients whose decoration mode depend on the xdg_toplevel state may send
a set_mode request in response to an xdg_surface.configure event and wait
for the next xdg_surface.configure event to prevent unwanted state.
Such clients are responsible for preventing configure loops and must
make sure not to send multiple successive set_mode requests with the
same decoration mode.
</description>
<arg name="mode" type="uint" enum="mode" summary="the decoration mode"/>
</request>
<request name="unset_mode">
<description summary="unset the decoration mode">
Unset the toplevel surface decoration mode. This informs the compositor
that the client doesn't prefer a particular decoration mode.
This request has the same semantics as set_mode.
</description>
</request>
<event name="configure">
<description summary="suggest a surface change">
The configure event asks the client to change its decoration mode. The
configured state should not be applied immediately. Clients must send an
ack_configure in response to this event. See xdg_surface.configure and
xdg_surface.ack_configure for details.
A configure event can be sent at any time. The specified mode must be
obeyed by the client.
</description>
<arg name="mode" type="uint" enum="mode" summary="the decoration mode"/>
</event>
</interface>
</protocol>

1370
deps/wayland/xdg-shell.xml vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -327,7 +327,7 @@ a thousand line one, if that is the appropriate size for the fix.
In addition to the code, a complete bug fix includes: In addition to the code, a complete bug fix includes:
- Change log entry in `README.md`, describing the incorrect behavior - Change log entry in `README.md`, describing the incorrect behavior
- Credits entries for all authors of the bug fix - Credits entries in `CONTRIBUTORS.md` for all authors of the bug fix
Bug fixes will not be rejected because they don't include all the above parts, Bug fixes will not be rejected because they don't include all the above parts,
but please keep in mind that maintainer time is finite and that there are many but please keep in mind that maintainer time is finite and that there are many
@ -358,11 +358,11 @@ feature.
In addition to the code, a complete feature includes: In addition to the code, a complete feature includes:
- Change log entry in `README.md`, listing all new symbols - Change log entry in `README.md`, listing all new symbols
- News page entry, briefly describing the feature - News page entry in `docs/news.dox`, briefly describing the feature
- Guide documentation, with minimal examples, in the relevant guide - Guide documentation, with minimal examples, in the relevant guide in the `docs` folder
- Reference documentation, with all applicable tags - Reference documentation, with all applicable tags
- Cross-references and mentions in appropriate places - Cross-references and mentions in appropriate places
- Credits entries for all authors of the feature - Credits entries in `CONTRIBUTORS.md` for all authors of the feature
If the feature requires platform-specific code, at minimum stubs must be added If the feature requires platform-specific code, at minimum stubs must be added
for the new platform function to all supported and experimental platforms. for the new platform function to all supported and experimental platforms.

View File

@ -1,4 +1,4 @@
# Doxyfile 1.9.5 # Doxyfile 1.9.7
# This file describes the settings to be used by the documentation system # This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project. # doxygen (www.doxygen.org) for a project.
@ -86,7 +86,7 @@ CREATE_SUBDIRS = NO
# level increment doubles the number of directories, resulting in 4096 # level increment doubles the number of directories, resulting in 4096
# directories at level 8 which is the default and also the maximum value. The # directories at level 8 which is the default and also the maximum value. The
# sub-directories are organized in 2 levels, the first level always has a fixed # sub-directories are organized in 2 levels, the first level always has a fixed
# numer of 16 directories. # number of 16 directories.
# Minimum value: 0, maximum value: 8, default value: 8. # Minimum value: 0, maximum value: 8, default value: 8.
# This tag requires that the tag CREATE_SUBDIRS is set to YES. # This tag requires that the tag CREATE_SUBDIRS is set to YES.
@ -364,6 +364,17 @@ MARKDOWN_SUPPORT = YES
TOC_INCLUDE_HEADINGS = 5 TOC_INCLUDE_HEADINGS = 5
# The MARKDOWN_ID_STYLE tag can be used to specify the algorithm used to
# generate identifiers for the Markdown headings. Note: Every identifier is
# unique.
# Possible values are: DOXYGEN Use a fixed 'autotoc_md' string followed by a
# sequence number starting at 0. and GITHUB Use the lower case version of title
# with any whitespace replaced by '-' and punctations characters removed..
# The default value is: DOXYGEN.
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
MARKDOWN_ID_STYLE = DOXYGEN
# When enabled doxygen tries to link words that correspond to documented # When enabled doxygen tries to link words that correspond to documented
# classes, or namespaces to their corresponding documentation. Such a link can # classes, or namespaces to their corresponding documentation. Such a link can
# be prevented in individual cases by putting a % sign in front of the word or # be prevented in individual cases by putting a % sign in front of the word or
@ -404,7 +415,7 @@ SIP_SUPPORT = NO
# should set this option to NO. # should set this option to NO.
# The default value is: YES. # The default value is: YES.
IDL_PROPERTY_SUPPORT = NO IDL_PROPERTY_SUPPORT = YES
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
# tag is set to YES then doxygen will reuse the documentation of the first # tag is set to YES then doxygen will reuse the documentation of the first
@ -488,6 +499,14 @@ LOOKUP_CACHE_SIZE = 0
NUM_PROC_THREADS = 1 NUM_PROC_THREADS = 1
# If the TIMESTAMP tag is set different from NO then each generated page will
# contain the date or date and time when the page was generated. Setting this to
# NO can help when comparing the output of multiple runs.
# Possible values are: YES, NO, DATETIME and DATE.
# The default value is: NO.
TIMESTAMP = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Build related configuration options # Build related configuration options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -569,7 +588,8 @@ HIDE_UNDOC_MEMBERS = NO
# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy. If set # undocumented classes that are normally visible in the class hierarchy. If set
# to NO, these classes will be included in the various overviews. This option # to NO, these classes will be included in the various overviews. This option
# has no effect if EXTRACT_ALL is enabled. # will also hide undocumented C++ concepts if enabled. This option has no effect
# if EXTRACT_ALL is enabled.
# The default value is: NO. # The default value is: NO.
HIDE_UNDOC_CLASSES = NO HIDE_UNDOC_CLASSES = NO
@ -860,11 +880,26 @@ WARN_IF_INCOMPLETE_DOC = YES
WARN_NO_PARAMDOC = YES WARN_NO_PARAMDOC = YES
# If WARN_IF_UNDOC_ENUM_VAL option is set to YES, doxygen will warn about
# undocumented enumeration values. If set to NO, doxygen will accept
# undocumented enumeration values. If EXTRACT_ALL is set to YES then this flag
# will automatically be disabled.
# The default value is: NO.
WARN_IF_UNDOC_ENUM_VAL = NO
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS # a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS
# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but # then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but
# at the end of the doxygen process doxygen will return with a non-zero status. # at the end of the doxygen process doxygen will return with a non-zero status.
# Possible values are: NO, YES and FAIL_ON_WARNINGS. # If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS_PRINT then doxygen behaves
# like FAIL_ON_WARNINGS but in case no WARN_LOGFILE is defined doxygen will not
# write the warning messages in between other messages but write them at the end
# of a run, in case a WARN_LOGFILE is defined the warning messages will be
# besides being in the defined file also be shown at the end of a run, unless
# the WARN_LOGFILE is defined as - i.e. standard output (stdout) in that case
# the behavior will remain as with the setting FAIL_ON_WARNINGS.
# Possible values are: NO, YES, FAIL_ON_WARNINGS and FAIL_ON_WARNINGS_PRINT.
# The default value is: NO. # The default value is: NO.
WARN_AS_ERROR = NO WARN_AS_ERROR = NO
@ -987,9 +1022,6 @@ EXCLUDE_PATTERNS =
# output. The symbol name can be a fully qualified name, a word, or if the # output. The symbol name can be a fully qualified name, a word, or if the
# wildcard * is used, a substring. Examples: ANamespace, AClass, # wildcard * is used, a substring. Examples: ANamespace, AClass,
# ANamespace::AClass, ANamespace::*Test # ANamespace::AClass, ANamespace::*Test
#
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories use the pattern */test/*
EXCLUDE_SYMBOLS = APIENTRY GLFWAPI EXCLUDE_SYMBOLS = APIENTRY GLFWAPI
@ -1186,10 +1218,11 @@ VERBATIM_HEADERS = YES
ALPHABETICAL_INDEX = YES ALPHABETICAL_INDEX = YES
# In case all classes in a project start with a common prefix, all classes will # The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes)
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag # that should be ignored while generating the index headers. The IGNORE_PREFIX
# can be used to specify a prefix (or a list of prefixes) that should be ignored # tag works for classes, function and member names. The entity will be placed in
# while generating the index headers. # the alphabetical list under the first letter of the entity name that remains
# after removing the prefix.
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
IGNORE_PREFIX = glfw GLFW_ IGNORE_PREFIX = glfw GLFW_
@ -1268,7 +1301,12 @@ HTML_STYLESHEET =
# Doxygen will copy the style sheet files to the output directory. # Doxygen will copy the style sheet files to the output directory.
# Note: The order of the extra style sheet files is of importance (e.g. the last # Note: The order of the extra style sheet files is of importance (e.g. the last
# style sheet in the list overrules the setting of the previous ones in the # style sheet in the list overrules the setting of the previous ones in the
# list). For an example see the documentation. # list).
# Note: Since the styling of scrollbars can currently not be overruled in
# Webkit/Chromium, the styling will be left out of the default doxygen.css if
# one or more extra stylesheets have been specified. So if scrollbar
# customization is desired it has to be added explicitly. For an example see the
# documentation.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_STYLESHEET = "@GLFW_SOURCE_DIR@/docs/extra.css" HTML_EXTRA_STYLESHEET = "@GLFW_SOURCE_DIR@/docs/extra.css"
@ -1284,17 +1322,13 @@ HTML_EXTRA_STYLESHEET = "@GLFW_SOURCE_DIR@/docs/extra.css"
HTML_EXTRA_FILES = "@GLFW_SOURCE_DIR@/docs/spaces.svg" HTML_EXTRA_FILES = "@GLFW_SOURCE_DIR@/docs/spaces.svg"
# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output # The HTML_COLORSTYLE tag can be used to specify if the generated HTML output
# should be rendered with a dark or light theme. Default setting AUTO_LIGHT # should be rendered with a dark or light theme.
# enables light output unless the user preference is dark output. Other options # Possible values are: LIGHT always generate light mode output, DARK always
# are DARK to always use dark mode, LIGHT to always use light mode, AUTO_DARK to # generate dark mode output, AUTO_LIGHT automatically set the mode according to
# default to dark mode unless the user prefers light mode, and TOGGLE to let the # the user preference, use light mode if no preference is set (the default),
# user toggle between dark and light mode via a button. # AUTO_DARK automatically set the mode according to the user preference, use
# Possible values are: LIGHT Always generate light output., DARK Always generate # dark mode if no preference is set and TOGGLE allow to user to switch between
# dark output., AUTO_LIGHT Automatically set the mode according to the user # light and dark mode via a button.
# preference, use light mode if no preference is set (the default)., AUTO_DARK
# Automatically set the mode according to the user preference, use dark mode if
# no preference is set. and TOGGLE Allow to user to switch between light and
# dark mode via a button..
# The default value is: AUTO_LIGHT. # The default value is: AUTO_LIGHT.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
@ -1330,15 +1364,6 @@ HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80 HTML_COLORSTYLE_GAMMA = 80
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
# page will contain the date and time when the page was generated. Setting this
# to YES can help to show when doxygen was last run and thus if the
# documentation is up to date.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_TIMESTAMP = YES
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML # If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
# documentation will contain a main index with vertical navigation menus that # documentation will contain a main index with vertical navigation menus that
# are dynamically created via JavaScript. If disabled, the navigation index will # are dynamically created via JavaScript. If disabled, the navigation index will
@ -1488,6 +1513,16 @@ BINARY_TOC = NO
TOC_EXPAND = NO TOC_EXPAND = NO
# The SITEMAP_URL tag is used to specify the full URL of the place where the
# generated documentation will be placed on the server by the user during the
# deployment of the documentation. The generated sitemap is called sitemap.xml
# and placed on the directory specified by HTML_OUTPUT. In case no SITEMAP_URL
# is specified no sitemap is generated. For information about the sitemap
# protocol see https://www.sitemaps.org
# This tag requires that the tag GENERATE_HTML is set to YES.
SITEMAP_URL =
# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help # can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
@ -1627,7 +1662,7 @@ ENUM_VALUES_PER_LINE = 4
# Minimum value: 0, maximum value: 1500, default value: 250. # Minimum value: 0, maximum value: 1500, default value: 250.
# This tag requires that the tag GENERATE_HTML is set to YES. # This tag requires that the tag GENERATE_HTML is set to YES.
TREEVIEW_WIDTH = 300 TREEVIEW_WIDTH = 250
# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to # If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
# external symbols imported via tag files in a separate window. # external symbols imported via tag files in a separate window.
@ -1976,9 +2011,16 @@ PDF_HYPERLINKS = YES
USE_PDFLATEX = YES USE_PDFLATEX = YES
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode # The LATEX_BATCHMODE tag ignals the behavior of LaTeX in case of an error.
# command to the generated LaTeX files. This will instruct LaTeX to keep running # Possible values are: NO same as ERROR_STOP, YES same as BATCH, BATCH In batch
# if errors occur, instead of asking the user for help. # mode nothing is printed on the terminal, errors are scrolled as if <return> is
# hit at every error; missing files that TeX tries to input or request from
# keyboard input (\read on a not open input stream) cause the job to abort,
# NON_STOP In nonstop mode the diagnostic message will appear on the terminal,
# but there is no possibility of user interaction just like in batch mode,
# SCROLL In scroll mode, TeX will stop only for missing files to input or if
# keyboard input is necessary and ERROR_STOP In errorstop mode, TeX will stop at
# each error, asking for user intervention.
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES. # This tag requires that the tag GENERATE_LATEX is set to YES.
@ -1999,14 +2041,6 @@ LATEX_HIDE_INDICES = NO
LATEX_BIB_STYLE = plain LATEX_BIB_STYLE = plain
# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
# page will contain the date and time when the page was generated. Setting this
# to NO can help when comparing the output of multiple runs.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_TIMESTAMP = NO
# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute) # The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
# path from which the emoji images will be read. If a relative path is entered, # path from which the emoji images will be read. If a relative path is entered,
# it will be relative to the LATEX_OUTPUT directory. If left blank the # it will be relative to the LATEX_OUTPUT directory. If left blank the
@ -2172,7 +2206,7 @@ DOCBOOK_OUTPUT = docbook
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures # AutoGen Definitions (see https://autogen.sourceforge.net/) file that captures
# the structure of the code including all documentation. Note that this feature # the structure of the code including all documentation. Note that this feature
# is still experimental and incomplete at the moment. # is still experimental and incomplete at the moment.
# The default value is: NO. # The default value is: NO.
@ -2353,16 +2387,9 @@ EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES EXTERNAL_PAGES = YES
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the dot tool # Configuration options related to diagram generator tools
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
# If left empty dia is assumed to be found in the default search path.
DIA_PATH =
# If set to YES the inheritance and collaboration graphs will hide inheritance # If set to YES the inheritance and collaboration graphs will hide inheritance
# and usage relations if the target is undocumented or is not a class. # and usage relations if the target is undocumented or is not a class.
# The default value is: YES. # The default value is: YES.
@ -2371,7 +2398,7 @@ HIDE_UNDOC_RELATIONS = YES
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
# available from the path. This tool is part of Graphviz (see: # available from the path. This tool is part of Graphviz (see:
# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # https://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
# Bell Labs. The other options in this section have no effect if this option is # Bell Labs. The other options in this section have no effect if this option is
# set to NO # set to NO
# The default value is: NO. # The default value is: NO.
@ -2424,13 +2451,15 @@ DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4"
DOT_FONTPATH = DOT_FONTPATH =
# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a # If the CLASS_GRAPH tag is set to YES or GRAPH or BUILTIN then doxygen will
# graph for each documented class showing the direct and indirect inheritance # generate a graph for each documented class showing the direct and indirect
# relations. In case HAVE_DOT is set as well dot will be used to draw the graph, # inheritance relations. In case the CLASS_GRAPH tag is set to YES or GRAPH and
# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set # HAVE_DOT is enabled as well, then dot will be used to draw the graph. In case
# to TEXT the direct and indirect inheritance relations will be shown as texts / # the CLASS_GRAPH tag is set to YES and HAVE_DOT is disabled or if the
# links. # CLASS_GRAPH tag is set to BUILTIN, then the built-in generator will be used.
# Possible values are: NO, YES, TEXT and GRAPH. # If the CLASS_GRAPH tag is set to TEXT the direct and indirect inheritance
# relations will be shown as texts / links.
# Possible values are: NO, YES, TEXT, GRAPH and BUILTIN.
# The default value is: YES. # The default value is: YES.
CLASS_GRAPH = YES CLASS_GRAPH = YES
@ -2571,7 +2600,7 @@ DIR_GRAPH_MAX_DEPTH = 1
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
# generated by dot. For an explanation of the image formats see the section # generated by dot. For an explanation of the image formats see the section
# output formats in the documentation of the dot tool (Graphviz (see: # output formats in the documentation of the dot tool (Graphviz (see:
# http://www.graphviz.org/)). # https://www.graphviz.org/)).
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
# to make the SVG files visible in IE 9+ (other browsers do not have this # to make the SVG files visible in IE 9+ (other browsers do not have this
# requirement). # requirement).
@ -2608,11 +2637,12 @@ DOT_PATH =
DOTFILE_DIRS = DOTFILE_DIRS =
# The MSCFILE_DIRS tag can be used to specify one or more directories that # You can include diagrams made with dia in doxygen documentation. Doxygen will
# contain msc files that are included in the documentation (see the \mscfile # then run dia to produce the diagram and insert it in the documentation. The
# command). # DIA_PATH tag allows you to specify the directory where the dia binary resides.
# If left empty dia is assumed to be found in the default search path.
MSCFILE_DIRS = DIA_PATH =
# The DIAFILE_DIRS tag can be used to specify one or more directories that # The DIAFILE_DIRS tag can be used to specify one or more directories that
# contain dia files that are included in the documentation (see the \diafile # contain dia files that are included in the documentation (see the \diafile
@ -2689,3 +2719,19 @@ GENERATE_LEGEND = YES
# The default value is: YES. # The default value is: YES.
DOT_CLEANUP = YES DOT_CLEANUP = YES
# You can define message sequence charts within doxygen comments using the \msc
# command. If the MSCGEN_TOOL tag is left empty (the default), then doxygen will
# use a built-in version of mscgen tool to produce the charts. Alternatively,
# the MSCGEN_TOOL tag can also specify the name an external tool. For instance,
# specifying prog as the value, doxygen will call the tool as prog -T
# <outfile_format> -o <outputfile> <inputfile>. The external tool should support
# output file formats "png", "eps", "svg", and "ismap".
MSCGEN_TOOL =
# The MSCFILE_DIRS tag can be used to specify one or more directories that
# contain msc files that are included in the documentation (see the \mscfile
# command).
MSCFILE_DIRS =

View File

@ -100,46 +100,45 @@ has sole responsibility for interacting well with every compositor in use on
Unix-like systems. Most of the features are provided by the core protocol, Unix-like systems. Most of the features are provided by the core protocol,
while cursor support is provided by the libwayland-cursor helper library, EGL while cursor support is provided by the libwayland-cursor helper library, EGL
integration by libwayland-egl, and keyboard handling by integration by libwayland-egl, and keyboard handling by
[libxkbcommon](https://xkbcommon.org/). In addition, GLFW uses some protocols [libxkbcommon](https://xkbcommon.org/). In addition, GLFW uses some additional
from wayland-protocols to provide additional features if the compositor Wayland protocols to implement certain features if the compositor supports them.
supports them.
GLFW uses xkbcommon 0.5.0 to provide key and text input support. Earlier GLFW uses xkbcommon 0.5.0 to provide key and text input support. Earlier
versions are not supported. versions are not supported.
GLFW uses the [xdg-shell GLFW uses the [xdg-shell protocol](https://wayland.app/protocols/xdg-shell)
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml) to provide better window management. This protocol is mandatory for GLFW to
to provide better window management. This protocol is part of display a window.
wayland-protocols 1.12, and is mandatory for GLFW to display a window.
GLFW uses the [relative pointer GLFW uses the
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/relative-pointer/relative-pointer-unstable-v1.xml) [relative pointer protocol](https://wayland.app/protocols/relative-pointer-unstable-v1)
alongside the [pointer constraints alongside the
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml) [pointer constraints protocol](https://wayland.app/protocols/pointer-constraints-unstable-v1)
to implement disabled cursor. These two protocols are part of to implement disabled cursor. If the running compositor does not support both
wayland-protocols 1.1, and mandatory at build time. If the running compositor of these protocols, disabling the cursor will have no effect.
does not support both of these protocols, disabling the cursor will have no
effect.
GLFW uses the [idle inhibit GLFW uses the
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml) [idle inhibit protocol](https://wayland.app/protocols/idle-inhibit-unstable-v1)
to prohibit the screensaver from starting. This protocol is part of to prohibit the screensaver from starting. If the running compositor does not
wayland-protocols 1.6, and mandatory at build time. If the running compositor support this protocol, the screensaver may start even for full screen windows.
does not support this protocol, the screensaver may start even for full screen
windows.
GLFW uses the [xdg-decoration GLFW uses the
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml) [libdecor library](https://gitlab.freedesktop.org/libdecor/libdecor) for window
decorations, where available. This in turn provides good quality client-side
decorations (drawn by the application) on desktop systems that do not support
server-side decorations (drawn by the window manager). On systems that do not
provide either libdecor or xdg-decoration, very basic window decorations are
provided. These do not include the window title or any caption buttons.
GLFW uses the
[xdg-decoration protocol](https://wayland.app/protocols/xdg-decoration-unstable-v1)
to request decorations to be drawn around its windows. This protocol is part to request decorations to be drawn around its windows. This protocol is part
of wayland-protocols 1.15, and mandatory at build time. If the running of wayland-protocols 1.15, and mandatory at build time. If the running
compositor does not support this protocol, a very simple frame will be drawn by compositor does not support this protocol, a very simple frame will be drawn by
GLFW itself, using the [viewporter GLFW itself, using the
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/viewporter/viewporter.xml) [viewporter protocol](https://wayland.app/protocols/viewporter)
alongside alongside subsurfaces. If the running compositor does not support these
[subsurfaces](https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml#n2598). protocols either, no decorations will be drawn around windows.
This protocol is part of wayland-protocols 1.4, and mandatory at build time.
If the running compositor does not support this protocol either, no decorations
will be drawn around windows.
@section compat_glx GLX extensions @section compat_glx GLX extensions

View File

@ -7,6 +7,8 @@
This is about compiling the GLFW library itself. For information on how to This is about compiling the GLFW library itself. For information on how to
build applications that use GLFW, see @ref build_guide. build applications that use GLFW, see @ref build_guide.
GLFW uses some C99 features and does not support Visual Studio 2012 and earlier.
@section compile_cmake Using CMake @section compile_cmake Using CMake
@ -83,29 +85,28 @@ development packages installed. They are not needed to build or run programs th
GLFW. You will also need to set the @ref GLFW_BUILD_WAYLAND CMake option in the next GLFW. You will also need to set the @ref GLFW_BUILD_WAYLAND CMake option in the next
step when generating build files. step when generating build files.
On Debian and derivatives like Ubuntu and Linux Mint you will need the `libwayland-dev`, On Debian and derivatives like Ubuntu and Linux Mint you will need the `libwayland-dev`
`libxkbcommon-dev` and `wayland-protocols` packages and the `xorg-dev` meta-package. and `libxkbcommon-dev` packages and the `xorg-dev` meta-package. These will pull in all
These will pull in all other dependencies. other dependencies.
@code{.sh} @code{.sh}
sudo apt install libwayland-dev libxkbcommon-dev wayland-protocols xorg-dev sudo apt install libwayland-dev libxkbcommon-dev xorg-dev
@endcode @endcode
On Fedora and derivatives like Red Hat you will need the `wayland-devel`, On Fedora and derivatives like Red Hat you will need the `wayland-devel`,
`libxkbcommon-devel`, `wayland-protocols-devel`, `libXcursor-devel`, `libXi-devel`, `libxkbcommon-devel`, `libXcursor-devel`, `libXi-devel`, `libXinerama-devel` and
`libXinerama-devel` and `libXrandr-devel` packages. These will pull in all other `libXrandr-devel` packages. These will pull in all other dependencies.
dependencies.
@code{.sh} @code{.sh}
sudo dnf install wayland-devel libxkbcommon-devel wayland-protocols-devel libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel sudo dnf install wayland-devel libxkbcommon-devel libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel
@endcode @endcode
On FreeBSD you will need the `wayland`, `libxkbcommon` and `wayland-protocols` packages. On FreeBSD you will need the `wayland` and `libxkbcommon` packages. The X11 headers are
The X11 headers are installed along the end-user X11 packages, so if you have an X server installed along the end-user X11 packages, so if you have an X server running you should
running you should have the headers as well. If not, install the `xorgproto` package. have the headers as well. If not, install the `xorgproto` package.
@code{.sh} @code{.sh}
pkg install wayland libxkbcommon wayland-protocols xorgproto pkg install wayland libxkbcommon xorgproto
@endcode @endcode
Once you have the required dependencies, move on to @ref compile_generate. Once you have the required dependencies, move on to @ref compile_generate.

View File

@ -88,9 +88,10 @@ window, even if none of them are visible.
@subsection context_less Windows without contexts @subsection context_less Windows without contexts
You can disable context creation by setting the You can disable context creation by setting the
[GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`. Windows [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`.
without contexts must not be passed to @ref glfwMakeContextCurrent or @ref
glfwSwapBuffers. Windows without contexts should not be passed to @ref glfwMakeContextCurrent or
@ref glfwSwapBuffers. Doing this generates a @ref GLFW_NO_WINDOW_CONTEXT error.
@subsection context_user User contexts for multi context windows @subsection context_user User contexts for multi context windows

View File

@ -95,7 +95,7 @@ new size before everything returns back out of the @ref glfwSetWindowSize call.
GLFW divides keyboard input into two categories; key events and character GLFW divides keyboard input into two categories; key events and character
events. Key events relate to actual physical keyboard keys, whereas character events. Key events relate to actual physical keyboard keys, whereas character
events relate to the Unicode code points generated by pressing some of them. events relate to the text that is generated by pressing some of them.
Keys and characters do not map 1:1. A single key press may produce several Keys and characters do not map 1:1. A single key press may produce several
characters, and a single character may require several keys to produce. This characters, and a single character may require several keys to produce. This
@ -127,6 +127,10 @@ The action is one of `GLFW_PRESS`, `GLFW_REPEAT` or `GLFW_RELEASE`. Events with
`GLFW_PRESS` and `GLFW_RELEASE` actions are emitted for every key press. Most `GLFW_PRESS` and `GLFW_RELEASE` actions are emitted for every key press. Most
keys will also emit events with `GLFW_REPEAT` actions while a key is held down. keys will also emit events with `GLFW_REPEAT` actions while a key is held down.
Note that many keyboards have a limit on how many keys being simultaneous held
down that they can detect. This limit is called
[key rollover](https://en.wikipedia.org/wiki/Key_rollover).
Key events with `GLFW_REPEAT` actions are intended for text input. They are Key events with `GLFW_REPEAT` actions are intended for text input. They are
emitted at the rate set in the user's keyboard settings. At most one key is emitted at the rate set in the user's keyboard settings. At most one key is
repeated even if several keys are held down. `GLFW_REPEAT` actions should not repeated even if several keys are held down. `GLFW_REPEAT` actions should not
@ -142,16 +146,16 @@ keys.
The scancode is unique for every key, regardless of whether it has a key token. The scancode is unique for every key, regardless of whether it has a key token.
Scancodes are platform-specific but consistent over time, so keys will have Scancodes are platform-specific but consistent over time, so keys will have
different scancodes depending on the platform but they are safe to save to disk. different scancodes depending on the platform but they are safe to save to disk.
You can query the scancode for any [named key](@ref keys) on the current You can query the scancode for any [key token](@ref keys) supported on the
platform with @ref glfwGetKeyScancode. current platform with @ref glfwGetKeyScancode.
@code @code
const int scancode = glfwGetKeyScancode(GLFW_KEY_X); const int scancode = glfwGetKeyScancode(GLFW_KEY_X);
set_key_mapping(scancode, swap_weapons); set_key_mapping(scancode, swap_weapons);
@endcode @endcode
The last reported state for every [named key](@ref keys) is also saved in The last reported state for every physical key with a [key token](@ref keys) is
per-window state arrays that can be polled with @ref glfwGetKey. also saved in per-window state arrays that can be polled with @ref glfwGetKey.
@code @code
int state = glfwGetKey(window, GLFW_KEY_E); int state = glfwGetKey(window, GLFW_KEY_E);
@ -164,7 +168,8 @@ if (state == GLFW_PRESS)
The returned state is one of `GLFW_PRESS` or `GLFW_RELEASE`. The returned state is one of `GLFW_PRESS` or `GLFW_RELEASE`.
This function only returns cached key event state. It does not poll the This function only returns cached key event state. It does not poll the
system for the current physical state of the key. system for the current state of the physical key. It also does not provide any
key repeat information.
@anchor GLFW_STICKY_KEYS @anchor GLFW_STICKY_KEYS
Whenever you poll state, you risk missing the state change you are looking for. Whenever you poll state, you risk missing the state change you are looking for.
@ -195,15 +200,15 @@ Lock was on when the event occurred and the @ref GLFW_MOD_NUM_LOCK bit set if
Num Lock was on. Num Lock was on.
The `GLFW_KEY_LAST` constant holds the highest value of any The `GLFW_KEY_LAST` constant holds the highest value of any
[named key](@ref keys). [key token](@ref keys).
@subsection input_char Text input @subsection input_char Text input
GLFW supports text input in the form of a stream of GLFW supports text input in the form of a stream of
[Unicode code points](https://en.wikipedia.org/wiki/Unicode), as produced by the [Unicode code points](https://en.wikipedia.org/wiki/Unicode), as produced by the
operating system text input system. Unlike key input, text input obeys keyboard operating system text input system. Unlike key input, text input is affected by
layouts and modifier keys and supports composing characters using keyboard layouts and modifier keys and supports composing characters using
[dead keys](https://en.wikipedia.org/wiki/Dead_key). Once received, you can [dead keys](https://en.wikipedia.org/wiki/Dead_key). Once received, you can
encode the code points into UTF-8 or any other encoding you prefer. encode the code points into UTF-8 or any other encoding you prefer.
@ -502,8 +507,9 @@ void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
The action is one of `GLFW_PRESS` or `GLFW_RELEASE`. The action is one of `GLFW_PRESS` or `GLFW_RELEASE`.
Mouse button states for [named buttons](@ref buttons) are also saved in The last reported state for every [supported mouse button](@ref buttons) is also
per-window state arrays that can be polled with @ref glfwGetMouseButton. saved in per-window state arrays that can be polled with @ref
glfwGetMouseButton.
@code @code
int state = glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT); int state = glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT);
@ -536,7 +542,7 @@ had been processed in the meantime, the state will reset to `GLFW_RELEASE`,
otherwise it will remain `GLFW_PRESS`. otherwise it will remain `GLFW_PRESS`.
The `GLFW_MOUSE_BUTTON_LAST` constant holds the highest value of any The `GLFW_MOUSE_BUTTON_LAST` constant holds the highest value of any
[named button](@ref buttons). [supported mouse button](@ref buttons).
@subsection scrolling Scroll input @subsection scrolling Scroll input

View File

@ -144,6 +144,15 @@ the `VK_KHR_xlib_surface` extension. Possible values are `GLFW_TRUE` and
`GLFW_FALSE`. This is ignored on other platforms. `GLFW_FALSE`. This is ignored on other platforms.
@subsubsection init_hints_wayland Wayland specific init hints
@anchor GLFW_WAYLAND_LIBDECOR_hint
__GLFW_WAYLAND_LIBDECOR__ specifies whether to use
[libdecor](https://gitlab.freedesktop.org/libdecor/libdecor) for window
decorations where available. Possible values are `GLFW_WAYLAND_PREFER_LIBDECOR`
and `GLFW_WAYLAND_DISABLE_LIBDECOR`. This is ignored on other platforms.
@subsubsection init_hints_values Supported and default values @subsubsection init_hints_values Supported and default values
Initialization hint | Default value | Supported values Initialization hint | Default value | Supported values
@ -154,6 +163,7 @@ Initialization hint | Default value | Supported v
@ref GLFW_COCOA_CHDIR_RESOURCES | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` @ref GLFW_COCOA_CHDIR_RESOURCES | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
@ref GLFW_COCOA_MENUBAR | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` @ref GLFW_COCOA_MENUBAR | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
@ref GLFW_X11_XCB_VULKAN_SURFACE | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` @ref GLFW_X11_XCB_VULKAN_SURFACE | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
@ref GLFW_WAYLAND_LIBDECOR | `GLFW_WAYLAND_PREFER_LIBDECOR` | `GLFW_WAYLAND_PREFER_LIBDECOR` or `GLFW_WAYLAND_DISABLE_LIBDECOR`
@subsection platform Runtime platform selection @subsection platform Runtime platform selection

View File

@ -54,6 +54,16 @@ to whatever window is behind it. This can also be changed after window
creation with the matching [window attribute](@ref GLFW_MOUSE_PASSTHROUGH_attrib). creation with the matching [window attribute](@ref GLFW_MOUSE_PASSTHROUGH_attrib).
@subsubsection wayland_libdecor_34 Wayland libdecor decorations
GLFW now supports improved fallback window decorations via
[libdecor](https://gitlab.freedesktop.org/libdecor/libdecor).
Support for libdecor can be toggled before GLFW is initialized with the
[GLFW_WAYLAND_LIBDECOR](@ref GLFW_WAYLAND_LIBDECOR_hint) init hint. It is
enabled by default.
@subsubsection wayland_app_id_34 Wayland app_id specification @subsubsection wayland_app_id_34 Wayland app_id specification
GLFW now supports specifying the app_id for a Wayland window using the GLFW now supports specifying the app_id for a Wayland window using the
@ -278,6 +288,10 @@ then GLFW will fail to initialize.
- @ref GLFW_POSITION_X - @ref GLFW_POSITION_X
- @ref GLFW_POSITION_Y - @ref GLFW_POSITION_Y
- @ref GLFW_ANY_POSITION - @ref GLFW_ANY_POSITION
- @ref GLFW_WAYLAND_APP_ID
- @ref GLFW_WAYLAND_LIBDECOR
- @ref GLFW_WAYLAND_PREFER_LIBDECOR
- @ref GLFW_WAYLAND_DISABLE_LIBDECOR
@section news_archive Release notes for earlier versions @section news_archive Release notes for earlier versions

View File

@ -31,7 +31,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "getopt.h"
#include "linmath.h" #include "linmath.h"
static const char* vertex_shader_text = static const char* vertex_shader_text =

View File

@ -361,10 +361,15 @@ extern "C" {
#define GLFW_HAT_RIGHT_DOWN (GLFW_HAT_RIGHT | GLFW_HAT_DOWN) #define GLFW_HAT_RIGHT_DOWN (GLFW_HAT_RIGHT | GLFW_HAT_DOWN)
#define GLFW_HAT_LEFT_UP (GLFW_HAT_LEFT | GLFW_HAT_UP) #define GLFW_HAT_LEFT_UP (GLFW_HAT_LEFT | GLFW_HAT_UP)
#define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN) #define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN)
/*! @ingroup input
*/
#define GLFW_KEY_UNKNOWN -1
/*! @} */ /*! @} */
/*! @defgroup keys Keyboard keys /*! @defgroup keys Keyboard key tokens
* @brief Keyboard key IDs. * @brief Keyboard key tokens.
* *
* See [key input](@ref input_key) for how these are used. * See [key input](@ref input_key) for how these are used.
* *
@ -387,9 +392,6 @@ extern "C" {
* @{ * @{
*/ */
/* The unknown key */
#define GLFW_KEY_UNKNOWN -1
/* Printable keys */ /* Printable keys */
#define GLFW_KEY_SPACE 32 #define GLFW_KEY_SPACE 32
#define GLFW_KEY_APOSTROPHE 39 /* ' */ #define GLFW_KEY_APOSTROPHE 39 /* ' */
@ -825,11 +827,11 @@ extern "C" {
#define GLFW_FEATURE_UNIMPLEMENTED 0x0001000D #define GLFW_FEATURE_UNIMPLEMENTED 0x0001000D
/*! @brief Platform unavailable or no matching platform was found. /*! @brief Platform unavailable or no matching platform was found.
* *
* If emitted during initialization, no matching platform was found. If @ref * If emitted during initialization, no matching platform was found. If the @ref
* GLFW_PLATFORM is set to `GLFW_ANY_PLATFORM`, GLFW could not detect any of the * GLFW_PLATFORM init hint was set to `GLFW_ANY_PLATFORM`, GLFW could not detect any of
* platforms supported by this library binary, except for the Null platform. If set to * the platforms supported by this library binary, except for the Null platform. If the
* a specific platform, it is either not supported by this library binary or GLFW was not * init hint was set to a specific platform, it is either not supported by this library
* able to detect it. * binary or GLFW was not able to detect it.
* *
* If emitted by a native access function, GLFW was initialized for a different platform * If emitted by a native access function, GLFW was initialized for a different platform
* than the function is for. * than the function is for.
@ -1164,6 +1166,9 @@ extern "C" {
#define GLFW_ANGLE_PLATFORM_TYPE_VULKAN 0x00037007 #define GLFW_ANGLE_PLATFORM_TYPE_VULKAN 0x00037007
#define GLFW_ANGLE_PLATFORM_TYPE_METAL 0x00037008 #define GLFW_ANGLE_PLATFORM_TYPE_METAL 0x00037008
#define GLFW_WAYLAND_PREFER_LIBDECOR 0x00038001
#define GLFW_WAYLAND_DISABLE_LIBDECOR 0x00038002
#define GLFW_ANY_POSITION 0x80000000 #define GLFW_ANY_POSITION 0x80000000
/*! @defgroup shapes Standard cursor shapes /*! @defgroup shapes Standard cursor shapes
@ -1307,6 +1312,11 @@ extern "C" {
* X11 specific [init hint](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint). * X11 specific [init hint](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint).
*/ */
#define GLFW_X11_XCB_VULKAN_SURFACE 0x00052001 #define GLFW_X11_XCB_VULKAN_SURFACE 0x00052001
/*! @brief Wayland specific init hint.
*
* Wayland specific [init hint](@ref GLFW_WAYLAND_LIBDECOR_hint).
*/
#define GLFW_WAYLAND_LIBDECOR 0x00053001
/*! @} */ /*! @} */
/*! @addtogroup init /*! @addtogroup init
@ -3091,8 +3101,8 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
* GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE, @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.
@ -4722,8 +4732,8 @@ GLFWAPI int glfwRawMouseMotionSupported(void);
* @param[in] scancode The scancode of the key to query. * @param[in] scancode The scancode of the key to query.
* @return The UTF-8 encoded, layout-specific name of the key, or `NULL`. * @return The UTF-8 encoded, layout-specific name of the key, or `NULL`.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_ERROR. * GLFW_INVALID_VALUE, @ref GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
* *
* @remark The contents of the returned string may change when a keyboard * @remark The contents of the returned string may change when a keyboard
* layout change event is received. * layout change event is received.
@ -4745,15 +4755,18 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode);
* *
* This function returns the platform-specific scancode of the specified key. * This function returns the platform-specific scancode of the specified key.
* *
* If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this * If the specified [key token](@ref keys) corresponds to a physical key not
* method will return `-1`. * supported on the current platform then this method will return `-1`.
* Calling this function with anything other than a key token will return `-1`
* and generate a @ref GLFW_INVALID_ENUM error.
* *
* @param[in] key Any [named key](@ref keys). * @param[in] key Any [key token](@ref keys).
* @return The platform-specific scancode for the key, or `-1` if an * @return The platform-specific scancode for the key, or `-1` if the key is
* [error](@ref error_handling) occurred. * not supported on the current platform or an [error](@ref error_handling)
* occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR. * GLFW_INVALID_ENUM.
* *
* @thread_safety This function may be called from any thread. * @thread_safety This function may be called from any thread.
* *
@ -5062,9 +5075,9 @@ GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
* [character callback](@ref glfwSetCharCallback) instead. * [character callback](@ref glfwSetCharCallback) instead.
* *
* When a window loses input focus, it will generate synthetic key release * When a window loses input focus, it will generate synthetic key release
* events for all pressed keys. You can tell these events from user-generated * events for all pressed keys with associated key tokens. You can tell these
* events by the fact that the synthetic ones are generated after the focus * events from user-generated events by the fact that the synthetic ones are
* loss event has been processed, i.e. after the * generated after the focus loss event has been processed, i.e. after the
* [window focus callback](@ref glfwSetWindowFocusCallback) has been called. * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
* *
* The scancode of a key is specific to that platform or sometimes even to that * The scancode of a key is specific to that platform or sometimes even to that
@ -5813,6 +5826,11 @@ 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
* writing. GLFW tries to acquire it a few times, which is almost always enough. If it
* cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns.
* It is safe to try this multiple times.
*
* @pointer_lifetime The specified string is copied before this function * @pointer_lifetime The specified string is copied before this function
* returns. * returns.
* *
@ -5841,6 +5859,11 @@ 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
* writing. GLFW tries to acquire it a few times, which is almost always enough. If it
* cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns.
* It is safe to try this multiple times.
*
* @pointer_lifetime The returned string is allocated and freed by GLFW. You * @pointer_lifetime The returned string is allocated and freed by GLFW. You
* should not free it yourself. It is valid until the next call to @ref * should not free it yourself. It is valid until the next call to @ref
* glfwGetClipboardString or @ref glfwSetClipboardString, or until the library * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
@ -5963,15 +5986,18 @@ GLFWAPI uint64_t glfwGetTimerFrequency(void);
* thread. * thread.
* *
* This function makes the OpenGL or OpenGL ES context of the specified window * This function makes the OpenGL or OpenGL ES context of the specified window
* current on the calling thread. A context must only be made current on * current on the calling thread. It can also detach the current context from
* a single thread at a time and each thread can have only a single current * the calling thread without making a new one current by passing in `NULL`.
* context at a time. *
* A context must only be made current on a single thread at a time and each
* thread can have only a single current context at a time. Making a context
* current detaches any previously current context on the calling thread.
* *
* Making a context of a window current on a given thread will detach * Making a context of a window current on a given thread will detach
* any user context which is current on that thread and visa versa. * any user context which is current on that thread and visa versa.
* *
* When moving a context between threads, you must make it non-current on the * When moving a context between threads, you must detach it (make it
* old thread before making it current on the new one. * non-current) on the old thread before making it current on the new one.
* *
* By default, making a context non-current implicitly forces a pipeline flush. * By default, making a context non-current implicitly forces a pipeline flush.
* On machines that support `GL_KHR_context_flush_control`, you can control * On machines that support `GL_KHR_context_flush_control`, you can control
@ -5986,6 +6012,10 @@ GLFWAPI uint64_t glfwGetTimerFrequency(void);
* @param[in] window The window whose context to make current, or `NULL` to * @param[in] window The window whose context to make current, or `NULL` to
* detach the current context. * detach the current context.
* *
* @remarks If the previously current context was created via a different
* context creation API than the one passed to this function, GLFW will still
* detach the previous one from its API before making the new one current.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR. * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
* *

View File

@ -169,7 +169,8 @@ extern "C" {
* of the specified monitor, or `NULL` if an [error](@ref error_handling) * of the specified monitor, or `NULL` if an [error](@ref error_handling)
* occurred. * occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -186,7 +187,8 @@ GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
* `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an * `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -202,7 +204,8 @@ GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
* @return The `HWND` of the specified window, or `NULL` if an * @return The `HWND` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @remark The `HDC` associated with the window can be queried with the * @remark The `HDC` associated with the window can be queried with the
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc) * [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
@ -228,8 +231,8 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
* @return The `HGLRC` of the specified window, or `NULL` if an * @return The `HGLRC` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_NOT_INITIALIZED. * GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
* *
* @remark The `HDC` associated with the window can be queried with the * @remark The `HDC` associated with the window can be queried with the
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc) * [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
@ -255,7 +258,8 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
* @return The `CGDirectDisplayID` of the specified monitor, or * @return The `CGDirectDisplayID` of the specified monitor, or
* `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred. * `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -271,7 +275,8 @@ GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
* @return The `NSWindow` of the specified window, or `nil` if an * @return The `NSWindow` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -289,8 +294,8 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
* @return The `NSOpenGLContext` of the specified window, or `nil` if an * @return The `NSOpenGLContext` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_NOT_INITIALIZED. * GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -308,7 +313,8 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
* @return The `Display` used by GLFW, or `NULL` if an * @return The `Display` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -324,7 +330,8 @@ GLFWAPI Display* glfwGetX11Display(void);
* @return The `RRCrtc` of the specified monitor, or `None` if an * @return The `RRCrtc` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -340,7 +347,8 @@ GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
* @return The `RROutput` of the specified monitor, or `None` if an * @return The `RROutput` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -356,7 +364,8 @@ GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
* @return The `Window` of the specified window, or `None` if an * @return The `Window` of the specified window, or `None` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -371,8 +380,8 @@ GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
* *
* @param[in] string A UTF-8 encoded string. * @param[in] string A UTF-8 encoded string.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
* *
* @pointer_lifetime The specified string is copied before this function * @pointer_lifetime The specified string is copied before this function
* returns. * returns.
@ -397,8 +406,8 @@ GLFWAPI void glfwSetX11SelectionString(const char* string);
* @return The contents of the selection as a UTF-8 encoded string, or `NULL` * @return The contents of the selection as a UTF-8 encoded string, or `NULL`
* if an [error](@ref error_handling) occurred. * if an [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
* *
* @pointer_lifetime The returned string is allocated and freed by GLFW. You * @pointer_lifetime The returned string is allocated and freed by GLFW. You
* should not free it yourself. It is valid until the next call to @ref * should not free it yourself. It is valid until the next call to @ref
@ -424,8 +433,8 @@ GLFWAPI const char* glfwGetX11SelectionString(void);
* @return The `GLXContext` of the specified window, or `NULL` if an * @return The `GLXContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_NOT_INITIALIZED. * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -441,8 +450,8 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
* @return The `GLXWindow` of the specified window, or `None` if an * @return The `GLXWindow` of the specified window, or `None` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_NOT_INITIALIZED. * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -460,7 +469,8 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
* @return The `struct wl_display*` used by GLFW, or `NULL` if an * @return The `struct wl_display*` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -476,7 +486,8 @@ GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
* @return The `struct wl_output*` of the specified monitor, or `NULL` if an * @return The `struct wl_output*` of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -492,7 +503,8 @@ GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
* @return The main `struct wl_surface*` of the specified window, or `NULL` if * @return The main `struct wl_surface*` of the specified window, or `NULL` if
* an [error](@ref error_handling) occurred. * an [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -529,8 +541,8 @@ GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
* @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an * @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_NOT_INITIALIZED. * GLFW_NO_WINDOW_CONTEXT.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -546,8 +558,8 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
* @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an * @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_NOT_INITIALIZED. * GLFW_NO_WINDOW_CONTEXT.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -572,8 +584,8 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_NOT_INITIALIZED. * GLFW_NO_WINDOW_CONTEXT.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -596,8 +608,8 @@ GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_NOT_INITIALIZED. * GLFW_NO_WINDOW_CONTEXT.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
@ -613,8 +625,8 @@ GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height
* @return The `OSMesaContext` of the specified window, or `NULL` if an * @return The `OSMesaContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_NOT_INITIALIZED. * GLFW_NO_WINDOW_CONTEXT.
* *
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.

View File

@ -72,47 +72,36 @@ if (GLFW_BUILD_WAYLAND)
endif() endif()
find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner) find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
if (NOT WAYLAND_SCANNER_EXECUTABLE)
message(FATAL_ERROR "Failed to find wayland-scanner")
endif()
include(FindPkgConfig) macro(generate_wayland_protocol protocol_file)
pkg_check_modules(WAYLAND_PROTOCOLS REQUIRED wayland-protocols>=1.15) set(protocol_path "${GLFW_SOURCE_DIR}/deps/wayland/${protocol_file}")
pkg_get_variable(WAYLAND_PROTOCOLS_BASE wayland-protocols pkgdatadir)
pkg_get_variable(WAYLAND_CLIENT_PKGDATADIR wayland-client pkgdatadir)
macro(wayland_generate protocol_file output_file) string(REGEX REPLACE "\\.xml$" "-client-protocol.h" header_file ${protocol_file})
add_custom_command(OUTPUT "${output_file}.h" string(REGEX REPLACE "\\.xml$" "-client-protocol-code.h" code_file ${protocol_file})
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${protocol_file}" "${output_file}.h"
DEPENDS "${protocol_file}" add_custom_command(OUTPUT ${header_file}
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${protocol_path}" ${header_file}
DEPENDS "${protocol_path}"
VERBATIM) VERBATIM)
add_custom_command(OUTPUT "${output_file}-code.h" add_custom_command(OUTPUT ${code_file}
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${protocol_file}" "${output_file}-code.h" COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${protocol_path}" ${code_file}
DEPENDS "${protocol_file}" DEPENDS "${protocol_path}"
VERBATIM) VERBATIM)
target_sources(glfw PRIVATE "${output_file}.h" "${output_file}-code.h") target_sources(glfw PRIVATE ${header_file} ${code_file})
endmacro() endmacro()
wayland_generate( generate_wayland_protocol("wayland.xml")
"${WAYLAND_CLIENT_PKGDATADIR}/wayland.xml" generate_wayland_protocol("viewporter.xml")
"${GLFW_BINARY_DIR}/src/wayland-client-protocol") generate_wayland_protocol("xdg-shell.xml")
wayland_generate( generate_wayland_protocol("idle-inhibit-unstable-v1.xml")
"${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml" generate_wayland_protocol("pointer-constraints-unstable-v1.xml")
"${GLFW_BINARY_DIR}/src/wayland-xdg-shell-client-protocol") generate_wayland_protocol("relative-pointer-unstable-v1.xml")
wayland_generate( generate_wayland_protocol("xdg-decoration-unstable-v1.xml")
"${WAYLAND_PROTOCOLS_BASE}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
"${GLFW_BINARY_DIR}/src/wayland-xdg-decoration-client-protocol")
wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/stable/viewporter/viewporter.xml"
"${GLFW_BINARY_DIR}/src/wayland-viewporter-client-protocol")
wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/unstable/relative-pointer/relative-pointer-unstable-v1.xml"
"${GLFW_BINARY_DIR}/src/wayland-relative-pointer-unstable-v1-client-protocol")
wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml"
"${GLFW_BINARY_DIR}/src/wayland-pointer-constraints-unstable-v1-client-protocol")
wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml"
"${GLFW_BINARY_DIR}/src/wayland-idle-inhibit-unstable-v1-client-protocol")
endif() endif()
if (WIN32 AND GLFW_BUILD_SHARED_LIBRARY) if (WIN32 AND GLFW_BUILD_SHARED_LIBRARY)
@ -126,6 +115,7 @@ if (UNIX AND GLFW_BUILD_SHARED_LIBRARY)
else() else()
set(GLFW_LIB_NAME glfw3) set(GLFW_LIB_NAME glfw3)
endif() endif()
set(GLFW_LIB_NAME_SUFFIX "")
set_target_properties(glfw PROPERTIES set_target_properties(glfw PROPERTIES
OUTPUT_NAME ${GLFW_LIB_NAME} OUTPUT_NAME ${GLFW_LIB_NAME}
@ -166,6 +156,8 @@ if (GLFW_BUILD_COCOA)
endif() endif()
if (GLFW_BUILD_WAYLAND) if (GLFW_BUILD_WAYLAND)
include(FindPkgConfig)
pkg_check_modules(Wayland REQUIRED pkg_check_modules(Wayland REQUIRED
wayland-client>=0.2.7 wayland-client>=0.2.7
wayland-cursor>=0.2.7 wayland-cursor>=0.2.7
@ -245,17 +237,6 @@ if (UNIX AND NOT APPLE)
endif() endif()
endif() endif()
# Make GCC warn about declarations that VS 2010 and 2012 won't accept for all
# source files that VS will build (Clang ignores this because we set -std=c99)
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
set_source_files_properties(context.c init.c input.c monitor.c platform.c vulkan.c
window.c null_init.c null_joystick.c null_monitor.c
null_window.c win32_init.c win32_joystick.c win32_module.c
win32_monitor.c win32_time.c win32_thread.c win32_window.c
wgl_context.c egl_context.c osmesa_context.c PROPERTIES
COMPILE_FLAGS -Wdeclaration-after-statement)
endif()
if (WIN32) if (WIN32)
if (GLFW_USE_HYBRID_HPG) if (GLFW_USE_HYBRID_HPG)
target_compile_definitions(glfw PRIVATE _GLFW_USE_HYBRID_HPG) target_compile_definitions(glfw PRIVATE _GLFW_USE_HYBRID_HPG)
@ -300,26 +281,10 @@ 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)
endif() endif()
# Workaround for VS 2008 not shipping with stdint.h
if (MSVC90)
target_include_directories(glfw PUBLIC "${GLFW_SOURCE_DIR}/deps/vs2008")
endif()
# Check for the DirectX 9 SDK as it is not included with VS 2008
if (MSVC90)
include(CheckIncludeFile)
check_include_file(dinput.h DINPUT_H_FOUND)
if (NOT DINPUT_H_FOUND)
message(FATAL_ERROR "DirectX 9 headers not found; install DirectX 9 SDK")
endif()
endif()
# Workaround for -std=c99 on Linux disabling _DEFAULT_SOURCE (POSIX 2008 and more) # Workaround for -std=c99 on Linux disabling _DEFAULT_SOURCE (POSIX 2008 and more)
if (GLFW_BUILD_X11 OR GLFW_BUILD_WAYLAND)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux") if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_compile_definitions(glfw PRIVATE _DEFAULT_SOURCE) target_compile_definitions(glfw PRIVATE _DEFAULT_SOURCE)
endif() endif()
endif()
if (GLFW_BUILD_SHARED_LIBRARY) if (GLFW_BUILD_SHARED_LIBRARY)
if (WIN32) if (WIN32)
@ -337,6 +302,7 @@ if (GLFW_BUILD_SHARED_LIBRARY)
# Add a suffix to the import library to avoid naming conflicts # Add a suffix to the import library to avoid naming conflicts
set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.lib") set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.lib")
endif() endif()
set (GLFW_LIB_NAME_SUFFIX "dll")
target_compile_definitions(glfw INTERFACE GLFW_DLL) target_compile_definitions(glfw INTERFACE GLFW_DLL)
endif() endif()

View File

@ -136,6 +136,14 @@ static void matchCallback(void* context,
return; return;
} }
CFArrayRef elements =
IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone);
// It is reportedly possible for this to fail on macOS 13 Ventura
// if the application does not have input monitoring permissions
if (!elements)
return;
axes = CFArrayCreateMutable(NULL, 0, NULL); axes = CFArrayCreateMutable(NULL, 0, NULL);
buttons = CFArrayCreateMutable(NULL, 0, NULL); buttons = CFArrayCreateMutable(NULL, 0, NULL);
hats = CFArrayCreateMutable(NULL, 0, NULL); hats = CFArrayCreateMutable(NULL, 0, NULL);
@ -179,9 +187,6 @@ static void matchCallback(void* context,
name[8], name[9], name[10]); name[8], name[9], name[10]);
} }
CFArrayRef elements =
IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone);
for (CFIndex i = 0; i < CFArrayGetCount(elements); i++) for (CFIndex i = 0; i < CFArrayGetCount(elements); i++)
{ {
IOHIDElementRef native = (IOHIDElementRef) IOHIDElementRef native = (IOHIDElementRef)

View File

@ -23,8 +23,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -310,12 +310,17 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
} }
- (void)windowDidChangeOcclusionState:(NSNotification* )notification - (void)windowDidChangeOcclusionState:(NSNotification* )notification
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1090
if ([window->ns.object respondsToSelector:@selector(occlusionState)])
{ {
if ([window->ns.object occlusionState] & NSWindowOcclusionStateVisible) if ([window->ns.object occlusionState] & NSWindowOcclusionStateVisible)
window->ns.occluded = GLFW_FALSE; window->ns.occluded = GLFW_FALSE;
else else
window->ns.occluded = GLFW_TRUE; window->ns.occluded = GLFW_TRUE;
} }
#endif
}
@end @end
@ -1279,7 +1284,7 @@ void _glfwSetWindowMonitorCocoa(_GLFWwindow* window,
if (window->monitor) if (window->monitor)
{ {
styleMask &= ~(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable); styleMask &= ~(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable);
styleMask |= NSWindowStyleMaskBorderless; styleMask |= NSWindowStyleMaskBorderless;
} }
else else

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"
@ -363,6 +361,8 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
previous = _glfwPlatformGetTls(&_glfw.contextSlot); previous = _glfwPlatformGetTls(&_glfw.contextSlot);
glfwMakeContextCurrent((GLFWwindow*) window); glfwMakeContextCurrent((GLFWwindow*) window);
if (_glfwPlatformGetTls(&_glfw.contextSlot) != window)
return GLFW_FALSE;
window->context.GetIntegerv = (PFNGLGETINTEGERVPROC) window->context.GetIntegerv = (PFNGLGETINTEGERVPROC)
window->context.getProcAddress("glGetIntegerv"); window->context.getProcAddress("glGetIntegerv");

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"
@ -311,6 +309,7 @@ static int extensionSupportedEGL(const char* extension)
static GLFWglproc getProcAddressEGL(const char* procname) static GLFWglproc getProcAddressEGL(const char* procname)
{ {
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot); _GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
assert(window != NULL);
if (window->context.egl.client) if (window->context.egl.client)
{ {
@ -641,18 +640,18 @@ GLFWbool _glfwCreateContextForConfigEGL(EGLConfig eglConfig,
flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR; flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
} }
if (ctxconfig->noerror)
{
if (_glfw.egl.KHR_create_context_no_error)
SET_ATTRIB(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, GLFW_TRUE);
}
if (ctxconfig->major != 1 || ctxconfig->minor != 0) if (ctxconfig->major != 1 || ctxconfig->minor != 0)
{ {
SET_ATTRIB(EGL_CONTEXT_MAJOR_VERSION_KHR, ctxconfig->major); SET_ATTRIB(EGL_CONTEXT_MAJOR_VERSION_KHR, ctxconfig->major);
SET_ATTRIB(EGL_CONTEXT_MINOR_VERSION_KHR, ctxconfig->minor); SET_ATTRIB(EGL_CONTEXT_MINOR_VERSION_KHR, ctxconfig->minor);
} }
if (ctxconfig->noerror)
{
if (_glfw.egl.KHR_create_context_no_error)
SET_ATTRIB(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, GLFW_TRUE);
}
if (mask) if (mask)
SET_ATTRIB(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, mask); SET_ATTRIB(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, mask);
@ -726,8 +725,11 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
if (!fbconfig->doublebuffer) if (!fbconfig->doublebuffer)
SET_ATTRIB(EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER); SET_ATTRIB(EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER);
if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND)
{
if (_glfw.egl.EXT_present_opaque) if (_glfw.egl.EXT_present_opaque)
SET_ATTRIB(EGL_PRESENT_OPAQUE_EXT, !fbconfig->transparent); SET_ATTRIB(EGL_PRESENT_OPAQUE_EXT, !fbconfig->transparent);
}
SET_ATTRIB(EGL_NONE, EGL_NONE); SET_ATTRIB(EGL_NONE, EGL_NONE);

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"
@ -192,6 +190,7 @@ static void swapBuffersGLX(_GLFWwindow* window)
static void swapIntervalGLX(int interval) static void swapIntervalGLX(int interval)
{ {
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot); _GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
assert(window != NULL);
if (_glfw.glx.EXT_swap_control) if (_glfw.glx.EXT_swap_control)
{ {

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"
@ -62,6 +60,9 @@ static _GLFWinitconfig _glfwInitHints =
{ {
GLFW_TRUE, // X11 XCB Vulkan surface GLFW_TRUE, // X11 XCB Vulkan surface
}, },
{
GLFW_WAYLAND_PREFER_LIBDECOR // Wayland libdecor mode
},
}; };
// The allocation function used when no custom allocator is set // The allocation function used when no custom allocator is set
@ -481,6 +482,9 @@ GLFWAPI void glfwInitHint(int hint, int value)
case GLFW_X11_XCB_VULKAN_SURFACE: case GLFW_X11_XCB_VULKAN_SURFACE:
_glfwInitHints.x11.xcbVulkanSurface = value; _glfwInitHints.x11.xcbVulkanSurface = value;
return; return;
case GLFW_WAYLAND_LIBDECOR:
_glfwInitHints.wl.libdecorMode = value;
return;
} }
_glfwInputError(GLFW_INVALID_ENUM, _glfwInputError(GLFW_INVALID_ENUM,

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"
#include "mappings.h" #include "mappings.h"
@ -462,10 +460,11 @@ void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value)
assert(hat >= 0); assert(hat >= 0);
assert(hat < js->hatCount); assert(hat < js->hatCount);
// Valid hat values only use the least significant nibble and have at most two bits // Valid hat values only use the least significant nibble
// set, which can be considered adjacent plus an arbitrary rotation within the nibble
assert((value & 0xf0) == 0); assert((value & 0xf0) == 0);
assert((value & ((value << 2) | (value >> 2))) == 0); // Valid hat values do not have both bits of an axis set
assert((value & GLFW_HAT_LEFT) == 0 || (value & GLFW_HAT_RIGHT) == 0);
assert((value & GLFW_HAT_UP) == 0 || (value & GLFW_HAT_DOWN) == 0);
base = js->buttonCount + hat * 4; base = js->buttonCount + hat * 4;
@ -701,6 +700,12 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode)
if (key != GLFW_KEY_UNKNOWN) if (key != GLFW_KEY_UNKNOWN)
{ {
if (key < GLFW_KEY_SPACE || key > GLFW_KEY_LAST)
{
_glfwInputError(GLFW_INVALID_ENUM, "Invalid key %i", key);
return NULL;
}
if (key != GLFW_KEY_KP_EQUAL && if (key != GLFW_KEY_KP_EQUAL &&
(key < GLFW_KEY_KP_0 || key > GLFW_KEY_KP_ADD) && (key < GLFW_KEY_KP_0 || key > GLFW_KEY_KP_ADD) &&
(key < GLFW_KEY_APOSTROPHE || key > GLFW_KEY_WORLD_2)) (key < GLFW_KEY_APOSTROPHE || key > GLFW_KEY_WORLD_2))
@ -721,7 +726,7 @@ GLFWAPI int glfwGetKeyScancode(int key)
if (key < GLFW_KEY_SPACE || key > GLFW_KEY_LAST) if (key < GLFW_KEY_SPACE || key > GLFW_KEY_LAST)
{ {
_glfwInputError(GLFW_INVALID_ENUM, "Invalid key %i", key); _glfwInputError(GLFW_INVALID_ENUM, "Invalid key %i", key);
return GLFW_RELEASE; return -1;
} }
return _glfw.platform.getKeyScancode(key); return _glfw.platform.getKeyScancode(key);

View File

@ -387,6 +387,9 @@ struct _GLFWinitconfig
struct { struct {
GLFWbool xcbVulkanSurface; GLFWbool xcbVulkanSurface;
} x11; } x11;
struct {
int libdecorMode;
} wl;
}; };
// Window configuration // Window configuration

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"
@ -326,7 +324,8 @@ GLFWbool _glfwInitJoysticksLinux(void)
// Continue without device connection notifications if inotify fails // Continue without device connection notifications if inotify fails
if (regcomp(&_glfw.linjs.regex, "^event[0-9]\\+$", 0) != 0) _glfw.linjs.regexCompiled = (regcomp(&_glfw.linjs.regex, "^event[0-9]\\+$", 0) == 0);
if (!_glfw.linjs.regexCompiled)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, "Linux: Failed to compile regex"); _glfwInputError(GLFW_PLATFORM_ERROR, "Linux: Failed to compile regex");
return GLFW_FALSE; return GLFW_FALSE;
@ -378,8 +377,10 @@ void _glfwTerminateJoysticksLinux(void)
inotify_rm_watch(_glfw.linjs.inotify, _glfw.linjs.watch); inotify_rm_watch(_glfw.linjs.inotify, _glfw.linjs.watch);
close(_glfw.linjs.inotify); close(_glfw.linjs.inotify);
regfree(&_glfw.linjs.regex);
} }
if (_glfw.linjs.regexCompiled)
regfree(&_glfw.linjs.regex);
} }
GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode) GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode)

View File

@ -50,6 +50,7 @@ typedef struct _GLFWlibraryLinux
int inotify; int inotify;
int watch; int watch;
regex_t regex; regex_t regex;
GLFWbool regexCompiled;
GLFWbool dropped; GLFWbool dropped;
} _GLFWlibraryLinux; } _GLFWlibraryLinux;

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -83,11 +83,10 @@ static void swapIntervalNSGL(int interval)
@autoreleasepool { @autoreleasepool {
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot); _GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
if (window) assert(window != NULL);
{
[window->context.nsgl.object setValues:&interval [window->context.nsgl.object setValues:&interval
forParameter:NSOpenGLContextParameterSwapInterval]; forParameter:NSOpenGLContextParameterSwapInterval];
}
} // autoreleasepool } // autoreleasepool
} }

View File

@ -24,12 +24,11 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -121,6 +120,138 @@ GLFWbool _glfwConnectNull(int platformID, _GLFWplatform* platform)
int _glfwInitNull(void) int _glfwInitNull(void)
{ {
int scancode;
memset(_glfw.null.keycodes, -1, sizeof(_glfw.null.keycodes));
memset(_glfw.null.scancodes, -1, sizeof(_glfw.null.scancodes));
_glfw.null.keycodes[GLFW_NULL_SC_SPACE] = GLFW_KEY_SPACE;
_glfw.null.keycodes[GLFW_NULL_SC_APOSTROPHE] = GLFW_KEY_APOSTROPHE;
_glfw.null.keycodes[GLFW_NULL_SC_COMMA] = GLFW_KEY_COMMA;
_glfw.null.keycodes[GLFW_NULL_SC_MINUS] = GLFW_KEY_MINUS;
_glfw.null.keycodes[GLFW_NULL_SC_PERIOD] = GLFW_KEY_PERIOD;
_glfw.null.keycodes[GLFW_NULL_SC_SLASH] = GLFW_KEY_SLASH;
_glfw.null.keycodes[GLFW_NULL_SC_0] = GLFW_KEY_0;
_glfw.null.keycodes[GLFW_NULL_SC_1] = GLFW_KEY_1;
_glfw.null.keycodes[GLFW_NULL_SC_2] = GLFW_KEY_2;
_glfw.null.keycodes[GLFW_NULL_SC_3] = GLFW_KEY_3;
_glfw.null.keycodes[GLFW_NULL_SC_4] = GLFW_KEY_4;
_glfw.null.keycodes[GLFW_NULL_SC_5] = GLFW_KEY_5;
_glfw.null.keycodes[GLFW_NULL_SC_6] = GLFW_KEY_6;
_glfw.null.keycodes[GLFW_NULL_SC_7] = GLFW_KEY_7;
_glfw.null.keycodes[GLFW_NULL_SC_8] = GLFW_KEY_8;
_glfw.null.keycodes[GLFW_NULL_SC_9] = GLFW_KEY_9;
_glfw.null.keycodes[GLFW_NULL_SC_SEMICOLON] = GLFW_KEY_SEMICOLON;
_glfw.null.keycodes[GLFW_NULL_SC_EQUAL] = GLFW_KEY_EQUAL;
_glfw.null.keycodes[GLFW_NULL_SC_A] = GLFW_KEY_A;
_glfw.null.keycodes[GLFW_NULL_SC_B] = GLFW_KEY_B;
_glfw.null.keycodes[GLFW_NULL_SC_C] = GLFW_KEY_C;
_glfw.null.keycodes[GLFW_NULL_SC_D] = GLFW_KEY_D;
_glfw.null.keycodes[GLFW_NULL_SC_E] = GLFW_KEY_E;
_glfw.null.keycodes[GLFW_NULL_SC_F] = GLFW_KEY_F;
_glfw.null.keycodes[GLFW_NULL_SC_G] = GLFW_KEY_G;
_glfw.null.keycodes[GLFW_NULL_SC_H] = GLFW_KEY_H;
_glfw.null.keycodes[GLFW_NULL_SC_I] = GLFW_KEY_I;
_glfw.null.keycodes[GLFW_NULL_SC_J] = GLFW_KEY_J;
_glfw.null.keycodes[GLFW_NULL_SC_K] = GLFW_KEY_K;
_glfw.null.keycodes[GLFW_NULL_SC_L] = GLFW_KEY_L;
_glfw.null.keycodes[GLFW_NULL_SC_M] = GLFW_KEY_M;
_glfw.null.keycodes[GLFW_NULL_SC_N] = GLFW_KEY_N;
_glfw.null.keycodes[GLFW_NULL_SC_O] = GLFW_KEY_O;
_glfw.null.keycodes[GLFW_NULL_SC_P] = GLFW_KEY_P;
_glfw.null.keycodes[GLFW_NULL_SC_Q] = GLFW_KEY_Q;
_glfw.null.keycodes[GLFW_NULL_SC_R] = GLFW_KEY_R;
_glfw.null.keycodes[GLFW_NULL_SC_S] = GLFW_KEY_S;
_glfw.null.keycodes[GLFW_NULL_SC_T] = GLFW_KEY_T;
_glfw.null.keycodes[GLFW_NULL_SC_U] = GLFW_KEY_U;
_glfw.null.keycodes[GLFW_NULL_SC_V] = GLFW_KEY_V;
_glfw.null.keycodes[GLFW_NULL_SC_W] = GLFW_KEY_W;
_glfw.null.keycodes[GLFW_NULL_SC_X] = GLFW_KEY_X;
_glfw.null.keycodes[GLFW_NULL_SC_Y] = GLFW_KEY_Y;
_glfw.null.keycodes[GLFW_NULL_SC_Z] = GLFW_KEY_Z;
_glfw.null.keycodes[GLFW_NULL_SC_LEFT_BRACKET] = GLFW_KEY_LEFT_BRACKET;
_glfw.null.keycodes[GLFW_NULL_SC_BACKSLASH] = GLFW_KEY_BACKSLASH;
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT_BRACKET] = GLFW_KEY_RIGHT_BRACKET;
_glfw.null.keycodes[GLFW_NULL_SC_GRAVE_ACCENT] = GLFW_KEY_GRAVE_ACCENT;
_glfw.null.keycodes[GLFW_NULL_SC_WORLD_1] = GLFW_KEY_WORLD_1;
_glfw.null.keycodes[GLFW_NULL_SC_WORLD_2] = GLFW_KEY_WORLD_2;
_glfw.null.keycodes[GLFW_NULL_SC_ESCAPE] = GLFW_KEY_ESCAPE;
_glfw.null.keycodes[GLFW_NULL_SC_ENTER] = GLFW_KEY_ENTER;
_glfw.null.keycodes[GLFW_NULL_SC_TAB] = GLFW_KEY_TAB;
_glfw.null.keycodes[GLFW_NULL_SC_BACKSPACE] = GLFW_KEY_BACKSPACE;
_glfw.null.keycodes[GLFW_NULL_SC_INSERT] = GLFW_KEY_INSERT;
_glfw.null.keycodes[GLFW_NULL_SC_DELETE] = GLFW_KEY_DELETE;
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT] = GLFW_KEY_RIGHT;
_glfw.null.keycodes[GLFW_NULL_SC_LEFT] = GLFW_KEY_LEFT;
_glfw.null.keycodes[GLFW_NULL_SC_DOWN] = GLFW_KEY_DOWN;
_glfw.null.keycodes[GLFW_NULL_SC_UP] = GLFW_KEY_UP;
_glfw.null.keycodes[GLFW_NULL_SC_PAGE_UP] = GLFW_KEY_PAGE_UP;
_glfw.null.keycodes[GLFW_NULL_SC_PAGE_DOWN] = GLFW_KEY_PAGE_DOWN;
_glfw.null.keycodes[GLFW_NULL_SC_HOME] = GLFW_KEY_HOME;
_glfw.null.keycodes[GLFW_NULL_SC_END] = GLFW_KEY_END;
_glfw.null.keycodes[GLFW_NULL_SC_CAPS_LOCK] = GLFW_KEY_CAPS_LOCK;
_glfw.null.keycodes[GLFW_NULL_SC_SCROLL_LOCK] = GLFW_KEY_SCROLL_LOCK;
_glfw.null.keycodes[GLFW_NULL_SC_NUM_LOCK] = GLFW_KEY_NUM_LOCK;
_glfw.null.keycodes[GLFW_NULL_SC_PRINT_SCREEN] = GLFW_KEY_PRINT_SCREEN;
_glfw.null.keycodes[GLFW_NULL_SC_PAUSE] = GLFW_KEY_PAUSE;
_glfw.null.keycodes[GLFW_NULL_SC_F1] = GLFW_KEY_F1;
_glfw.null.keycodes[GLFW_NULL_SC_F2] = GLFW_KEY_F2;
_glfw.null.keycodes[GLFW_NULL_SC_F3] = GLFW_KEY_F3;
_glfw.null.keycodes[GLFW_NULL_SC_F4] = GLFW_KEY_F4;
_glfw.null.keycodes[GLFW_NULL_SC_F5] = GLFW_KEY_F5;
_glfw.null.keycodes[GLFW_NULL_SC_F6] = GLFW_KEY_F6;
_glfw.null.keycodes[GLFW_NULL_SC_F7] = GLFW_KEY_F7;
_glfw.null.keycodes[GLFW_NULL_SC_F8] = GLFW_KEY_F8;
_glfw.null.keycodes[GLFW_NULL_SC_F9] = GLFW_KEY_F9;
_glfw.null.keycodes[GLFW_NULL_SC_F10] = GLFW_KEY_F10;
_glfw.null.keycodes[GLFW_NULL_SC_F11] = GLFW_KEY_F11;
_glfw.null.keycodes[GLFW_NULL_SC_F12] = GLFW_KEY_F12;
_glfw.null.keycodes[GLFW_NULL_SC_F13] = GLFW_KEY_F13;
_glfw.null.keycodes[GLFW_NULL_SC_F14] = GLFW_KEY_F14;
_glfw.null.keycodes[GLFW_NULL_SC_F15] = GLFW_KEY_F15;
_glfw.null.keycodes[GLFW_NULL_SC_F16] = GLFW_KEY_F16;
_glfw.null.keycodes[GLFW_NULL_SC_F17] = GLFW_KEY_F17;
_glfw.null.keycodes[GLFW_NULL_SC_F18] = GLFW_KEY_F18;
_glfw.null.keycodes[GLFW_NULL_SC_F19] = GLFW_KEY_F19;
_glfw.null.keycodes[GLFW_NULL_SC_F20] = GLFW_KEY_F20;
_glfw.null.keycodes[GLFW_NULL_SC_F21] = GLFW_KEY_F21;
_glfw.null.keycodes[GLFW_NULL_SC_F22] = GLFW_KEY_F22;
_glfw.null.keycodes[GLFW_NULL_SC_F23] = GLFW_KEY_F23;
_glfw.null.keycodes[GLFW_NULL_SC_F24] = GLFW_KEY_F24;
_glfw.null.keycodes[GLFW_NULL_SC_F25] = GLFW_KEY_F25;
_glfw.null.keycodes[GLFW_NULL_SC_KP_0] = GLFW_KEY_KP_0;
_glfw.null.keycodes[GLFW_NULL_SC_KP_1] = GLFW_KEY_KP_1;
_glfw.null.keycodes[GLFW_NULL_SC_KP_2] = GLFW_KEY_KP_2;
_glfw.null.keycodes[GLFW_NULL_SC_KP_3] = GLFW_KEY_KP_3;
_glfw.null.keycodes[GLFW_NULL_SC_KP_4] = GLFW_KEY_KP_4;
_glfw.null.keycodes[GLFW_NULL_SC_KP_5] = GLFW_KEY_KP_5;
_glfw.null.keycodes[GLFW_NULL_SC_KP_6] = GLFW_KEY_KP_6;
_glfw.null.keycodes[GLFW_NULL_SC_KP_7] = GLFW_KEY_KP_7;
_glfw.null.keycodes[GLFW_NULL_SC_KP_8] = GLFW_KEY_KP_8;
_glfw.null.keycodes[GLFW_NULL_SC_KP_9] = GLFW_KEY_KP_9;
_glfw.null.keycodes[GLFW_NULL_SC_KP_DECIMAL] = GLFW_KEY_KP_DECIMAL;
_glfw.null.keycodes[GLFW_NULL_SC_KP_DIVIDE] = GLFW_KEY_KP_DIVIDE;
_glfw.null.keycodes[GLFW_NULL_SC_KP_MULTIPLY] = GLFW_KEY_KP_MULTIPLY;
_glfw.null.keycodes[GLFW_NULL_SC_KP_SUBTRACT] = GLFW_KEY_KP_SUBTRACT;
_glfw.null.keycodes[GLFW_NULL_SC_KP_ADD] = GLFW_KEY_KP_ADD;
_glfw.null.keycodes[GLFW_NULL_SC_KP_ENTER] = GLFW_KEY_KP_ENTER;
_glfw.null.keycodes[GLFW_NULL_SC_KP_EQUAL] = GLFW_KEY_KP_EQUAL;
_glfw.null.keycodes[GLFW_NULL_SC_LEFT_SHIFT] = GLFW_KEY_LEFT_SHIFT;
_glfw.null.keycodes[GLFW_NULL_SC_LEFT_CONTROL] = GLFW_KEY_LEFT_CONTROL;
_glfw.null.keycodes[GLFW_NULL_SC_LEFT_ALT] = GLFW_KEY_LEFT_ALT;
_glfw.null.keycodes[GLFW_NULL_SC_LEFT_SUPER] = GLFW_KEY_LEFT_SUPER;
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT_SHIFT] = GLFW_KEY_RIGHT_SHIFT;
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT_CONTROL] = GLFW_KEY_RIGHT_CONTROL;
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT_ALT] = GLFW_KEY_RIGHT_ALT;
_glfw.null.keycodes[GLFW_NULL_SC_RIGHT_SUPER] = GLFW_KEY_RIGHT_SUPER;
_glfw.null.keycodes[GLFW_NULL_SC_MENU] = GLFW_KEY_MENU;
for (scancode = GLFW_NULL_SC_FIRST; scancode < GLFW_NULL_SC_LAST; scancode++)
{
if (_glfw.null.keycodes[scancode] > 0)
_glfw.null.scancodes[_glfw.null.keycodes[scancode]] = scancode;
}
_glfwPollMonitorsNull(); _glfwPollMonitorsNull();
return GLFW_TRUE; return GLFW_TRUE;
} }

View File

@ -23,8 +23,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -34,6 +34,129 @@
#define GLFW_NULL_LIBRARY_CONTEXT_STATE #define GLFW_NULL_LIBRARY_CONTEXT_STATE
#define GLFW_NULL_USER_CONTEXT_STATE #define GLFW_NULL_USER_CONTEXT_STATE
#define GLFW_NULL_SC_FIRST GLFW_NULL_SC_SPACE
#define GLFW_NULL_SC_SPACE 1
#define GLFW_NULL_SC_APOSTROPHE 2
#define GLFW_NULL_SC_COMMA 3
#define GLFW_NULL_SC_MINUS 4
#define GLFW_NULL_SC_PERIOD 5
#define GLFW_NULL_SC_SLASH 6
#define GLFW_NULL_SC_0 7
#define GLFW_NULL_SC_1 8
#define GLFW_NULL_SC_2 9
#define GLFW_NULL_SC_3 10
#define GLFW_NULL_SC_4 11
#define GLFW_NULL_SC_5 12
#define GLFW_NULL_SC_6 13
#define GLFW_NULL_SC_7 14
#define GLFW_NULL_SC_8 15
#define GLFW_NULL_SC_9 16
#define GLFW_NULL_SC_SEMICOLON 17
#define GLFW_NULL_SC_EQUAL 18
#define GLFW_NULL_SC_LEFT_BRACKET 19
#define GLFW_NULL_SC_BACKSLASH 20
#define GLFW_NULL_SC_RIGHT_BRACKET 21
#define GLFW_NULL_SC_GRAVE_ACCENT 22
#define GLFW_NULL_SC_WORLD_1 23
#define GLFW_NULL_SC_WORLD_2 24
#define GLFW_NULL_SC_ESCAPE 25
#define GLFW_NULL_SC_ENTER 26
#define GLFW_NULL_SC_TAB 27
#define GLFW_NULL_SC_BACKSPACE 28
#define GLFW_NULL_SC_INSERT 29
#define GLFW_NULL_SC_DELETE 30
#define GLFW_NULL_SC_RIGHT 31
#define GLFW_NULL_SC_LEFT 32
#define GLFW_NULL_SC_DOWN 33
#define GLFW_NULL_SC_UP 34
#define GLFW_NULL_SC_PAGE_UP 35
#define GLFW_NULL_SC_PAGE_DOWN 36
#define GLFW_NULL_SC_HOME 37
#define GLFW_NULL_SC_END 38
#define GLFW_NULL_SC_CAPS_LOCK 39
#define GLFW_NULL_SC_SCROLL_LOCK 40
#define GLFW_NULL_SC_NUM_LOCK 41
#define GLFW_NULL_SC_PRINT_SCREEN 42
#define GLFW_NULL_SC_PAUSE 43
#define GLFW_NULL_SC_A 44
#define GLFW_NULL_SC_B 45
#define GLFW_NULL_SC_C 46
#define GLFW_NULL_SC_D 47
#define GLFW_NULL_SC_E 48
#define GLFW_NULL_SC_F 49
#define GLFW_NULL_SC_G 50
#define GLFW_NULL_SC_H 51
#define GLFW_NULL_SC_I 52
#define GLFW_NULL_SC_J 53
#define GLFW_NULL_SC_K 54
#define GLFW_NULL_SC_L 55
#define GLFW_NULL_SC_M 56
#define GLFW_NULL_SC_N 57
#define GLFW_NULL_SC_O 58
#define GLFW_NULL_SC_P 59
#define GLFW_NULL_SC_Q 60
#define GLFW_NULL_SC_R 61
#define GLFW_NULL_SC_S 62
#define GLFW_NULL_SC_T 63
#define GLFW_NULL_SC_U 64
#define GLFW_NULL_SC_V 65
#define GLFW_NULL_SC_W 66
#define GLFW_NULL_SC_X 67
#define GLFW_NULL_SC_Y 68
#define GLFW_NULL_SC_Z 69
#define GLFW_NULL_SC_F1 70
#define GLFW_NULL_SC_F2 71
#define GLFW_NULL_SC_F3 72
#define GLFW_NULL_SC_F4 73
#define GLFW_NULL_SC_F5 74
#define GLFW_NULL_SC_F6 75
#define GLFW_NULL_SC_F7 76
#define GLFW_NULL_SC_F8 77
#define GLFW_NULL_SC_F9 78
#define GLFW_NULL_SC_F10 79
#define GLFW_NULL_SC_F11 80
#define GLFW_NULL_SC_F12 81
#define GLFW_NULL_SC_F13 82
#define GLFW_NULL_SC_F14 83
#define GLFW_NULL_SC_F15 84
#define GLFW_NULL_SC_F16 85
#define GLFW_NULL_SC_F17 86
#define GLFW_NULL_SC_F18 87
#define GLFW_NULL_SC_F19 88
#define GLFW_NULL_SC_F20 89
#define GLFW_NULL_SC_F21 90
#define GLFW_NULL_SC_F22 91
#define GLFW_NULL_SC_F23 92
#define GLFW_NULL_SC_F24 93
#define GLFW_NULL_SC_F25 94
#define GLFW_NULL_SC_KP_0 95
#define GLFW_NULL_SC_KP_1 96
#define GLFW_NULL_SC_KP_2 97
#define GLFW_NULL_SC_KP_3 98
#define GLFW_NULL_SC_KP_4 99
#define GLFW_NULL_SC_KP_5 100
#define GLFW_NULL_SC_KP_6 101
#define GLFW_NULL_SC_KP_7 102
#define GLFW_NULL_SC_KP_8 103
#define GLFW_NULL_SC_KP_9 104
#define GLFW_NULL_SC_KP_DECIMAL 105
#define GLFW_NULL_SC_KP_DIVIDE 106
#define GLFW_NULL_SC_KP_MULTIPLY 107
#define GLFW_NULL_SC_KP_SUBTRACT 108
#define GLFW_NULL_SC_KP_ADD 109
#define GLFW_NULL_SC_KP_ENTER 110
#define GLFW_NULL_SC_KP_EQUAL 111
#define GLFW_NULL_SC_LEFT_SHIFT 112
#define GLFW_NULL_SC_LEFT_CONTROL 113
#define GLFW_NULL_SC_LEFT_ALT 114
#define GLFW_NULL_SC_LEFT_SUPER 115
#define GLFW_NULL_SC_RIGHT_SHIFT 116
#define GLFW_NULL_SC_RIGHT_CONTROL 117
#define GLFW_NULL_SC_RIGHT_ALT 118
#define GLFW_NULL_SC_RIGHT_SUPER 119
#define GLFW_NULL_SC_MENU 120
#define GLFW_NULL_SC_LAST GLFW_NULL_SC_MENU
// Null-specific per-window data // Null-specific per-window data
// //
typedef struct _GLFWwindowNull typedef struct _GLFWwindowNull
@ -68,6 +191,8 @@ typedef struct _GLFWlibraryNull
int ycursor; int ycursor;
char* clipboardString; char* clipboardString;
_GLFWwindow* focusedWindow; _GLFWwindow* focusedWindow;
uint16_t keycodes[GLFW_NULL_SC_LAST + 1];
uint8_t scancodes[GLFW_KEY_LAST + 1];
} _GLFWlibraryNull; } _GLFWlibraryNull;
void _glfwPollMonitorsNull(void); void _glfwPollMonitorsNull(void);
@ -115,7 +240,6 @@ void _glfwSetRawMouseMotionNull(_GLFWwindow *window, GLFWbool enabled);
GLFWbool _glfwRawMouseMotionSupportedNull(void); GLFWbool _glfwRawMouseMotionSupportedNull(void);
void _glfwShowWindowNull(_GLFWwindow* window); void _glfwShowWindowNull(_GLFWwindow* window);
void _glfwRequestWindowAttentionNull(_GLFWwindow* window); void _glfwRequestWindowAttentionNull(_GLFWwindow* window);
void _glfwRequestWindowAttentionNull(_GLFWwindow* window);
void _glfwHideWindowNull(_GLFWwindow* window); void _glfwHideWindowNull(_GLFWwindow* window);
void _glfwFocusWindowNull(_GLFWwindow* window); void _glfwFocusWindowNull(_GLFWwindow* window);
GLFWbool _glfwWindowFocusedNull(_GLFWwindow* window); GLFWbool _glfwWindowFocusedNull(_GLFWwindow* window);

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"
@ -568,7 +566,7 @@ EGLNativeWindowType _glfwGetEGLNativeWindowNull(_GLFWwindow* window)
const char* _glfwGetScancodeNameNull(int scancode) const char* _glfwGetScancodeNameNull(int scancode)
{ {
if (scancode < GLFW_KEY_SPACE || scancode > GLFW_KEY_LAST) if (scancode < GLFW_NULL_SC_FIRST || scancode > GLFW_NULL_SC_LAST)
{ {
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode); _glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
return NULL; return NULL;
@ -576,117 +574,117 @@ const char* _glfwGetScancodeNameNull(int scancode)
switch (scancode) switch (scancode)
{ {
case GLFW_KEY_APOSTROPHE: case GLFW_NULL_SC_APOSTROPHE:
return "'"; return "'";
case GLFW_KEY_COMMA: case GLFW_NULL_SC_COMMA:
return ","; return ",";
case GLFW_KEY_MINUS: case GLFW_NULL_SC_MINUS:
case GLFW_KEY_KP_SUBTRACT: case GLFW_NULL_SC_KP_SUBTRACT:
return "-"; return "-";
case GLFW_KEY_PERIOD: case GLFW_NULL_SC_PERIOD:
case GLFW_KEY_KP_DECIMAL: case GLFW_NULL_SC_KP_DECIMAL:
return "."; return ".";
case GLFW_KEY_SLASH: case GLFW_NULL_SC_SLASH:
case GLFW_KEY_KP_DIVIDE: case GLFW_NULL_SC_KP_DIVIDE:
return "/"; return "/";
case GLFW_KEY_SEMICOLON: case GLFW_NULL_SC_SEMICOLON:
return ";"; return ";";
case GLFW_KEY_EQUAL: case GLFW_NULL_SC_EQUAL:
case GLFW_KEY_KP_EQUAL: case GLFW_NULL_SC_KP_EQUAL:
return "="; return "=";
case GLFW_KEY_LEFT_BRACKET: case GLFW_NULL_SC_LEFT_BRACKET:
return "["; return "[";
case GLFW_KEY_RIGHT_BRACKET: case GLFW_NULL_SC_RIGHT_BRACKET:
return "]"; return "]";
case GLFW_KEY_KP_MULTIPLY: case GLFW_NULL_SC_KP_MULTIPLY:
return "*"; return "*";
case GLFW_KEY_KP_ADD: case GLFW_NULL_SC_KP_ADD:
return "+"; return "+";
case GLFW_KEY_BACKSLASH: case GLFW_NULL_SC_BACKSLASH:
case GLFW_KEY_WORLD_1: case GLFW_NULL_SC_WORLD_1:
case GLFW_KEY_WORLD_2: case GLFW_NULL_SC_WORLD_2:
return "\\"; return "\\";
case GLFW_KEY_0: case GLFW_NULL_SC_0:
case GLFW_KEY_KP_0: case GLFW_NULL_SC_KP_0:
return "0"; return "0";
case GLFW_KEY_1: case GLFW_NULL_SC_1:
case GLFW_KEY_KP_1: case GLFW_NULL_SC_KP_1:
return "1"; return "1";
case GLFW_KEY_2: case GLFW_NULL_SC_2:
case GLFW_KEY_KP_2: case GLFW_NULL_SC_KP_2:
return "2"; return "2";
case GLFW_KEY_3: case GLFW_NULL_SC_3:
case GLFW_KEY_KP_3: case GLFW_NULL_SC_KP_3:
return "3"; return "3";
case GLFW_KEY_4: case GLFW_NULL_SC_4:
case GLFW_KEY_KP_4: case GLFW_NULL_SC_KP_4:
return "4"; return "4";
case GLFW_KEY_5: case GLFW_NULL_SC_5:
case GLFW_KEY_KP_5: case GLFW_NULL_SC_KP_5:
return "5"; return "5";
case GLFW_KEY_6: case GLFW_NULL_SC_6:
case GLFW_KEY_KP_6: case GLFW_NULL_SC_KP_6:
return "6"; return "6";
case GLFW_KEY_7: case GLFW_NULL_SC_7:
case GLFW_KEY_KP_7: case GLFW_NULL_SC_KP_7:
return "7"; return "7";
case GLFW_KEY_8: case GLFW_NULL_SC_8:
case GLFW_KEY_KP_8: case GLFW_NULL_SC_KP_8:
return "8"; return "8";
case GLFW_KEY_9: case GLFW_NULL_SC_9:
case GLFW_KEY_KP_9: case GLFW_NULL_SC_KP_9:
return "9"; return "9";
case GLFW_KEY_A: case GLFW_NULL_SC_A:
return "a"; return "a";
case GLFW_KEY_B: case GLFW_NULL_SC_B:
return "b"; return "b";
case GLFW_KEY_C: case GLFW_NULL_SC_C:
return "c"; return "c";
case GLFW_KEY_D: case GLFW_NULL_SC_D:
return "d"; return "d";
case GLFW_KEY_E: case GLFW_NULL_SC_E:
return "e"; return "e";
case GLFW_KEY_F: case GLFW_NULL_SC_F:
return "f"; return "f";
case GLFW_KEY_G: case GLFW_NULL_SC_G:
return "g"; return "g";
case GLFW_KEY_H: case GLFW_NULL_SC_H:
return "h"; return "h";
case GLFW_KEY_I: case GLFW_NULL_SC_I:
return "i"; return "i";
case GLFW_KEY_J: case GLFW_NULL_SC_J:
return "j"; return "j";
case GLFW_KEY_K: case GLFW_NULL_SC_K:
return "k"; return "k";
case GLFW_KEY_L: case GLFW_NULL_SC_L:
return "l"; return "l";
case GLFW_KEY_M: case GLFW_NULL_SC_M:
return "m"; return "m";
case GLFW_KEY_N: case GLFW_NULL_SC_N:
return "n"; return "n";
case GLFW_KEY_O: case GLFW_NULL_SC_O:
return "o"; return "o";
case GLFW_KEY_P: case GLFW_NULL_SC_P:
return "p"; return "p";
case GLFW_KEY_Q: case GLFW_NULL_SC_Q:
return "q"; return "q";
case GLFW_KEY_R: case GLFW_NULL_SC_R:
return "r"; return "r";
case GLFW_KEY_S: case GLFW_NULL_SC_S:
return "s"; return "s";
case GLFW_KEY_T: case GLFW_NULL_SC_T:
return "t"; return "t";
case GLFW_KEY_U: case GLFW_NULL_SC_U:
return "u"; return "u";
case GLFW_KEY_V: case GLFW_NULL_SC_V:
return "v"; return "v";
case GLFW_KEY_W: case GLFW_NULL_SC_W:
return "w"; return "w";
case GLFW_KEY_X: case GLFW_NULL_SC_X:
return "x"; return "x";
case GLFW_KEY_Y: case GLFW_NULL_SC_Y:
return "y"; return "y";
case GLFW_KEY_Z: case GLFW_NULL_SC_Z:
return "z"; return "z";
} }
@ -695,7 +693,7 @@ const char* _glfwGetScancodeNameNull(int scancode)
int _glfwGetKeyScancodeNull(int key) int _glfwGetKeyScancodeNull(int key)
{ {
return key; return _glfw.null.scancodes[key];
} }
void _glfwGetRequiredInstanceExtensionsNull(char** extensions) void _glfwGetRequiredInstanceExtensionsNull(char** extensions)

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -23,8 +23,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -23,8 +23,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#define _GNU_SOURCE #define _GNU_SOURCE

View File

@ -23,8 +23,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include <poll.h> #include <poll.h>

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"
@ -332,6 +330,7 @@ static void swapBuffersWGL(_GLFWwindow* window)
static void swapIntervalWGL(int interval) static void swapIntervalWGL(int interval)
{ {
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot); _GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
assert(window != NULL);
window->context.wgl.interval = interval; window->context.wgl.interval = interval;

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"
@ -384,7 +382,7 @@ static GLFWbool createHelperWindow(void)
if (!_glfw.win32.helperWindowClass) if (!_glfw.win32.helperWindowClass)
{ {
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR, _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
"WIn32: Failed to register helper window class"); "Win32: Failed to register helper window class");
return GLFW_FALSE; return GLFW_FALSE;
} }

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"
@ -736,6 +734,13 @@ GLFWbool _glfwPollJoystickWin32(_GLFWjoystick* js, int mode)
if (xis.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT) if (xis.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT)
dpad |= GLFW_HAT_LEFT; dpad |= GLFW_HAT_LEFT;
// Treat invalid combinations as neither being pressed
// while preserving what data can be preserved
if ((dpad & GLFW_HAT_RIGHT) && (dpad & GLFW_HAT_LEFT))
dpad &= ~(GLFW_HAT_RIGHT | GLFW_HAT_LEFT);
if ((dpad & GLFW_HAT_UP) && (dpad & GLFW_HAT_DOWN))
dpad &= ~(GLFW_HAT_UP | GLFW_HAT_DOWN);
_glfwInputJoystickHat(js, 0, dpad); _glfwInputJoystickHat(js, 0, dpad);
} }

View File

@ -23,8 +23,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -25,6 +25,11 @@
// //
//======================================================================== //========================================================================
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
// example to allow applications to correctly declare a GL_KHR_debug callback)
// but windows.h assumes no one will define APIENTRY before it does
#undef APIENTRY
#include <windows.h> #include <windows.h>
#define GLFW_WIN32_TLS_STATE _GLFWtlsWin32 win32; #define GLFW_WIN32_TLS_STATE _GLFWtlsWin32 win32;

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -25,6 +25,11 @@
// //
//======================================================================== //========================================================================
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
// example to allow applications to correctly declare a GL_KHR_debug callback)
// but windows.h assumes no one will define APIENTRY before it does
#undef APIENTRY
#include <windows.h> #include <windows.h>
#define GLFW_WIN32_LIBRARY_TIMER_STATE _GLFWtimerWin32 win32; #define GLFW_WIN32_LIBRARY_TIMER_STATE _GLFWtimerWin32 win32;

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"
@ -2121,7 +2119,7 @@ void _glfwWaitEventsWin32(void)
void _glfwWaitEventsTimeoutWin32(double timeout) void _glfwWaitEventsTimeoutWin32(double timeout)
{ {
MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD) (timeout * 1e3), QS_ALLEVENTS); MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD) (timeout * 1e3), QS_ALLINPUT);
_glfwPollEventsWin32(); _glfwPollEventsWin32();
} }
@ -2293,7 +2291,7 @@ void _glfwSetCursorWin32(_GLFWwindow* window, _GLFWcursor* cursor)
void _glfwSetClipboardStringWin32(const char* string) void _glfwSetClipboardStringWin32(const char* string)
{ {
int characterCount; int characterCount, tries = 0;
HANDLE object; HANDLE object;
WCHAR* buffer; WCHAR* buffer;
@ -2321,13 +2319,21 @@ void _glfwSetClipboardStringWin32(const char* string)
MultiByteToWideChar(CP_UTF8, 0, string, -1, buffer, characterCount); MultiByteToWideChar(CP_UTF8, 0, string, -1, buffer, characterCount);
GlobalUnlock(object); GlobalUnlock(object);
if (!OpenClipboard(_glfw.win32.helperWindowHandle)) // NOTE: Retry clipboard opening a few times as some other application may have it
// open and also the Windows Clipboard History reads it after each update
while (!OpenClipboard(_glfw.win32.helperWindowHandle))
{
Sleep(1);
tries++;
if (tries == 3)
{ {
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR, _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
"Win32: Failed to open clipboard"); "Win32: Failed to open clipboard");
GlobalFree(object); GlobalFree(object);
return; return;
} }
}
EmptyClipboard(); EmptyClipboard();
SetClipboardData(CF_UNICODETEXT, object); SetClipboardData(CF_UNICODETEXT, object);
@ -2338,13 +2344,22 @@ const char* _glfwGetClipboardStringWin32(void)
{ {
HANDLE object; HANDLE object;
WCHAR* buffer; WCHAR* buffer;
int tries = 0;
if (!OpenClipboard(_glfw.win32.helperWindowHandle)) // NOTE: Retry clipboard opening a few times as some other application may have it
// open and also the Windows Clipboard History reads it after each update
while (!OpenClipboard(_glfw.win32.helperWindowHandle))
{
Sleep(1);
tries++;
if (tries == 3)
{ {
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR, _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
"Win32: Failed to open clipboard"); "Win32: Failed to open clipboard");
return NULL; return NULL;
} }
}
object = GetClipboardData(CF_UNICODETEXT); object = GetClipboardData(CF_UNICODETEXT);
if (!object) if (!object)

View File

@ -25,8 +25,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -23,8 +23,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"
@ -40,14 +38,15 @@
#include <sys/timerfd.h> #include <sys/timerfd.h>
#include <unistd.h> #include <unistd.h>
#include <time.h> #include <time.h>
#include <assert.h>
#include "wayland-client-protocol.h" #include "wayland-client-protocol.h"
#include "wayland-xdg-shell-client-protocol.h" #include "xdg-shell-client-protocol.h"
#include "wayland-xdg-decoration-client-protocol.h" #include "xdg-decoration-unstable-v1-client-protocol.h"
#include "wayland-viewporter-client-protocol.h" #include "viewporter-client-protocol.h"
#include "wayland-relative-pointer-unstable-v1-client-protocol.h" #include "relative-pointer-unstable-v1-client-protocol.h"
#include "wayland-pointer-constraints-unstable-v1-client-protocol.h" #include "pointer-constraints-unstable-v1-client-protocol.h"
#include "wayland-idle-inhibit-unstable-v1-client-protocol.h" #include "idle-inhibit-unstable-v1-client-protocol.h"
// NOTE: Versions of wayland-scanner prior to 1.17.91 named every global array of // NOTE: Versions of wayland-scanner prior to 1.17.91 named every global array of
// wl_interface pointers 'types', making it impossible to combine several unmodified // wl_interface pointers 'types', making it impossible to combine several unmodified
@ -59,27 +58,27 @@
#undef types #undef types
#define types _glfw_xdg_shell_types #define types _glfw_xdg_shell_types
#include "wayland-xdg-shell-client-protocol-code.h" #include "xdg-shell-client-protocol-code.h"
#undef types #undef types
#define types _glfw_xdg_decoration_types #define types _glfw_xdg_decoration_types
#include "wayland-xdg-decoration-client-protocol-code.h" #include "xdg-decoration-unstable-v1-client-protocol-code.h"
#undef types #undef types
#define types _glfw_viewporter_types #define types _glfw_viewporter_types
#include "wayland-viewporter-client-protocol-code.h" #include "viewporter-client-protocol-code.h"
#undef types #undef types
#define types _glfw_relative_pointer_types #define types _glfw_relative_pointer_types
#include "wayland-relative-pointer-unstable-v1-client-protocol-code.h" #include "relative-pointer-unstable-v1-client-protocol-code.h"
#undef types #undef types
#define types _glfw_pointer_constraints_types #define types _glfw_pointer_constraints_types
#include "wayland-pointer-constraints-unstable-v1-client-protocol-code.h" #include "pointer-constraints-unstable-v1-client-protocol-code.h"
#undef types #undef types
#define types _glfw_idle_inhibit_types #define types _glfw_idle_inhibit_types
#include "wayland-idle-inhibit-unstable-v1-client-protocol-code.h" #include "idle-inhibit-unstable-v1-client-protocol-code.h"
#undef types #undef types
static void wmBaseHandlePing(void* userData, static void wmBaseHandlePing(void* userData,
@ -102,10 +101,9 @@ static void registryHandleGlobal(void* userData,
{ {
if (strcmp(interface, "wl_compositor") == 0) if (strcmp(interface, "wl_compositor") == 0)
{ {
_glfw.wl.compositorVersion = _glfw_min(3, version);
_glfw.wl.compositor = _glfw.wl.compositor =
wl_registry_bind(registry, name, &wl_compositor_interface, wl_registry_bind(registry, name, &wl_compositor_interface,
_glfw.wl.compositorVersion); _glfw_min(3, version));
} }
else if (strcmp(interface, "wl_subcompositor") == 0) else if (strcmp(interface, "wl_subcompositor") == 0)
{ {
@ -125,10 +123,9 @@ static void registryHandleGlobal(void* userData,
{ {
if (!_glfw.wl.seat) if (!_glfw.wl.seat)
{ {
_glfw.wl.seatVersion = _glfw_min(4, version);
_glfw.wl.seat = _glfw.wl.seat =
wl_registry_bind(registry, name, &wl_seat_interface, wl_registry_bind(registry, name, &wl_seat_interface,
_glfw.wl.seatVersion); _glfw_min(4, version));
_glfwAddSeatListenerWayland(_glfw.wl.seat); _glfwAddSeatListenerWayland(_glfw.wl.seat);
} }
} }
@ -204,6 +201,36 @@ static const struct wl_registry_listener registryListener =
registryHandleGlobalRemove registryHandleGlobalRemove
}; };
void libdecorHandleError(struct libdecor* context,
enum libdecor_error error,
const char* message)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: libdecor error %u: %s",
error, message);
}
static const struct libdecor_interface libdecorInterface =
{
libdecorHandleError
};
static void libdecorReadyCallback(void* userData,
struct wl_callback* callback,
uint32_t time)
{
_glfw.wl.libdecor.ready = GLFW_TRUE;
assert(_glfw.wl.libdecor.callback == callback);
wl_callback_destroy(_glfw.wl.libdecor.callback);
_glfw.wl.libdecor.callback = NULL;
}
static const struct wl_callback_listener libdecorReadyListener =
{
libdecorReadyCallback
};
// Create key code translation tables // Create key code translation tables
// //
static void createKeyTables(void) static void createKeyTables(void)
@ -339,7 +366,7 @@ static void createKeyTables(void)
static GLFWbool loadCursorTheme(void) static GLFWbool loadCursorTheme(void)
{ {
int cursorSize = 32; int cursorSize = 16;
const char* sizeString = getenv("XCURSOR_SIZE"); const char* sizeString = getenv("XCURSOR_SIZE");
if (sizeString) if (sizeString)
@ -510,6 +537,8 @@ int _glfwInitWayland(void)
_glfw.wl.keyRepeatTimerfd = -1; _glfw.wl.keyRepeatTimerfd = -1;
_glfw.wl.cursorTimerfd = -1; _glfw.wl.cursorTimerfd = -1;
_glfw.wl.tag = glfwGetVersionString();
_glfw.wl.client.display_flush = (PFN_wl_display_flush) _glfw.wl.client.display_flush = (PFN_wl_display_flush)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_display_flush"); _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_display_flush");
_glfw.wl.client.display_cancel_read = (PFN_wl_display_cancel_read) _glfw.wl.client.display_cancel_read = (PFN_wl_display_cancel_read)
@ -540,6 +569,10 @@ int _glfwInitWayland(void)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_get_user_data"); _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_get_user_data");
_glfw.wl.client.proxy_set_user_data = (PFN_wl_proxy_set_user_data) _glfw.wl.client.proxy_set_user_data = (PFN_wl_proxy_set_user_data)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_set_user_data"); _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_set_user_data");
_glfw.wl.client.proxy_get_tag = (PFN_wl_proxy_get_tag)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_get_tag");
_glfw.wl.client.proxy_set_tag = (PFN_wl_proxy_set_tag)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_set_tag");
_glfw.wl.client.proxy_get_version = (PFN_wl_proxy_get_version) _glfw.wl.client.proxy_get_version = (PFN_wl_proxy_get_version)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_get_version"); _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_get_version");
_glfw.wl.client.proxy_marshal_flags = (PFN_wl_proxy_marshal_flags) _glfw.wl.client.proxy_marshal_flags = (PFN_wl_proxy_marshal_flags)
@ -559,7 +592,9 @@ int _glfwInitWayland(void)
!_glfw.wl.client.proxy_marshal_constructor || !_glfw.wl.client.proxy_marshal_constructor ||
!_glfw.wl.client.proxy_marshal_constructor_versioned || !_glfw.wl.client.proxy_marshal_constructor_versioned ||
!_glfw.wl.client.proxy_get_user_data || !_glfw.wl.client.proxy_get_user_data ||
!_glfw.wl.client.proxy_set_user_data) !_glfw.wl.client.proxy_set_user_data ||
!_glfw.wl.client.proxy_get_tag ||
!_glfw.wl.client.proxy_set_tag)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to load libwayland-client entry point"); "Wayland: Failed to load libwayland-client entry point");
@ -647,6 +682,93 @@ int _glfwInitWayland(void)
_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");
if (_glfw.hints.init.wl.libdecorMode == GLFW_WAYLAND_PREFER_LIBDECOR)
_glfw.wl.libdecor.handle = _glfwPlatformLoadModule("libdecor-0.so.0");
if (_glfw.wl.libdecor.handle)
{
_glfw.wl.libdecor.libdecor_new_ = (PFN_libdecor_new)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_new");
_glfw.wl.libdecor.libdecor_unref_ = (PFN_libdecor_unref)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_unref");
_glfw.wl.libdecor.libdecor_get_fd_ = (PFN_libdecor_get_fd)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_get_fd");
_glfw.wl.libdecor.libdecor_dispatch_ = (PFN_libdecor_dispatch)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_dispatch");
_glfw.wl.libdecor.libdecor_decorate_ = (PFN_libdecor_decorate)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_decorate");
_glfw.wl.libdecor.libdecor_frame_unref_ = (PFN_libdecor_frame_unref)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_unref");
_glfw.wl.libdecor.libdecor_frame_set_app_id_ = (PFN_libdecor_frame_set_app_id)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_app_id");
_glfw.wl.libdecor.libdecor_frame_set_title_ = (PFN_libdecor_frame_set_title)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_title");
_glfw.wl.libdecor.libdecor_frame_set_minimized_ = (PFN_libdecor_frame_set_minimized)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_minimized");
_glfw.wl.libdecor.libdecor_frame_set_fullscreen_ = (PFN_libdecor_frame_set_fullscreen)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_fullscreen");
_glfw.wl.libdecor.libdecor_frame_unset_fullscreen_ = (PFN_libdecor_frame_unset_fullscreen)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_unset_fullscreen");
_glfw.wl.libdecor.libdecor_frame_map_ = (PFN_libdecor_frame_map)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_map");
_glfw.wl.libdecor.libdecor_frame_commit_ = (PFN_libdecor_frame_commit)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_commit");
_glfw.wl.libdecor.libdecor_frame_set_min_content_size_ = (PFN_libdecor_frame_set_min_content_size)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_min_content_size");
_glfw.wl.libdecor.libdecor_frame_set_max_content_size_ = (PFN_libdecor_frame_set_max_content_size)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_max_content_size");
_glfw.wl.libdecor.libdecor_frame_set_maximized_ = (PFN_libdecor_frame_set_maximized)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_maximized");
_glfw.wl.libdecor.libdecor_frame_unset_maximized_ = (PFN_libdecor_frame_unset_maximized)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_unset_maximized");
_glfw.wl.libdecor.libdecor_frame_set_capabilities_ = (PFN_libdecor_frame_set_capabilities)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_capabilities");
_glfw.wl.libdecor.libdecor_frame_unset_capabilities_ = (PFN_libdecor_frame_unset_capabilities)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_unset_capabilities");
_glfw.wl.libdecor.libdecor_frame_set_visibility_ = (PFN_libdecor_frame_set_visibility)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_visibility");
_glfw.wl.libdecor.libdecor_frame_get_xdg_toplevel_ = (PFN_libdecor_frame_get_xdg_toplevel)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_get_xdg_toplevel");
_glfw.wl.libdecor.libdecor_configuration_get_content_size_ = (PFN_libdecor_configuration_get_content_size)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_configuration_get_content_size");
_glfw.wl.libdecor.libdecor_configuration_get_window_state_ = (PFN_libdecor_configuration_get_window_state)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_configuration_get_window_state");
_glfw.wl.libdecor.libdecor_state_new_ = (PFN_libdecor_state_new)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_state_new");
_glfw.wl.libdecor.libdecor_state_free_ = (PFN_libdecor_state_free)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_state_free");
if (!_glfw.wl.libdecor.libdecor_new_ ||
!_glfw.wl.libdecor.libdecor_unref_ ||
!_glfw.wl.libdecor.libdecor_get_fd_ ||
!_glfw.wl.libdecor.libdecor_dispatch_ ||
!_glfw.wl.libdecor.libdecor_decorate_ ||
!_glfw.wl.libdecor.libdecor_frame_unref_ ||
!_glfw.wl.libdecor.libdecor_frame_set_app_id_ ||
!_glfw.wl.libdecor.libdecor_frame_set_title_ ||
!_glfw.wl.libdecor.libdecor_frame_set_minimized_ ||
!_glfw.wl.libdecor.libdecor_frame_set_fullscreen_ ||
!_glfw.wl.libdecor.libdecor_frame_unset_fullscreen_ ||
!_glfw.wl.libdecor.libdecor_frame_map_ ||
!_glfw.wl.libdecor.libdecor_frame_commit_ ||
!_glfw.wl.libdecor.libdecor_frame_set_min_content_size_ ||
!_glfw.wl.libdecor.libdecor_frame_set_max_content_size_ ||
!_glfw.wl.libdecor.libdecor_frame_set_maximized_ ||
!_glfw.wl.libdecor.libdecor_frame_unset_maximized_ ||
!_glfw.wl.libdecor.libdecor_frame_set_capabilities_ ||
!_glfw.wl.libdecor.libdecor_frame_unset_capabilities_ ||
!_glfw.wl.libdecor.libdecor_frame_set_visibility_ ||
!_glfw.wl.libdecor.libdecor_frame_get_xdg_toplevel_ ||
!_glfw.wl.libdecor.libdecor_configuration_get_content_size_ ||
!_glfw.wl.libdecor.libdecor_configuration_get_window_state_ ||
!_glfw.wl.libdecor.libdecor_state_new_ ||
!_glfw.wl.libdecor.libdecor_state_free_)
{
_glfwPlatformFreeModule(_glfw.wl.libdecor.handle);
memset(&_glfw.wl.libdecor, 0, sizeof(_glfw.wl.libdecor));
}
}
_glfw.wl.registry = wl_display_get_registry(_glfw.wl.display); _glfw.wl.registry = wl_display_get_registry(_glfw.wl.display);
wl_registry_add_listener(_glfw.wl.registry, &registryListener, NULL); wl_registry_add_listener(_glfw.wl.registry, &registryListener, NULL);
@ -666,13 +788,27 @@ int _glfwInitWayland(void)
// Sync so we got all initial output events // Sync so we got all initial output events
wl_display_roundtrip(_glfw.wl.display); wl_display_roundtrip(_glfw.wl.display);
#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION if (_glfw.wl.libdecor.handle)
if (_glfw.wl.seatVersion >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) {
_glfw.wl.libdecor.context = libdecor_new(_glfw.wl.display, &libdecorInterface);
if (_glfw.wl.libdecor.context)
{
// Perform an initial dispatch and flush to get the init started
libdecor_dispatch(_glfw.wl.libdecor.context, 0);
// Create sync point to "know" when libdecor is ready for use
_glfw.wl.libdecor.callback = wl_display_sync(_glfw.wl.display);
wl_callback_add_listener(_glfw.wl.libdecor.callback,
&libdecorReadyListener,
NULL);
}
}
if (wl_seat_get_version(_glfw.wl.seat) >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION)
{ {
_glfw.wl.keyRepeatTimerfd = _glfw.wl.keyRepeatTimerfd =
timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK); timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
} }
#endif
if (!_glfw.wl.wmBase) if (!_glfw.wl.wmBase)
{ {
@ -707,6 +843,22 @@ void _glfwTerminateWayland(void)
_glfwTerminateEGL(); _glfwTerminateEGL();
_glfwTerminateOSMesa(); _glfwTerminateOSMesa();
if (_glfw.wl.libdecor.context)
{
// Allow libdecor to finish receiving all its requested globals
// and ensure the associated sync callback object is destroyed
while (!_glfw.wl.libdecor.ready)
_glfwWaitEventsWayland();
libdecor_unref(_glfw.wl.libdecor.context);
}
if (_glfw.wl.libdecor.handle)
{
_glfwPlatformFreeModule(_glfw.wl.libdecor.handle);
_glfw.wl.libdecor.handle = NULL;
}
if (_glfw.wl.egl.handle) if (_glfw.wl.egl.handle)
{ {
_glfwPlatformFreeModule(_glfw.wl.egl.handle); _glfwPlatformFreeModule(_glfw.wl.egl.handle);

View File

@ -23,8 +23,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"
@ -114,14 +112,15 @@ static void outputHandleScale(void* userData,
{ {
struct _GLFWmonitor* monitor = userData; struct _GLFWmonitor* monitor = userData;
monitor->wl.scale = factor; monitor->wl.contentScale = factor;
for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next) for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next)
{ {
for (int i = 0; i < window->wl.monitorsCount; i++) for (int i = 0; i < window->wl.scaleCount; i++)
{ {
if (window->wl.monitors[i] == monitor) if (window->wl.scales[i].output == monitor->wl.output)
{ {
window->wl.scales[i].factor = monitor->wl.contentScale;
_glfwUpdateContentScaleWayland(window); _glfwUpdateContentScaleWayland(window);
break; break;
} }
@ -129,8 +128,6 @@ static void outputHandleScale(void* userData,
} }
} }
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
void outputHandleName(void* userData, struct wl_output* wl_output, const char* name) void outputHandleName(void* userData, struct wl_output* wl_output, const char* name)
{ {
struct _GLFWmonitor* monitor = userData; struct _GLFWmonitor* monitor = userData;
@ -144,18 +141,14 @@ void outputHandleDescription(void* userData,
{ {
} }
#endif // WL_OUTPUT_NAME_SINCE_VERSION
static const struct wl_output_listener outputListener = static const struct wl_output_listener outputListener =
{ {
outputHandleGeometry, outputHandleGeometry,
outputHandleMode, outputHandleMode,
outputHandleDone, outputHandleDone,
outputHandleScale, outputHandleScale,
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
outputHandleName, outputHandleName,
outputHandleDescription, outputHandleDescription,
#endif
}; };
@ -172,11 +165,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
return; return;
} }
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
version = _glfw_min(version, WL_OUTPUT_NAME_SINCE_VERSION); version = _glfw_min(version, WL_OUTPUT_NAME_SINCE_VERSION);
#else
version = 2;
#endif
struct wl_output* output = wl_registry_bind(_glfw.wl.registry, struct wl_output* output = wl_registry_bind(_glfw.wl.registry,
name, name,
@ -187,10 +176,11 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
// The actual name of this output will be set in the geometry handler // The actual name of this output will be set in the geometry handler
_GLFWmonitor* monitor = _glfwAllocMonitor("", 0, 0); _GLFWmonitor* monitor = _glfwAllocMonitor("", 0, 0);
monitor->wl.scale = 1; monitor->wl.contentScale = 1;
monitor->wl.output = output; monitor->wl.output = output;
monitor->wl.name = name; monitor->wl.name = name;
wl_proxy_set_tag((struct wl_proxy*) output, &_glfw.wl.tag);
wl_output_add_listener(output, &outputListener, monitor); wl_output_add_listener(output, &outputListener, monitor);
} }
@ -217,9 +207,9 @@ void _glfwGetMonitorContentScaleWayland(_GLFWmonitor* monitor,
float* xscale, float* yscale) float* xscale, float* yscale)
{ {
if (xscale) if (xscale)
*xscale = (float) monitor->wl.scale; *xscale = (float) monitor->wl.contentScale;
if (yscale) if (yscale)
*yscale = (float) monitor->wl.scale; *yscale = (float) monitor->wl.contentScale;
} }
void _glfwGetMonitorWorkareaWayland(_GLFWmonitor* monitor, void _glfwGetMonitorWorkareaWayland(_GLFWmonitor* monitor,

View File

@ -28,6 +28,8 @@
#include <xkbcommon/xkbcommon.h> #include <xkbcommon/xkbcommon.h>
#include <xkbcommon/xkbcommon-compose.h> #include <xkbcommon/xkbcommon-compose.h>
#include <stdbool.h>
typedef VkFlags VkWaylandSurfaceCreateFlagsKHR; typedef VkFlags VkWaylandSurfaceCreateFlagsKHR;
typedef struct VkWaylandSurfaceCreateInfoKHR typedef struct VkWaylandSurfaceCreateInfoKHR
@ -61,6 +63,8 @@ typedef struct wl_proxy* (* PFN_wl_proxy_marshal_constructor)(struct wl_proxy*,u
typedef struct wl_proxy* (* PFN_wl_proxy_marshal_constructor_versioned)(struct wl_proxy*,uint32_t,const struct wl_interface*,uint32_t,...); typedef struct wl_proxy* (* PFN_wl_proxy_marshal_constructor_versioned)(struct wl_proxy*,uint32_t,const struct wl_interface*,uint32_t,...);
typedef void* (* PFN_wl_proxy_get_user_data)(struct wl_proxy*); typedef void* (* PFN_wl_proxy_get_user_data)(struct wl_proxy*);
typedef void (* PFN_wl_proxy_set_user_data)(struct wl_proxy*,void*); typedef void (* PFN_wl_proxy_set_user_data)(struct wl_proxy*,void*);
typedef void (* PFN_wl_proxy_set_tag)(struct wl_proxy*,const char*const*);
typedef const char* const* (* PFN_wl_proxy_get_tag)(struct wl_proxy*);
typedef uint32_t (* PFN_wl_proxy_get_version)(struct wl_proxy*); typedef uint32_t (* PFN_wl_proxy_get_version)(struct wl_proxy*);
typedef struct wl_proxy* (* PFN_wl_proxy_marshal_flags)(struct wl_proxy*,uint32_t,const struct wl_interface*,uint32_t,uint32_t,...); typedef struct wl_proxy* (* PFN_wl_proxy_marshal_flags)(struct wl_proxy*,uint32_t,const struct wl_interface*,uint32_t,uint32_t,...);
#define wl_display_flush _glfw.wl.client.display_flush #define wl_display_flush _glfw.wl.client.display_flush
@ -78,10 +82,13 @@ typedef struct wl_proxy* (* PFN_wl_proxy_marshal_flags)(struct wl_proxy*,uint32_
#define wl_proxy_marshal_constructor_versioned _glfw.wl.client.proxy_marshal_constructor_versioned #define wl_proxy_marshal_constructor_versioned _glfw.wl.client.proxy_marshal_constructor_versioned
#define wl_proxy_get_user_data _glfw.wl.client.proxy_get_user_data #define wl_proxy_get_user_data _glfw.wl.client.proxy_get_user_data
#define wl_proxy_set_user_data _glfw.wl.client.proxy_set_user_data #define wl_proxy_set_user_data _glfw.wl.client.proxy_set_user_data
#define wl_proxy_get_tag _glfw.wl.client.proxy_get_tag
#define wl_proxy_set_tag _glfw.wl.client.proxy_set_tag
#define wl_proxy_get_version _glfw.wl.client.proxy_get_version #define wl_proxy_get_version _glfw.wl.client.proxy_get_version
#define wl_proxy_marshal_flags _glfw.wl.client.proxy_marshal_flags #define wl_proxy_marshal_flags _glfw.wl.client.proxy_marshal_flags
struct wl_shm; struct wl_shm;
struct wl_output;
#define wl_display_interface _glfw_wl_display_interface #define wl_display_interface _glfw_wl_display_interface
#define wl_subcompositor_interface _glfw_wl_subcompositor_interface #define wl_subcompositor_interface _glfw_wl_subcompositor_interface
@ -198,13 +205,129 @@ typedef xkb_keysym_t (* PFN_xkb_compose_state_get_one_sym)(struct xkb_compose_st
#define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status #define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status
#define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym #define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym
struct libdecor;
struct libdecor_frame;
struct libdecor_state;
struct libdecor_configuration;
enum libdecor_error
{
LIBDECOR_ERROR_COMPOSITOR_INCOMPATIBLE,
LIBDECOR_ERROR_INVALID_FRAME_CONFIGURATION,
};
enum libdecor_window_state
{
LIBDECOR_WINDOW_STATE_NONE = 0,
LIBDECOR_WINDOW_STATE_ACTIVE = 1,
LIBDECOR_WINDOW_STATE_MAXIMIZED = 2,
LIBDECOR_WINDOW_STATE_FULLSCREEN = 4,
LIBDECOR_WINDOW_STATE_TILED_LEFT = 8,
LIBDECOR_WINDOW_STATE_TILED_RIGHT = 16,
LIBDECOR_WINDOW_STATE_TILED_TOP = 32,
LIBDECOR_WINDOW_STATE_TILED_BOTTOM = 64
};
enum libdecor_capabilities
{
LIBDECOR_ACTION_MOVE = 1,
LIBDECOR_ACTION_RESIZE = 2,
LIBDECOR_ACTION_MINIMIZE = 4,
LIBDECOR_ACTION_FULLSCREEN = 8,
LIBDECOR_ACTION_CLOSE = 16
};
struct libdecor_interface
{
void (* error)(struct libdecor*,enum libdecor_error,const char*);
void (* reserved0)(void);
void (* reserved1)(void);
void (* reserved2)(void);
void (* reserved3)(void);
void (* reserved4)(void);
void (* reserved5)(void);
void (* reserved6)(void);
void (* reserved7)(void);
void (* reserved8)(void);
void (* reserved9)(void);
};
struct libdecor_frame_interface
{
void (* configure)(struct libdecor_frame*,struct libdecor_configuration*,void*);
void (* close)(struct libdecor_frame*,void*);
void (* commit)(struct libdecor_frame*,void*);
void (* dismiss_popup)(struct libdecor_frame*,const char*,void*);
void (* reserved0)(void);
void (* reserved1)(void);
void (* reserved2)(void);
void (* reserved3)(void);
void (* reserved4)(void);
void (* reserved5)(void);
void (* reserved6)(void);
void (* reserved7)(void);
void (* reserved8)(void);
void (* reserved9)(void);
};
typedef struct libdecor* (* PFN_libdecor_new)(struct wl_display*,const struct libdecor_interface*);
typedef void (* PFN_libdecor_unref)(struct libdecor*);
typedef int (* PFN_libdecor_get_fd)(struct libdecor*);
typedef int (* PFN_libdecor_dispatch)(struct libdecor*,int);
typedef struct libdecor_frame* (* PFN_libdecor_decorate)(struct libdecor*,struct wl_surface*,const struct libdecor_frame_interface*,void*);
typedef void (* PFN_libdecor_frame_unref)(struct libdecor_frame*);
typedef void (* PFN_libdecor_frame_set_app_id)(struct libdecor_frame*,const char*);
typedef void (* PFN_libdecor_frame_set_title)(struct libdecor_frame*,const char*);
typedef void (* PFN_libdecor_frame_set_minimized)(struct libdecor_frame*);
typedef void (* PFN_libdecor_frame_set_fullscreen)(struct libdecor_frame*,struct wl_output*);
typedef void (* PFN_libdecor_frame_unset_fullscreen)(struct libdecor_frame*);
typedef void (* PFN_libdecor_frame_map)(struct libdecor_frame*);
typedef void (* PFN_libdecor_frame_commit)(struct libdecor_frame*,struct libdecor_state*,struct libdecor_configuration*);
typedef void (* PFN_libdecor_frame_set_min_content_size)(struct libdecor_frame*,int,int);
typedef void (* PFN_libdecor_frame_set_max_content_size)(struct libdecor_frame*,int,int);
typedef void (* PFN_libdecor_frame_set_maximized)(struct libdecor_frame*);
typedef void (* PFN_libdecor_frame_unset_maximized)(struct libdecor_frame*);
typedef void (* PFN_libdecor_frame_set_capabilities)(struct libdecor_frame*,enum libdecor_capabilities);
typedef void (* PFN_libdecor_frame_unset_capabilities)(struct libdecor_frame*,enum libdecor_capabilities);
typedef void (* PFN_libdecor_frame_set_visibility)(struct libdecor_frame*,bool visible);
typedef struct xdg_toplevel* (* PFN_libdecor_frame_get_xdg_toplevel)(struct libdecor_frame*);
typedef bool (* PFN_libdecor_configuration_get_content_size)(struct libdecor_configuration*,struct libdecor_frame*,int*,int*);
typedef bool (* PFN_libdecor_configuration_get_window_state)(struct libdecor_configuration*,enum libdecor_window_state*);
typedef struct libdecor_state* (* PFN_libdecor_state_new)(int,int);
typedef void (* PFN_libdecor_state_free)(struct libdecor_state*);
#define libdecor_new _glfw.wl.libdecor.libdecor_new_
#define libdecor_unref _glfw.wl.libdecor.libdecor_unref_
#define libdecor_get_fd _glfw.wl.libdecor.libdecor_get_fd_
#define libdecor_dispatch _glfw.wl.libdecor.libdecor_dispatch_
#define libdecor_decorate _glfw.wl.libdecor.libdecor_decorate_
#define libdecor_frame_unref _glfw.wl.libdecor.libdecor_frame_unref_
#define libdecor_frame_set_app_id _glfw.wl.libdecor.libdecor_frame_set_app_id_
#define libdecor_frame_set_title _glfw.wl.libdecor.libdecor_frame_set_title_
#define libdecor_frame_set_minimized _glfw.wl.libdecor.libdecor_frame_set_minimized_
#define libdecor_frame_set_fullscreen _glfw.wl.libdecor.libdecor_frame_set_fullscreen_
#define libdecor_frame_unset_fullscreen _glfw.wl.libdecor.libdecor_frame_unset_fullscreen_
#define libdecor_frame_map _glfw.wl.libdecor.libdecor_frame_map_
#define libdecor_frame_commit _glfw.wl.libdecor.libdecor_frame_commit_
#define libdecor_frame_set_min_content_size _glfw.wl.libdecor.libdecor_frame_set_min_content_size_
#define libdecor_frame_set_max_content_size _glfw.wl.libdecor.libdecor_frame_set_max_content_size_
#define libdecor_frame_set_maximized _glfw.wl.libdecor.libdecor_frame_set_maximized_
#define libdecor_frame_unset_maximized _glfw.wl.libdecor.libdecor_frame_unset_maximized_
#define libdecor_frame_set_capabilities _glfw.wl.libdecor.libdecor_frame_set_capabilities_
#define libdecor_frame_unset_capabilities _glfw.wl.libdecor.libdecor_frame_unset_capabilities_
#define libdecor_frame_set_visibility _glfw.wl.libdecor.libdecor_frame_set_visibility_
#define libdecor_frame_get_xdg_toplevel _glfw.wl.libdecor.libdecor_frame_get_xdg_toplevel_
#define libdecor_configuration_get_content_size _glfw.wl.libdecor.libdecor_configuration_get_content_size_
#define libdecor_configuration_get_window_state _glfw.wl.libdecor.libdecor_configuration_get_window_state_
#define libdecor_state_new _glfw.wl.libdecor.libdecor_state_new_
#define libdecor_state_free _glfw.wl.libdecor.libdecor_state_free_
typedef enum _GLFWdecorationSideWayland typedef enum _GLFWdecorationSideWayland
{ {
mainWindow, GLFW_MAIN_WINDOW,
topDecoration, GLFW_TOP_DECORATION,
leftDecoration, GLFW_LEFT_DECORATION,
rightDecoration, GLFW_RIGHT_DECORATION,
bottomDecoration, GLFW_BOTTOM_DECORATION
} _GLFWdecorationSideWayland; } _GLFWdecorationSideWayland;
typedef struct _GLFWdecorationWayland typedef struct _GLFWdecorationWayland
@ -221,6 +344,12 @@ typedef struct _GLFWofferWayland
GLFWbool text_uri_list; GLFWbool text_uri_list;
} _GLFWofferWayland; } _GLFWofferWayland;
typedef struct _GLFWscaleWayland
{
struct wl_output* output;
int factor;
} _GLFWscaleWayland;
// Wayland-specific per-window data // Wayland-specific per-window data
// //
typedef struct _GLFWwindowWayland typedef struct _GLFWwindowWayland
@ -254,6 +383,11 @@ typedef struct _GLFWwindowWayland
uint32_t decorationMode; uint32_t decorationMode;
} xdg; } xdg;
struct {
struct libdecor_frame* frame;
int mode;
} libdecor;
_GLFWcursor* currentCursor; _GLFWcursor* currentCursor;
double cursorPosX, cursorPosY; double cursorPosX, cursorPosY;
@ -262,10 +396,10 @@ typedef struct _GLFWwindowWayland
// We need to track the monitors the window spans on to calculate the // We need to track the monitors the window spans on to calculate the
// optimal scaling factor. // optimal scaling factor.
int scale; int contentScale;
_GLFWmonitor** monitors; _GLFWscaleWayland* scales;
int monitorsCount; int scaleCount;
int monitorsSize; int scaleSize;
struct zwp_relative_pointer_v1* relativePointer; struct zwp_relative_pointer_v1* relativePointer;
struct zwp_locked_pointer_v1* lockedPointer; struct zwp_locked_pointer_v1* lockedPointer;
@ -311,8 +445,7 @@ typedef struct _GLFWlibraryWayland
_GLFWwindow* dragFocus; _GLFWwindow* dragFocus;
uint32_t dragSerial; uint32_t dragSerial;
int compositorVersion; const char* tag;
int seatVersion;
struct wl_cursor_theme* cursorTheme; struct wl_cursor_theme* cursorTheme;
struct wl_cursor_theme* cursorThemeHiDPI; struct wl_cursor_theme* cursorThemeHiDPI;
@ -391,6 +524,8 @@ typedef struct _GLFWlibraryWayland
PFN_wl_proxy_marshal_constructor_versioned proxy_marshal_constructor_versioned; PFN_wl_proxy_marshal_constructor_versioned proxy_marshal_constructor_versioned;
PFN_wl_proxy_get_user_data proxy_get_user_data; PFN_wl_proxy_get_user_data proxy_get_user_data;
PFN_wl_proxy_set_user_data proxy_set_user_data; PFN_wl_proxy_set_user_data proxy_set_user_data;
PFN_wl_proxy_get_tag proxy_get_tag;
PFN_wl_proxy_set_tag proxy_set_tag;
PFN_wl_proxy_get_version proxy_get_version; PFN_wl_proxy_get_version proxy_get_version;
PFN_wl_proxy_marshal_flags proxy_marshal_flags; PFN_wl_proxy_marshal_flags proxy_marshal_flags;
} client; } client;
@ -411,6 +546,38 @@ typedef struct _GLFWlibraryWayland
PFN_wl_egl_window_destroy window_destroy; PFN_wl_egl_window_destroy window_destroy;
PFN_wl_egl_window_resize window_resize; PFN_wl_egl_window_resize window_resize;
} egl; } egl;
struct {
void* handle;
struct libdecor* context;
struct wl_callback* callback;
GLFWbool ready;
PFN_libdecor_new libdecor_new_;
PFN_libdecor_unref libdecor_unref_;
PFN_libdecor_get_fd libdecor_get_fd_;
PFN_libdecor_dispatch libdecor_dispatch_;
PFN_libdecor_decorate libdecor_decorate_;
PFN_libdecor_frame_unref libdecor_frame_unref_;
PFN_libdecor_frame_set_app_id libdecor_frame_set_app_id_;
PFN_libdecor_frame_set_title libdecor_frame_set_title_;
PFN_libdecor_frame_set_minimized libdecor_frame_set_minimized_;
PFN_libdecor_frame_set_fullscreen libdecor_frame_set_fullscreen_;
PFN_libdecor_frame_unset_fullscreen libdecor_frame_unset_fullscreen_;
PFN_libdecor_frame_map libdecor_frame_map_;
PFN_libdecor_frame_commit libdecor_frame_commit_;
PFN_libdecor_frame_set_min_content_size libdecor_frame_set_min_content_size_;
PFN_libdecor_frame_set_max_content_size libdecor_frame_set_max_content_size_;
PFN_libdecor_frame_set_maximized libdecor_frame_set_maximized_;
PFN_libdecor_frame_unset_maximized libdecor_frame_unset_maximized_;
PFN_libdecor_frame_set_capabilities libdecor_frame_set_capabilities_;
PFN_libdecor_frame_unset_capabilities libdecor_frame_unset_capabilities_;
PFN_libdecor_frame_set_visibility libdecor_frame_set_visibility_;
PFN_libdecor_frame_get_xdg_toplevel libdecor_frame_get_xdg_toplevel_;
PFN_libdecor_configuration_get_content_size libdecor_configuration_get_content_size_;
PFN_libdecor_configuration_get_window_state libdecor_configuration_get_window_state_;
PFN_libdecor_state_new libdecor_state_new_;
PFN_libdecor_state_free libdecor_state_free_;
} libdecor;
} _GLFWlibraryWayland; } _GLFWlibraryWayland;
// Wayland-specific per-monitor data // Wayland-specific per-monitor data
@ -423,7 +590,7 @@ typedef struct _GLFWmonitorWayland
int x; int x;
int y; int y;
int scale; int contentScale;
} _GLFWmonitorWayland; } _GLFWmonitorWayland;
// Wayland-specific per-cursor data // Wayland-specific per-cursor data

File diff suppressed because it is too large Load Diff

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -24,8 +24,6 @@
// distribution. // distribution.
// //
//======================================================================== //========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h" #include "internal.h"

View File

@ -266,9 +266,10 @@ static void list_vulkan_instance_layers(void)
for (uint32_t i = 0; i < lp_count; i++) for (uint32_t i = 0; i < lp_count; i++)
{ {
printf(" %s (spec version %u) \"%s\"\n", printf(" %s (spec version %u.%u) \"%s\"\n",
lp[i].layerName, lp[i].layerName,
lp[i].specVersion >> 22, VK_VERSION_MAJOR(lp[i].specVersion),
VK_VERSION_MINOR(lp[i].specVersion),
lp[i].description); lp[i].description);
} }
@ -286,9 +287,10 @@ static void list_vulkan_device_layers(VkInstance instance, VkPhysicalDevice devi
for (uint32_t i = 0; i < lp_count; i++) for (uint32_t i = 0; i < lp_count; i++)
{ {
printf(" %s (spec version %u) \"%s\"\n", printf(" %s (spec version %u.%u) \"%s\"\n",
lp[i].layerName, lp[i].layerName,
lp[i].specVersion >> 22, VK_VERSION_MAJOR(lp[i].specVersion),
VK_VERSION_MINOR(lp[i].specVersion),
lp[i].description); lp[i].description);
} }
@ -710,12 +712,8 @@ int main(int argc, char** argv)
glfwWindowHint(GLFW_COCOA_GRAPHICS_SWITCHING, cocoa_graphics_switching); glfwWindowHint(GLFW_COCOA_GRAPHICS_SWITCHING, cocoa_graphics_switching);
GLFWwindow* window = glfwCreateWindow(200, 200, "Version", NULL, NULL); GLFWwindow* window = glfwCreateWindow(200, 200, "Version", NULL, NULL);
if (!window) if (window)
{ {
glfwTerminate();
exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGL(glfwGetProcAddress); gladLoadGL(glfwGetProcAddress);
@ -893,6 +891,7 @@ int main(int argc, char** argv)
list_context_extensions(client, major, minor); list_context_extensions(client, major, minor);
glfwDestroyWindow(window); glfwDestroyWindow(window);
}
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);