On 07/18/17 09:38, MacArthur, Ian (Leonardo, UK) wrote:
> Anyway - A quote from the docs:
> <quote>
> Drawing using Xlib
>
> The following global variables are set before Fl_Widget::draw() is called, or by Fl_Window::make_current():
>
> extern Display *fl_display;
> extern Window fl_window;
> extern GC fl_gc;
> extern int fl_screen;
> extern XVisualInfo *fl_visual;
> extern Colormap fl_colormap;
>
> You must use them to produce Xlib calls. Don't attempt to change them. A typical X drawing call is written like this:
>
> XDrawSomething(fl_display, fl_window, fl_gc, ...);
>
> </quote>
>
> There's also a section in the docs "Using a Subclass of Fl_Window for
> Special X Stuff" that might be pertinent to your case, though it is
> coming at things from a slightly different direction to what you actually want, I think!
Perhaps the OP's proprietary app also needs the window to be physically
open and on the screen. And I don't think that happens until Fl::run()
has gotten some cpu, which makes it tricky to initialize a lib that
needs a window id for an /open/ window. (Usually involves intercepting
the draw() call for the window)
I know that after a window.show() call, fl_xid(window) will return
the window id, and both window.shown() and window.visible() will
return 1, even though the window is not open + visible on the screen.
I just ran a small test and found that after window.show() is called,
fl_xid(window) is valid, and both window.shown() and window.visible()
return 1, but the window is /not/ open yet. (One can prove this by
adding a sleep() or getchar() just after the window.show() call)
So it's possible the OP's prop program needs the window already open.
I'm not 100% sure we offer a method that detects when the window
is actually physically open, but I think it's safe to say that if
you intercept the draw() call, at that time for sure the window is
open, and it would therefore be "safe" to initialize a proprietary
library that assumes the window is open.