     win "delete-event" [ on-delete yield ]
     GtkWidget:delete-event connect-signal ;
 
+:: connect-im-signals ( im-context -- )
+    im-context "commit" [ on-commit yield ]
+    GtkIMContext:commit connect-signal ;
+
 CONSTANT: window-controls>decor-flags
     H{
         { close-button 0 }


M:: gtk-ui-backend (open-window) ( world -- )
    GTK_WINDOW_TOPLEVEL gtk_window_new :> win
    
    world win [ <window-handle> >>handle drop ]
    [ register-window ] 2bi
    
    win world [ window-loc>> auto-position ]
    [ dim>> first2 gtk_window_set_default_size ] 2bi

ui.event-loop ui.gadgets ui.gadgets.private ui.gadgets.worlds
ui.gestures ui.pixel-formats ui.pixel-formats.private ui.private
glib.ffi gobject.ffi gtk.ffi gdk.ffi gdk.gl.ffi gtk.gl.ffi ;
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 -- window-handle )
    [ window-handle new ] dip >>window ;
