Danny Milosavljevic wrote:
Can you use a GtkPlug instead of a normal window? I get the feeling that
normal forms do strange extra stuff... no, scratch that, I'm _pretty
sure_ that normal forms do strange extra stuff that system trays don't
particularily like.

for testing do something like that in CreateForm:

Ok, I put this to CreateForm, made many other small modifications and I now I have a Tray Icon that writes 'foobar'!! Works on Gnome and KDE!

The realize_cb event is trigerred correctly and now no more Sleep(80).

The big problem right now is to paint TIcon into the widget.

Any ideas?

Does anyone know what TIcon.Handle is??? I think I need a PGdkImage to paint a image to the plug, but I don't know how to get one from TIcon.

Here is the code:

procedure TWidgetTrayIcon.CreateForm(id: Integer);
var
  Alabel: PGtkWidget;
begin
  fEmbedded := False;

  GtkForm := gtk_plug_new(0);

  g_signal_connect(GtkForm, 'realize', realize_cb, nil); // [1]

  Alabel := gtk_label_new('foobar');

  gtk_widget_show(Alabel);

  gtk_container_add(GTK_CONTAINER(GtkForm), Alabel);

  gtk_widget_show(GtkForm);
end;

(also, try to react on the realize signal of the icon to dock it (which
is the earliest point in it's life where it has a X window). [1])

  gdk_screen := gtk_widget_get_screen(icon);
  fScreen := GDK_SCREEN_XSCREEN(gdk_screen); // get the real screen

This code doesn't work. Raises an exception inside a X function. The exception propagates to Gtk and halts the hole icon creating process. I used the old code:

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

thanks,

Felipe

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

Reply via email to