 ! 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
+USING: accessors alien.accessors alien.c-types alien.data alien.enums
+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.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
 IN: ui.backend.gtk
 
 SINGLETON: gtk-ui-backend
 
 TUPLE: handle ;
-TUPLE: window-handle < handle window fullscreen? im-context ;
+TUPLE: window-handle < handle window fullscreen? im-context im-menu ;
 
 : <window-handle> ( window im-context -- window-handle )
     window-handle new

    ] ui-running ;

: connect-signal-with-data ( object signal-name callback data -- )
    [ utf8 string>alien ] 2dip f 0 g_signal_connect_data drop ;

: connect-signal ( object signal-name callback -- )
    f connect-signal-with-data ;

        f f gtk_gl_init
        init-clipboard
        start-ui
        stop-io-thread
        [
            init-io-event-source
            init-timeout
