SWT Support Status
To support any Windowing Toolkit, the "only" task is to get a handle to a native widget (X11 window, NSView, win32 Window) and let xine draw into it. For AWT/Swing, this is documented by Sun nicely (look for the term JAWT). For SWT, it looks like it is used rarely and not documented. There are two options to embed or draw into a native widget in SWT:
- The
SWT Composite widget
on Linux/GTK+ provides anSWT.EMBEDDED
style. If this style is specified, SWT creates aGtkSocket
which can be accessed by the embeddedHandle field. GtkSocket allows to embed a native X11 window from any Windowing Toolkit, as long as it supports the XEmbed protocol. TheSWT.EMBEDDED
style is only supported on Linux/GTK+. - The SWT Canvas and SWT Composite widgets have a public
handle
field which is the native handle. This is a HWND on Windows, a GtkWidget on Linux/GTK+ and a Pane on Mac OS X Carbon.
GtkSocket Experience
The C++ examples in the gtkmm documentation worked fine. My C version of them worked, when used without SWT. But the native plug did not show in the SWT Composite. See this post on the eclipse.platform.org newsgroup if you have an idea how to fix this.
Native Drawing in an SWT Canvas
The second approach basically works for SWT/GTK+. A native function can directly use the Canvas.handle as a GtkWidet pointer. This pointer is enough to get the native X11 Window XID via
gdk_x11_drawable_get_xid ( GDK_DRAWABLE(drawable->window)
A PaintControlListener and a ControlListener are required to catch redraw and resize events.
See Native drawing on SWT/GTK+ for a detailed example on this.
The SVN version of libxine-java already supports SWT incl. Fullscreen mode in an alpha state. Try example/MuXineSWT.java
for the first SWT libxine-java video player. Stay tuned..