799 posts
Location
Land of Meh
Posted 21 April 2014 - 09:48 AM
Versions:
MacOSX 10.9.2
Java 6
Minecraft 1.6.4
ComputerCraft 1.63
Testing on advanced computer
Description and steps to reproduce:
When holding down the control key on the keyboard (can only test the left side, don't have one on the right side on my laptop's keyboard), pressing a letter or number key (ones that fire a char event), I expected a key event and a char event to fire, but I instead only got the key event. For example, pressing "n" fires "char n", and "key 49". Holding control and pressing n fires "key 29" (pressing down control), and "key 49". No char event.
This also occurs with the alt key. The command key, tab key, function key, and delete key work as expected (firing both key and char events).
Not sure if this is mac specific, or occurs with other OSes too. Also occurs in CC 1.58.
1610 posts
Posted 21 April 2014 - 11:35 AM
Versions:
MacOSX 10.9.2
Java 6
Minecraft 1.6.4
ComputerCraft 1.63
Testing on advanced computer
Description and steps to reproduce:
When holding down the control key on the keyboard (can only test the left side, don't have one on the right side on my laptop's keyboard), pressing a letter or number key (ones that fire a char event), I expected a key event and a char event to fire, but I instead only got the key event. For example, pressing "n" fires "char n", and "key 49". Holding control and pressing n fires "key 29" (pressing down control), and "key 49". No char event.
This also occurs with the alt key. The command key, tab key, function key, and delete key work as expected (firing both key and char events).
Not sure if this is mac specific, or occurs with other OSes too. Also occurs in CC 1.58.
I believe this is intended as the char event is to pick up visible characters. Therefore, when you hold shift and press "1", you don't get a char events for "1", but instead "!".
Edited on 21 April 2014 - 09:36 AM
799 posts
Location
Land of Meh
Posted 21 April 2014 - 02:03 PM
I believe this is intended as the char event is to pick up visible characters. Therefore, when you hold shift and press "1", you don't get a char events for "1", but instead "!".
But control shouldn't modify the pressed key (unlike shift)? It's like the command key on mac - which does trigger the char event. Control shouldn't be any different.
7083 posts
Location
Tasmania (AU)
Posted 21 April 2014 - 02:37 PM
Hrm.
If I go into eg Notepad and hit Ctrl/Alt+anything, no characters are typed into the document. I'd assume TextEdit on your Mac is the same with Cmd/Alt+anything.
I'm kinda inclined to see the bug as "Cmd+keys fires char events", not "Ctrl/Alt+keys don't". ;)/>
It also strikes me that the current behaviour would make it a lot easier to determine if certain combos are being pressed.
51 posts
Posted 01 May 2014 - 01:58 PM
If a keyboard receives a Modifier key event (Ctrl, Alt or Shift press), it will wait for a valid key combination before it returns. This is useful and intended. Lets take Ctrl+Alt+Delete as example. We don't want to fire a Delete event, that could end up with deleted files. So instead, Ctrl+Alt+Delete is fired as a single event. Programs looking if Ctrl, Alt or Delete only events won't receive any. Now for ComputerCraft. ComputerCraft (or Lua) has a coroutine.yield() function. in ComputerCraft, coroutine.yield is (most likely, I dont have the source code) programmed to return single key events and convert them into numbers. Key combinations are not programmed, expect for Ctrl+S, Ctrl+R, Ctrl+T. This is, again, intended, as we dont want to fire events when key combinations like Ctrl+Alt+Delete are pressed.
2447 posts
Posted 01 May 2014 - 09:30 PM
CC is very much at the mercy of LWJGL's handling of this. A char event will not get passed, as no character is passed to Minecraft. Not a bug!
995 posts
Location
Canada
Posted 04 May 2014 - 10:21 PM
But could Dan not make it so that Command/Windows/Whatever key doesn't fire a char event, looking at this from Bomb Bloke's perspective?
1610 posts
Posted 05 May 2014 - 01:46 PM
But could Dan not make it so that Command/Windows/Whatever key doesn't fire a char event, looking at this from Bomb Bloke's perspective?
It's probably possible to convert it to a character event, but this way helps determine if the user is trying to type or trying to use a key combo.