Still some troubles in Commodity-land

6 posts / 0 new
Last post
OldFart
OldFart's picture
Offline
Last seen: 1 month 1 day ago
Joined: 2010-11-30 14:09
Still some troubles in Commodity-land
Hi, I experience some strange phenomenon when trying to create a CxFilter object. Especially when "rawmouse" is used, in which case it sets the error to 'BADFILTER'. Here is a little proggy I cobbled up to demonstrate the issue:
  1. #include <proto/exec.h>
  2. #include <proto/dos.h>
  3. #include <proto/commodities.h>
  4.  
  5. CONST_STRPTR FD[] = {"rawmouse leftbutton"
  6. ,"rawmouse rightbutton"
  7. ,"rawmouse midbutton"
  8. ,"rawmouse relativemouse"
  9. ,"shift -alt -control a"
  10. ,"rawkey lshift alt f2"
  11. ,"rawkey control esc"
  12. , NULL
  13. };
  14.  
  15. int main(int argc, char *argv[])
  16. {
  17. int RetVal = 9;
  18.  
  19. CxObj *CO;
  20. int32 CxErr;
  21. uint16 i = 0;
  22.  
  23. while (FD[i] != NULL)
  24. {
  25. CO = CxFilter(FD[i]);
  26.  
  27. if (CO != NULL)
  28. {
  29. CxErr = ICommodities->CxObjError(CO);
  30. IDOS->Printf("Error : %ld -- %s\n", CxErr, FD[i]);
  31. ICommodities->ClearCxObjError(CO);
  32.  
  33. CxErr = 0;
  34.  
  35. ICommodities->DeleteCxObj(CO);
  36. }
  37.  
  38. i++;
  39. }
  40.  
  41. return RetVal;
  42. }
On the console i get this output:
  1. Error : 4 -- rawmouse leftbutton
  2. Error : 4 -- rawmouse rightbutton
  3. Error : 4 -- rawmouse midbutton
  4. Error : 4 -- rawmouse relativemouse
  5. Error : 0 -- shift -alt -control a
  6. Error : 0 -- rawkey lshift alt f2
  7. Error : 0 -- rawkey control esc
Anything related to "rawmouse" produces an error. N.b. '-lauto' switch is used for compilation. Do I overlook something? Btw.: I've even taken one of the examples from Amiga wiki, made it compileable, and it produces the same error. OldFart
OldFart
OldFart's picture
Offline
Last seen: 1 month 1 day ago
Joined: 2010-11-30 14:09
Re: Troubles in Commodity-land
After a reply I got from xenic at another forum it appears that some keywords are ill-documented: "leftbutton" should be "mouse_leftpress", "rightbutton" should be "mouse_rightpress" and "midbutton" should be "mouse_middlepress".
  1. Error : 4 -- rawmouse leftbutton
  2. Error : 0 -- rawmouse mouse_rightpress
  3. Error : 4 -- rawmouse rightbutton
  4. Error : 0 -- rawmouse mouse_leftpress
  5. Error : 4 -- rawmouse midbutton
  6. Error : 0 -- rawmouse mouse_middlepress
  7. Error : 4 -- rawmouse relativemouse
  8. Error : 0 -- shift -alt -control a
  9. Error : 0 -- rawkey lshift alt f2
  10. Error : 0 -- rawkey control esc
Problem seems solved. OldFart
OldFart
OldFart's picture
Offline
Last seen: 1 month 1 day ago
Joined: 2010-11-30 14:09
Re: (No more) Troubles in Commodity-land
@lurkers It is HERE where all the fun is happening. Come in and join the party! OldFart
hypex
hypex's picture
Offline
Last seen: 1 month 1 day ago
Joined: 2011-09-09 16:20
Re: Still some troubles in Commodity-land
Just out of interest what happens if you try "rawkey leftbutton" instead? :-
xenic
xenic's picture
Offline
Last seen: 3 months 3 weeks ago
Joined: 2011-05-07 04:52
Re: Still some troubles in Commodity-land
@hypex Unless leftbutton was in the Commodities library documentation WIKI and has been removed it's not listed as a valid qualifier for OS4. It's listed in the commodities library section of the OS3 Workbench book but some OS3 documentation doesn't apply to OS4 anymore. I do think the WIKI could lead to a little confusion over what you can use when creating a hotkey with the CxFilter() function and what you can use in a CxCustom() object. I think the old OS3 Workbench manual states that a hotkey consists of a qualifier and keyboard key; which appears to be true. Even though CxFilter() didn't produce an error in Oldfarts tests, my testing indicates that using a qualifier alone in CxFilter() doesn't actually work.
X1000 - OS 4.1FE
thomas
thomas's picture
Offline
Last seen: 6 days 5 hours ago
Joined: 2011-05-16 14:23
Re: Still some troubles in Commodity-land
Using a qualifier alone does not make any sense. The CxFilter object filters input events. An input event consists (among others) of a class, a code and a qualifier. Class and code describe the cause of the input event, qualifier is only an attribute. So you always have to specify a class and a code. The qualifier is an optional additional filter criteria.
Log in or register to post comments