I wouldn't bother with this NOLEGACY thing, but if you really want to fix it I think it should probably be done in queue_hardware_message: as far as I can tell, ll-hooks should still called in all cases.
My main goal is to remove the dependency of `queue_keyboard_message` on `current` in a way that at least doesn't make anything worse (and ideally improves things if the work is not too much of tangent). I am fine with going with the simplest approach possible, but I am not sure what trade-off (in terms of correctness and/or complexity) would be preferable. Some notes about a few options discussed before:
1. Adding `!current` check: it will lead to legacy messages during key repetition (assuming we don't set `current` when repeating) 2. Saving and restoring `current` for key repeat: we will need to handle `current` being destroyed, but also checking `current`/sender is not correct as we discussed. 3. Using `foreground` instead of `current`: Possibly good enough, although still not strictly correct. 4. NOLEGACY logic in queue_hardware_message: Not straightforward due to interactions with the hotkey and message altering logic earlier in the function (but, complexity aside, indeed seems to be a good way forward for a proper fix).
What would be the simplest approach that you would find acceptable in the context of this MR?
Perhaps we could store the `(no)legacy` flag as part of the keyrepeat info, and consult that for all repeats instead of checking the device again?