diff --git a/Controls/pdAccelerator.ctl b/Controls/pdAccelerator.ctl index a2c769fd0..3a13cc537 100644 --- a/Controls/pdAccelerator.ctl +++ b/Controls/pdAccelerator.ctl @@ -516,32 +516,31 @@ Friend Function KeyboardHookProcAccelerator(ByVal nCode As Long, ByVal wParam As ' that are full transitions from "Unpressed" to "Pressed" or vice-versa. (The byte masks here ' all come from MSDN - check the link above for details!) ' - 'TODO: some hotkeys (like brush size up/down) would actually benefit from key repeat behavior. - ' This line needs to be revisited accordingly! - If ((lParam >= 0) And ((lParam And &H40000000) = 0)) Or ((lParam < 0) And ((lParam And &H40000000) <> 0)) Then - - 'We now want to check two things simultaneously. First, we want to update Ctrl/Alt/Shift - ' key state tracking. (This is handled by a separate function.) If something other than - ' Ctrl/Alt/Shift was pressed, *and* this is a keydown event, let's look for hotkey matches. - ' - '(How do we detect keydown vs keyup events? The first bit (e.g. "bit 31" per MSDN) of lParam - ' defines key state: 0 means the key is being pressed, 1 means the key is being released. - ' Note the similarity to the transition check, above.) - If (lParam >= 0) And (Not UpdateCtrlAltShiftState(wParam, lParam)) Then - - 'Before proceeding with further checks, see if PD is even allowed to process accelerators - ' in its current state (e.g. if a modal dialog is active, we don't want to raise events) - If CanIAccumulateAnAccelerator Then + '(Update 2024: some hotkeys (like brush size up/down) actually benefit from key repeat behavior. + ' To enable this, I removed the old transition state check. If for some reason we need to enable + ' it in the future, use the boolean calculation below.) + 'Dim keyTransitionState As Boolean + 'keyTransitionState = ((lParam >= 0) And ((lParam And &H40000000) = 0)) Or ((lParam < 0) And ((lParam And &H40000000) <> 0)) + + 'We now want to check two things simultaneously. First, we want to update Ctrl/Alt/Shift + ' key state tracking. (This is handled by a separate function.) If something other than + ' Ctrl/Alt/Shift was pressed, *and* this is a keydown event, let's look for hotkey matches. + ' + '(How do we detect keydown vs keyup events? The first bit (e.g. "bit 31" per MSDN) of lParam + ' defines key state: 0 means the key is being pressed, 1 means the key is being released. + ' Note the similarity to the transition check, above.) + If (lParam >= 0) And (Not UpdateCtrlAltShiftState(wParam, lParam)) Then + + 'Before proceeding with further checks, see if PD is even allowed to process accelerators + ' in its current state (e.g. if a modal dialog is active, we don't want to raise events) + If CanIAccumulateAnAccelerator Then + + 'All checks have passed. We'll handle the actual keycode evaluation matching in another function. + msgEaten = HandleActualKeypress(nCode, wParam, lParam) - 'All checks have passed. We'll handle the actual keycode evaluation matching in another function. - msgEaten = HandleActualKeypress(nCode, wParam, lParam) - - End If - - '/Ctrl/Alt/Shift was pressed End If - '/Key is not in a transitionary state + '/Ctrl/Alt/Shift was pressed End If '/nCode negative diff --git a/PhotoDemon.vbp b/PhotoDemon.vbp index 97e7234bf..cfa1ca0c2 100644 --- a/PhotoDemon.vbp +++ b/PhotoDemon.vbp @@ -528,7 +528,7 @@ Description="PhotoDemon Photo Editor" CompatibleMode="0" MajorVer=2024 MinorVer=8 -RevisionVer=24 +RevisionVer=25 AutoIncrementVer=1 ServerSupportFiles=0 VersionComments="Copyright 2000-2024 Tanner Helland - photodemon.org"