glfw sources updated

This commit is contained in:
JupiterRider 2024-11-23 17:21:57 +01:00
parent fc50e055c0
commit 724c790ff7
13 changed files with 165 additions and 81 deletions

View file

@ -1,7 +1,8 @@
//========================================================================
// GLFW 3.4 macOS - www.glfw.org
// GLFW 3.4 macOS (modified for raylib) - www.glfw.org; www.raylib.com
//------------------------------------------------------------------------
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
// Copyright (c) 2024 M374LX <wilsalx@gmail.com>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
@ -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));
@ -618,7 +619,7 @@ int _glfwInitCocoa(void)
name:NSTextInputContextKeyboardSelectionDidChangeNotification
object:nil];
createKeyTables();
createKeyTablesCocoa();
_glfw.ns.eventSource = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
if (!_glfw.ns.eventSource)

View file

@ -1,8 +1,9 @@
//========================================================================
// GLFW 3.4 macOS - www.glfw.org
// GLFW 3.4 macOS (modified for raylib) - www.glfw.org; www.raylib.com
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
// Copyright (c) 2024 M374LX <wilsalx@gmail.com>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages

View file

@ -111,7 +111,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);
@ -127,7 +127,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;
@ -158,7 +158,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;
@ -277,7 +277,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)windowDidMiniaturize:(NSNotification *)notification
{
if (window->monitor)
releaseMonitor(window);
releaseMonitorCocoa(window);
_glfwInputWindowIconify(window, GLFW_TRUE);
}
@ -285,7 +285,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)windowDidDeminiaturize:(NSNotification *)notification
{
if (window->monitor)
acquireMonitor(window);
acquireMonitorCocoa(window);
_glfwInputWindowIconify(window, GLFW_FALSE);
}
@ -561,7 +561,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);
@ -574,7 +574,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);
@ -593,7 +593,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);
}
@ -966,7 +966,7 @@ GLFWbool _glfwCreateWindowCocoa(_GLFWwindow* window,
{
_glfwShowWindowCocoa(window);
_glfwFocusWindowCocoa(window);
acquireMonitor(window);
acquireMonitorCocoa(window);
if (wndconfig->centerCursor)
_glfwCenterCursorInContentArea(window);
@ -996,7 +996,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);
@ -1083,7 +1083,7 @@ void _glfwSetWindowSizeCocoa(_GLFWwindow* window, int width, int height)
if (window->monitor)
{
if (window->monitor->window == window)
acquireMonitor(window);
acquireMonitorCocoa(window);
}
else
{
@ -1252,7 +1252,7 @@ void _glfwSetWindowMonitorCocoa(_GLFWwindow* window,
if (monitor)
{
if (monitor->window == window)
acquireMonitor(window);
acquireMonitorCocoa(window);
}
else
{
@ -1270,7 +1270,7 @@ void _glfwSetWindowMonitorCocoa(_GLFWwindow* window,
}
if (window->monitor)
releaseMonitor(window);
releaseMonitorCocoa(window);
_glfwInputWindowMonitor(window, monitor);
@ -1308,7 +1308,7 @@ void _glfwSetWindowMonitorCocoa(_GLFWwindow* window,
[window->ns.object setLevel:NSMainMenuWindowLevel + 1];
[window->ns.object setHasShadow:NO];
acquireMonitor(window);
acquireMonitorCocoa(window);
}
else
{

View file

@ -996,6 +996,7 @@ const char* _glfwDefaultMappings[] =
"03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,platform:Linux,",
"03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,",
"03000000120c0000101e000011010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,",
"03000000af1e00002400000010010000,Clockwork Pi DevTerm,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,start:b9,x:b3,y:b0,platform:Linux,",
#endif // GLFW_BUILD_LINUX_JOYSTICK
};

82
raylib/external/glfw/src/mappings.h.in vendored Normal file
View file

@ -0,0 +1,82 @@
//========================================================================
// GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
// As mappings.h.in, this file is used by CMake to produce the mappings.h
// header file. If you are adding a GLFW specific gamepad mapping, this is
// where to put it.
//========================================================================
// As mappings.h, this provides all pre-defined gamepad mappings, including
// all available in SDL_GameControllerDB. Do not edit this file. Any gamepad
// mappings not specific to GLFW should be submitted to SDL_GameControllerDB.
// This file can be re-generated from mappings.h.in and the upstream
// gamecontrollerdb.txt with the 'update_mappings' CMake target.
//========================================================================
// All gamepad mappings not labeled GLFW are copied from the
// SDL_GameControllerDB project under the following license:
//
// Simple DirectMedia Layer
// Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the
// use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
const char* _glfwDefaultMappings[] =
{
#if defined(_GLFW_WIN32)
@GLFW_WIN32_MAPPINGS@
"78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
"78696e70757402000000000000000000,XInput Wheel (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
"78696e70757403000000000000000000,XInput Arcade Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
"78696e70757404000000000000000000,XInput Flight Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
"78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
"78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
"78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
#endif // _GLFW_WIN32
#if defined(_GLFW_COCOA)
@GLFW_COCOA_MAPPINGS@
#endif // _GLFW_COCOA
#if defined(GLFW_BUILD_LINUX_JOYSTICK)
@GLFW_LINUX_MAPPINGS@
#endif // GLFW_BUILD_LINUX_JOYSTICK
};

View file

@ -1,8 +1,9 @@
//========================================================================
// GLFW 3.4 - www.glfw.org
// GLFW 3.4 (modified for raylib) - www.glfw.org; www.raylib.com
//------------------------------------------------------------------------
// Copyright (c) 2016 Google Inc.
// Copyright (c) 2016-2019 Camilla Löwy <elmindreda@glfw.org>
// Copyright (c) 2024 M374LX <wilsalx@gmail.com>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
@ -59,12 +60,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;
@ -147,7 +148,7 @@ GLFWbool _glfwCreateWindowNull(_GLFWwindow* window,
{
_glfwShowWindowNull(window);
_glfwFocusWindowNull(window);
acquireMonitor(window);
acquireMonitorNull(window);
if (wndconfig->centerCursor)
_glfwCenterCursorInContentArea(window);
@ -168,7 +169,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;
@ -203,14 +204,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
@ -340,7 +341,7 @@ void _glfwIconifyWindowNull(_GLFWwindow* window)
_glfwInputWindowIconify(window, GLFW_TRUE);
if (window->monitor)
releaseMonitor(window);
releaseMonitorNull(window);
}
}
@ -352,7 +353,7 @@ void _glfwRestoreWindowNull(_GLFWwindow* window)
_glfwInputWindowIconify(window, GLFW_FALSE);
if (window->monitor)
acquireMonitor(window);
acquireMonitorNull(window);
}
else if (window->null.maximized)
{

View file

@ -1,8 +1,9 @@
//========================================================================
// GLFW 3.4 - www.glfw.org
// GLFW 3.4 (modified for raylib) - www.glfw.org; www.raylib.com
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
// Copyright (c) 2024 M374LX <wilsalx@gmail.com>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
@ -74,15 +75,6 @@ GLFWbool _glfwSelectPlatform(int desiredID, _GLFWplatform* platform)
return GLFW_FALSE;
}
// Only allow the Null platform if specifically requested
if (desiredID == GLFW_PLATFORM_NULL)
return _glfwConnectNull(desiredID, platform);
else if (count == 0)
{
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "This binary only supports the Null platform");
return GLFW_FALSE;
}
#if defined(_GLFW_WAYLAND) && defined(_GLFW_X11)
if (desiredID == GLFW_ANY_PLATFORM)
{

View file

@ -1,8 +1,9 @@
//========================================================================
// GLFW 3.4 Win32 - www.glfw.org
// GLFW 3.4 Win32 (modified for raylib) - www.glfw.org; www.raylib.com
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
// Copyright (c) 2024 M374LX <wilsalx@gmail.com>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
@ -195,7 +196,7 @@ static void freeLibraries(void)
// Create key code translation tables
//
static void createKeyTables(void)
static void createKeyTablesWin32(void)
{
int scancode;
@ -685,7 +686,7 @@ int _glfwInitWin32(void)
if (!loadLibraries())
return GLFW_FALSE;
createKeyTables();
createKeyTablesWin32();
_glfwUpdateKeyNamesWin32();
if (_glfwIsWindows10Version1703OrGreaterWin32())

View file

@ -1,8 +1,9 @@
//========================================================================
// GLFW 3.4 Win32 - www.glfw.org
// GLFW 3.4 Win32 (modified for raylib) - www.glfw.org; www.raylib.com
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
// Copyright (c) 2024 M374LX <wilsalx@gmail.com>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
@ -439,7 +440,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)
{
@ -460,7 +461,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;
@ -470,7 +471,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);
}
@ -1050,10 +1051,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);
}
}
@ -1534,7 +1535,7 @@ GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window,
{
_glfwShowWindowWin32(window);
_glfwFocusWindowWin32(window);
acquireMonitor(window);
acquireMonitorWin32(window);
fitToMonitor(window);
if (wndconfig->centerCursor)
@ -1556,7 +1557,7 @@ GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window,
void _glfwDestroyWindowWin32(_GLFWwindow* window)
{
if (window->monitor)
releaseMonitor(window);
releaseMonitorWin32(window);
if (window->context.destroy)
window->context.destroy(window);
@ -1677,7 +1678,7 @@ void _glfwSetWindowSizeWin32(_GLFWwindow* window, int width, int height)
{
if (window->monitor->window == window)
{
acquireMonitor(window);
acquireMonitorWin32(window);
fitToMonitor(window);
}
}
@ -1849,7 +1850,7 @@ void _glfwSetWindowMonitorWin32(_GLFWwindow* window,
{
if (monitor->window == window)
{
acquireMonitor(window);
acquireMonitorWin32(window);
fitToMonitor(window);
}
}
@ -1879,7 +1880,7 @@ void _glfwSetWindowMonitorWin32(_GLFWwindow* window,
}
if (window->monitor)
releaseMonitor(window);
releaseMonitorWin32(window);
_glfwInputWindowMonitor(window, monitor);
@ -1897,7 +1898,7 @@ void _glfwSetWindowMonitorWin32(_GLFWwindow* window,
flags |= SWP_FRAMECHANGED;
}
acquireMonitor(window);
acquireMonitorWin32(window);
GetMonitorInfoW(window->monitor->win32.handle, &mi);
SetWindowPos(window->win32.handle, HWND_TOPMOST,

View file

@ -1,7 +1,8 @@
//========================================================================
// GLFW 3.4 Wayland - www.glfw.org
// GLFW 3.4 Wayland (modified for raylib) - www.glfw.org; www.raylib.com
//------------------------------------------------------------------------
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
// Copyright (c) 2024 M374LX <wilsalx@gmail.com>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
@ -257,7 +258,7 @@ static const struct wl_callback_listener libdecorReadyListener =
// Create key code translation tables
//
static void createKeyTablesWL(void)
static void createKeyTablesWayland(void)
{
memset(_glfw.wl.keycodes, -1, sizeof(_glfw.wl.keycodes));
memset(_glfw.wl.scancodes, -1, sizeof(_glfw.wl.scancodes));
@ -821,7 +822,7 @@ int _glfwInitWayland(void)
_glfw.wl.registry = wl_display_get_registry(_glfw.wl.display);
wl_registry_add_listener(_glfw.wl.registry, &registryListener, NULL);
createKeyTablesWL();
createKeyTablesWayland();
_glfw.wl.xkb.context = xkb_context_new(0);
if (!_glfw.wl.xkb.context)

View file

@ -1,7 +1,8 @@
//========================================================================
// GLFW 3.4 Wayland - www.glfw.org
// GLFW 3.4 Wayland (modified for raylib) - www.glfw.org; www.raylib.com
//------------------------------------------------------------------------
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
// Copyright (c) 2024 M374LX <wilsalx@gmail.com>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
@ -498,7 +499,7 @@ static void setIdleInhibitor(_GLFWwindow* window, GLFWbool enable)
// Make the specified window and its video mode active on its monitor
//
static void acquireMonitorWL(_GLFWwindow* window)
static void acquireMonitorWayland(_GLFWwindow* window)
{
if (window->wl.libdecor.frame)
{
@ -519,7 +520,7 @@ static void acquireMonitorWL(_GLFWwindow* window)
// Remove the window and restore the original video mode
//
static void releaseMonitorWL(_GLFWwindow* window)
static void releaseMonitorWayland(_GLFWwindow* window)
{
if (window->wl.libdecor.frame)
libdecor_frame_unset_fullscreen(window->wl.libdecor.frame);
@ -1156,7 +1157,7 @@ static GLFWbool flushDisplay(void)
return GLFW_TRUE;
}
static int translateKeyWL(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];
@ -1270,7 +1271,7 @@ static void handleEvents(double* timeout)
for (uint64_t i = 0; i < repeats; i++)
{
_glfwInputKey(_glfw.wl.keyboardFocus,
translateKeyWL(_glfw.wl.keyRepeatScancode),
translateKeyWayland(_glfw.wl.keyRepeatScancode),
_glfw.wl.keyRepeatScancode,
GLFW_PRESS,
_glfw.wl.xkb.modifiers);
@ -1773,7 +1774,7 @@ static void keyboardHandleKey(void* userData,
if (!window)
return;
const int key = translateKeyWL(scancode);
const int key = translateKeyWayland(scancode);
const int action =
state == WL_KEYBOARD_KEY_STATE_PRESSED ? GLFW_PRESS : GLFW_RELEASE;
@ -2509,12 +2510,12 @@ void _glfwSetWindowMonitorWayland(_GLFWwindow* window,
}
if (window->monitor)
releaseMonitorWL(window);
releaseMonitorWayland(window);
_glfwInputWindowMonitor(window, monitor);
if (window->monitor)
acquireMonitorWL(window);
acquireMonitorWayland(window);
else
_glfwSetWindowSizeWayland(window, width, height);
}

View file

@ -1,8 +1,9 @@
//========================================================================
// GLFW 3.4 X11 - www.glfw.org
// GLFW 3.4 X11 (modified for raylib) - www.glfw.org; www.raylib.com
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
// Copyright (c) 2024 M374LX <wilsalx@gmail.com>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
@ -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;
@ -908,7 +909,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);

View file

@ -1,8 +1,9 @@
//========================================================================
// GLFW 3.4 X11 - www.glfw.org
// GLFW 3.4 X11 (modified for raylib) - www.glfw.org; www.raylib.com
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
// Copyright (c) 2024 M374LX <wilsalx@gmail.com>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
@ -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;
@ -1081,7 +1082,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)
{
@ -1120,7 +1121,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;
@ -1242,7 +1243,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));
@ -1314,7 +1315,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)
@ -1806,9 +1807,9 @@ static void processEvent(XEvent *event)
if (window->monitor)
{
if (iconified)
releaseMonitor(window);
releaseMonitorX11(window);
else
acquireMonitor(window);
acquireMonitorX11(window);
}
window->x11.iconified = iconified;
@ -2025,7 +2026,7 @@ GLFWbool _glfwCreateWindowX11(_GLFWwindow* window,
{
_glfwShowWindowX11(window);
updateWindowMode(window);
acquireMonitor(window);
acquireMonitorX11(window);
if (wndconfig->centerCursor)
_glfwCenterCursorInContentArea(window);
@ -2050,7 +2051,7 @@ void _glfwDestroyWindowX11(_GLFWwindow* window)
enableCursor(window);
if (window->monitor)
releaseMonitor(window);
releaseMonitorX11(window);
if (window->x11.ic)
{
@ -2206,7 +2207,7 @@ void _glfwSetWindowSizeX11(_GLFWwindow* window, int width, int height)
if (window->monitor)
{
if (window->monitor->window == window)
acquireMonitor(window);
acquireMonitorX11(window);
}
else
{
@ -2477,7 +2478,7 @@ void _glfwSetWindowMonitorX11(_GLFWwindow* window,
if (monitor)
{
if (monitor->window == window)
acquireMonitor(window);
acquireMonitorX11(window);
}
else
{
@ -2496,7 +2497,7 @@ void _glfwSetWindowMonitorX11(_GLFWwindow* window,
{
_glfwSetWindowDecoratedX11(window, window->decorated);
_glfwSetWindowFloatingX11(window, window->floating);
releaseMonitor(window);
releaseMonitorX11(window);
}
_glfwInputWindowMonitor(window, monitor);
@ -2511,7 +2512,7 @@ void _glfwSetWindowMonitorX11(_GLFWwindow* window,
}
updateWindowMode(window);
acquireMonitor(window);
acquireMonitorX11(window);
}
else
{