Hi,

Am Dienstag, den 24.01.2006, 07:19 -0200 schrieb Felipe Monteiro de
Carvalho:
> On 1/21/06, Danny Milosavljevic <[EMAIL PROTECTED]> wrote:
> > I would guess you only need to realize the window (so that it has a GDK
> > - i.e. X - drawable, for example)
> >
> > You could also connect to the "realize" signal to only be notified when
> > the window is realized and save the drawable there.
> 

> Well ..... fell free to try those things and submit a patch if they work =)

Right after I did the ~4000 other things in my TODO queue ;)

(f.e. I do not have a system tray anymore so it would be quite some
work)

I do answer questions quickly though :)

> 
> I don´t know much about Gtk and X11. I just copyed the GtkTrayIcon
> component form Andrew Heines and adapted it to my interface, changing
> the code until it worked =P

I see :)

> 
> > If anything is unclear with gtk2 stuff, just ask me :)
> 
> The following lines on gtk1 interface:
> 
> procedure TWidgetTrayIcon.CreateForm(id: Integer);
> begin
> .....
>   fDisplay := 
> GDK_WINDOW_XDISPLAY(Pointer(PGtkWidget(GtkForm.Handle)^.window));
> //  SHowMessage(IntToStr(Integer(fDisplay)));
>   fWindow := GDK_WINDOW_XWINDOW (Pointer(PGtkWidget(GtkForm.Handle)^.window));
>   fScreen := XDefaultScreenOfDisplay(fDisplay); // get the screen
>   fScreenID := XScreenNumberOfScreen(fScreen); // and it's number
> end;
> 
> GDK_WINDOW_XDISPLAY doesn´t exist on the Gtk2 interface. It´s a X11
> specific MACRO. I tryed to substitute this with:

It does exist in gtk2 itself... though it's a little bit TOO low-level
for my taste :)

Better just use gtk_widget_get_screen and then
gdk_x11_screen_get_xscreen, the latter being missing from the
bindings.... there is no gdkx.pas in the bindings yet (not many people
use the pascal gtk2 bindings for X interfacing it seems), I suggest
creating a minimal one and converting/putting that (hmm, might later
want to dynamically load them because not everyone uses X11 together
with gtk+  - though the majority does):

Screen*     gdk_x11_screen_get_xscreen      (GdkScreen *screen);


>   fDisplay := GDK_DISPLAY;

that looks like an incomplete cast to me... does it work? (or is it the
non-multihead-safe-gdk-version exported global gdk_display variable?)

(GdkDrawable methods work on a GdkWindow)
Display *gdk_x11_drawable_get_xdisplay    (GdkDrawable *drawable);  

> //  SHowMessage(IntToStr(Integer(fDisplay)));
>   Widget := PGtkWidget(GtkForm.Handle);

ok

>   fWindow := PX11GdkDrawable(PGdkWindowObject(Widget^.window)^.impl)^.xid;

ok (O_o is GDK_WINDOW_XID missing too? :))
#define GDK_WINDOW_XID(win)           (gdk_x11_drawable_get_xid (win))

XID      gdk_x11_drawable_get_xid         (GdkDrawable *drawable);

(XID being just "Window" from X I think)

>   fScreen := XDefaultScreenOfDisplay(fDisplay); // get the screen

um... this is evil.

>   fScreenID := XScreenNumberOfScreen(fScreen); // and it's number

gint        gdk_screen_get_number           (GdkScreen *screen);

> 
> But the Icon doesn´t show (I have no idea why).

Is space for the icon allocated in the tray - i.e. is there a "hole"  ?
- and it just doesnt draw or doesn't "anything" happen? In your version,
check the value of fWindow and use "xwininfo -id xxxxx" to see if it's
correct...

Most of those kind of problems with lowlevel X stuff not getting
executed properly have to do with the widget not being realized yet...
Might want to make double-sure that it is :)



> 
> Any help is appreciated =)
> 
> thanks,
> --
> Felipe Monteiro de Carvalho

cheers,
   Danny


_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to