Skip to content

Instantly share code, notes, and snippets.

@bigos
Created December 4, 2018 22:01
Show Gist options
  • Save bigos/93ea8d9fd6e7c6e6a6224e374f3a99de to your computer and use it in GitHub Desktop.
Save bigos/93ea8d9fd6e7c6e6a6224e374f3a99de to your computer and use it in GitHub Desktop.
#!/usr/local/bin/sbcl --script
(define-alien-routine gtk_application_window_new (* t) (app (* t)))
(define-alien-routine gtk_application_new (* t) (txt c-string) (flags int))
(define-alien-routine g_application_run int
(app (* t)) (argc int) (argv (* t)))
(define-alien-routine g_signal_connect_data int ;
(instance (* t)) (sig c-string)
(cback (function void (* t) int))
(data (* t)) (unusedptr (* t)) (unusedint int))
(define-alien-routine gtk_window_set_title void (win (* t)) (ttl (c-string)))
(define-alien-routine gtk_window_set_default_size void
(win (* t)) (x int) (y int))
(define-alien-routine gtk_widget_show_all void (win (* t)))
(sb-alien::define-alien-callback mycallback void ((app (* t)) (u int))
(with-alien ((win (* t)))
(setf win (gtk_application_window_new app))
(gtk_window_set_title win "This")
(gtk_window_set_default_size win 100 100)
(gtk_widget_show_all win)))
(load-shared-object "/usr/lib/x86_64-linux-gnu/libgtk-3.so.0")
(with-alien ((app (* t)) (status int))
(setf app (gtk_application_new nil 0))
(g_signal_connect_data app "activate" mycallback nil nil 0)
(g_application_run app 0 nil))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment