     [ dim>> first2 gtk_window_set_default_size ] 2bi
     
     world setup-gl drop
+
+    win configure-im
     
     win connect-signals
     

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

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

        [ scroll-direction ] [ event-loc ] bi
    ] dip window send-scroll t ;

: key-sym ( event -- sym/f action? )
    keyval>> dup action-key-codes at [ t ]
    [ gdk_keyval_to_unicode [ f ] [ 1string ] if-zero f ] ?if ;

: key-event>gesture ( event -- mods sym/f action? )
    GdkEventKey memory>struct
    [ event-modifiers ] [ key-sym ] bi ;

: send-key-gesture ( win gesture -- )
    swap window propagate-key-gesture ;
   
: on-key-press ( sender event user-data -- result )
    drop key-event>gesture over
    [ <key-down> send-key-gesture ] [ 3drop drop ] if t ;

: on-key-release ( sender event user-data -- result )
    drop key-event>gesture over
    [ <key-up> send-key-gesture ] [ 3drop drop ] if t ;

: on-focus-in ( sender event user-data -- result )
    2drop window focus-world t ;
