Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » control handle in X
control handle in X [message #290005] Wed, 17 August 2005 02:07 Go to next message
Eclipse UserFriend
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 #290008 is a reply to message #290005] Wed, 17 August 2005 03:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"Ulisses" <ubguada@hotmail.com> wrote in message
news:ddu64s$ps9$1@news.eclipse.org...
> 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*?
>
Why don't you look at the source code for SWT?
It's open source, after all.
---
Sunil
Re: control handle in X [message #290026 is a reply to message #290008] Wed, 17 August 2005 15:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ubguada.hotmail.com

Sir, not sure what was your point with such comment, it was not helpful at
all.
Please do not feel pressed to give an incomplete or rather inocuous response
just for your fun, it only adds unneeded entropy to this list.
If you'd rather include along with your minimalist answer snippets of code
or even hyperlinks that would clarify my doubts, I'd be very very grateful.
Thank you
Re: control handle in X [message #290028 is a reply to message #290026] Wed, 17 August 2005 18:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"Ulisses" <ubguada@hotmail.com> wrote in message
news:ddvn23$ell$1@news.eclipse.org...
> Sir, not sure what was your point with such comment, it was not helpful at
> all.
> Please do not feel pressed to give an incomplete or rather inocuous
> response just for your fun, it only adds unneeded entropy to this list.
> If you'd rather include along with your minimalist answer snippets of code
> or even hyperlinks that would clarify my doubts, I'd be very very
> grateful.
> Thank you
>
The point is that if you are not going to bother to do some minimal research
on your own, don't expect help from others.
If you look at the SWT source code it is quite obvious what the widget
handle corresponds to.
----
Sunil
Re: control handle in X [message #290030 is a reply to message #290005] Wed, 17 August 2005 19:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bbiggs.ca.ibm.com

Ulisses wrote:
> 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*?

For SWT/GTK+, the handle is usually a GtkWidget, but it depends on
the widget what type of widget this is, or whether it is the owner of
the X window (some widgets have many associated X windows, and GTK+
doesn't always expose them).

Note: these sort of internals are subject to change.

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.

-Billy
Re: control handle in X [message #290032 is a reply to message #290030] Wed, 17 August 2005 22:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ubguada.hotmail.com

> 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)

then I get this critical:

The program 'SWT' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
(Details: serial 8 error_code 3 request_code 3 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
Re: control handle in X [message #290033 is a reply to message #290028] Wed, 17 August 2005 22:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ubguada.hotmail.com

Minimal research? What you fail to realize is that eclipse's source code is
composed 16990 files.
A hint like 'look at...' would be very welcome - but you seem to consider
yourself so high that I doubt you'd bother dignifying this help group with a
concrete answer. I may be mistaken though... please let us know.



"Sunil Kamath" <sunil_kamath@nohotspammail.com> wrote in message
news:ddvvmu$pkt$1@news.eclipse.org...
> "Ulisses" <ubguada@hotmail.com> wrote in message
> news:ddvn23$ell$1@news.eclipse.org...
>> Sir, not sure what was your point with such comment, it was not helpful
>> at all.
>> Please do not feel pressed to give an incomplete or rather inocuous
>> response just for your fun, it only adds unneeded entropy to this list.
>> If you'd rather include along with your minimalist answer snippets of
>> code or even hyperlinks that would clarify my doubts, I'd be very very
>> grateful.
>> Thank you
>>
> The point is that if you are not going to bother to do some minimal
> research on your own, don't expect help from others.
> If you look at the SWT source code it is quite obvious what the widget
> handle corresponds to.
> ----
> Sunil
>
Re: control handle in X [message #290037 is a reply to message #290033] Thu, 18 August 2005 02:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"Ulisses" <ubguada@hotmail.com> wrote in message
news:de0fbn$drq$1@news.eclipse.org...
> Minimal research? What you fail to realize is that eclipse's source code
> is composed 16990 files.

How many SWT widget source files are there?

> A hint like 'look at...' would be very welcome - but you seem to consider
> yourself so high that I doubt you'd bother dignifying this help group with
> a concrete answer. I may be mistaken though... please let us know.
>

See for yourself. Do a search.
---
Sunil

>
>
> "Sunil Kamath" <sunil_kamath@nohotspammail.com> wrote in message
> news:ddvvmu$pkt$1@news.eclipse.org...
>> "Ulisses" <ubguada@hotmail.com> wrote in message
>> news:ddvn23$ell$1@news.eclipse.org...
>>> Sir, not sure what was your point with such comment, it was not helpful
>>> at all.
>>> Please do not feel pressed to give an incomplete or rather inocuous
>>> response just for your fun, it only adds unneeded entropy to this list.
>>> If you'd rather include along with your minimalist answer snippets of
>>> code or even hyperlinks that would clarify my doubts, I'd be very very
>>> grateful.
>>> Thank you
>>>
>> The point is that if you are not going to bother to do some minimal
>> research on your own, don't expect help from others.
>> If you look at the SWT source code it is quite obvious what the widget
>> handle corresponds to.
>> ----
>> Sunil
>>
>
>
Re: control handle in X [message #290089 is a reply to message #290037] Thu, 18 August 2005 13:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ubguada.hotmail.com

> See for yourself. Do a search.

I knew your unwillingness to help was just plain bluff.
Good luck mister, you'll certainly need it.
Re: control handle in X [message #290092 is a reply to message #290032] Thu, 18 August 2005 14:59 Go to previous messageGo to next message
Eclipse UserFriend
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 15:32 Go to previous message
Eclipse UserFriend
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
Previous Topic:eclipse crashes under SuSe 9.3
Next Topic:How to change color in editor when the new color was set in preferences
Goto Forum:
  


Current Time: Wed Apr 24 15:41:42 GMT 2024

Powered by FUDForum. Page generated in 0.02593 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top