Embedding arbitrary window using createWindowContainer()
-
Hi guys,
I have an application, which used QX11EmbedContainer() to embed arbitrary windows (xterm, emacs, etc) into my application. This seemed to work pretty well.
I am
notnow in the process of porting my application from Qt4 to Qt5 and I have found the new createWindowContainer() method of QWidget(). The problem is that I can't get things to work.Firstly, my understanding is that new method of embedding works differently. Rather than the external application embedding itself into the Qt window using the WinId of the Qt window, now the Qt Window pulls the external application into itself using the WinId of the external application. Is that correct?
If my understanding described above is correct, how is Qt supposed to get the WinId of the external application? There doesn't seem to be a standard API to do this. Of course, all of this is easy of the external application is another Qt application. However, I am interested in embedding any arbitrary X11 application.
[mrJJ- changed not -> now. ]
-
Hi
As far as I know via QWindow::fromWinId()
But its not always happy
https://bugreports.qt.io/browse/QTBUG-40320 -
Yeah, I got that far, as well. However, the real question is how is the embedding application supposed to obtain the WinId of the external application?
Searching through Google is showing me that there is no good way to do this. At the very least, there is no standard way to do it. The best that I've found is a shell script that is put together using xwininfo and xprop commands. Even then, those rely on a property (_NET_WM_PID) that may or may not be set by the external applications.
Qt being a portable platform should have a portable way to get the WinId of an external application. Otherwise, this new embedding mechanism seems rather pointless and useless. The question is whether there really is a portable way to get the WinId and if so what is it?
-
Yeah, I got that far, as well. However, the real question is how is the embedding application supposed to obtain the WinId of the external application?
Searching through Google is showing me that there is no good way to do this. At the very least, there is no standard way to do it. The best that I've found is a shell script that is put together using xwininfo and xprop commands. Even then, those rely on a property (_NET_WM_PID) that may or may not be set by the external applications.
Qt being a portable platform should have a portable way to get the WinId of an external application. Otherwise, this new embedding mechanism seems rather pointless and useless. The question is whether there really is a portable way to get the WinId and if so what is it?
@voidtrance said in Embedding arbitrary window using createWindowContainer():
Qt being a portable platform should have a portable way to get the WinId of an external application.
Why? Is Qt a window manager? I don't think so.
Otherwise, this new embedding mechanism seems rather pointless and useless.
It's useful as an integration point between Qt and another library and/or code that creates/initializes/manages a window.
The question is whether there really is a portable way to get the WinId and if so what is it?
Refer to the OS/Library API you're working with, there should be some way provided it's designed well.
-
@kshegunov said in Embedding arbitrary window using createWindowContainer():
@voidtrance said in Embedding arbitrary window using createWindowContainer():
Qt being a portable platform should have a portable way to get the WinId of an external application.
Why? Is Qt a window manager? I don't think so.
This has nothing to do with Qt being a window manager. I am not asking to mange windows. I am asking about querying the windowing system about window properties. Given that Qt applications are supposed to work in various windowing systems, it would stand to reason that it would have some kind of a standard, independent way to query properties from the windowing system.
Otherwise, an application would have to implement the specifics of every windowing system that it may run under making it much less portable.Otherwise, this new embedding mechanism seems rather pointless and useless.
It's useful as an integration point between Qt and another library and/or code that creates/initializes/manages a window.
The question is whether there really is a portable way to get the WinId and if so what is it?
Refer to the OS/Library API you're working with, there should be some way provided it's designed well.
Sure, I can start making X11 calls but, again, the question was whether Qt provided a OS/Window manager independent way to do this. I am starting to think that there isn't.