crategus / cl-cffi-gtk

cl-cffi-gtk is a Lisp binding to the GTK+ 3 library.

Home Page:http://www.crategus.com/books/cl-cffi-gtk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tutorial "Drawing_in_response_to_input" Undefined functions GTK-WIDGET-ALLOCATED-HEIGH GTK-WIDGET-ALLOCATED-WIDT

mashomee opened this issue · comments

WARNING: redefining GTK-TUTORIAL::EXAMPLE-DRAWING in DEFUN
; in: DEFUN EXAMPLE-DRAWING
;     (GTK-TUTORIAL::GTK-WIDGET-ALLOCATED-HEIGHT GTK-TUTORIAL::WIDGET)
; 
; caught STYLE-WARNING:
;   undefined function: GTK-TUTORIAL::GTK-WIDGET-ALLOCATED-HEIGHT

;     (GTK-TUTORIAL::GTK-WIDGET-ALLOCATED-WIDTH GTK-TUTORIAL::WIDGET)
; 
; caught STYLE-WARNING:
;   undefined function: GTK-TUTORIAL::GTK-WIDGET-ALLOCATED-WIDTH
; 
; compilation unit finished
;   Undefined functions:
;     GTK-WIDGET-ALLOCATED-HEIGHT GTK-WIDGET-ALLOCATED-WIDTH
;   caught 2 STYLE-WARNING conditions

Does the code outdated and functions should be
gtk-widget-get-allocated-width and gtk-widget-get-allocated-heigh ?

Also, when I run the code, error occurs and the cl-cffi-gtk main thread quits.

PS C:\Users\o> sbcl
This is SBCL 2.0.0, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.

WARNING: the Windows port is fragile, particularly for multithreaded
code.  Unfortunately, the development team currently lacks the time
and resources this platform demands.
* (load #P"f:/lisp/gtk_tut.lisp")
To load "cl-cffi-gtk":
  Load 1 ASDF system:
    cl-cffi-gtk
; Loading "cl-cffi-gtk"
.................
T
* leave event 'configure-event'

(sbcl.exe:11956): Gtk-WARNING **: drawing failure for widget 'GtkFrame': cairo_restore() without matching cairo_save()

(sbcl.exe:11956): Gtk-WARNING **: drawing failure for widget 'GtkWindow': cairo_restore() without matching cairo_save()

debugger invoked on a SB-SYS:MEMORY-FAULT-ERROR in thread
#<THREAD "cl-cffi-gtk main thread" RUNNING {10066DD4B3}>:
  Unhandled memory fault at #x20473BE38.

The current thread is not at the foreground,
SB-THREAD:RELEASE-FOREGROUND has to be called in #<SB-THREAD:THREAD "main thread" RUNNING {10010B0523}>
for this thread to enter the debugger.

(sb-thread:release-foreground)
0Resuming thread #<THREAD "cl-cffi-gtk main thread" RUNNING {10066DD4B3}>

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] abort thread
             (#<THREAD "cl-cffi-gtk main thread" RUNNING {10066DD4B3}>)

(SB-KERNEL:HANDLE-WIN32-EXCEPTION #.(SB-SYS:INT-SAP #X040CDE60) #.(SB-SYS:INT-SAP #X040CE6F0))
0] 0
Resuming thread #<THREAD "main thread" RUNNING {10010B0523}>
* 3
3
*

Below is the system info:

* (gtk:cl-cffi-gtk-build-info)

cl-cffi-gtk version: 1.0.0
cl-cffi-gtk build date: 14:48 3/19/2021
GTK+ version: 3.22.19
GLIB version: 2.52.3
GDK-Pixbuf version: 2.36.9
Pango version: 1.40.11
Cairo version: 1.16.0
Machine type: X86-64
Machine version: NIL
Software type: Win32
Software version: 6.2.9200
Lisp implementation type: SBCL
Lisp implementation version: 2.0.0

NIL

BTW, it's really an excellent tutorial and library,
Thanks for your work!

gtk_tut.lisp.txt

commented

gtk-widget-get-allocated-width and gtk-widget-get-allocated-heigh update to :
gtk-widget-allocated-width and gtk-widget-allocated-height .

I've now notice that the cl-cffi-gtk I use is downloaded by quicklisp from https://github.com/Ferada/cl-cffi-gtk
according to #77

I really like the documentation here!

Solution is like you say to not use the default remote quicklisp upstream. Instead, clone this repo locally into a place where quicklisp can find it and the correct code that is consistent with the tutorial will be loaded.