Hi,

Currently the IAccessible2 IDL imports the types and constants from 
oleacc (IAccessible etc) using the IDL import statement. This is correct 
in that this allows  further types in the IDL file (such as 
IAccessible2) access to the types so that they can inherit from them.

However, This also currently means that if you generate a type library 
from the IAccessible2 IDL, it will then contain *all* of the oleacc 
library inside it.

This so far really hasn't been too much of a problem. However the 
disadvantages are:
*The IA2 type library may be larger than it needs to be (truthfully only 
by about 3 kb)
*The IA2 type library statically uses a version of oleacc's type library 
at the time of compile, rather than the version on the user's system.

The actual way I noticed this was while testing something in NVDA (using 
Python comtypes):
For a long time now NVDA has done an extra queryInterface to IAccessible 
even if the pointer is an IAccessible in the first place. This of course 
is redundant, so I tried taking it out.
However, then a line of code lower down kept failing causing NVDA to not 
work at all. This line was asking if the pointer was in deed an 
IAccessible instance.
if not isinstance(pacc,IAccessible): raise ValueError("pacc %s is not an 
IAccessible"%pacc)

The ValueError was always raised. Yet the message in the ValueError 
printed showed me it was an IAccessible: "<POINTER(IAccessible) at 
0x38bcf6" for example.

After further debugging I ended up finding out that the definition of 
IAccessible that my Python module was using was the one from its 
Pythonified IAccessible2 type library, not the one from the Pythonified 
oleacc type library (which the actual pointer was using).

In reality I could fix this very easily in NVDA by importing the oleacc 
type library after the IAccessible2 type library, which would allow the 
oleacc definition of IAccessible to clobber the IAccessible2 one. But, I 
think the most logical way would be to fix the IDL.

The fix is very simple:
Inside the Library block, there is already a line that says:
     importlib ("stdole2.tlb")
Under this line, just put:
     importlib ("oleacc.dll")

This instructs midl to link the generated Ia2 tlb with oleacc.dll, which 
contains oleacc's type library.

Note that you still need to keep the other import statement at the top 
of the idl, that imports oleacc.idl, as midl itself still needs these 
definitions.

Thanks
Mick

  --

--
Michael Curran
Email: [email protected]
website: http://blog.kulgan.net

_______________________________________________
Accessibility-ia2 mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/accessibility-ia2

Reply via email to