Feature request: Spill out a native handle

14 views
Skip to first unread message

Kevin Ingwersen

unread,
Jan 1, 2014, 3:28:04 PM1/1/14
to fltkg...@googlegroups.com
Hey there.

I have just found the solution to a problem I had with libcef. Let’s consider the following piece of code:

// Information used when creating the native window.
CefWindowInfo window_info;
#ifdef __APPLE__
FLWindow *flwind = (FLWindow*)fl_xid(this->window);
NSView *view = [flwind contentView];
window_info.SetAsChild( view, 0, 0, 500, 500 );
#endif

This code will tell the library to use the specified NSView as it’s parent view, where it shall render into. That view I get by querying FLTK for a „native“ handle. In the Cocoa version of FLTK, this is „FLWindow“, from which I can get an NSView. But since the library will reuse the view in order to get back to the window that it contains, it will automatically reuse the FLWindow class.
Due to the drawing conflict (native drawing is different from FLTK’s), I get a strong flicker reaction on the screen. But if I do not use the lines from above, the library will use a flat NSView from the window just created, and will not give a damn on the actual subclass, FLWindow. Therefore, ti renders completely right.

My request therefore would be, to have a function that’ll spill out a real handle - on OS X, an actual NSWindow, not a subclass (FLWindow).

For now, I can reuse the fact that the library will the already-opened window and alike - but for the future, i’d like to be able to do proper things with FL_Window. :)

Kind regards,
Ingwie

PS: other #ifdef blocks for linux and windows are planned to properly set the window. Thus, I may create a whole addon for FLTK to take advantage of CEF :)
Reply all
Reply to author
Forward
0 new messages