Skip to content

SDL3 Changes to key codes breaks the SDL3 backend build. #7761

@adrian-purser

Description

@adrian-purser

Version/Branch of Dear ImGui:

Version 1.90.9, Branch: docking

Back-ends:

imgui_impl_SDL3.cpp + imgui_impl_OpenGL3.cpp

Compiler, OS:

Linux + GCC 14.1.1

Full config/build information:

Dear ImGui 1.90.9 (19090)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=202302
define: __linux__
define: __GNUC__=14
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_sdl3
io.BackendRendererName: imgui_impl_opengl3
io.ConfigFlags: 0x00000480
 DockingEnable
 ViewportsEnable
io.ConfigViewportsNoDecoration
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00001C0E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 HasMouseHoveredViewport
 RendererHasVtxOffset
 RendererHasViewports
--------------------------------
io.Fonts: 8 fonts, Flags: 0x00000000, TexSize: 512,1024
io.DisplaySize: 1024.00,768.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 1.00,1.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 3.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Details:

The latest SDL3 commit has removed keypad symbols ( SDLK_KP_?? ) and changed the symbols SDLK_a -> SDLK_z to uppercase. ie. SDLK_A -> SDLK_Z. These are used in the SDL3 backend implementation.

The Relevant SDL commits are -

Renamed SDLK_a-z to SDLK_A-Z
Made the symbols uppercase for consistency with the other SDLK_* constants, but the values are still lowercase.

and

Numpad scancodes have non-numpad keycodes
This allows the numpad to work as the user expects based on the numlock state. If the application needs to distinguish the keys, it can check to see whether the scancode is a numpad key or not.

This affects Lines 196-212 and 232-257 in imgui_impl_sdl3.cpp.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions