On 09/28/2011 05:12 PM, ext Harri Porten wrote:
> 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...

We were consdering replacing the void * return values with QVariants, 
but that doesn't really give much in the case were they're anyway 
pointers to some platform specific type. Any thoughts?

Also a comment on the display parameters, in the Xlib and XCB cases 
those are the same thing. I also think we have an "EGLDisplay" resource 
in several plugins. Many of these are for use in qt-compositor, which 
requires some low level hooks to do shared pixmaps or use the wayland 
EGL API.

>> 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 ;)

The platform plugin name should probably be a getter in QGuiApplication.

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

Reply via email to