Keyboard ctrl key state behaves erractically

If reporting a bug with the Zeus IDE please post the details here. Please do not post questions here.
Post Reply
David Morris
Posts: 33
Joined: Tue Jun 21, 2005 4:07 am
Location: Perth, Western Australia
Contact:

Keyboard ctrl key state behaves erractically

Post by David Morris »

Hi Jussi

This is a follow up to a problem I reported privately to you some time back. At the time we thought that is was likely to be an artefact of the KVM I was using, but I am no longer so sure.

I am using Version 3.95s.

Problem: When coming back to editing in Zeus after using some other program, the ctrl key state in Zeus appears not to reflect the keyboard state, so that typing a some control characters, for example "Enter" creates a small box rather than a line feed and carriage return.

No other program I use does this (as far as I can tell), hence my conclusion that it is not the KVM.

This seems to happen especially when the last action carried out in another program is to minimise the other application. This seems almost is repeatable if the other application is Outlook Express. I have also seen the effect with MS Access 95. Though in this case clicking on the Zues current edit window seems to activate the navigator Windows, rather than cause the little boxes when typing.

The work around seems to be to double click back in the offending application, and then double click in the Zeus edit window.

While not 100% repeatable it does seems to be more than 50% repeatable now... so obviously this is getting to be a bit of a pain...

Otherwise, my productivity has improved with Zeus. :)

regards DM
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Hi David,
Problem: When coming back to editing in Zeus after using some other program, the ctrl key state in Zeus appears not to reflect the keyboard state, so that typing a some control characters, for example "Enter" creates a small box rather than a line feed and carriage return.

This is what I think is happening.

The appearance of the small box means the keyboard key stroke was passed to the default key processing and inserted into the document as a plain character. Because one of the Ctrl,Shift or Alt extended keys is somehow in a down state an extended character (i.e. displayed as a square character) gets inserted into the document.

This effect is exactly the same as if the keyboard was working fine and a key was pressed while holding down one of these extended keys.

The reason the Enter function does not triggered is because as far as Zeus is concerned one of the Ctrl,Shift or Alt extended keys and the Enter key have been pressed. This keyboard combination does not map to any keyboard function, and as such it is passed on to the default keyboard processing.

Now what is confusing is that Zeus does not hold the state of the keyboard internally, but rather gets all the keyboard information from the actual keyboard message or from Windows itself.

So I can only explain this behaviour by assuming that Windows somehow thinks the Ctrl,Shift or Alt keys are stuck down :?
No other program I use does this (as far as I can tell), hence my conclusion that it is not the KVM.

I think the problem directly relates to some sort of corruption of the keyboard state information held within the driver or within Windows itself.

The big unkown question is what is the cause of this corruption and how to stop it :?:
The work around seems to be to double click back in the offending application, and then double click in the Zeus edit window.

I only ever recall seeing this problem using Zeus on a machine with a KVM and on these occasions I found that a random selection of a dozen or so rapid Ctrl,Shift or Alt keystrokes returns the keyboard to its correct state.
While not 100% repeatable it does seems to be more than 50% repeatable now...

If you think you have a set of exact steps (i.e. start Zeus, start Office, Click on Zeus in taskbar etc) based on Zeus, Outlook or any other Office applications, I would be more than happy to try to replicate the bug at this end :)
so obviously this is getting to be a bit of a pain...

I too would love to know the exact reason for the problem but I still suspect it is KVM related :?

Cheers Jussi
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Why I think this is a KVM issue :wink: Cheers Jussi
Last edited by jussij on Wed Feb 08, 2006 5:59 am, edited 2 times in total.
David Morris
Posts: 33
Joined: Tue Jun 21, 2005 4:07 am
Location: Perth, Western Australia
Contact:

Post by David Morris »

jussij wrote: If you think you have a set of exact steps (i.e. start Zeus, start Office, Click on Zeus in taskbar etc) based on Zeus, Outlook or any other Office applications, I would be more than happy to try to replicate the bug at this end :)


This seems to be happening pretty much every time.

