]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/ui/backend/gtk/gtk.factor
Merge remote-tracking branch 'Blei/gtk-image-loader'
[factor.git] / basis / ui / backend / gtk / gtk.factor
index fba30fc15a5a01ffca2eecb0ae4388606efb36ce..db316120c46c0d0c94cd25f0a7e97f4e6e6156dc 100644 (file)
@@ -3,14 +3,18 @@
 USING: accessors alien.accessors alien.c-types alien.data
 alien.strings arrays assocs classes.struct command-line
 continuations destructors environment gdk.ffi gdk.gl.ffi
-glib.ffi gobject-introspection.standard-types gobject.ffi
-gtk.ffi gtk.gl.ffi io.encodings.utf8 kernel libc literals locals
-math math.bitwise math.order math.vectors namespaces sequences
-strings system threads ui ui.backend ui.backend.gtk.input-methods
-ui.backend.gtk.io ui.clipboards ui.event-loop ui.gadgets
-ui.gadgets.private ui.gadgets.worlds ui.gestures
-ui.pixel-formats ui.pixel-formats.private ui.private
-vocabs.loader combinators prettyprint io ;
+gdk.pixbuf.ffi glib.ffi
+gobject-introspection.standard-types
+gobject.ffi gtk.ffi gtk.gl.ffi io.backend
+io.backend.unix.multiplexers io.encodings.binary
+io.encodings.utf8 io.files io.thread kernel libc literals
+locals math math.bitwise math.order math.vectors namespaces
+sequences strings system threads ui ui.backend ui.backend.gtk.input-methods
+ui.backend.gtk.io ui.clipboards
+ui.commands ui.event-loop ui.gadgets ui.gadgets.editors
+ui.gadgets.menus ui.gadgets.private ui.gadgets.worlds
+ui.gestures ui.pixel-formats ui.pixel-formats.private
+ui.private vocabs.loader combinators io ;
 IN: ui.backend.gtk
 
 SINGLETON: gtk-ui-backend
@@ -213,6 +217,17 @@ CONSTANT: action-key-codes
 : on-focus-out ( win event user-data -- ? )
     2drop window unfocus-world t ;
 
+! This word gets replaced when deploying. See 'Vocabulary icons'
+! in the docs and tools.deploy.shaker.gtk-icon
+: get-icon-data ( -- byte-array )
+    "resource:misc/icons/Factor_48x48.png" binary file-contents ;
+
+: load-icon ( -- )
+    get-icon-data [
+        data>GInputStream &g_object_unref
+        GInputStream>GdkPixbuf gtk_window_set_default_icon
+    ] with-destructors ;
+
 :: connect-user-input-signals ( win -- )
     win events-mask gtk_widget_add_events
     win "motion-notify-event" [ on-motion yield ]
@@ -502,6 +517,7 @@ M: gtk-ui-backend (with-ui)
     [
         0 gint <ref> f void* <ref> gtk_init
         0 gint <ref> f void* <ref> gtk_gl_init
+        load-icon
         init-clipboard
         start-ui
         [