WINDOW_Qualifier always returning 0

This forum is for general developer support questions.
Post Reply
chris
Posts: 570
Joined: Sat Jun 18, 2011 12:05 pm
Contact:

WINDOW_Qualifier always returning 0

Post by chris »

I'm using this code after receiving a WMHI_GADGETUP message:

Code: Select all

	UWORD quals = 0;
	GetAttr(WINDOW_Qualifier,window_object,(ULONG *)&quals);
quals is always 0.

If I do WINDOW_InputEvent instead the ie->ie_Qualifier field is correct (except if I shift-click a gadget it gets stuck "on" for next time, which isn't ideal, and the Autodoc says this attribute is only valid immediately after a WMHI_RAWKEY which isn't appropriate)

This behaviour seems the same in OS4 and OS3.2. Does WINDOW_Qualifier not work or do I need to be specifying some tag in my window for the qualifiers to be fed through? Or am I simply doing something wrong?
thomasrapp
Posts: 319
Joined: Sun Jun 19, 2011 12:22 am

Re: WINDOW_Qualifier always returning 0

Post by thomasrapp »

GetAttrs always writes four bytes to the destination storage. The qualifiers you want to see are written into the two bytes behind your UWORD, possibly causing a storage violation.

Check intuition/classusr.h for struct opGet. You'll see that it has an ULONG *opg_Storage. Most if not all classes implement OM_GET as *msg->opg_Storage = value; which means that the internal UWORD qualifiers is converted to an ULONG before it is written to the destination. You have to accept the ULONG and convert it back to an UWORD if you really need to.
chris
Posts: 570
Joined: Sat Jun 18, 2011 12:05 pm
Contact:

Re: WINDOW_Qualifier always returning 0

Post by chris »

Ah, OK, however I originally had it as a ULONG and was still only getting 0 (I changed it when I saw the AutoDoc said it returned a UWORD)
Post Reply