1) Start computer.
2) When booted into Win2K
3) Start Outlook Express as a normalised window.
4) (Do something in outlook express).
5) Start Zeus normalise window, open a document, enter some characters.
6) Go back to Outlook Express, do something and minimise.
7) Click in the open document in Zeus, and press enter to see the square.

My think, is that if it is a hardware/windows driver problem every application should be experiencing it. It might still be KVM related, but I am thinking (assuming this is not a common problem) KVM or some driver related in combination with MFC, say somehow MFC is failing to hold the state between applications.

The real culprit seems to be Outlook Express and Zues together. I failed to replicate the Access problem when I last tried.

Is this only on my KVM machine? Or am I one of the few using Outlook Express?

regards DM
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Hi David,

On a Windows XP machine with no KVM, I was able to switch at will between Microsoft Outlook (not Express) and Zeus as described, without any issues.

I will try to replicate this on a machine with a KVM.
in combination with MFC, say somehow MFC is failing to hold the state between applications.

As it so happens Zeus in not written in MFC, but rather it written in pure Win32 :wink:
Is this only on my KVM machine? Or am I one of the few using Outlook Express?

What happens if you do the Ctrl, Alt, Shift trick descibed here :?:

Does this fix up the keyboard state :?:

Cheers Jussi
David Morris
Posts: 33
Joined: Tue Jun 21, 2005 4:07 am
Location: Perth, Western Australia
Contact:

Post by David Morris »

jussij wrote: What happens if you do the Ctrl, Alt, Shift trick descibed here :?:
Does this fix up the keyboard state :?:
Not a thing (except to active the menu with every second alt key strike). Interestingly, I had though I really could replicate the problem, but for a while there I couldn't get the problem to occur even when I did minimise. It was kind of odd having it work correctly. However I did notice that the focus returned to the Navigator, rather than the active window.

Since I haven't been able to cause the problem with anything else other than Outlook Express today, I am wondering if it is just that application?

Also, the reason I though you were using MFC was because of some code you showed me when were last discussing the issue. That is the problem with these sorts of issues, it is too easy to make assumptions! ;) So going with the making assumptions theme, is there any possibility you are sharing a Window Class name or something like it with one in Outlook? :)

regards DM
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Not a thing (except to active the menu with every second alt key strike).

The key sequence for the fix is not just hitting one key at a time but rather holding down Ctrl, then holding down Alt and finally holding down Shift key. Then release all three keys.

Repeat this sequence in rapid succession, using both left and right sets of Ctrl and Alt keys.

Cheers Jussi
David Morris
Posts: 33
Joined: Tue Jun 21, 2005 4:07 am
Location: Perth, Western Australia
Contact:

Post by David Morris »

jussij wrote: Repeat this sequence in rapid succession, using both left and right sets of Ctrl and Alt keys.
I tried this too, and it didn't make any difference. I clicked back on Firefox to view the instructions you gave above, and when I returned to Zeus the problem when away.

(I have noticed that on some occasions the Navigator windows seems to be activated before the current edit window is reactivated.)

In terms of chasing bugs, why is it that only Zeus has the problem with the keyboard state and not other applications? I have no hanging (suggested by the links above), and a click or double click elsewhere seems to fix it (rather than the gymnastics of trying to press those keys on the right hand side of the KB!). Does any of this help?

regards DM
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

This is why I think the problem is with the KVM and not Zeus:
  1. As far as I remember, I have only ever seen the bug on a machine using a KVM.
  2. I have seen the exact same bug on a machine running nothing but MSVC++. It was in fact the C++ programmer using MSVC++ who told me of the Ctl+Alt+Shift fix.
  3. The keyboard code in Zeus is about seven years old and has changed very little (if at all) over this time, yet only just recently (ie the last 2 years) has this bug been reported.
  4. Over this time the there have been very few reports of this bug (half a dozen or so).
  5. There are similar reports of similar KVM problems by users not even using Zeus.
