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
: 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 ]
[
0 gint <ref> f void* <ref> gtk_init
0 gint <ref> f void* <ref> gtk_gl_init
+ load-icon
init-clipboard
start-ui
[