RAWKEY, no VANILLAKEY

7 posts / 0 new
Last post
mritter0
mritter0's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2014-04-21 21:15
RAWKEY, no VANILLAKEY

I am trying to update an old piece of code that I have (way too large to post). It is not using WindowClass. It uses IDCMP_RAWKEY and IDCMP_VANILLAKEY and others.

I have updated the old window to the new WindowClass so I can use ReAction classes. Now I don't receive any VANILLAKEYs, neither WMHI_VANILLAKEY or IDCMP_VANILLAKEY. I only get WMHI_RAWKEY.

Do I have to use a WINDOW_IDCMPHook to catch the vanillakeys? I really don't want to since it would take some serious re-writing.

broadblues
broadblues's picture
Offline
Last seen: 1 week 3 days ago
Joined: 2012-05-02 21:48
Re: RAWKEY, no VANILLAKEY

Did you explicitly set IDCMPVANILLAKEY in the WA_IDCMP tag?

You need to do that to get WMHI_VANILLAKEY messages.

mritter0
mritter0's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2014-04-21 21:15
Re: RAWKEY, no VANILLAKEY

I had both IDCMP_RAWKEY and IDCMP_VANILLAKEY in WA_IDCMP. I took out IDCMP_RAWKEY and it started to work, I receive both now. That makes no sense.

mritter0
mritter0's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2014-04-21 21:15
Re: RAWKEY, no VANILLAKEY

Now what is throwing me off is I am getting the correct RAWKEY code, but wrong VANILLAKEY code.

When I revert back to the old code using IExec->Wait() and IExec->GetMsg() it all works fine.

When I use the WindowClass: while((Result=IIntuition->IDoMethod(Objects[OID_WINDOW],WM_HANDLEINPUT,&Code)) != WMHI_LASTMSG)
I get the correct Result (Class) but the Code is wrong for VanillaKey.

Key | Old | New
1 | 49 | 129
Q | 113 | 144
A | 97 | 160
Z | 122 | 177

New Code values totally out of the range they should be in. Any ideas?

uint32 Result;
uint16 Code, Qualifier;

broadblues
broadblues's picture
Offline
Last seen: 1 week 3 days ago
Joined: 2012-05-02 21:48
Re: RAWKEY, no VANILLAKEY

IDCMP_RAWKEY is there by default as window.class requires it so adds it to the WA_IDCMP mask you pass, so whether it's present or not should make no difference.

broadblues
broadblues's picture
Offline
Last seen: 1 week 3 days ago
Joined: 2012-05-02 21:48
Re: RAWKEY, no VANILLAKEY

I think you should be using result & WMHI_KEYMASK for vanilla key not 'code'.

eg

  1. case WMHI_VANILLAKEY:
  2. {
  3. // IDOS->Printf("vanillakey code %ld %ld \n",code,result&WMHI_KEYMASK);
  4. switch (result & WMHI_KEYMASK)
  5. {
  6. case 's':
  7. Executerexx("SWAPCOLORS");
  8. break;
  9. case 26: // CTTL Z
  10. Executerexx("UNDO;DISPLAYPROJECT DAMAGE");
  11. break;
  12. case 25: /// CTRL Y
  13. Executerexx("REDO;DISPLAYPROJECT DAMAGE");
  14. break;
  15. }
  16. break;
  17. }
mritter0
mritter0's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2014-04-21 21:15
Re: RAWKEY, no VANILLAKEY

I found an example using your suggestion probably around the same time:

https://wiki.amigaos.net/wiki/Programming_AmigaOS_4:_GUI_Toolkit_ReAction

I am slowly getting it updated/working. Still a long way to go.

Thanks.

Log in or register to post comments