Page 1 of 1

WINDOW_Qualifier always returning 0

Posted: Fri Jul 10, 2026 5:57 pm
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?

Re: WINDOW_Qualifier always returning 0

Posted: Fri Jul 10, 2026 7:03 pm
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.

Re: WINDOW_Qualifier always returning 0

Posted: Fri Jul 10, 2026 8:38 pm
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)