From 6d6e89e4a0851273fd83d8247b06ee29b4aaf33c Mon Sep 17 00:00:00 2001 From: M374LX Date: Mon, 10 Aug 2026 20:40:23 -0300 Subject: [PATCH] Redo changes from pull request #3863 --- src/external/glfw/README.md | 208 ++------------------------- src/external/glfw/src/cocoa_init.m | 7 +- src/external/glfw/src/cocoa_window.m | 33 ++--- src/external/glfw/src/null_window.c | 19 +-- src/external/glfw/src/platform.c | 4 + src/external/glfw/src/win32_init.c | 7 +- src/external/glfw/src/win32_window.c | 25 ++-- src/external/glfw/src/wl_init.c | 7 +- src/external/glfw/src/wl_window.c | 17 +-- src/external/glfw/src/x11_init.c | 7 +- src/external/glfw/src/x11_window.c | 31 ++-- 11 files changed, 99 insertions(+), 266 deletions(-) diff --git a/src/external/glfw/README.md b/src/external/glfw/README.md index c37d1deb5..6d26a76fd 100755 --- a/src/external/glfw/README.md +++ b/src/external/glfw/README.md @@ -1,198 +1,18 @@ -# GLFW +# GLFW (modified for raylib) -[![Build status](https://github.com/glfw/glfw/actions/workflows/build.yml/badge.svg)](https://github.com/glfw/glfw/actions) -[![Build status](https://ci.appveyor.com/api/projects/status/0kf0ct9831i5l6sp/branch/master?svg=true)](https://ci.appveyor.com/project/elmindreda/glfw) +This directory contains a modification of GLFW, whose official website and +upstream repository are https://glfw.org and https://github.com/glfw/glfw, +respectively. -## Introduction +In this modification, some static functions sharing the same name in different +platforms have been renamed so all of GLFW's source files can be combined into +one (as done by ``rglfw.c``). Also, the Null platform, which is not used by +raylib, has been disabled. The renamed functions are: -GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan -application development. It provides a simple, platform-independent API for -creating windows, contexts and surfaces, reading input, handling events, etc. - -GLFW is written primarily in C99, with parts of macOS support being written in -Objective-C. - -GLFW supports Windows, macOS and Linux, and also works on many other Unix-like -systems. On Linux both Wayland and X11 are supported. - -GLFW is licensed under the [zlib/libpng -license](https://www.glfw.org/license.html). - -You can [download](https://www.glfw.org/download.html) the latest stable release -as source or Windows and macOS binaries. There are [release -tags](https://github.com/glfw/glfw/releases) with source and binary archives -attached for every version since 3.0. - -The [documentation](https://www.glfw.org/docs/latest/) is available online and is -also included in source and binary archives, except those generated -automatically by Github. The documentation contains guides, a tutorial and the -API reference. The [release -notes](https://www.glfw.org/docs/latest/news.html) list the new features, -caveats and deprecations in the latest release. The [version -history](https://www.glfw.org/changelog.html) lists every user-visible change -for every release. - -GLFW exists because of the contributions of [many people](CONTRIBUTORS.md) -around the world, whether by reporting bugs, providing community support, adding -features, reviewing or testing code, debugging, proofreading docs, suggesting -features or fixing bugs. - - -## System requirements - -GLFW supports Windows 7 and later and macOS 10.11 and later. On GNOME Wayland, -window decorations will be very basic unless the -[libdecor](https://gitlab.freedesktop.org/libdecor/libdecor) package is -installed. Linux and other Unix-like systems running X11 are supported even -without a desktop environment or modern extensions, although some features -require a clipboard manager or a modern window manager. - -See the [compatibility guide](https://www.glfw.org/docs/latest/compat.html) -for more detailed information. - - -## Compiling GLFW - -GLFW supports compilation with Visual C++ (2013 and later), GCC and Clang. Both -Clang-CL and MinGW-w64 are supported. Other C99 compilers will likely also -work, but this is not regularly tested. - -There are [pre-compiled binaries](https://www.glfw.org/download.html) -available for Windows and macOS. - -GLFW itself needs only CMake and the headers and libraries for your operating -system and window system. No other SDKs are required. - -See the [compilation guide](https://www.glfw.org/docs/latest/compile.html) for -more information about compiling GLFW and the exact dependencies required for -each window system. - -The examples and test programs depend on a number of tiny libraries. These are -bundled in the `deps/` directory. The repository has no submodules. - - - [getopt\_port](https://github.com/kimgr/getopt_port/) for examples - with command-line options - - [TinyCThread](https://github.com/tinycthread/tinycthread) for threaded - examples - - [glad2](https://github.com/Dav1dde/glad) for loading OpenGL and Vulkan - functions - - [linmath.h](https://github.com/datenwolf/linmath.h) for linear algebra in - examples - - [Nuklear](https://github.com/Immediate-Mode-UI/Nuklear) for test and example UI - - [stb\_image\_write](https://github.com/nothings/stb) for writing images to disk - -The documentation is generated with [Doxygen](https://doxygen.org/) when the -library is built, provided CMake could find a sufficiently new version of it -during configuration. - - -## Using GLFW - -See the [HTML documentation](https://www.glfw.org/docs/latest/) for a tutorial, -guides and the API reference. - - -## Contributing to GLFW - -See the [contribution -guide](https://github.com/glfw/glfw/blob/master/docs/CONTRIBUTING.md) for -more information. - -The `master` branch is the stable integration branch and _should_ always compile -and run on all supported platforms. Details of a newly added feature, -including the public API, may change until it has been included in a release. - -The `latest` branch is equivalent to the [highest numbered](https://semver.org/) -release, although it may not always point to the same commit as the tag for that -release. - -The `ci` branch is used to trigger continuous integration jobs for code under -testing and should never be relied on for any purpose. - - -## Reporting bugs - -Bugs are reported to our [issue tracker](https://github.com/glfw/glfw/issues). -Please check the [contribution -guide](https://github.com/glfw/glfw/blob/master/docs/CONTRIBUTING.md) for -information on what to include when reporting a bug. - - -## Changelog since 3.5 - -None. - -## Changelog since 3.4 - - - Added `GLFW_UNLIMITED_MOUSE_BUTTONS` input mode that allows mouse buttons beyond - the limit of the mouse button tokens to be reported (#2423) - - Added `glfwGetEGLConfig` function to query the `EGLConfig` of a window (#2045) - - Added `glfwGetGLXFBConfig` function to query the `GLXFBConfig` of a window (#1925) - - Updated minimum CMake version to 3.16 (#2541) - - Removed support for building with original MinGW (#2540) - - [Win32] Removed support for Windows XP and Vista (#2505) - - [Win32] Bugfix: Media keys were reported with a scancode of 256 (#1768,#2417,#2625) - - [Cocoa] Added `QuartzCore` framework as link-time dependency - - [Cocoa] Removed support for OS X 10.10 Yosemite and earlier (#2506) - - [Cocoa] Bugfix: Cmd+Period, Ctrl+Tab and Ctrl+Esc key events were not emitted - (#1362,#2278) - - [Wayland] Bugfix: The fractional scaling related objects were not destroyed - - [Wayland] Bugfix: `glfwInit` would segfault on compositor with no seat (#2517) - - [Wayland] Bugfix: A drag entering a non-GLFW surface could cause a segfault - - [Wayland] Bugfix: Ignore key repeat events when no window has keyboard focus (#2727) - - [Wayland] Bugfix: Reset key repeat timer when window destroyed (#2741,#2727) - - [Wayland] Bugfix: Memory would leak if reading a data offer failed midway - - [Wayland] Bugfix: Retrieved cursor position would be incorrect when hovering over - fallback decorations - - [Wayland] Bugfix: Fallback decorations would report scroll events - - [Wayland] Bugfix: Keyboard repeat events halted when any key is released (#2568) - - [Wayland] Bugfix: Fallback decorations would show menu at wrong position - - [Wayland] Bugfix: The cursor was not updated when clicking through from - a modal to a fallback decoration - - [Wayland] Bugfix: The cursor position was not updated when clicking through - from a modal to the content area - - [Wayland] Bugfix: free modules at end of terminate function to resolve - potential segmentation fault (#2744) - - [Wayland] Bugfix: Confining or disabling the cursor could segfault on - compositors without `pointer-constraints-unstable-v1` - - [Wayland] Bugfix: Key repeat did not function on very old compositors - - [Wayland] Bugfix: The `libwayland-client` library was not unloaded at termination - - [Wayland] Bugfix: Scroll events were sent twice on some versions of GNOME (#2494) - - [Wayland] Bugfix: Two-dimensional scroll input was emitted as separate axes - - [Wayland] Bugfix: Mouse wheel scroll distance was incorrect on some compositors - - [Wayland] Bugfix: `glfwSwapBuffers` would halt with nonzero swap interval when window - was suspended (#1350,#2582,#2640,#2719,#2723,#2800,#2827) - - [Wayland] Bugfix: `glfwPostEmptyEvent` would leak a callback proxy (#2836) - - [Wayland] Bugfix: `glfwHideWindow` did not always send its request immediately - - [Wayland] Bugfix: Some event types were not always processed by `glfwPollEvents` or - `glfwWait*Events` (#2793,#2795) - - [Wayland] Bugfix: Scaled framebuffer size was sometimes incorect (#2713,#2810) - - [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631) - - [X11] Bugfix: Occasional crash when an idle display awakes (#2766) - - [X11] Bugfix: Prevent BadWindow when creating small windows with a content scale - less than 1 (#2754) - - [X11] Bugfix: Clamp width and height to >= 1 to prevent BadValue error and app exit - - [X11] Bugfix: Floating windows silently became non-floating when hidden (#2276) - - [X11] Bugfix: The `libXext` library was not unloaded at termination - - [Linux] Bugfix: The header for `ioctl` was only implicitly included (#2778) - - [Null] Added Vulkan 'window' surface creation via `VK_EXT_headless_surface` - - [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless` - - [EGL] Allowed native access on Wayland with `GLFW_CONTEXT_CREATION_API` set to - `GLFW_NATIVE_CONTEXT_API` (#2518) - - -## Contact - -On [glfw.org](https://www.glfw.org/) you can find the latest version of GLFW, as -well as news, documentation and other information about the project. - -If you have questions related to the use of GLFW, we have a -[forum](https://discourse.glfw.org/). - -If you have a bug to report, a patch to submit or a feature you'd like to -request, please file it in the -[issue tracker](https://github.com/glfw/glfw/issues) on GitHub. - -Finally, if you're interested in helping out with the development of GLFW or -porting it to your favorite platform, join us on the forum or GitHub. +``` +createKeyTables() +translateKey() +acquireMonitor() +releaseMonitor() +``` diff --git a/src/external/glfw/src/cocoa_init.m b/src/external/glfw/src/cocoa_init.m index 95d6289e3..6b2d3f253 100755 --- a/src/external/glfw/src/cocoa_init.m +++ b/src/external/glfw/src/cocoa_init.m @@ -1,7 +1,8 @@ //======================================================================== -// GLFW 3.5 Cocoa - www.glfw.org +// GLFW 3.5 Cocoa (modified for raylib) - www.glfw.org; www.raylib.com //------------------------------------------------------------------------ // Copyright (c) 2009-2019 Camilla Löwy +// Copyright (c) 2024-2026 M374LX // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages @@ -175,7 +176,7 @@ static void createMenuBar(void) // Create key code translation tables // -static void createKeyTables(void) +static void createKeyTablesCocoa(void) { memset(_glfw.ns.keycodes, -1, sizeof(_glfw.ns.keycodes)); memset(_glfw.ns.scancodes, -1, sizeof(_glfw.ns.scancodes)); @@ -583,7 +584,7 @@ int _glfwInitCocoa(void) name:NSTextInputContextKeyboardSelectionDidChangeNotification object:nil]; - createKeyTables(); + createKeyTablesCocoa(); _glfw.ns.eventSource = CGEventSourceCreate(kCGEventSourceStateHIDSystemState); if (!_glfw.ns.eventSource) diff --git a/src/external/glfw/src/cocoa_window.m b/src/external/glfw/src/cocoa_window.m index 610498080..5f2a302a7 100755 --- a/src/external/glfw/src/cocoa_window.m +++ b/src/external/glfw/src/cocoa_window.m @@ -1,7 +1,8 @@ //======================================================================== -// GLFW 3.5 Cocoa - www.glfw.org +// GLFW 3.5 Cocoa (modified for raylib) - www.glfw.org; www.raylib.com //------------------------------------------------------------------------ // Copyright (c) 2009-2019 Camilla Löwy +// Copyright (c) 2024-2026 M374LX // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages @@ -114,7 +115,7 @@ static void updateCursorMode(_GLFWwindow* window) // Make the specified window and its video mode active on its monitor // -static void acquireMonitor(_GLFWwindow* window) +static void acquireMonitorCocoa(_GLFWwindow* window) { _glfwSetVideoModeCocoa(window->monitor, &window->videoMode); const CGRect bounds = CGDisplayBounds(window->monitor->ns.displayID); @@ -130,7 +131,7 @@ static void acquireMonitor(_GLFWwindow* window) // Remove the window and restore the original video mode // -static void releaseMonitor(_GLFWwindow* window) +static void releaseMonitorCocoa(_GLFWwindow* window) { if (window->monitor->window != window) return; @@ -161,7 +162,7 @@ static int translateFlags(NSUInteger flags) // Translates a macOS keycode to a GLFW keycode // -static int translateKey(unsigned int key) +static int translateKeyCocoa(unsigned int key) { if (key >= sizeof(_glfw.ns.keycodes) / sizeof(_glfw.ns.keycodes[0])) return GLFW_KEY_UNKNOWN; @@ -280,7 +281,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; - (void)windowDidMiniaturize:(NSNotification *)notification { if (window->monitor) - releaseMonitor(window); + releaseMonitorCocoa(window); _glfwInputWindowIconify(window, GLFW_TRUE); } @@ -288,7 +289,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; - (void)windowDidDeminiaturize:(NSNotification *)notification { if (window->monitor) - acquireMonitor(window); + acquireMonitorCocoa(window); _glfwInputWindowIconify(window, GLFW_FALSE); } @@ -562,7 +563,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; - (void)keyDown:(NSEvent *)event { - const int key = translateKey([event keyCode]); + const int key = translateKeyCocoa([event keyCode]); const int mods = translateFlags([event modifierFlags]); _glfwInputKey(window, key, [event keyCode], GLFW_PRESS, mods); @@ -575,7 +576,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; int action; const unsigned int modifierFlags = [event modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask; - const int key = translateKey([event keyCode]); + const int key = translateKeyCocoa([event keyCode]); const int mods = translateFlags(modifierFlags); const NSUInteger keyFlag = translateKeyToModifierFlag(key); @@ -594,7 +595,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; - (void)keyUp:(NSEvent *)event { - const int key = translateKey([event keyCode]); + const int key = translateKeyCocoa([event keyCode]); const int mods = translateFlags([event modifierFlags]); _glfwInputKey(window, key, [event keyCode], GLFW_RELEASE, mods); } @@ -603,7 +604,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; { // HACK: Some key combinations are consumed before reaching keyDown: // so we claim those events and emit them here - const int key = translateKey([event keyCode]); + const int key = translateKeyCocoa([event keyCode]); const int mods = translateFlags([event modifierFlags]); if (mods & GLFW_MOD_CONTROL) @@ -995,7 +996,7 @@ GLFWbool _glfwCreateWindowCocoa(_GLFWwindow* window, { _glfwShowWindowCocoa(window); _glfwFocusWindowCocoa(window); - acquireMonitor(window); + acquireMonitorCocoa(window); if (wndconfig->centerCursor) _glfwCenterCursorInContentArea(window); @@ -1025,7 +1026,7 @@ void _glfwDestroyWindowCocoa(_GLFWwindow* window) [window->ns.object orderOut:nil]; if (window->monitor) - releaseMonitor(window); + releaseMonitorCocoa(window); if (window->context.destroy) window->context.destroy(window); @@ -1112,7 +1113,7 @@ void _glfwSetWindowSizeCocoa(_GLFWwindow* window, int width, int height) if (window->monitor) { if (window->monitor->window == window) - acquireMonitor(window); + acquireMonitorCocoa(window); } else { @@ -1281,7 +1282,7 @@ void _glfwSetWindowMonitorCocoa(_GLFWwindow* window, if (monitor) { if (monitor->window == window) - acquireMonitor(window); + acquireMonitorCocoa(window); } else { @@ -1299,7 +1300,7 @@ void _glfwSetWindowMonitorCocoa(_GLFWwindow* window, } if (window->monitor) - releaseMonitor(window); + releaseMonitorCocoa(window); _glfwInputWindowMonitor(window, monitor); @@ -1337,7 +1338,7 @@ void _glfwSetWindowMonitorCocoa(_GLFWwindow* window, [window->ns.object setLevel:NSMainMenuWindowLevel + 1]; [window->ns.object setHasShadow:NO]; - acquireMonitor(window); + acquireMonitorCocoa(window); } else { diff --git a/src/external/glfw/src/null_window.c b/src/external/glfw/src/null_window.c index f0e1dcc9a..b2e2d1e0a 100755 --- a/src/external/glfw/src/null_window.c +++ b/src/external/glfw/src/null_window.c @@ -1,8 +1,9 @@ //======================================================================== -// GLFW 3.5 - www.glfw.org +// GLFW 3.5 (modified for raylib) - www.glfw.org; www.raylib.com //------------------------------------------------------------------------ // Copyright (c) 2016 Google Inc. // Copyright (c) 2016-2019 Camilla Löwy +// Copyright (c) 2024-2026 M374LX // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages @@ -60,12 +61,12 @@ static void fitToMonitor(_GLFWwindow* window) window->null.height = mode.height; } -static void acquireMonitor(_GLFWwindow* window) +static void acquireMonitorNull(_GLFWwindow* window) { _glfwInputMonitorWindow(window->monitor, window); } -static void releaseMonitor(_GLFWwindow* window) +static void releaseMonitorNull(_GLFWwindow* window) { if (window->monitor->window != window) return; @@ -148,7 +149,7 @@ GLFWbool _glfwCreateWindowNull(_GLFWwindow* window, { _glfwShowWindowNull(window); _glfwFocusWindowNull(window); - acquireMonitor(window); + acquireMonitorNull(window); if (wndconfig->centerCursor) _glfwCenterCursorInContentArea(window); @@ -169,7 +170,7 @@ GLFWbool _glfwCreateWindowNull(_GLFWwindow* window, void _glfwDestroyWindowNull(_GLFWwindow* window) { if (window->monitor) - releaseMonitor(window); + releaseMonitorNull(window); if (_glfw.null.focusedWindow == window) _glfw.null.focusedWindow = NULL; @@ -204,14 +205,14 @@ void _glfwSetWindowMonitorNull(_GLFWwindow* window, } if (window->monitor) - releaseMonitor(window); + releaseMonitorNull(window); _glfwInputWindowMonitor(window, monitor); if (window->monitor) { window->null.visible = GLFW_TRUE; - acquireMonitor(window); + acquireMonitorNull(window); fitToMonitor(window); } else @@ -341,7 +342,7 @@ void _glfwIconifyWindowNull(_GLFWwindow* window) _glfwInputWindowIconify(window, GLFW_TRUE); if (window->monitor) - releaseMonitor(window); + releaseMonitorNull(window); } } @@ -353,7 +354,7 @@ void _glfwRestoreWindowNull(_GLFWwindow* window) _glfwInputWindowIconify(window, GLFW_FALSE); if (window->monitor) - acquireMonitor(window); + acquireMonitorNull(window); } else if (window->null.maximized) { diff --git a/src/external/glfw/src/platform.c b/src/external/glfw/src/platform.c index 95b8d0b58..a67100faf 100755 --- a/src/external/glfw/src/platform.c +++ b/src/external/glfw/src/platform.c @@ -74,6 +74,9 @@ GLFWbool _glfwSelectPlatform(int desiredID, _GLFWplatform* platform) return GLFW_FALSE; } + //Modification for raylib: this Null platform check is removed because it is + //not used by raylib +#if 0 // Only allow the Null platform if specifically requested if (desiredID == GLFW_PLATFORM_NULL) return _glfwConnectNull(desiredID, platform); @@ -82,6 +85,7 @@ GLFWbool _glfwSelectPlatform(int desiredID, _GLFWplatform* platform) _glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "This binary only supports the Null platform"); return GLFW_FALSE; } +#endif #if defined(_GLFW_WAYLAND) && defined(_GLFW_X11) if (desiredID == GLFW_ANY_PLATFORM) diff --git a/src/external/glfw/src/win32_init.c b/src/external/glfw/src/win32_init.c index d526fe8a3..4eea6b4e0 100755 --- a/src/external/glfw/src/win32_init.c +++ b/src/external/glfw/src/win32_init.c @@ -1,8 +1,9 @@ //======================================================================== -// GLFW 3.5 Win32 - www.glfw.org +// GLFW 3.5 Win32 (modified for raylib) - www.glfw.org; www.raylib.com //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy +// Copyright (c) 2024-2026 M374LX // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages @@ -168,7 +169,7 @@ static GLFWbool loadLibraries(void) // Create key code translation tables // -static void createKeyTables(void) +static void createKeyTablesWin32(void) { int scancode; @@ -659,7 +660,7 @@ int _glfwInitWin32(void) if (!loadLibraries()) return GLFW_FALSE; - createKeyTables(); + createKeyTablesWin32(); _glfwUpdateKeyNamesWin32(); if (_glfwIsWindows10Version1703OrGreaterWin32()) diff --git a/src/external/glfw/src/win32_window.c b/src/external/glfw/src/win32_window.c index 8f83a9a08..d479b0c52 100755 --- a/src/external/glfw/src/win32_window.c +++ b/src/external/glfw/src/win32_window.c @@ -1,8 +1,9 @@ //======================================================================== -// GLFW 3.5 Win32 - www.glfw.org +// GLFW 3.5 Win32 (modified for raylib) - www.glfw.org; www.raylib.com //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy +// Copyright (c) 2024-2026 M374LX // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages @@ -437,7 +438,7 @@ static void fitToMonitor(_GLFWwindow* window) // Make the specified window and its video mode active on its monitor // -static void acquireMonitor(_GLFWwindow* window) +static void acquireMonitorWin32(_GLFWwindow* window) { if (!_glfw.win32.acquiredMonitorCount) { @@ -458,7 +459,7 @@ static void acquireMonitor(_GLFWwindow* window) // Remove the window and restore the original video mode // -static void releaseMonitor(_GLFWwindow* window) +static void releaseMonitorWin32(_GLFWwindow* window) { if (window->monitor->window != window) return; @@ -468,7 +469,7 @@ static void releaseMonitor(_GLFWwindow* window) { SetThreadExecutionState(ES_CONTINUOUS); - // HACK: Restore mouse trail length saved in acquireMonitor + // HACK: Restore mouse trail length saved in acquireMonitorWin32 SystemParametersInfoW(SPI_SETMOUSETRAILS, _glfw.win32.mouseTrailSize, 0, 0); } @@ -1048,10 +1049,10 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l if (window->monitor && window->win32.iconified != iconified) { if (iconified) - releaseMonitor(window); + releaseMonitorWin32(window); else { - acquireMonitor(window); + acquireMonitorWin32(window); fitToMonitor(window); } } @@ -1526,7 +1527,7 @@ GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window, { _glfwShowWindowWin32(window); _glfwFocusWindowWin32(window); - acquireMonitor(window); + acquireMonitorWin32(window); fitToMonitor(window); if (wndconfig->centerCursor) @@ -1548,7 +1549,7 @@ GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window, void _glfwDestroyWindowWin32(_GLFWwindow* window) { if (window->monitor) - releaseMonitor(window); + releaseMonitorWin32(window); if (window->context.destroy) window->context.destroy(window); @@ -1669,7 +1670,7 @@ void _glfwSetWindowSizeWin32(_GLFWwindow* window, int width, int height) { if (window->monitor->window == window) { - acquireMonitor(window); + acquireMonitorWin32(window); fitToMonitor(window); } } @@ -1841,7 +1842,7 @@ void _glfwSetWindowMonitorWin32(_GLFWwindow* window, { if (monitor->window == window) { - acquireMonitor(window); + acquireMonitorWin32(window); fitToMonitor(window); } } @@ -1871,7 +1872,7 @@ void _glfwSetWindowMonitorWin32(_GLFWwindow* window, } if (window->monitor) - releaseMonitor(window); + releaseMonitorWin32(window); _glfwInputWindowMonitor(window, monitor); @@ -1889,7 +1890,7 @@ void _glfwSetWindowMonitorWin32(_GLFWwindow* window, flags |= SWP_FRAMECHANGED; } - acquireMonitor(window); + acquireMonitorWin32(window); GetMonitorInfoW(window->monitor->win32.handle, &mi); SetWindowPos(window->win32.handle, HWND_TOPMOST, diff --git a/src/external/glfw/src/wl_init.c b/src/external/glfw/src/wl_init.c index e6da57822..05cf2ba86 100755 --- a/src/external/glfw/src/wl_init.c +++ b/src/external/glfw/src/wl_init.c @@ -1,7 +1,8 @@ //======================================================================== -// GLFW 3.5 Wayland - www.glfw.org +// GLFW 3.5 Wayland (modified for raylib) - www.glfw.org; www.raylib.com //------------------------------------------------------------------------ // Copyright (c) 2014 Jonas Ådahl +// Copyright (c) 2024-2026 M374LX // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages @@ -254,7 +255,7 @@ static const struct wl_callback_listener libdecorReadyListener = // Create key code translation tables // -static void createKeyTables(void) +static void createKeyTablesWayland(void) { memset(_glfw.wl.keycodes, -1, sizeof(_glfw.wl.keycodes)); memset(_glfw.wl.scancodes, -1, sizeof(_glfw.wl.scancodes)); @@ -846,7 +847,7 @@ int _glfwInitWayland(void) _glfw.wl.registry = wl_display_get_registry(_glfw.wl.display); wl_registry_add_listener(_glfw.wl.registry, ®istryListener, NULL); - createKeyTables(); + createKeyTablesWayland(); _glfw.wl.keyRepeatTimerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK); diff --git a/src/external/glfw/src/wl_window.c b/src/external/glfw/src/wl_window.c index fd8553a56..298b8525a 100755 --- a/src/external/glfw/src/wl_window.c +++ b/src/external/glfw/src/wl_window.c @@ -1,7 +1,8 @@ //======================================================================== -// GLFW 3.5 Wayland - www.glfw.org +// GLFW 3.5 Wayland (modified for raylib) - www.glfw.org; www.raylib.com //------------------------------------------------------------------------ // Copyright (c) 2014 Jonas Ådahl +// Copyright (c) 2024-2026 M374LX // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages @@ -662,7 +663,7 @@ static void setIdleInhibitor(_GLFWwindow* window, GLFWbool enable) // Make the specified window and its video mode active on its monitor // -static void acquireMonitor(_GLFWwindow* window) +static void acquireMonitorWayland(_GLFWwindow* window) { if (window->wl.libdecor.frame) { @@ -683,7 +684,7 @@ static void acquireMonitor(_GLFWwindow* window) // Remove the window and restore the original video mode // -static void releaseMonitor(_GLFWwindow* window) +static void releaseMonitorWayland(_GLFWwindow* window) { if (window->wl.libdecor.frame) libdecor_frame_unset_fullscreen(window->wl.libdecor.frame); @@ -1328,7 +1329,7 @@ static GLFWbool flushDisplay(void) return GLFW_TRUE; } -static int translateKey(uint32_t scancode) +static int translateKeyWayland(uint32_t scancode) { if (scancode < sizeof(_glfw.wl.keycodes) / sizeof(_glfw.wl.keycodes[0])) return _glfw.wl.keycodes[scancode]; @@ -1452,7 +1453,7 @@ static void handleEvents(double* timeout) for (uint64_t i = 0; i < repeats; i++) { _glfwInputKey(_glfw.wl.keyboardFocus, - translateKey(_glfw.wl.keyRepeatScancode), + translateKeyWayland(_glfw.wl.keyRepeatScancode), _glfw.wl.keyRepeatScancode, GLFW_PRESS, _glfw.wl.xkb.modifiers); @@ -1962,7 +1963,7 @@ static void keyboardHandleKey(void* userData, if (!window) return; - const int key = translateKey(scancode); + const int key = translateKeyWayland(scancode); const int action = state == WL_KEYBOARD_KEY_STATE_PRESSED ? GLFW_PRESS : GLFW_RELEASE; @@ -2809,12 +2810,12 @@ void _glfwSetWindowMonitorWayland(_GLFWwindow* window, } if (window->monitor) - releaseMonitor(window); + releaseMonitorWayland(window); _glfwInputWindowMonitor(window, monitor); if (window->monitor) - acquireMonitor(window); + acquireMonitorWayland(window); else _glfwSetWindowSizeWayland(window, width, height); } diff --git a/src/external/glfw/src/x11_init.c b/src/external/glfw/src/x11_init.c index b0acbf7f6..c33c9f8e1 100755 --- a/src/external/glfw/src/x11_init.c +++ b/src/external/glfw/src/x11_init.c @@ -1,8 +1,9 @@ //======================================================================== -// GLFW 3.5 X11 - www.glfw.org +// GLFW 3.5 X11 (modified for raylib) - www.glfw.org; www.raylib.com //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy +// Copyright (c) 2024-2026 M374LX // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages @@ -210,7 +211,7 @@ static int translateKeySyms(const KeySym* keysyms, int width) // Create key code translation tables // -static void createKeyTables(void) +static void createKeyTablesX11(void) { int scancodeMin, scancodeMax; @@ -909,7 +910,7 @@ static GLFWbool initExtensions(void) // Update the key code LUT // FIXME: We should listen to XkbMapNotify events to track changes to // the keyboard mapping. - createKeyTables(); + createKeyTablesX11(); // String format atoms _glfw.x11.NULL_ = XInternAtom(_glfw.x11.display, "NULL", False); diff --git a/src/external/glfw/src/x11_window.c b/src/external/glfw/src/x11_window.c index f46a7e6ce..a6210a768 100755 --- a/src/external/glfw/src/x11_window.c +++ b/src/external/glfw/src/x11_window.c @@ -1,8 +1,9 @@ //======================================================================== -// GLFW 3.5 X11 - www.glfw.org +// GLFW 3.5 X11 (modified for raylib) - www.glfw.org; www.raylib.com //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2019 Camilla Löwy +// Copyright (c) 2024-2026 M374LX // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages @@ -235,9 +236,9 @@ static int translateState(int state) // Translates an X11 key code to a GLFW key token // -static int translateKey(int scancode) +static int translateKeyX11(int scancode) { - // Use the pre-filled LUT (see createKeyTables() in x11_init.c) + // Use the pre-filled LUT (see createKeyTablesX11() in x11_init.c) if (scancode < 0 || scancode > 255) return GLFW_KEY_UNKNOWN; @@ -1085,7 +1086,7 @@ static const char* getSelectionString(Atom selection) // Make the specified window and its video mode active on its monitor // -static void acquireMonitor(_GLFWwindow* window) +static void acquireMonitorX11(_GLFWwindow* window) { if (_glfw.x11.saver.count == 0) { @@ -1124,7 +1125,7 @@ static void acquireMonitor(_GLFWwindow* window) // Remove the window and restore the original video mode // -static void releaseMonitor(_GLFWwindow* window) +static void releaseMonitorX11(_GLFWwindow* window) { if (window->monitor->window != window) return; @@ -1246,7 +1247,7 @@ static void processEvent(XEvent *event) case KeyPress: { - const int key = translateKey(keycode); + const int key = translateKeyX11(keycode); const int mods = translateState(event->xkey.state); const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT)); @@ -1318,7 +1319,7 @@ static void processEvent(XEvent *event) case KeyRelease: { - const int key = translateKey(keycode); + const int key = translateKeyX11(keycode); const int mods = translateState(event->xkey.state); if (!_glfw.x11.xkb.detectable) @@ -1810,9 +1811,9 @@ static void processEvent(XEvent *event) if (window->monitor) { if (iconified) - releaseMonitor(window); + releaseMonitorX11(window); else - acquireMonitor(window); + acquireMonitorX11(window); } window->x11.iconified = iconified; @@ -2029,7 +2030,7 @@ GLFWbool _glfwCreateWindowX11(_GLFWwindow* window, { _glfwShowWindowX11(window); updateWindowMode(window); - acquireMonitor(window); + acquireMonitorX11(window); if (wndconfig->centerCursor) _glfwCenterCursorInContentArea(window); @@ -2054,7 +2055,7 @@ void _glfwDestroyWindowX11(_GLFWwindow* window) enableCursor(window); if (window->monitor) - releaseMonitor(window); + releaseMonitorX11(window); if (window->x11.ic) { @@ -2214,7 +2215,7 @@ void _glfwSetWindowSizeX11(_GLFWwindow* window, int width, int height) if (window->monitor) { if (window->monitor->window == window) - acquireMonitor(window); + acquireMonitorX11(window); } else { @@ -2517,7 +2518,7 @@ void _glfwSetWindowMonitorX11(_GLFWwindow* window, if (monitor) { if (monitor->window == window) - acquireMonitor(window); + acquireMonitorX11(window); } else { @@ -2536,7 +2537,7 @@ void _glfwSetWindowMonitorX11(_GLFWwindow* window, { _glfwSetWindowDecoratedX11(window, window->decorated); _glfwSetWindowFloatingX11(window, window->floating); - releaseMonitor(window); + releaseMonitorX11(window); } _glfwInputWindowMonitor(window, monitor); @@ -2551,7 +2552,7 @@ void _glfwSetWindowMonitorX11(_GLFWwindow* window, } updateWindowMode(window); - acquireMonitor(window); + acquireMonitorX11(window); } else {