[Development] Foreign windows, embedding and transiency

Samuel Rødal samuel.rodal at digia.com
Tue Dec 11 14:04:32 CET 2012


On 12/11/2012 01:30 PM, Alberto Mardegan wrote:
> On 12/11/2012 12:47 PM, Sorvig Morten wrote:
>> I've been planning this a bit from he perspective if the Cocoa port, here's what I think I need:
>>
>> - A Qt::WindowFlags flag ("Qt::NativeWindow")
>
> OK. Though I'd prefer to call it Qt::ForeignWindow, to make it obvious
> that it's not owned by this process (Qt::NativeWindow just seems to tell
> that the QWindow is associated with a native window, which is always
> true, AFAIU).

Foreign sounds like "alien" which is what we use in QtWidgets to 
describe a widget that's not native :) Maybe "external" is better? 
OutOfProcess?

> I'd rather use a constructor than the QPlatformNativeInterface, and
> Samuel's idea of using a static one is also nice. The reason why I was
> suggesting a different class is simply to keep the QWindow code as
> simple as possible; QWindow for foreign windows might need to have a
> special implementation for the virtual methods inherited from QSurface
> (BTW, we might want to add a "Foreign" enum value to
> QSurface::SurfaceType). Having it as a separate subclass could also help
> with the documentation, by avoiding putting a lot of different concepts
> into QWindow's. But indeed having a subclass is not strictly needed.

Most of the implementation happens behind the QPlatformWindow in any case.

> However, the flag is needed: the QPA plugin needs to know whether a
> QWindow is foreign or not. The xcb plugin would also take care of
> implementing the XEmbed protocol when it sees that the parent window is
> foreign.
> Unless we can convey the same information in another way, of course.

Yep, there are quite a few ways to convey information from QWindow to 
QPlatformWindow. In the worst case the QPlatformWindow implementation 
can access the QWindowPrivate, such as it does to get the positionPolicy 
currently. We can't add a setter to QPlatformWindow since this needs to 
be known at construction time. Another parameter to 
QPlatformIntegration::createPlatformWindow() could work.

--
Samuel



More information about the Development mailing list