| 766 | |
| 767 | |
| 768 | input_type *InputRelease(input_type *aInput) |
| 769 | { |
| 770 | if (!aInput) |
| 771 | return NULL; |
| 772 | // Input should already have ended prior to this function being called. |
| 773 | // Otherwise, removal of aInput from the chain will end input collection. |
| 774 | if (g_input == aInput) |
| 775 | g_input = aInput->Prev; |
| 776 | else |
| 777 | for (auto *input = g_input; ; input = input->Prev) |
| 778 | { |
| 779 | if (!input) |
| 780 | return NULL; // aInput is not valid (faked AHK_INPUT_END message?) or not active. |
| 781 | if (input->Prev == aInput) |
| 782 | { |
| 783 | input->Prev = aInput->Prev; |
| 784 | break; |
| 785 | } |
| 786 | } |
| 787 | |
| 788 | // Ensure any pending use of aInput by the hook is finished. |
| 789 | WaitHookIdle(); |
| 790 | |
| 791 | aInput->Prev = NULL; |
| 792 | if (aInput->ScriptObject) |
| 793 | { |
| 794 | Hotkey::MaybeUninstallHook(); |
| 795 | if (aInput->ScriptObject->onEnd) |
| 796 | return aInput; // Return for caller to call OnEnd and Release. |
| 797 | aInput->ScriptObject->Release(); |
| 798 | aInput->ScriptObject = NULL; |
| 799 | g_script.ExitIfNotPersistent(EXIT_EXIT); // In case this InputHook was the only thing keeping the script running. |
| 800 | } |
| 801 | return NULL; |
| 802 | } |
| 803 | |
| 804 | |
| 805 | input_type *InputFind(InputObject *object) |
no test coverage detected