         f f gtk_gl_init
         init-clipboard
         start-ui
-        f io-thread-running? set-global
+        stop-io-thread
         [
             init-io-event-source
             init-timeout

! 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.enums alien.strings arrays ascii assocs classes.struct
combinators combinators.short-circuit command-line destructors
documents gdk.ffi gdk.gl.ffi glib.ffi gobject.ffi gtk.ffi
gtk.gl.ffi 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.event-loop ui.gadgets
ui.gadgets.editors ui.gadgets.line-support ui.gadgets.private
ui.gadgets.worlds ui.gestures ui.pixel-formats
ui.pixel-formats.private ui.private ;
RENAME: windows ui.private => ui:windows
IN: ui.backend.gtk

SINGLETON: gtk-ui-backend

TUPLE: handle ;
TUPLE: window-handle < handle window fullscreen? im-context ;

: <window-handle> ( window im-context -- window-handle )
    window-handle new

    GtkWidget:focus-out-event im connect-signal-with-data
    win "focus-out-event" [ im-on-focus-out yield ]
    GtkWidget:focus-out-event im connect-signal-with-data
    win "destroy" [ im-on-destroy yield ]
    GtkObject:destroy im connect-signal-with-data ;

