I'm not sure if this counts as a noob question cause this is my first post, as I've been working in Qt for about 3 weeks now. Anyways...
I have this third-party library that is reponsible for creating and displaying a certain type of buffer. I'm sure it uses the Xlib libs somehow.
When I try to embed this XWindow into a GUI i'm working on, it keeps popping up separately from the GUI, but works fine.
At first I thought I just sucked at Qt, but after about 7 or so hours of looking into this, I'm really stumped.
I attempted to solve this problem in a few different ways:
- first, create a QX11EmbedContainer, and embed the XWindow client into this container.
container -> setFixedSize(320, 240);
//After display creation
void *handler = malloc(sizeof(int *));
thirdPartyFunctionForGettingWindowHandle(thirdPartyDisplay, GET_WINDOW_HANDLE, (void *) handler); //the window handle is returned in handler
container -> embedClient (handler)
QX11EmbedContainer *container = new QX11EmbedContainer(this);
container -> setFixedSize(320, 240);
//After display creation
void *handler = malloc(sizeof(int *));
thirdPartyFunctionForGettingWindowHandle(thirdPartyDisplay, GET_WINDOW_HANDLE, (void *) handler); //the window handle is returned in handler
container -> embedClient (handler)
To copy to clipboard, switch view to plain text mode
Unfortunately this doesn't work, as I'm not entirely sure of the function that returns the window Id.
Second way:
I attempted to create my own XWindow with an associated display, and pass that into the third-party display creation function:
Display *display = XOpenDisplay(NULL);
Window win = XCreateSimpleWindow(display, RootWindow(display, DefaultScreen(display)), 1, 1, 320, 240, 0, BlackPixel(display, 0), BlackPixel(display, 0));
XMapWindow(display, win);
XFlush(display);
...
thirdPartyFunctionForCreatingADisplay(display, NULL, Camera_handle, errorHandler);
Display *display = XOpenDisplay(NULL);
Window win = XCreateSimpleWindow(display, RootWindow(display, DefaultScreen(display)), 1, 1, 320, 240, 0, BlackPixel(display, 0), BlackPixel(display, 0));
XMapWindow(display, win);
XFlush(display);
...
thirdPartyFunctionForCreatingADisplay(display, NULL, Camera_handle, errorHandler);
To copy to clipboard, switch view to plain text mode
This doesn't even compile, as all the third party functions take in only void pointers and do weird stuff with them, and casting doesn't work, of course.
After summing all this info up, I guess nobody on this forum can help me unless they're familiar with the libraries I'm using...sigh. I've emailed the third-party people for some advice on this one.
I don't think I can switch to another window managing system like GTK cause I need their other functions for buffer handling and such.
In any case, is there another way for embedding XWindows that I haven't figured out yet?
(I have to use these libs, by the way)
Thanks!
Bookmarks