mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-10 19:03:30 +00:00
Backends: Win32: ImGuiKey_PrintScreen key down event not emitted. #6859
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#6859
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Version/Branch of Dear ImGui:
Version: 1.89.4 WIP (18931)
Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_dx12.cpp + imgui_impl_win32.cpp
Compiler: Visual Studio (Version 17.7.4)
Operating System: Windows 11.
My Issue/Question:
"PrintScreen" (
VK_SNAPSHOT) key event is ignored by ImGui.Windows only sends
WM_KEYUPwhen "PrintScreen" key is pressed and no previousWM_KEYDOWNevent is triggered. As a result, "PrintScreen" key-up event is just ignored byImGui_ImplWin32_AddKeyEvent.We can reproduce this issue using ImGui Demo. In the Inputs section, we press PrintScreen, and no key event is logged:

Windows does not send WM_KEYDOWN for VK_SNAPSHOT, only WM_KEYUP. Workarounds in Windows backend are necessary.
One way to deal with missing message I found is:
https://gamedev.net/forums/topic/693260-vk_snapshot-and-keydown/5361602/
Another is to synthesise key down, when recieving key up.
Hi @thedmd
Yes, I did the second workaround:
A PR for the backend would be appreciated, particularly if we can received the Down event at the right time.
I investigated and realized both GLFW and SDL did the same thing: synthetize key-down at the time for key-up, for this special key. So going along and implementing the same unperfect workaround. Pushed
12ee2dd. Thanks!