Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Narrowing Down Keyboard Issues in Allegro 4.2.0

This thread is locked; no one can reply to it. rss feed Print
Narrowing Down Keyboard Issues in Allegro 4.2.0
Kris Asick
Member #1,424
July 2001

Allegro Version: 4.2.0
Compiler: MSVC++ 6.0
OS: Windows 98SE

I discovered this moments ago and can't find any fault with my code which would be causing it. For some peculiar reason, when I press either CTRL key on the keyboard, the Escape key no longer registers until I press any other key. Also, if I press either ALT key, Escape, Spacebar and Tab no longer register until I push any other key.

After thinking about this, I realized it may be related to Allegro's handling of Windows shortcuts. CTRL+ESC, ALT+TAB, ALT+SPACEBAR and ALT+ESCAPE are shortcuts which function in almost every Windows program, including my Allegro programs. I don't think that's just a random coincidence.

This problem is also occuring in all other Windows-based Allegro 4.2.0 driven applications on my computer. I don't have any DOS based Allegro 4.2.0 applications to test...

This may also explain my earlier issues with the CTRL key acting very weird in the Grabber.

--- Kris Asick (Gemini)
--- http://www.pixelships.com

--- Kris Asick (Gemini)
--- http://www.pixelships.com

Evert
Member #794
November 2000
avatar

Would it be possible for you to check the SVN version of Allegro?
This may have some fixes in to correct these problems...

Kris Asick
Member #1,424
July 2001

I don't know what you mean by the SVN version...

But, I did find the exact lines of code where the failure occurs. It's right at the start of the key_dinput_handle_scancode function in wkeybd.c:

/* ignore special Windows keys (alt+tab, alt+space, (ctrl|alt)+esc) */
if (((scancode == DIK_TAB) && (_key_shifts & KB_ALT_FLAG))
    || ((scancode == DIK_SPACE) && (_key_shifts & KB_ALT_FLAG))
    || ((scancode == DIK_ESCAPE) && (_key_shifts & (KB_CTRL_FLAG | KB_ALT_FLAG))))
   return;

My guess is that for some reason, the flags for ALT and CTRL aren't going away when CTRL or ALT are released, but rather go away when another key is pressed. I'm further looking through the Allegro source to see if I can't figure out why...

--- Kris Asick (Gemini)
--- http://www.pixelships.com

--- Kris Asick (Gemini)
--- http://www.pixelships.com

Milan Mimica
Member #3,877
September 2003
avatar

Kris Asick
Member #1,424
July 2001

I looked through the SVN changelogs and found some interesting things. Among them was this refreshing entry in the 4.3 log:

Quote:

r4574 | tjaden | 2004-10-11 03:13:37 +0200 (Mon, 11 Oct 2004) | 2 lines

Fixed a bug in the new Windows keyboard driver where some keys (such as Escape) would not be registered if the previous key pressed was a modifier key

So I guess that problem is solved for 4.3.0, but I found a couple other interesting entries in the 4.2 log:

Quote:

r4538 | eglebbk | 2004-10-03 12:58:00 +0200 (Sun, 03 Oct 2004) | 2 lines

Peter Wang fixed the shift key toggeling the CapsLock led in Windows

That still happens on my system...

Quote:

r5365 | tjaden | 2005-08-27 03:31:24 +0200 (Sat, 27 Aug 2005) | 4 lines

Elias patched the Windows keyboard driver to get key_shifts & KB_SHIFT_FLAG,
key_shifts & KB_CTRL_FLAG, key_shifts & KB_ALT_FLAG working again on Win98.
Untested yet on Win98 but reportedly does not break under Windows XP.

Hmm... I wonder if that's why the flags seem to lock in until another key is pushed on Windows 98?

shrugs

At four in the morning I'm definitely way over my head in this. I ignore the key-shift features anyways so as long as the keyboard will respond correctly no matter what keys are pushed in what order in 4.3.0 as stated above, I'm happy. :)

--- Kris Asick (Gemini)
--- http://www.pixelships.com

--- Kris Asick (Gemini)
--- http://www.pixelships.com

Arthur Kalliokoski
Second in Command
February 2005
avatar

I had win98 a few months ago and stuck with Allegro 4.0.3 because the keyboard stuff was so broken. I didn't really think it was that different as long as you didn't try to end windowed progs by clicking on the 'X' on the titlebar.

This isn't meant as a slur on Allegro developers, IIRC they don't have win9x machines in abundance for testing (or any windows boxes in general):)

They all watch too much MSNBC... they get ideas.

Evert
Member #794
November 2000
avatar

Can someone check if the problem is still there in 4.2 SVN?
If so, can someone backport the fix from 4.3 (if it's related at all)?

Andrei Ellman
Member #3,434
April 2003

I've posted a test-program that demonstrates this problem on the [AD] list at: http://sourceforge.net/mailarchive/forum.php?thread_id=10260792&forum_id=34598

In Allegro 4.2, the problem occurs in Windows 2000 and Windows 98, but not in DOS.

Incidentally, this problem manifests itself in the grabber when you sometimes end up selecting multiple objects when you just want to select one.

AE.

--
Don't let the illegitimates turn you into carbon.

A J
Member #3,025
December 2002
avatar

Is windwows stealing your key presses before they occur ?

Compare the fullscreeen with teh windowed mode, are they the same ?

___________________________
The more you talk, the more AJ is right. - ML

Andrei Ellman
Member #3,434
April 2003

I just tried my test-app in both fullscreen and windowed modes. In both cases, the same thing happens. The 'stuck' CTRL key prevents 'ESC' from being registered.

AE.

--
Don't let the illegitimates turn you into carbon.

Go to: