Page 1 of 1

0.16.51 - Keyboard doesn't differentiate

Posted: Sun Sep 09, 2018 6:52 pm
by seePyou
I have set up some keybinds that other programs monitor. Two of these are the Control+Alt+Shift+F5 and Control+Alt+Shift+F6.
As Control+F5 and F6 already do something in Factorio, these are also triggered (F6 = detailed debug, Control+F5: GUI debug).
I have pressed control and alt and shift before I press the buttons F5 or F6 and still the debug options are triggered in game.

Re: 0.16.51 - Keyboard doesn't differentiate

Posted: Sun Sep 09, 2018 7:47 pm
by posila
Hello, Factorio has no way of knowing what keyboard shortcuts trigger some actions in 3rd party programs running in background.
Just unset F6 and Ctrl+F5 in Factorio control options.

EDIT: It occured to me that you might be suggesting that the game should not accept key inputs that have also extra keys pressed to the bound key combination.
Well, it works that way so you can do multiple things at once. For example: you can shoot while walking. Or you can shoot, walk, and control+click ammo to turrets all at the same time, etc.

Re: 0.16.51 - Keyboard doesn't differentiate

Posted: Sun Sep 09, 2018 8:06 pm
by DaleStan
I'm not sure I agree with that NaB designation. The issue (as I see it) is not whether or not some other program is bound to <ctrl+alt+shift+F5>. If Factorio says the shortcut to do a particular action is <ctrl-F5>, then only <ctrl-F5> should trigger that action. <ctrl-alt-F5>, <ctrl-shift-F5>, and <ctrl-alt-shift-F5> are different shortcuts, and should be treated as such. They should not trigger the <ctrl-F5> action.

If I were to bind all four of those shortcuts to four different Factorio actions, should all four actions happen when I type <ctrl-alt-shift-F5>? Assuming the answer is "no", what happens when I then unbind <ctrl-alt-shift-F5> (leaving the other three bindings untouched) and type <ctrl-alt-shift-F5>? Does it now suddenly do the other three actions?

Re: 0.16.51 - Keyboard doesn't differentiate

Posted: Sun Sep 09, 2018 8:14 pm
by seePyou
DaleStan wrote:I'm not sure I agree with that NaB designation. The issue (as I see it) is not whether or not some other program is bound to <ctrl+alt+shift+F5>. If Factorio says the shortcut to do a particular action is <ctrl-F5>, then only <ctrl-F5> should trigger that action. <ctrl-alt-F5>, <ctrl-shift-F5>, and <ctrl-alt-shift-F5> are different shortcuts, and should be treated as such. They should not trigger the <ctrl-F5> action.

If I were to bind all four of those shortcuts to four different Factorio actions, should all four actions happen when I type <ctrl-alt-shift-F5>? Assuming the answer is "no", what happens when I then unbind <ctrl-alt-shift-F5> (leaving the other three bindings untouched) and type <ctrl-alt-shift-F5>? Does it now suddenly do the other three actions?
Exactly that. The point is not what I have keybinds to other programs, but that Control+F5, if Control+F5 is NOT bound to anything in Factorio, should do nothing.
However, Control is also a modifier, as posila said, so maybe exclude the F keys from this? Maybe say that the F keys will have to be pressed as assigned in the game, or be ignored, so that when I press Control+Alt+Shift+F6 the game doesn't try to do an F6 and a Control+F6 and all the other combinations? If only for the F keys?

Re: 0.16.51 - Keyboard doesn't differentiate

Posted: Sun Sep 09, 2018 8:18 pm
by posila
I edited my post, but DaleStan wrote a respons in meantime.
DaleStan wrote:If I were to bind all four of those shortcuts to four different Factorio actions, should all four actions happen when I type <ctrl-alt-shift-F5>? Assuming the answer is "no", what happens when I then unbind <ctrl-alt-shift-F5> (leaving the other three bindings untouched) and type <ctrl-alt-shift-F5>? Does it now suddenly do the other three actions?
Factorio will try to match the longest shortcut with the currently pressed keys, if any keys are not "consumed" it continues in searching for other actions they might consume them. I am not sure what happens in your example of <ctrl-alt-shift-F5> is pressed and <ctrl-alt-F5>, <ctrl-shift-F5> and <ctrl-F5> are bound ... well, for sure <ctrl-F5> won't be triggered for sure, but which of <ctrl-alt-F5> and <ctrl-shift-F5> will be? I don't know ... it's possible neither of them due to ambiguity.

