On Wed, 28 Sep 2011, Thiago Macieira wrote:

> On Wednesday, 28 de September de 2011 14:38:40 Harri Porten wrote:
>> How will anyone be able to tell them apart without a way to check which
>> plugin is active? Or has this changed?
>
> What are you going to do with this native resource after you get it from
> QPlatformNativeInterface? You plan on calling some some function in wayland or
> XCB or directfb, right?
>
> Then you need to have code to deal with the many plugins active.

Yes. That's accepted. It's about replacing an #ifdef solution with an if() 
solution for esoteric cases of platform-specific code.

> Or was your question asking how to determine which plugin is active? If that's
> the case, I support you that we need such a function.

If there'd be such a query that'll do the job of passing on e.g. window 
handles to 3rd party functions operating on those.

>> I know, that ideally Qt should provide a portable API avoid the use of
>> native resources. But realistically this will never all cases. So what to
>> do? Add some runtime detection? In the case of nativeResourceForWindow()
>> I'd say it would already suffice to mandate that the resource names have
>> to unique. Either by a pure text prefix
>>
>>    nativeResourceForWindow("xlib/display");
>>
>> or a distinct parameter:
>>
>>     nativeResourceForWindow("xlib", "display");
>>
>> As it is I foresee weird crashes after casting void* pointers. In our
>> product's code we already had to take the risk...
>
> The only thing this buys us is that you detect which plugin is active by
> getting null pointers if you ask resources of the wrong plugin. You will not
> get a valid XLib display if the plugin in use is Wayland.

No. I admit this was proposal was a very local solution that would avoid a 
global I'm-running-on-platform-X function - in case this is against Qt 5's 
philosophy ;)

> This all boils down to a runtime determination of which plugin is active.

An interface exchanging type safety with void* for the purpose of platform 
independant API will be fine with a string-based identifier?

Harri.
_______________________________________________
Qt5-feedback mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback

Reply via email to