WINDOW_Qualifier always returning 0

This forum is for general developer support questions.
Post Reply
chris
Posts: 571
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: 320
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: 571
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)
chris
Posts: 571
Joined: Sat Jun 18, 2011 12:05 pm
Contact:

Re: WINDOW_Qualifier always returning 0

Post 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
thomasrapp
Posts: 320
Joined: Sun Jun 19, 2011 12:22 am

Re: WINDOW_Qualifier always returning 0

Post 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.
Post Reply