Results 1 to 18 of 18

Thread: QX11EmbedContainer problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2006
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QX11EmbedContainer problem

    If that is the way it works, then Qt is not very much of assistance here.

    Well, I tried it anyway, getting the window id of a running application using xwininfo. Passing this to my application at least does something... The original window disappears but still does not appear in the container.

    Having read something about bugs in this area in Qt 4 or 4.2 specifically, I was wondering whether anyone actually has experience with these calls.

    Maybe a question to pass to one of the Qt developers?

    Quote Originally Posted by jacek View Post
    I've never played with QX11EmbedWidget before, but it looks like you just have to know the window id of that editor. You probably can find it using some XLib calls (like XQueryTree()).

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: QX11EmbedContainer problem

    Quote Originally Posted by Martin42 View Post
    If that is the way it works, then Qt is not very much of assistance here.
    It musn't be necessarily Qt's fault, but rather it's the way XEmbed works.

    Quote Originally Posted by Martin42 View Post
    Having read something about bugs in this area in Qt 4 or 4.2 specifically, I was wondering whether anyone actually has experience with these calls.
    Indeed it doesn't always work with Qt 4.2 (at least when I tried my test app with xclock), but I couldn't find anything in the task tracker.

    Quote Originally Posted by Martin42 View Post
    Maybe a question to pass to one of the Qt developers?
    It's hard to find them here. Better contact Trolltech support or try qt-interest mailing list.

  3. #3
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3
    Thanked 74 Times in 54 Posts

    Default Re: QX11EmbedContainer problem

    I have done this. If the window is not an XEmbedClient, then you need to know its window ID. You can get this with xwininfo or similar methods. I am attaching a sample program that does this, which I have used to embed XEmacs, xterm, etc.

    XEmbed is intended for XEmbed-aware clients. Otherwise all it does is swallow apps, making it a poor-man's window manager.

    p.s. There was a bug in 4.2.0-rc1, but it has been resolved.
    Attached Files Attached Files

  4. The following 5 users say thank you to Brandybuck for this useful post:

    amit.tomar (19th August 2011), cochise (22nd November 2010), developDavid (6th July 2010), wagmare (2nd December 2008), wirthmi (10th May 2011)

  5. #4
    Join Date
    Dec 2006
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QX11EmbedContainer problem

    Compiling you example has been extremely helpful, thanks. It worked! I had in fact tried the following code earlier:

    QX11EmbedContainer *test=new QX11EmbedContainer(parent);
    test->embedClient(winid);
    test->show();

    which is very very similar, but doesn't work. The only difference I can think of is that in my case, there has not been time enough for the container window to be realised, so the embedding fails. It seems you need to wait for the container to appear on screen. That will probably be possible some way.

    Next is the problem of knowing the winid of the process you forked, automatically, as I can't expect my users to use xwininfo....

    Cheers.

    Martin

    Quote Originally Posted by Brandybuck View Post
    I have done this. If the window is not an XEmbedClient, then you need to know its window ID. You can get this with xwininfo or similar methods. I am attaching a sample program that does this, which I have used to embed XEmacs, xterm, etc.

    XEmbed is intended for XEmbed-aware clients. Otherwise all it does is swallow apps, making it a poor-man's window manager.

    p.s. There was a bug in 4.2.0-rc1, but it has been resolved.

  6. #5
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3
    Thanked 74 Times in 54 Posts

    Default Re: QX11EmbedContainer problem

    Quote Originally Posted by Martin42 View Post
    It seems you need to wait for the container to appear on screen.
    The client needs the container's X11 window to be embedded into. From your behavior, I'm assuming it isn't being created until the widget is shown for the first time. So either call show() before embedClient(), or embed the client in the showEvent() method.

  7. #6
    Join Date
    Dec 2006
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QX11EmbedContainer problem

    show() (immediately) before embedClient() doesn't work, so I will go for the latter.
    Thanks for your help!

    Martin

    Quote Originally Posted by Brandybuck View Post
    The client needs the container's X11 window to be embedded into. From your behavior, I'm assuming it isn't being created until the widget is shown for the first time. So either call show() before embedClient(), or embed the client in the showEvent() method.

  8. #7

    Default Re: QX11EmbedContainer problem

    I have a similiar problem.

    If I use "QProcess" to invoke an external application, how can I get the winId of that application?

  9. #8
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: QX11EmbedContainer problem

    You have to iterate through all the windows until you find it.

  10. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QX11EmbedContainer problem

    Either use X11 calls to get it or ask the process for it. Maybe it has a way of telling you its winId.

  11. #10
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: QX11EmbedContainer problem

    Quote Originally Posted by wysota View Post
    Either use X11 calls to get it or ask the process for it. Maybe it has a way of telling you its winId.
    He can use at most the PID of the process.

  12. #11
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    116
    Thanked 42 Times in 41 Posts

    Smile Re: QX11EmbedContainer problem

    Quote Originally Posted by yumiko View Post
    I have a similiar problem.

    If I use "QProcess" to invoke an external application, how can I get the winId of that application?
    this system call works fine after we start the external program by QProcess : xwininfo -root -all | grep ' " Window Title " ' |awk '{print $1}'

    Window title is the running QProcess execution's title

  13. #12
    Join Date
    May 2011
    Posts
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: QX11EmbedContainer problem

    I am using the the container for a xEmbed Widget in the same scope and expect the widget to get embedded in the container but i am getting two window not a single window, the code is like this...
    int main(int argc, char*argv[])
    {
    QApplication app(argc,argv)
    QX11EmbedContainer container;
    QX11EmbedWidget window;
    container.show();
    window.embedInto(container.WinID());
    container.embedclient(window.winID());
    int status= app.exec();
    return status;
    }

    Ideally i shud be getting only a single window but i am getting two separate window.

    What could be the problem????????

Similar Threads

  1. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  2. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  3. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 14:08
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.