Re: 0.16.51 - Keyboard doesn't differentiate

Posted: Sun Sep 09, 2018 8:44 pm
by seePyou
posila wrote:I edited my post, but DaleStan wrote a respons in meantime.
DaleStan wrote:If I were to bind all four of those shortcuts to four different Factorio actions, should all four actions happen when I type <ctrl-alt-shift-F5>? Assuming the answer is "no", what happens when I then unbind <ctrl-alt-shift-F5> (leaving the other three bindings untouched) and type <ctrl-alt-shift-F5>? Does it now suddenly do the other three actions?
Factorio will try to match the longest shortcut with the currently pressed keys, if any keys are not "consumed" it continues in searching for other actions they might consume them. I am not sure what happens in your example of <ctrl-alt-shift-F5> is pressed and <ctrl-alt-F5>, <ctrl-shift-F5> and <ctrl-F5> are bound ... well, for sure <ctrl-F5> won't be triggered for sure, but which of <ctrl-alt-F5> and <ctrl-shift-F5> will be? I don't know ... it's possible neither of them due to ambiguity.
I understand what you are doing in terms of keybinds inside Factorio, but have you thought about the fact that players might need other keybinds outside of Factorio? What if I want an AutoIT keybind to trigger a script for "focus notepad, paste the blueprint, save the file in incremental order and then return to factorio"? I need to be able to give it a unique keybind that doesn't exist in the game, and these are typically with long keybinds. Factorio triggering the lesser keybind does something that I do not want to happen, as most other games have "trained" us to work; use a long keybind, nothing else triggers. I understand what you did, and why, but at the same time, Factorio is incredibly greedy of our keys if we cannot extend the combinations of keybinds. Essentially, if I want to use F5 in something else, then I better make sure that no F5 combination exists in my Factorio keybinds anywhere. Could there be a better way?

Re: 0.16.51 - Keyboard doesn't differentiate

Posted: Sun Sep 09, 2018 9:48 pm
by posila
I am sorry if that's not good enough solution. (You can completely unset key binding from an action by right clicking it in control settings)
You posted this to bug reports and I am trying to explain it works exactly as we intended to work therefore there is nothing to fix. You can post to Ideas and suggestions and if it gets some traction from community we will consider changing it, but I'm not going to change it right of the bat because, if I do, somebody else will come report that their setup got broken.

Btw. the best way would be if the application that captures the global hotkey would not pass the final key press to Factorio. Which is how for example GeForce Experience handles its global hotkeys. Strangly, AutoIT documentation (https://www.autoitscript.com/autoit3/do ... KeySet.htm) says
When you set a hotkey, AutoIt captures the key-press and does not pass it on to the active application, with one exception: the Lock keys (NumLock, CapsLock, and ScrollLock) still toggle their respective state!
so I have no idea how come Factorio still receives the key press.

Re: 0.16.51 - Keyboard doesn't differentiate

Posted: Mon Sep 10, 2018 12:00 am
by eradicator
As a long time AutoHotkey user ...ohwait, did you say AutoIt? I thought that was dead (wiki says it's not :o).

Anyway, in AutoHotkey this script works as "expected" ("alt-shift-ctrl-f6" sends "Enter"):

Code: Select all

#InstallKeybdHook
^!+F6::Enter
This does not fire F6. Though it does trigger "alt-enter". So AutoHotkey only "consumes" the final key, not the modifiers.
It would be useful to see the exact script the OP is using to get what he wants as there might be possible bugs in the script. The AHK help file for example mentions that behavior is different between using the built-in general-purpose keyboard hook, registering the hotkey directly to the OS via "RegisterHotkey", or using neither of the two (it doesn't have details about the last case).

Re: 0.16.51 - Keyboard doesn't differentiate

Posted: Mon Sep 10, 2018 10:06 am
by seePyou
That's interesting; I did not know that global keypresses can be "locked" by the application that has them assigned.
I did look and I think I found some solutions for AutoIT v3 and I will look into them.
I will also have to check why OBS doesn't do the same (I had to set the scene change to a combination of F7 as Factorio did not have anything for F7). Maybe OBS doesn't block them and passes them, and maybe I missed something in its config.
With AutoIT possibly fixed, OBS is all that is left.
Since global keybinds can be NOT passed to other applications, then the onus is on these applications, not Factorio. Thank you for making me aware of this.