]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'gtk' into gtk-image-loader
authorPhilipp Brüschweiler <blei42@gmail.com>
Thu, 22 Jul 2010 21:51:17 +0000 (23:51 +0200)
committerPhilipp Brüschweiler <blei42@gmail.com>
Thu, 22 Jul 2010 21:51:17 +0000 (23:51 +0200)
Conflicts:
basis/glib/ffi/ffi.factor
basis/ui/backend/gtk/gtk.factor

1  2 
basis/glib/ffi/ffi.factor
basis/ui/backend/gtk/gtk.factor

index a0dc3a3fdbc128344e7fd6be95f51432a5dc72dc,d7b265004e934a5a2348bd950e1a66df60aa922a..f5af540dfaf9a9f997453beb7d54dc20e6c6d0be
@@@ -1,8 -1,8 +1,9 @@@
  ! Copyright (C) 2009 Anton Gorenko.
  ! See http://factorcode.org/license.txt for BSD license.
  USING: accessors alien alien.c-types alien.destructors
- alien.libraries alien.strings alien.syntax combinators gir
- io.encodings.utf8 kernel system vocabs.parser words ;
 -alien.libraries alien.syntax combinators compiler.units
 -gobject-introspection kernel system vocabs.parser words ;
++alien.libraries alien.strings alien.syntax combinators
++gobject-introspection io.encodings.utf8 kernel system
++vocabs.parser words ;
  IN: glib.ffi
  
  <<
@@@ -67,7 -67,7 +68,7 @@@ TYPEDEF: guint16 gunichar
  TYPEDEF: gpointer pointer
  TYPEDEF: gpointer any
  
 -IMPLEMENT-STRUCTS: GPollFD GSource GSourceFuncs ;
 +IMPLEMENT-STRUCTS: GError GPollFD GSource GSourceFuncs ;
  
  GIR: vocab:glib/GLib-2.0.gir
  
@@@ -78,17 -78,3 +79,17 @@@ CALLBACK: gboolean GSourceFuncsPrepareF
  CALLBACK: gboolean GSourceFuncsCheckFunc ( GSource* source ) ;
  CALLBACK: gboolean GSourceFuncsDispatchFunc ( GSource* source, GSourceFunc callback, gpointer user_data ) ;
  
 +ERROR: g-error domain code message ;
 +
 +: GError>g-error ( GError -- g-error )
 +    [ domain>> g_quark_to_string utf8 alien>string ]
 +    [ code>> ]
 +    [ message>> utf8 alien>string ] tri
 +    \ g-error boa ;
 +
 +: handle-GError ( GError/f -- )
 +    [
 +        [ GError>g-error ]
 +        [ g_error_free ] bi
 +        throw
 +    ] when* ;
index 57b406f6fd412edafc1ea29e51b30667aa6a6a79,441e02a04fd91de6943159bc7d677c39efe6f7a7..fe72c6ddf5a3586b45921966f2fba706e8f9261c
@@@ -1,19 -1,15 +1,16 @@@
  ! Copyright (C) 2010 Anton Gorenko, Philipp Brüschweiler.
  ! See http://factorcode.org/license.txt for BSD license.
  USING: accessors alien.accessors alien.c-types alien.data
 -alien.strings arrays assocs classes.struct command-line
 -destructors gdk.ffi gdk.gl.ffi glib.ffi gobject.ffi gtk.ffi
 -gtk.gl.ffi io.backend io.backend.unix.multiplexers
 -io.encodings.utf8 io.thread kernel libc literals locals math
 -math.bitwise math.order math.vectors namespaces sequences
 -strings system threads ui ui.backend 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 ;
 +alien.strings alien.syntax arrays assocs classes.struct
 +command-line destructors gdk.ffi gdk.gl.ffi glib.ffi
 +gobject.ffi gtk.ffi gtk.gl.ffi io.backend
 +io.backend.unix.multiplexers io.encodings.utf8 io.thread kernel
 +libc literals locals math math.bitwise math.order math.vectors
 +namespaces sequences strings system threads ui ui.backend
 +ui.clipboards ui.commands ui.event-loop ui.gadgets
- ui.gadgets.menus ui.gadgets.private ui.gadgets.worlds
- ui.gestures ui.pixel-formats ui.pixel-formats.private
- ui.private ;
- RENAME: windows ui.private => ui:windows
- EXCLUDE: ui.gadgets.editors => change-caret ;
- RENAME: change-caret ui.gadgets.editors => editors:change-caret
++ui.gadgets.editors ui.gadgets.menus ui.gadgets.private
++ui.gadgets.worlds ui.gestures ui.pixel-formats
++ui.pixel-formats.private ui.private ;
  IN: ui.backend.gtk
  
  SINGLETON: gtk-ui-backend
@@@ -231,7 -227,12 +228,12 @@@ CONSTANT: poll-fd-event
          mx get fd>> >>fd
          poll-fd-events >>events ;
  
- : init-io-event-source ( -- )
+ HOOK: init-io-event-source io-backend ( -- )
+ M: c-io-backend init-io-event-source
+     ;
+ M: object init-io-event-source
      GSourceFuncs malloc-struct &free
          [ io-source-prepare ] GSourceFuncsPrepareFunc >>prepare
          [ io-source-check ] GSourceFuncsCheckFunc >>check
@@@ -266,21 -267,10 +268,21 @@@ SYMBOL: next-timeou
      f g_source_attach drop
      nano-count next-timeout set-global ;
  
 +: load-icon ( -- )
 +    ! This file is not in a resource.txt because it can be
 +    ! overwritten when deploying. See 'Vocabulary icons'
 +    ! in the docs.
 +    "vocab:ui/backend/gtk/icon.png"
 +    normalize-path utf8 string>alien
 +    { { pointer: GError initial: f } }
 +    [ gtk_window_set_default_icon_from_file ] with-out-parameters
 +    handle-GError drop ;
 +
  M: gtk-ui-backend (with-ui)
      [
          f f gtk_init
          f f gtk_gl_init
 +        load-icon
          init-clipboard
          start-ui
          stop-io-thread