lacasanova / shortcutrecorder

Automatically exported from code.google.com/p/shortcutrecorder
0 stars 0 forks source link

Selection of F- keys not allowed, even if unassigned #24

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
ShortcutRecorder does not allow the choice of the F1 - F19 keys, even if 
they're unassigned in 
System Preferences, claiming that they're in use globally.

The reason for this is that SRValidator performs a single-character comparison 
(globalHotKeyUniChar == localHotKeyUniChar) rather than a string comparison. It 
is true that 
this character comparison is "cheaper" than whole string, but both function 
keys and number pad 
keys are composed of multiple letters.

Using the method currently in place, the check will result in something like 
"F" == "F", which is 
true, when the keys *really* being compared may be "F5" == "F6", which is false.

The solution to this is to instead compare the raw signed short values of the 
key codes. I've 
modified SRValidator for my own application, and it now validates perfectly. :)

I've attached a copy of my version of SRValidator. Pay special attention to 
lines 81 and 82 
(commented out unused variables), lines 104 and 105 (changed 
globalHotKeyCharCode to use 
shortValue rather than unsignedShortValue, and commented out character line), 
line 118 
(commented out unichar assignment), and lines 122 and 123 (changed condition to 
compare char 
codes).

Original issue reported on code.google.com by patenaud...@gmail.com on 26 Aug 2008 at 9:14

Attachments:

GoogleCodeExporter commented 8 years ago
yes, that fixed it for me.  thanks!

Original comment by david.re...@gmail.com on 4 Sep 2008 at 2:38

GoogleCodeExporter commented 8 years ago
committed in revision 33 to trunk, unsure what the purpose of the separate 
Leopard branch is at this point, if 
anyone wants to they can merge this change into the leopard branch.

Original comment by rarich...@gmail.com on 8 Sep 2008 at 10:32