1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fixed a bug in the linux XEmbedComponent and added support for host initiated embedding

This commit is contained in:
hogliux 2017-04-04 15:57:36 +01:00
parent 84f4362a40
commit ec21d0464d
2 changed files with 98 additions and 20 deletions

View file

@ -38,11 +38,22 @@ unsigned long juce_getCurrentFocusWindow (ComponentPeer*);
Use this class to embed a foreign X11 widget from other toolkits such as
GTK+ or QT.
For GTK+, create a gtk_plug container and pass the plug's id
(gtk_plug_get_id) to the constructor of this class.
There are two ways to initiate the Xembed protocol. Either the client creates
a window and passes this to the host (client initiated) or the host
creates a window in which the client can reparent it's client widget
(host initiated). XEmbedComponent supports both protocol types.
For QT, use the QX11EmbedWidget class and pass the widget's
id (containerWinId()) to the constructor of this class.
This is how you embed a GTK+ widget: if you are using the client
initiated version of the protocol, then create a new gtk widget with
gtk_plug_new (0). Then query the window id of the plug via gtk_plug_get_id().
Pass this id to the constructor of this class.
If you are using the host initiated version of the protocol, then first create
the XEmbedComponent using the default constructor. Use getHostWindowID to get
the window id of the host, use this to construct your gtk plug via gtk_plug_new.
A similar approach can be used to embed QT widgets via QT's QX11EmbedWidget
class.
Other toolkits or raw X11 widgets should follow the X11 embed protocol:
https://specifications.freedesktop.org/xembed-spec/xembed-spec-latest.html
@ -52,12 +63,30 @@ class XEmbedComponent : public Component
public:
//==============================================================================
/** Create a JUCE component wrapping the foreign widget with id wID */
/** Creates a JUCE component wrapping a foreign widget
Use this constructor if you are using the host initiated version
of the XEmbedProtocol. When using this version of the protocol
you must call getHostWindowID() and pass this id to the foreign toolkit.
*/
XEmbedComponent (bool wantsKeyboardFocus = true);
/** Create a JUCE component wrapping the foreign widget with id wID
Use this constructor if you are using the client initiated version
of the XEmbedProtocol.
*/
XEmbedComponent (unsigned long wID, bool wantsKeyboardFocus = true);
/** Destructor. */
~XEmbedComponent();
/** Use this method to retrieve the host's window id when using the
host initiated version of the XEmbedProtocol
*/
unsigned long getHostWindowID();
protected:
//==============================================================================
/** @internal */