[cl-gtk2-devel] widget-event

hrapof at common-lisp.ru hrapof at common-lisp.ru
Thu Aug 19 08:56:45 UTC 2010


Hello!

I have an image with an eventbox and two rulers around it.
I'm trying to make rulers' position markers follow mouse movements  
above the image.
The following idea was found on the web and worked for me with CLG.
However, with such cl-gtk2 code

(within-main-loop
     (let ((builder (make-instance 'builder)))
       (builder-add-from-file builder "a.glade")
       (builder-connect-signals-simple
        builder
        `(("eventbox1_motion_notify_event_cb"
	  ,(lambda (b event)
		   (declare (ignore b))
		   (widget-event (builder-get-object builder "vruler1") event)
		   (widget-event (builder-get-object builder "hruler1") event)
		   ))

I'm getting:


The value NIL is not of type SYSTEM-AREA-POINTER.
    [Condition of type TYPE-ERROR]

Restarts:
  0: [RETURN-FROM-G-CLOSURE] Return value from closure
  1: [TERMINATE-THREAD] Terminate this thread (#<THREAD "cl-gtk2 main  
thread" RUNNING {AF84F01}>)

Backtrace:
   0: (CFFI-SYS:%MEM-SET NIL #.(SB-SYS:INT-SAP #X08168390) :POINTER 32)
       Locals:
         CFFI-SYS::OFFSET = 32
         CFFI-SYS::PTR = #.(SB-SYS:INT-SAP #X08168390)
         TYPE = :POINTER
         CFFI-SYS::VALUE = NIL
   1: ((SB-PCL::FAST-METHOD (SETF CFFI::FOREIGN-STRUCT-SLOT-VALUE) (T  
T CFFI::SIMPLE-STRUCT-SLOT)) ..)
       Locals:
         SB-DEBUG::ARG-0 = :<NOT-AVAILABLE>
         SB-DEBUG::ARG-1 = :<NOT-AVAILABLE>
         SB-DEBUG::ARG-2 = NIL
         SB-DEBUG::ARG-3 = #.(SB-SYS:INT-SAP #X08168390)
         SB-DEBUG::ARG-4 = #<CFFI::SIMPLE-STRUCT-SLOT {BE6B551}>
   2: (GOBJECT::COPY-SLOTS-TO-NATIVE ..)
       Locals:
         SB-DEBUG::ARG-0 = #S(GDK:EVENT-MOTION ..)
         SB-DEBUG::ARG-1 = #.(SB-SYS:INT-SAP #X08168390)
         SB-DEBUG::ARG-2 = #S(GOBJECT::CSTRUCT-DESCRIPTION ..)
   3: ((SB-PCL::FAST-METHOD CFFI:TRANSLATE-TO-FOREIGN (T  
GOBJECT::BOXED-VARIANT-CSTRUCT-FOREIGN-TYPE)) ..)
       Locals:
         SB-DEBUG::ARG-0 = :<NOT-AVAILABLE>
         SB-DEBUG::ARG-1 = :<NOT-AVAILABLE>
         SB-DEBUG::ARG-2 = #S(GDK:EVENT-MOTION ..)
         SB-DEBUG::ARG-3 =  
#<GOBJECT::BOXED-VARIANT-CSTRUCT-FOREIGN-TYPE {B03C261}>
   4: (GTK:WIDGET-EVENT #<GTK:V-RULER {C398E39}> #S(GDK:EVENT-MOTION  
:TYPE :MOTION-NOTIFY :WINDOW #<GDK:GDK-WINDOW {C37BE29}> :SEND-EVENT  
NIL :TIME 57142006 :X 498.0d0 :Y 265.0d0 ...))
       Locals:
         SB-DEBUG::ARG-0 = #<GTK:V-RULER {C398E39}>
         SB-DEBUG::ARG-1 = #S(GDK:EVENT-MOTION ..)
   5: ((LAMBDA (GAR::B GAR::EVENT)) #<unavailable argument>  
#S(GDK:EVENT-MOTION :TYPE :MOTION-NOTIFY :WINDOW #<GDK:GDK-WINDOW  
{C37BE29}> :SEND-EVENT NIL :TIME 57142006 :X 498.0d0 :Y 265.0d0 ...))
       Locals:
         SB-DEBUG::ARG-0 = :<NOT-AVAILABLE>
         SB-DEBUG::ARG-1 = #S(GDK:EVENT-MOTION ..)
   6: (GOBJECT::CALL-WITH-RESTARTS #<CLOSURE (LAMBDA #) {B0CE4F5}>  
(#<GTK:EVENT-BOX {B0CEA81}> #S(GDK:EVENT-MOTION :TYPE :MOTION-NOTIFY  
:WINDOW # :SEND-EVENT NIL :TIME 57142006 :X 498.0d0 :Y 265.0d0 ...)))
   7: ((LAMBDA (GOBJECT::CLOSURE GOBJECT::RETURN-VALUE  
GOBJECT::COUNT-OF-ARGS GOBJECT::ARGS GOBJECT::INVOCATION-HINT  
GOBJECT::MARSHAL-DATA)) ..)
   8: ((LAMBDA (SB-ALIEN::ARGS-POINTER SB-ALIEN::RESULT-POINTER  
FUNCTION)) -313727419 -313727423 #<FUNCTION (LAMBDA #) {AC9079D}>)
   9: ("foreign function: #x806773B")
  10: ("foreign function: #x8052F6E")
  11: ("foreign function: #x1100A75")
  12: ("foreign function: #xB75EE252")
  13: ("foreign function: #xB760299D")
  14: ("foreign function: #xB7603C33")
  15: ("foreign function: #xB7604256")
  16: ("foreign function: #xB591A636")
  17: ("foreign function: #xB57E5A5D")
  18: ("foreign function: #xB57E6E07")
  19: ("foreign function: #xB756039A")
  --more--

#<GDK:EVENT-MOTION {C37ADD9}>
--------------------
The object is a STRUCTURE-OBJECT of type GDK:EVENT-MOTION.
TYPE: :MOTION-NOTIFY
WINDOW: #<GDK:GDK-WINDOW {C37BE29}>
SEND-EVENT: NIL
TIME: 57142006
X: 498.0d0
Y: 265.0d0
AXES: NIL
STATE: NIL
IS-HINT: 0
DEVICE: #<GDK:GDK-DEVICE Core Pointer (MOUSE, SCREEN) {AD11179}>
X-ROOT: 534.0d0
Y-ROOT: 385.0d0

#<V-RULER {C398E39}>
--------------------
Class: #<GOBJECT:GOBJECT-CLASS V-RULER>
--------------------
  Group slots by inheritance [ ]
  Sort slots alphabetically  [X]

All Slots:
[ ]  ACCESSIBLE         = #<GOBJECT:G-OBJECT {C3C8161}>
[ ]  APP-PAINTABLE      = NIL
[ ]  CAN-DEFAULT        = NIL
[ ]  CAN-FOCUS          = NIL
[ ]  CHILD-VISIBLE      = T
[ ]  COLORMAP           = #<GDK:GDK-COLORMAP {C7C2031}>
[ ]  COMPOSITE-CHILD    = NIL
[ ]  COMPOSITE-NAME     = NIL
[ ]  DIRECTION          = :LTR
[ ]  EVENTS             = NIL
[ ]  EXTENSION-EVENTS   = :NONE
[ ]  HAS-DEFAULT        = NIL
[ ]  HAS-FOCUS          = NIL
[ ]  HAS-REFERENCE      = T
[ ]  HAS-TOOLTIP        = NIL
[ ]  HEIGHT-REQUEST     = -1
[ ]  IS-FOCUS           = NIL
[ ]  LOWER              = 0.0d0
[ ]  MAX-SIZE           = 300.0d0
[ ]  METRIC             = :PIXELS
[ ]  MODIFIER-STYLE     = #<RC-STYLE {C7F2821}>
[ ]  NAME               = ""
[ ]  NO-SHOW-ALL        = NIL
[ ]  ORIENTATION        = :VERTICAL
[ ]  PANGO-CONTEXT      = #<PANGO:PANGO-CONTEXT {C80EF91}>
[ ]  PARENT             = #<TABLE {C82EA01}>
[ ]  PARENT-WINDOW      = #<GDK:GDK-WINDOW {C832B11}>
[ ]  POINTER            = #.(SB-SYS:INT-SAP #X08113D00)
[ ]  POSITION           = 150.0d0
[ ]  RECEIVES-DEFAULT   = NIL
[ ]  REDRAW-ON-ALLOCATE = #<unbound>
[ ]  SENSITIVE          = T
[ ]  SIGNAL-HANDLERS    = #()
[ ]  STYLE              = #<STYLE {C852B81}>
[ ]  TOOLTIP-MARKUP     = NIL
[ ]  TOOLTIP-TEXT       = NIL
[ ]  TOOLTIP-WINDOW     = NIL
[ ]  TOPLEVEL           = #<GTK-WINDOW {AD111E9}>
[ ]  UPPER              = 300.0d0
[ ]  USER-DATA          = #.(SB-SYS:INT-SAP #X00000000)
[ ]  VISIBLE            = T
[ ]  VISUAL             = #<GDK:VISUAL :TRUE-COLOR at 24 bpp {C875A41}>
[ ]  WIDTH-REQUEST      = -1
[ ]  WINDOW             = #<GDK:GDK-WINDOW {C87BAE1}>

[set value]  [make unbound]

Why?

Sincerely yours,
Dmitri







More information about the cl-gtk2-devel mailing list