RFR: JDK-8311113: Remove invalid pointer cast and clean up setLabel() in awt_MenuItem.cpp [v3]

Alexey Ivanov aivanov at openjdk.org
Fri Sep 1 18:18:44 UTC 2023


On Thu, 31 Aug 2023 22:42:11 GMT, Phil Race <prr at openjdk.org> wrote:

> > This proves _what's done in `_SetLabel` is **dead code**_: it's not used by us, it's not used by the OS. Removing more than 100 lines which essentially do nothing is a good thing in my opinion.
> 
> OK. So it doesn't pull it because we don't tell it it is there to be read.

It's a limitation of Windows Menu API: the system doesn't store any additional data for owner drawn menu items. We tell the system, here's the label, but it ignores it.

It seems there's nothing we can do about it.

I tried setting `MIIM_FTYPE | MIIM_STRING` in `fMask` which explicitly tells the system the `dwTypeData` member is valid. The system ignores it all the same, the label cannot be retrieved.

> Which does make it sound very much like JAWS is getting the data from somewhere else.

There's no other way…

> Hmm, I didn't know the AWT heavyweights participated in that. Only the Swing components.

It is also my understanding, so I was surprised JAWS can read AWT menus.

It is not a surprise Narrator can't read menus (or anything else in a Java app) since Java doesn't implement native Windows accessibility APIs.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/15276#issuecomment-1703154735


More information about the client-libs-dev mailing list