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)
Re: WINDOW_Qualifier always returning 0
Posted: Thu Jul 16, 2026 12:19 am
by chris
chris wrote: Fri Jul 10, 2026 8:38 pm
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)
I double checked this with ULONG and it still only ever returns 0 after GADGETUP events on OS 3.2.3 and OS 4.1FEU3
Re: WINDOW_Qualifier always returning 0
Posted: Fri Jul 17, 2026 4:22 pm
by thomasrapp
I did some tests myself. You are right, WINDOW_Qualifier only returns a meaningful value on WMHI_RAWKEY or WMHI_VANILLAKEY messages, otherwise it always returns 0. However, you receive a WMHI_RAWKEY message for each qualifier key change, even if you did not request IDCMP_RAWKEY messages.
So as a workaround you can query WINDOW_Qualifier whenever you receive WMHI_RAWKEY and store the value for use with other messages.
Re: WINDOW_Qualifier always returning 0
Posted: Sun Jul 19, 2026 12:59 pm
by chris
Ok, thanks, I'll have to store it for later.