Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Does SWT (in Eclipse 3.2 or w.4) support embedding of GTK widgets inside the SWT widgets?


Does gnome-calculator support XEMBED?

You are entering the relm of application embedding.  A while back, there was something call Bonobo that was "OLE for X".  I think this effort is dead (but I could be wrong).  I suggest you google around and find out how application embedding is done.  For example, has anyoneever embedded gnome-calculator in another application?  Just hammering the X window is unlikely to work.  Even if if was to draw properly, tabbing and focus are unlikely to work.



"Dharmesh Bhakta" <bhaktadn@xxxxxxxxx>
Sent by: platform-swt-dev-bounces@xxxxxxxxxxx

06/12/2008 07:56 PM

Please respond to
"Eclipse Platform SWT component developers list."        <platform-swt-dev@xxxxxxxxxxx>

To
"Eclipse Platform SWT component developers list." <platform-swt-dev@xxxxxxxxxxx>
cc
mukundan80@xxxxxxxxx
Subject
Re: [platform-swt-dev] Does SWT (in Eclipse 3.2 or w.4) support        embedding of GTK widgets inside the SWT widgets?





Thanks Steve for the quick response. Let me admit this first, I am a
newbie to both SWT and GTK so I am not familiar with all the concepts
around it but trying to learn as fast as i can.

Yes, That's exactly I want. I would like to make one window appear
inside the another. Let's say I have a simple native application,
gnaome-calculator. I would like the gnome-calculator to appear inside
a view under eclipse. For now, I'm just trying the gnome-calculator as
an example. But If I can get this to work, I should be able to get
other native business applications to work under eclipse.

I was hoping that the OS.gtk_widget_reparent(widget, parent) would
have given me the same results as I got on Windows. But it somehow did
not work as expected.

So, I did a little investigation on the GtkPlug & GtkSocket which uses
the XEMBED protocol. Doing deeper investigation on the SWT's side and
it appears that the nativeComposite.embeddedHandle is the socket_id
where I would like the gnome-calculator to appear. So now, I created a
new Gtk Plug using the OS.gtk_plug_new passing the socket_id of the
nativeComposite.embeddedHandle as the parameter.
This method returns a reference to the plug widget. I have been
successful in adding a new GTK widget to this plug widget and display
it inside an Eclipse view. :-) But I've been able to add a Window to
the plug widget. Any suggestions?

So now, the issue I will have here is how do I add the
gnome-calculator to the plug widget so I can display inside the
Eclipse Vieww. The only information I have for now is the X Window id
for the ganome-caculator. Some now I need to find a way to get the
widget representation of  X Window id. Any suggestion here?

THanks in advance for your help.

- Dharmesh

Thanks in
On Thu, Jun 12, 2008 at 3:06 PM, Steve Northover
<Steve_Northover@xxxxxxxxxx> wrote:
>
> I'm not sure this "works".  Your code may end up making one window appear in
> another but that's about it.  The right way to embed on Windows is to use
> OLE.
>
> On GTK, the right way to embed one X window in another is to use XEMBED,
> which is supported by GTK and therefore SWT.  Both sides implement this
> protocol which covers things like focus, tabbing etc.
>
> If you just have the handle to a widget and expect to slap it into another
> widget hierarchy (like the sample Windows code), you could reach through to
> X windows on both sides and call XReparentWindow().  I have no idea whether
> it would work, but it would be equivalent to what you are doing on Windows.
>
>
>
> "Dharmesh Bhakta" <bhaktadn@xxxxxxxxx>
> Sent by: platform-swt-dev-bounces@xxxxxxxxxxx
>
> 06/12/2008 03:16 PM
>
> Please respond to
> "Eclipse Platform SWT component developers list."
>  <platform-swt-dev@xxxxxxxxxxx>
> To
> platform-swt-dev@xxxxxxxxxxx
> cc
> Subject
> [platform-swt-dev] Does SWT (in Eclipse 3.2 or w.4) support        embedding
> of GTK widgets inside the SWT widgets?
>
>
>
>
> Does SWT (in Eclipse 3.2 or w.4) support embedding of GTK widgets
> inside the SWT widgets? I can embed Windows based widgets inside the
> SWT in the following manner and it seems to just work fine. But I
> would like to embed a Linux GTK based native window inside the SWT.
> How do I do it?
>
>        nativeComposite = new Composite(parent, SWT.EMBEDDED );
>
>        TCHAR  tChrTitle = new TCHAR(0,"Notepad - Untitled",true);
>
>        handle = os.FindWindow(null, tChrTitle);
>
>        os.SetWindowLong(handle, OS.GWL_STYLE, OS.WS_VISIBLE |
> OS.WS_CLIPCHILDREN | OS.WS_CLIPSIBLINGS);
>
>        os.SetParent(handle,nativeComposite.handle);
>
> - Dan
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
>
>
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
>
>
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top