 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? ;
+TUPLE: window-handle < handle window fullscreen? im-context ;
 
 : <window-handle> ( window -- window-handle )
     [ window-handle new ] dip >>window ;

    win "delete-event" [ on-delete yield ]
    GtkWidget:delete-event connect-signal ;

CONSTANT: window-controls>decor-flags
    H{
        { close-button 0 }

    world setup-gl drop
    
    win connect-signals
    im-context connect-im-signals
    
    win gtk_widget_realize
    win world window-controls>> configure-window-controls

    win gtk_widget_show_all ;

M: gtk-ui-backend (close-window) ( handle -- )
    window>> [ gtk_widget_destroy ] [ unregister-window ] bi
    event-loop? [ gtk_main_quit ] unless ;

M: gtk-ui-backend set-title