The bug is very hard to reproduce which makes it very hard to debug, which makes it almost impossible to fix :(

I have no doubt that Zeus is causing the problem, in the sense that, as a keyboard editor it makes extensive use of the Ctl+Alt+Shift keys. My suspicion is some strange key combination with a particular timing pattern causing the KVM to loose its way. Other programs do not trigger the problem becuase they do not use these keys in the same way.

But naturally if you can reproduce this bug at will, it is very easy to prove this theory, one way or another. All you would need do is unplug the KVM and if you can then reproduce the bug with a direct keyboard connection then of course the problem is not the KVM :wink:

Cheers Jussi
David Morris
Posts: 33
Joined: Tue Jun 21, 2005 4:07 am
Location: Perth, Western Australia
Contact:

Post by David Morris »

jussij wrote: But naturally if you can reproduce this bug at will, it is very easy to prove this theory, one way or another. All you would need do is unplug the KVM and if you can then reproduce the bug with a direct keyboard connection then of course the problem is not the KVM :wink:
You are of course not going to believe me but...

I have done just that. After considerable fiddling about (trying various keyboards - the USB one didn't work, while on the other PS/2 KB the keys were too spongy - and the reboots took forever), I ended up using the original KB (DIAMOND TOUCH standard PS/2 AT layout with the Window key - but nothing more), and the same brand of mouse (MS OEM Optical), direct to the work PC bypassing the KVM. (The monitor is still being driven by the KVM).

To be honest I was about 80% convinced that you were right, and that it was some sort of timing problem that the KVM exacerbated.

However, I replicated the problem first time in pretty much the same steps that I showed about. Now, I guess this could mean that I have a broken KB or a driver problem or some Key logging malware or something, but I am now about 95% convinced that it is a Zeus MS outlook interaction problem. (I have run both Spybot and Adaware and found nothing suss BTW).

For completeness my system is:

Intel D865PERL Mb, P4 2.67 Hhz, 512Mb Ram, Windows 2000 Service pack 4 build 2195 with all patches applied. I am running a minimum of extra software (but this is my work day machine - so I still have a few things installed). I'll provide more info if you need it.

I acknowledge that this could still be a system related problem, but since I have replicated the problem without a KVM, I think you need to take this more seriously. ;)

I probably should have done this a few days ago, but as you might have gathered by my typos in the messages above, I have been a tad busy and distracted by other issues. :)

regards DM
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

However, I replicated the problem first time in pretty much the same steps that I showed about.

That is interesting.
Now, I guess this could mean that I have a broken KB or a driver problem

The unfortunate thing is the problem is very difficult to isolate.

I have been running Zeus for over a year on a HP PC running Windows XP with no KVM and to date I have never experienced this problem. But I have seen the some half a dozen times on two other generic brand PC.

Now that you have proved the KVM is not the cause I fresh out of ideas as to what triggers the bug :(
I acknowledge that this could still be a system related problem, but since I have replicated the problem without a KVM, I think you need to take this more seriously.
I do take the problem seriously. When I first ran into the issue I spent a few days inspecting of the Zeus keyboard handling code looking for problems.

But as far as I can tell the keyboard handling code looks fine.

It is very difficult to try and fix the code when I can't see anything wrong with it :(

At this stage all I can do is have another look at the code and do internet searching to see if I can find reason for this problem.

What I might also do is add some tracing messages into the keyboard handling code. I could then send you a test executable to see if this tracing information can help identify the problem.

Cheers Jussi
David Morris
Posts: 33
Joined: Tue Jun 21, 2005 4:07 am
Location: Perth, Western Australia
Contact:

Post by David Morris »

jussij wrote:What I might also do is add some tracing messages into the keyboard handling code. I could then send you a test executable to see if this tracing information can help identify the problem.
I would be keen to help in any way that is reasonable.

regards DM
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

With the help of David this problem was identified as a focus issue caused when the navigator dialog was used in the undocked state, rather than the KVM issue described above.

While I suspect the KVM issue still exists, this focus bug has now been fixed in the latest Zeus patch: http://www.zeusedit.com/forum/viewtopic.php?t=328

Cheers Jussi
Post Reply