     win im <window-handle> world handle<<
 
     world win register-window
-    
+
     win world [ window-loc>> auto-position ]
     [ dim>> first2 gtk_window_set_default_size ] 2bi
 
     win "factor" "Factor" [ utf8 string>alien ] bi@
     gtk_window_set_wmclass
-    
+
     world configure-gl
 
     win gtk_widget_realize
     win world window-controls>> configure-window-controls
-    
+
     win im configure-im
     win connect-user-input-signals
     win connect-win-state-signals


:: on-button-press ( win event user-data -- ? )
    win window :> world
    event mouse-event>gesture :> ( modifiers button loc )
    button {
        { 8 [ ] }
        { 9 [ ] }
        [ modifiers swap <button-down> loc world
          send-button-down ]
    } case t ;

:: on-button-release ( win event user-data -- ? )
    win window :> world
    event mouse-event>gesture :> ( modifiers button loc )
    button {
        { 8 [ world left-action send-action ] }
        { 9 [ world right-action send-action ] }
        [ modifiers swap <button-up> loc world
          send-button-up ]
    } case t ;

: on-scroll ( win event user-data -- ? )
    drop swap [

        { normal-title-bar $ GDK_DECOR_TITLE }
        { textured-background 0 }
    }

CONSTANT: window-controls>func-flags
    H{
        { close-button $ GDK_FUNC_CLOSE }
