Window Icon on Linux
Archives Forums/Linux Discussion/Window Icon on Linux
| ||
I decided to take a look at Bruce's modules, to see how he implemented the Icon support on the window titlebar on Linux, so I got the following code:
?linux
Import "-L/usr/lib"
Import "-lgtk-x11-2.0"
Import "-lgdk-x11-2.0"
?
Extern
Function gtk_window_set_default_icon(pixbuf:Int)
Function gdk_pixbuf_new_from_data:Int(data:Byte Ptr, colorspace:Int, has_alpha:Int, bits_per_sample:Int, width:Int, height:Int, rowstride:Int, destroy_fn:Byte Ptr, data_fn:Byte Ptr)
End Extern
Const GDK_COLORSPACE_RGB:Int = 0
Function SetAppIcon(pix:TPixmap)
If pix <> Null Then
Local pixmap:TPixmap
If pix.format <> PF_RGBA8888 Then
pixmap = pix.convert( PF_RGBA8888 )
Else
pixmap = pix
End If
Local icon:Int = gdk_pixbuf_new_from_data(pixmap.pixels, GDK_COLORSPACE_RGB, True, 8, ..
pixmap.width, pixmap.height, pixmap.Pitch, Null, Null)
gtk_window_set_default_icon(icon)
End If
End Function
Graphics 800,600,0
Local icon:TPixmap = LoadPixmap("lupa.png")
SetAppIcon icon
While KeyHit(KEY_ESCAPE)=False
Cls
SetBlend ALPHABLEND
DrawPixmap icon,0,0
Flip 1
Delay 1
Wend
Problem is: I can't compile this! Blitzmax keeps telling me: Linking:icon_test /usr/bin/ld: cannot find -lgtk-x11-2.0 collect2: ld returned 1 exit status But apparently I do have gtk-x11-2.0: root@ubuntu:/home/ubuntu# locate gtk-x11-2.0 /rofs/usr/lib/libgtk-x11-2.0.so.0 /rofs/usr/lib/libgtk-x11-2.0.so.0.1400.4 /usr/lib/libgtk-x11-2.0.so.0 /usr/lib/libgtk-x11-2.0.so.0.1400.4 So what am I missing here?? (Sorry if this is something simple, I'm completely newbie on Linux...) |
| ||
| So what am I missing here?? The "dev" libraries for linking. |
| ||
| Thanks... I did an apt-get libgtk-2.0-dev, and it compiled, but my attempt at setting the app icon this way didn't work... at all :P~ |