Browse Source

Backends: Allegro5: fixed missing support for ImGuiKey_PrintScreen under Windows.

ocornut 5 days ago
parent
commit
02f654cbce
2 changed files with 8 additions and 0 deletions
  1. 6 0
      backends/imgui_impl_allegro5.cpp
  2. 2 0
      docs/CHANGELOG.txt

+ 6 - 0
backends/imgui_impl_allegro5.cpp

@@ -21,6 +21,7 @@
 
 // CHANGELOG
 // (minor and older changes stripped away, please see git history for details)
+//  2025-08-12: Inputs: fixed missing support for ImGuiKey_PrintScreen under Windows, as raw Allegro 5 does not receive it.
 //  2025-08-12: Added ImGui_ImplAllegro5_SetDisplay() function to change current ALLEGRO_DISPLAY, as Allegro applications often need to do that.
 //  2025-07-07: Fixed texture update broken on some platforms where ALLEGRO_LOCK_WRITEONLY needed all texels to be rewritten.
 //  2025-06-11: Added support for ImGuiBackendFlags_RendererHasTextures, for dynamic font atlas. Removed ImGui_ImplSDLGPU3_CreateFontsTexture() and ImGui_ImplSDLGPU3_DestroyFontsTexture().
@@ -679,6 +680,11 @@ void ImGui_ImplAllegro5_NewFrame()
     io.DeltaTime = bd->Time > 0.0 ? (float)(current_time - bd->Time) : (float)(1.0f / 60.0f);
     bd->Time = current_time;
 
+    // Allegro 5 doesn't receive PrintScreen under Windows
+#ifdef _WIN32
+    io.AddKeyEvent(ImGuiKey_PrintScreen, (::GetAsyncKeyState(VK_SNAPSHOT) & 0x8000) != 0);
+#endif
+
     // Setup mouse cursor shape
     ImGui_ImplAllegro5_UpdateMouseCursor();
 }

+ 2 - 0
docs/CHANGELOG.txt

@@ -47,6 +47,8 @@ Other Changes:
   setups/drivers. (#8770, #8465)
 - Backends: Allegro5: Added ImGui_ImplAllegro5_SetDisplay() function to 
   change current ALLEGRO_DISPLAY, as Allegro applications often need to do that.
+- Backends: Allegro5: Fixed missing support for ImGuiKey_PrintScreen
+  under Windows, as raw Allegro 5 does not receive it.
 
 
 -----------------------------------------------------------------------