Fix #109525: Improved Win32 Repeat Key Filtering #109991

Merged
Harley Acheson merged 1 commits from Harley/blender:WinModifiers into main 2023-07-12 20:55:06 +02:00
Member

Allows Win32 key repeat filtering to support multiple simultaneously
repeating keys, as can happen with modifiers. Removes
m_keycode_last_repeat_key and instead checks current down status.


We detect repeating keys and attempt to filter out repeating modifier keypresses, like Shift, Alt, Ctrl. But we don't currently filter properly when there are multiple keys repeating at once.

We are currently storing the last key pressed, and then comparing the next key against that to determine if we are repeating. However this doesn't work when we have multiple keys repeating at once, for example when holding down combinations of Shift, Ctrl, and Alt. These repeated keydown events don't come in the expect order and every time a different one comes in we fail to filter it. This results in the majority of events not being filtered when they involve multiple modifiers together.

To fix this the m_keycode_last_repeat_key is removed. Instead key repeat detection just uses the state as it is in the thead's event queue. If the incoming event is key_down we use GetKeyState to see if that key is already known to be down. If yes it is repeating.

Note that an earlier version of the PR included functionality that has been moved out into #110020 to make it easier to track these changes separately.

Allows Win32 key repeat filtering to support multiple simultaneously repeating keys, as can happen with modifiers. Removes m_keycode_last_repeat_key and instead checks current down status. --- We detect repeating keys and attempt to filter out repeating modifier keypresses, like Shift, Alt, Ctrl. But we don't currently filter properly when there are multiple keys repeating at once. We are currently storing the last key pressed, and then comparing the next key against that to determine if we are repeating. However this doesn't work when we have multiple keys repeating at once, for example when holding down combinations of Shift, Ctrl, and Alt. These repeated keydown events don't come in the expect order and every time a different one comes in we fail to filter it. This results in the majority of events not being filtered when they involve multiple modifiers together. To fix this the `m_keycode_last_repeat_key` is **removed**. Instead key repeat detection just uses the state as it is in the thead's event queue. If the incoming event is key_down we use `GetKeyState` to see if that key is already known to be down. If yes it is repeating. Note that an earlier version of the PR included functionality that has been moved out into #110020 to make it easier to track these changes separately.
Campbell Barton approved these changes 2023-07-12 01:29:27 +02:00

This looks good, minor requests:

  • Split the Alt-Tab on Windows-10 (22H2) removal into a separate commit - to make it simpler to bisect if the error ever returns (other applications also run into this from checking on-line, so it's possible the problem persists depending on the version of windows).
  • Include some details in the commit log (that m_keycode_last_repeat_key is removed & why).
  • The commit subject mentions refactoring repeat events, but I'm still unclear on what was failing exactly, and what this change fixes - although I can guess it's related to repeat events not working properly.
This looks good, minor requests: - Split the `Alt-Tab on Windows-10 (22H2)` removal into a separate commit - to make it simpler to bisect if the error ever returns (other applications also run into this from checking on-line, so it's possible the problem persists depending on the version of windows). - Include some details in the commit log (that `m_keycode_last_repeat_key` is removed & why). - The commit subject mentions refactoring repeat events, but I'm still unclear on what was failing exactly, and what this change fixes - although I can guess it's related to repeat events not working properly.
Harley Acheson force-pushed WinModifiers from 9ab65e73df to 1759164f28 2023-07-12 20:39:51 +02:00 Compare
Harley Acheson changed title from Fix #109525: Refactor of Win32 Repeat and Multi-Window Modifiers to Fix #109525: Improved Win32 Repeat Key Filtering 2023-07-12 20:40:36 +02:00
Harley Acheson merged commit 65e8b21a95 into main 2023-07-12 20:55:06 +02:00
Harley Acheson deleted branch WinModifiers 2023-07-12 20:55:08 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#109991
No description provided.