         ] [ gtk_dialog_run drop ] bi
     ] with-destructors ;
 
+: <yield-callback> ( -- callback )
+    [ drop yield t ] GSourceFunc ;
+
 M: gtk-ui-backend (with-ui)
     [
         0 gint <ref> f void* <ref> gtk_init

    2drop window ungraft t ;

:: connect-win-state-signals ( win -- )
    win "expose-event" [ on-expose yield ]
    GtkWidget:expose-event connect-signal
    win "configure-event" [ on-configure yield ]
    GtkWidget:configure-event connect-signal
    win "delete-event" [ on-delete yield ]
    GtkWidget:delete-event connect-signal
    win "map-event" [ on-map yield ]
    GtkWidget:map-event connect-signal ;

! Input methods

    ] when* ;

:: connect-user-input-signals ( win -- )
    win "motion-notify-event" [ on-motion ]
    GtkWidget:motion-notify-event connect-signal
    win "leave-notify-event" [ on-leave ]
    GtkWidget:leave-notify-event connect-signal
    win "button-press-event" [ on-button-press ]
    GtkWidget:button-press-event connect-signal
    win "button-release-event" [ on-button-release ]
    GtkWidget:button-release-event connect-signal
    win "scroll-event" [ on-scroll ]
    GtkWidget:scroll-event connect-signal
    win "key-press-event" [ on-key-press/release ]
    GtkWidget:key-press-event connect-signal
    win "key-release-event" [ on-key-press/release ]
    GtkWidget:key-release-event connect-signal
    win "focus-in-event" [ on-focus-in ]
    GtkWidget:focus-in-event connect-signal
    win "focus-out-event" [ on-focus-out ]
    GtkWidget:focus-out-event connect-signal ;

! Window state events
