From davazp at gmail.com Wed Aug 18 13:34:24 2010 From: davazp at gmail.com (David =?utf-8?Q?V=C3=A1zquez?=) Date: Wed, 18 Aug 2010 15:34:24 +0200 Subject: [cl-gtk2-devel] let-ui find the class at macroexpansion Message-ID: <87lj846o4f.fsf@gmail.com> Hello, I want to report I think it is a bug. A simple code: (defclass pb (progress-bar) nil (:metaclass gobject:gobject-class)) (defun run () (within-main-loop (let-ui (gtk-window :var win (pb)) (widget-show win)))) It works well if when you compile run, pb class is defined. However, if previous code is in a single file and you use compile-file, it fails. I hope it was helpful. It should be delayed at runtime I think. Thanks! Greetings, David. From kalyanov.dmitry at gmail.com Thu Aug 19 03:20:08 2010 From: kalyanov.dmitry at gmail.com (Kalyanov Dmitry) Date: Thu, 19 Aug 2010 07:20:08 +0400 Subject: [cl-gtk2-devel] let-ui find the class at macroexpansion In-Reply-To: <87lj846o4f.fsf@gmail.com> References: <87lj846o4f.fsf@gmail.com> Message-ID: <1282188008.8699.7.camel@dvk-laptop.localdomain> Hi, On Wed, 2010-08-18 at 15:34 +0200, David V?zquez wrote: > It works well if when you compile run, pb class is defined. However, if > previous code is in a single file and you use compile-file, it fails. I > hope it was helpful. > > It should be delayed at runtime I think. > Thanks! Thanks for the report! I've though about it and came to the same conclusion that I've been doing too much things at compile-time. let-ui macro tries to resolve class by class name at compile time to determine which function should be used for adding children. But the same thing is better done with generic function dispatched on container widget and having keyword arguments. Unfortunately, I'm having difficulties with my time (aside from my job I'm trying to add Windows threads to SBCL which leaves me no free time for other projects), so it'll take some time for me to actually implement it. But if I'll have a ready-to-merge patch, I'll gladly accept it. From andy128k at gmail.com Thu Aug 19 07:42:06 2010 From: andy128k at gmail.com (Andrey Kutejko) Date: Thu, 19 Aug 2010 10:42:06 +0300 Subject: [cl-gtk2-devel] let-ui find the class at macroexpansion In-Reply-To: <1282188008.8699.7.camel@dvk-laptop.localdomain> References: <87lj846o4f.fsf@gmail.com> <1282188008.8699.7.camel@dvk-laptop.localdomain> Message-ID: Hello I hope, this is what you need http://github.com/andy128k/cl-gtk2/commit/294efbb30a9fbbf8273b4766681becbe08018e80 This commit also adds packing for GtkToolbar and changes a bit syntax for attributes of tree columns. So, instead of :attribute ("stock-id" 2) :attribute ("text" 1) following syntax should be used :attributes '("stock-id" 2 "text" 1) 2010/8/19 Kalyanov Dmitry : > Hi, > > On Wed, 2010-08-18 at 15:34 +0200, David V?zquez wrote: >> It works well if when you compile run, pb class is defined. However, if >> previous code is in a single file and you use compile-file, it fails. I >> hope it was helpful. >> >> It should be delayed at runtime I think. >> Thanks! > > Thanks for the report! > > I've though about it and came to the same conclusion that I've been > doing too much things at compile-time. let-ui macro tries to resolve > class by class name at compile time to determine which function should > be used for adding children. But the same thing is better done with > generic function dispatched on container widget and having keyword > arguments. > > Unfortunately, I'm having difficulties with my time (aside from my job > I'm trying to add Windows threads to SBCL which leaves me no free time > for other projects), so it'll take some time for me to actually > implement it. But if I'll have a ready-to-merge patch, I'll gladly > accept it. > > > _______________________________________________ > cl-gtk2-devel mailing list > cl-gtk2-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/cl-gtk2-devel > From hrapof at common-lisp.ru Thu Aug 19 08:56:45 2010 From: hrapof at common-lisp.ru (hrapof at common-lisp.ru) Date: Thu, 19 Aug 2010 08:56:45 +0000 Subject: [cl-gtk2-devel] widget-event Message-ID: <20100819085645.183755i6lhm4t6fh@webmail.common-lisp.ru> 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 (#) 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 = : SB-DEBUG::ARG-1 = : SB-DEBUG::ARG-2 = NIL SB-DEBUG::ARG-3 = #.(SB-SYS:INT-SAP #X08168390) SB-DEBUG::ARG-4 = # 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 = : SB-DEBUG::ARG-1 = : SB-DEBUG::ARG-2 = #S(GDK:EVENT-MOTION ..) SB-DEBUG::ARG-3 = # 4: (GTK:WIDGET-EVENT # #S(GDK:EVENT-MOTION :TYPE :MOTION-NOTIFY :WINDOW # :SEND-EVENT NIL :TIME 57142006 :X 498.0d0 :Y 265.0d0 ...)) Locals: SB-DEBUG::ARG-0 = # SB-DEBUG::ARG-1 = #S(GDK:EVENT-MOTION ..) 5: ((LAMBDA (GAR::B GAR::EVENT)) # #S(GDK:EVENT-MOTION :TYPE :MOTION-NOTIFY :WINDOW # :SEND-EVENT NIL :TIME 57142006 :X 498.0d0 :Y 265.0d0 ...)) Locals: SB-DEBUG::ARG-0 = : SB-DEBUG::ARG-1 = #S(GDK:EVENT-MOTION ..) 6: (GOBJECT::CALL-WITH-RESTARTS # (# #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 #) 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-- # -------------------- The object is a STRUCTURE-OBJECT of type GDK:EVENT-MOTION. TYPE: :MOTION-NOTIFY WINDOW: # SEND-EVENT: NIL TIME: 57142006 X: 498.0d0 Y: 265.0d0 AXES: NIL STATE: NIL IS-HINT: 0 DEVICE: # X-ROOT: 534.0d0 Y-ROOT: 385.0d0 # -------------------- Class: # -------------------- Group slots by inheritance [ ] Sort slots alphabetically [X] All Slots: [ ] ACCESSIBLE = # [ ] APP-PAINTABLE = NIL [ ] CAN-DEFAULT = NIL [ ] CAN-FOCUS = NIL [ ] CHILD-VISIBLE = T [ ] COLORMAP = # [ ] 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 = # [ ] NAME = "" [ ] NO-SHOW-ALL = NIL [ ] ORIENTATION = :VERTICAL [ ] PANGO-CONTEXT = # [ ] PARENT = # [ ] PARENT-WINDOW = # [ ] POINTER = #.(SB-SYS:INT-SAP #X08113D00) [ ] POSITION = 150.0d0 [ ] RECEIVES-DEFAULT = NIL [ ] REDRAW-ON-ALLOCATE = # [ ] SENSITIVE = T [ ] SIGNAL-HANDLERS = #() [ ] STYLE = #