PDA

View Full Version : Porting QX11Embed* functionality



dv_
23rd February 2008, 09:17
Hi,
I really like the QX11Embed classes, however they are X11 only (of course). Since I didn't find any Windows/Mac equivalents, I wonder if anyone ever tried to develop some.

In Windows, it should be easy - subclassing windows is done all the time in the winapi. It would require some digging into Qt internals, I suppose.

As for OSX, I don't know (don't have one). Can somebody tell me if its hard to do there?

This is really relevant for me, since I am toying with the idea of having plugins as processes (not shared libraries) for increased stability (if one process segfaults the rest of the program is naturally shielded from it), flexibility (the plugins can also run as stand-alone programs)... so, feedback would be very welcome.

wysota
24th February 2008, 00:32
In Windows, it should be easy - subclassing windows is done all the time in the winapi. It would require some digging into Qt internals, I suppose.
Hmm... what exactly would you like to subclass here? QX11Embed is meant to pull existing windows into your application's window as a widget. The contained widget is a separate application - you can't access its internals or anything like that.

dv_
24th February 2008, 12:37
This is exactly what I mean. You can reparent and subclass an application's main window (all you need is its HWND). Of course, to control the window's size and position you need to intercept messages as well, this might be trickier. Still, it can be done.

wysota
24th February 2008, 12:44
subclass an application's main window (all you need is its HWND).

Hmm... what do you mean by "subclass" here? As far as I know WinAPI is not object oriented, so there are no classes there. Do you mean "add new controls to an existing window"?

dv_
24th February 2008, 16:38
Its not meant in the OO sense. Here is a good article: http://www.venkydude.com/articles/subclass.htm

wysota
24th February 2008, 16:46
It's definitely not what X11Embed does.

dv_
24th February 2008, 20:20
Of course the two techniques differ substantially, but in the end the result is the same: both embed processes, and this is exactly what I want. In the X11Embed case, if the process is X11Embed aware, then focus etc. work properly - but this is not necessary in my app.