control handle in X [message #290005] |
Tue, 16 August 2005 22:07  |
Eclipse User |
|
|
|
Originally posted by: ubguada.hotmail.com
Hi all
I'm trying to access the underlying X window structure of an SWT control.
On Windows control.handle will be exactly the same as the control's HWND.
But on X what's the relationship? Is it a Display*?
Thanks!
|
|
|
|
|
|
|
|
|
|
|
Re: control handle in X [message #290092 is a reply to message #290032] |
Thu, 18 August 2005 10:59   |
Eclipse User |
|
|
|
Originally posted by: bbiggs.ca.ibm.com
Ulisses wrote:
>> If you create a Composite with the style SWT.EMBEDDED style, then under
>>SWT/GTK+ Composite.embeddedHandle will be an X window ID you can use for
>>parenting an XEMBED child. Maybe this is what you're looking for.
>
> In fact, Im trying to get a (X) ::Window handle from an arbitrary
> org.eclipse.swt.widgets.Control object.
> Not sure if it is even possible to do it in a cross-platform way.
> It works wonderfully under Windows but fails miserably under Linux/Gtk.
> Here's what I'm getting so far.
>
> Window 0 created from handle 136011016 (that's my programs output)
> The error was 'BadWindow (invalid Window parameter)'.
> (Details: serial 8 error_code 3 request_code 3 minor_code 0)
You're doing XGetWindowAtributes on something that isn't a window.
If you need the X window, there's no way to do this from the public
SWT API (even going through internals), and furthermore even if there
was a way I don't think you could guarentee it for all controls. I'm
not sure if this works but the closest you could get might be to:
1. make Control.fixedHandle public
2. Use OS.GTK_WIDGET_WINDOW (control.fixedHandle) to get a GdkWindow
3. Use OS.gdk_x11_drawable_get_xid (gdkWindow) to translate that to
an X window
I guess the other way might be to take Control.handle, and then call
GTK_WIDGET_WINDOW() on it, or if that's null keep calling it on its
parents until you find one with a GdkWindow, and then translate that to
an X window.
The difficulty here is that SWT talks to GTK+, which talks to GDK,
which then talks to X. So, there's three layers between you and the X
window.
-Billy
|
|
|
Re: control handle in X [message #290097 is a reply to message #290089] |
Thu, 18 August 2005 11:32  |
Eclipse User |
|
|
|
Originally posted by: sunil_kamath.nohotspammail.com
"Ulisses" <ubguada@hotmail.com> wrote in message
news:de233i$94p$1@news.eclipse.org...
>> See for yourself. Do a search.
>
> I knew your unwillingness to help was just plain bluff.
> Good luck mister, you'll certainly need it.
>
Your unwillingness to do anything for yourself indicates that the more
pressing need for luck is surely yours.
---
Sunil
|
|
|
Powered by
FUDForum. Page generated in 0.04532 seconds