Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » 4.2b2 keyb bug

This thread is locked; no one can reply to it. rss feed Print
4.2b2 keyb bug
A J
Member #3,025
December 2002
avatar

scancodes are wrong.
in 4.1.18 /examples/exkeys 'alt-a' and 'a' are different scan codes.
in 4.1.20b2 /examples/exkeys shows them returning the same scan code.

winXP sp1
msvc7.1

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

Arthur Kalliokoski
Second in Command
February 2005
avatar

The BIOS in real mode has a similar function to return scancode and ascii value, and the scancode is always the same for a given key, e.g. just the 'a' key returns (i forget the specific values, stick in some randoms here) 0x2361 and Alt-A returns 0x2300, Control A would be 0x2301.

However, I was playing with the excamera example and noticed that pressing the Y key, shifted or not, always increased the "altitude".

Then I tried a short little test proggie with something like:

while(1)
{
textprintf_ex(screen,...,"%X",keyshifts);
if(key[KEY_ESC]) break;
}

and NONE of the control-shift-alt keys changed it from 0x200, although pressing the Shift Lock toggled it to 0x600. In the djgpp allegro, it gave different values according to which of the three were pressed.

The exkeys example does show the alt etc. keys being pressed, but it has a thing that draws the keypresses on the screen within the key callback (it also mentions that it's an ugly hack that you shouldn't use)

EDIT: Oops, forgot to mention that these were all 4.20b2 :-/

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

Elias
Member #358
May 2000

I'll look at this. The Alt-key one should be fixed, but seems I broke the keyshifts with it (*sigh*).

Edit:

Quote:

scancodes are wrong.
in 4.1.18 /examples/exkeys 'alt-a' and 'a' are different scan codes.
in 4.1.20b2 /examples/exkeys shows them returning the same scan code.

In exkeys, I press a and get: 0x0161
I press Alt-a, I get: 0x100

Not sure what to do.. it may be that windows doesn't always assign the same values to the Alt key or something..

Quote:

and NONE of the control-shift-alt keys changed it from 0x200, although pressing the Shift Lock toggled it to 0x600. In the djgpp allegro, it gave different values according to which of the three were pressed.

I tried in exkeys, one of the test modes prints the various control key states.. it all works as it should here.

I assume, you are both using US keyboard layout? And which OS?

--
"Either help out or stop whining" - Evert

Arthur Kalliokoski
Second in Command
February 2005
avatar

Windows 98 second edition, US keyboard, mingw 3.4.1 (?)

EDIT: Also I seen that the exkeys thing had a hack to draw to screen
in the keyboard callback, so it's not going through the "proper channels"

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

A J
Member #3,025
December 2002
avatar

i use a standard US keyb layout, WinXPSp1..
i also emailed more probs on this matter on [AD] but have seen it take upto 24hrs for the post to arrive, is sourceforge getting worse?

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

Elias
Member #358
May 2000

Quote:

EDIT: Also I seen that the exkeys thing had a hack to draw to screen
in the keyboard callback, so it's not going through the "proper channels"

That's just for the real-time update of the key-presses. I know it's not the best thing to do something like this in an example.. ideally should move it into the "test" directory. Anyway, the rest of the program (the left half :)) should be completely un-affected by it.

So, to be sure - in the 3rd (or 4th? forgot) test in exkeys, where it tells the state of Alt, Control, Shift (by reading key_shifts), what does it print for you? Only the ASCII of the letters? Do Numlock, Scrolllock, Capslock work? (should also be displayed in the same test).

Quote:

i use a standard US keyb layout, WinXPSp1..
i also emailed more probs on this matter on [AD] but have seen it take upto 24hrs for the post to arrive, is sourceforge getting worse?

Replied on [AD] (and SF isn't getting worse, but also not better) Oh, and for you, key_shifts works, right?

--
"Either help out or stop whining" - Evert

Arthur Kalliokoski
Second in Command
February 2005
avatar

I just ran home & back to test (puff, puff), I forgot to test the control,alt, but it did NOT print 'shift' etc. The DJGPP compiled 4.20b2 did print 'shift'.

Perhaps you need to drop support for 7 year old OS'es? We fossils can always use 4.1.8 etc. I think I'll start a new thread about this in the off-topic forum...

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

Evert
Member #794
November 2000
avatar

Quote:

Perhaps you need to drop support for 7 year old OS'es? We fossils can always use 4.1.8 etc. I think I'll start a new thread about this in the off-topic forum...

No. We will not drop DOS support for 4.2 at this stage of development.
Nor would it help with fixing a bug in the Windows version. ;)

Elias
Member #358
May 2000

I think he means Windows 98.. and we won't drop support for that in 4.2.0. If the key[] array is used, are KEY_LSHIFT and KEY_RSHIFT detected?

I'll try to make a program which prints the windows keystate information, then you can run it and tell me what it does under win98 (well, probably only well get around to it in a week from today). Should be simple to fix this in any case.

--
"Either help out or stop whining" - Evert

Arthur Kalliokoski
Second in Command
February 2005
avatar

I'm about to run out of time on my landladys computer (internet access) but the KEY_LSHIFT & KEY_RSHIFT did change to -1 when pressed, 0 unpressed. Gotta go for a couple days.

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

Evert
Member #794
November 2000
avatar

Elias said:

I'll try to make a program which prints the windows keystate information, then you can run it and tell me what it does under win98 (well, probably only well get around to it in a week from today). Should be simple to fix this in any case.

Elias: can you give me a quick idea on what sort of change would be needed? I may be able to test it before then.

Elias
Member #358
May 2000

Ok, in src/win/wkeybd.c, look for the function update_shifts. For some reason, on win98, it doesn't work. The passed parameter "keystate" simply is an array of 256 virtual keys returned by GetKeyboardState.

Probably I'm doing something wrong there.. but it works in XP. My idea is, somehow print out that complete 256 keys in a test program.. and find out what happens on win98 for the shift key..

--
"Either help out or stop whining" - Evert

Go to: