Thought I'd have a little play with GTK3, particularly the TrayIcon. Initially appeared quite easy to get it to work with LibAppIndicator but I have run into problems with the function gdk_pixbuf_save() that is derived from libgdk_pixbuf-2.0.so.0. Same library in both gtk2 and gtk3.
In gtk2 its accessed via Gdk2Pixbuf unit from -
/usr/share/fpcsrc/3.0.4/packages/gtk2/src/gtk+/gdkpixbuf/gtk2pixbuf.pas
In gtk3 I choose to 'use' LazGdkPixbuf2 unit from -
lcl/interfaces/gtk3/gtk3bindings/lazgdkpixbuf2.pas
and I wonder if thats was a mistake. Not wanting to bore everyon with TrayIcon issues, I reduced it down to the following code, its a form with nothing more than a TrayIcon that has had a icon and a menu assigned in the Object Inspector
procedure TForm1.ButtonFiddleIconClick(Sender: TObject);
var
NewIcon: Pointer;
begin
NewIcon := {%H-}Pointer(TrayIcon1.Icon.Handle);
gdk_pixbuf_save(NewIcon, PChar('icon.png'), 'png', nil, [nil]);
end;
Under GTK2 it works fine, writes out a png file. In GTK3 the gdk_pixbuf_save fails and we see a message -
gtk3test:596): GdkPixbuf-[1;35mCRITICAL[0m **: [34m18:06:31.164[0m: gdk_pixbuf_savev: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
It does not like my icon, apparently does not believe its a pixbuf. Apart from gdk_pixbuf_save() is there some other way to dump the icon out to have a look at it ?
Davo