AutoHotkey Community

It is currently May 27th, 2012, 12:49 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: June 20th, 2011, 4:21 pm 
Offline
User avatar

Joined: May 10th, 2007, 10:54 am
Posts: 649
Location: .switzerland
Mr Seidenweber detected a very strange behaviour of AHK.
Issue was reported in the German forum: http://de.autohotkey.com/forum/viewtopic.php?t=8765

Issue
Deadkeys, which are very often used in the German Keyboard layout, partially disappear.
That means for example, pressing [¨] + [A] which should result in "Ä" gives an standard "A".
Pressing [¨]+[A] very often does sometimes let some "¨" pass to give an "Ä".
This applies similar to all dead keys.

I assume that this is caused by a race condition in the Keyboardhook from Autohotkey, or something similar.

How to reproduce
Under the following conditions this is reproducible:
  • At least two separate Scripts running, which both of it use at least one hotstring definition.
    like:
    Code:
    ::qqq::huhu

  • AHK 1.1 (Unicode) or AHK Basic (1.0.48.05 -... Ascii - for the cake :} ) both behave similar
  • Confirmed configs: Win 7, 64bit + 32 bit, with AHK Versions listed above


Current Workaround
Ensure that all your Hotstring-Definitions are in the same script.

_________________
http://securityvision.ch
AHK 2D GAME ENGINE


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 20th, 2011, 6:39 pm 
Offline

Joined: May 10th, 2011, 10:17 pm
Posts: 30
Location: Germany
I think, this issue isn't only related to German users. Almost every keyboard uses deadkeys, because all over the European languages there are about 160+ diacritical signs/types in use.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 6th, 2011, 2:09 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
While AutoHotkey is collecting input for either the Input command or hotstring detection, it uses ToAsciiEx or ToUnicodeEx to convert each keystroke to the appropriate character. These functions handle dead keys, but they do so in a way that interferes with regular keyboard input. AutoHotkey worked around this by re-sending the dead key when the second key in the sequences is about to be passed on to the system. However, as you've found, this did not work correctly when multiple scripts are involved.

I believe I've solved the problem with v1.1.02. While searching for a solution I found many other people asking the same question with no direct answer, so I'm posting these comments from the source code "out here in the open" in the hopes it may help someone in the future:
Quote:
SUMMARY OF DEAD KEY ISSUE:
Calling ToAsciiEx() on the dead key itself doesn't disrupt anything. The disruption occurs on the next key
(for which the dead key is pending): ToAsciiEx() consumes previous/pending dead key, which causes the
active window's call of ToAsciiEx() to fail to see a dead key. So unless the program reinserts the dead key
after the call to ToAsciiEx() but before allowing the dead key's successor key to pass through to the
active window, that window would see a non-diacritic like "u" instead of û. In other words, the program
"uses up" the dead key to populate its own hotstring buffer, depriving the active window of the dead key.
...
Lexikos: Testing shows that calling ToUnicodeEx with the VK/SC of a dead key
acts the same as actually pressing that key. Calling it once when there is
no pending dead key places the dead key in the keyboard layout's buffer and
returns -1; calling it again consumes the dead key and returns either 1 or 2,
depending on the keyboard layout. For instance:
- Passing vkC0 twice with US-International gives the string "``".
- Passing vkBA twice with Neo2 gives just the combining version of "^".

Normally ToUnicodeEx would be called by the active window (after the hook
returns), thus placing the dead key in the buffer. Since our call above
has already done that, we need to remove the dead key from the buffer
before returning. [...]
[Call ToUnicodeEx again with the same parameters.]
...
Since our call to ToUnicodeOrAsciiEx above has removed the pending dead key from the
buffer, we need to put it back for the active window or the next hook in the chain:
[Call ToUnicodeEx with the original dead key VK/SC.]


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher and 3 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group