From peter.hildebrandt at gmail.com Thu Jan 3 18:56:18 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Thu, 03 Jan 2008 19:56:18 +0100 Subject: [cells-gtk-devel] Re: GUI programming in CL .. In-Reply-To: <477C5359.1060503@optonline.net> References: <477C400D.4030703@likelihood.uwaterloo.ca> <477C5359.1060503@optonline.net> Message-ID: Hi Greg, Ken already brought up the main points. However, I'm looking at things from a slightly different angle, so for me the solution is somewhat different. On Thu, 03 Jan 2008 04:15:37 +0100, Ken Tilton wrote: > Greg Bennett wrote: >> Hullo and Happy New Year from Greg Bennett .. >> I have been following with interest the c.l.l thread on GUI >> programming and the discussion of cells-gtk. >> A group us at the University of Waterloo has a project centred around >> the analysis of data; since we are in the Statistics Department there >> is a bias in the direction. >> The work began on lisp machines (xerox) and then moved to Macs, and >> (almost) to unix using CLX for the graphics component. I did most of >> the porting to Windows under Allegro + Common Graphics which makes GUI >> development pretty straightforward, as such things go. The question is, of course, how do you define "straightforward" ;-) >> We are considering moving the whole thing to Linux and a >> non-commercial lisp - cmucl is a candidate. As we plan to do that, it >> makes sense to think hard about the graphics end for the project is >> highly graphical with lots of 2-D, 3-D dynamic plots which are often >> linked so that playing in one produces updates to others. We had been >> thinking of OpenGL for access to which which Cello sounds like a >> possibility. However, I am interested to note that there is no mention >> of OpenGL in the thread. > > Hey, Greg. > > I think "no opengl" just traces back to the original thread RFP, if you > will. Me, I am all OpenGL all the time. My 3d buttons are actually 3D. :) I use opengl in my project, too. There's a little world simulator, which I implemented using a little clos glue code between cl-opengl for the drawing and cl-ode as a physics backend. I use glut (cl-glut is included in cl-opengl) for the drawing, giving me a simple window with nothing but an opengl canvas in it. The main GUI has its own GTK window. >> Perhaps it is a poor choice, perhaps nobody has used it extensively, >> perhaps I don't understand what toolkits the wrappers in cells-gtk give >> access to. >> For us, porting to a new OS means rewriting the basic windowing layer >> including windows, scrolling, menus, dialogs, etc. so we are trying to >> get as much background information as we can before starting. Trying >> out one only to find it is a poor choice doesn't seem like fun. There's a couple different questions in here. I'll try to sort it out: - MATURITY - cells-gtk/celtk appear to be somewhat "cutting edge" compared to more established things such as clg or LTK. That is, you get all the benefits (declarative programming, cells inside, etc), but -- at least with cells-gtk -- be warned: you'll have to work on the toolkit sooner or later. You cannot expect everything to work out of the box, because the odds are in your application you'll come to a point where you need some functionality that has not yet been integrated. AFAICT the develoment of cells-gtk/celtk are largely driven by demand, that is, the maintainers implement more or less what /they/ need. clg for instance appears to be /a lot/ more complete than cells-gtk. Then OTOH cells makes your code so much nicer. It's a trade-off. - OPENGL - Do you wish to use opengl and widgets /in the same window/? if yes, celtk/togl is the way to go, as there is currently no opengl canvas in cells-gtk. However, prompted by your question I did some research and found GtkGLArea [1] and GtkGLExt [2]. Later tonight I will look into adding one those to cells-gtk (can't tell which one to use yet. GtkGLExt seems to be not actively maintained, and GtkGLArea provides hardly any docs. There are deb packages for both of them). [1] http://linux.maruhn.com/sec/gtkglarea.html [2] http://www.k-3d.org/gtkglext/Main_Page - CAIRO - There is experimental cairo support in cells-gtk. If you just want to use cairo funcs to draw on some widget, there's support for that in the latest cl-cairo2 (Tamas committed my patch about two weeks ago). A full blown drawing area, in which each primitive is represented by a cells model, is clickable, draggable, has a mouse-over-p etc. is still under development. I've been using it in my application for about six months now, and I am in the process of clearing up the interface before I will release a patch. Ken, is there cairo in celtk? OpenGL vs Cairo is another question to ask. Cairo is arguably preferrable for 2D stuff (including a pretty postscript export), but does not support 3D. You might end up using both (like me). - NATIVE LOOK - GTK is native on the gnome desktop, that is, your application will integrate perfectly with the rest of the system. There is GTK for windows, but I don't know what the status of that project is. GTK for mac is still under development. Tcl/Tk is available on all three platforms and looks native on windows and mac, but used to feature a "mid-80s look and feel" on linux (hard-edged, no font antialiasing, not theme-aware) . Tcl/Tk 8.5 remedies the former two, but still does not use gnome themes. Moreover, 8.5 is brand new, you'll have to depend on your users running Ubuntu 8.04, debian unstable, or else installing backports. If you plan on deploying your application no sooner than a year from now, this might be an non-issue (OTOH, my lab at Berkeley was running an ancient Red Hat Enterprise 3, which did not even support cairo) - VERSATILITY - You might want to consider the range of available widgets, depending on what your application needs (a rich text editor, a list view/tree view, ...). GTK seems to be quite complete, but I'm the wrong person to ask because I don't know Tcl/Tk well enough. Note that this is different from the completeness of the wrapper -- if some widget is available in GTK but missing in cells-gtk, it is usually quite easy to add support (add a few ffi bindings, define the new widget model, add some property handlers). The same is probably true for celtk. But if a feature is missing in the toolkit, you'll have to use cairo or opengl to roll your own. This might be more hairy. OTOH, Ken seems not to mind too much :) . >> I've written off-list because I don't want to drag OpenGL into a >> discussion which seems to be going along a different track; if this is >> poor etiquette, then apologies for the error. >> If you have any advice or (not xor) opinions you'd care to share eg. >> about possible choices of lisp or about OpenGL, I'd be a most grateful >> recipient. > > This is a no-brainer, you want Celtk with the TOGL (Tk OpenGL) widget. I > set it up a while ago so my recall is fuzzy, but I am pretty sure > somewhere out there is what I called Celtk3D, which is just Celtk + > TOGL, leaving straight Celtk as the project for those who did not want > the 3D bit. Me, I use Cello which is basically Tk with /just/ the Togl > widget, then everything done ground-up in OpenGL. You might be happier > with the full set of Tk widgets and 3D in just the subframes where you > need it. And then you are Lisp and OS independent, pick and choose as > you like. Again, your choice depends on what you really want. cells-gtk gives you a native UI (and the sample app test-gtk makes it easy to get started with all of 'em and test their capabilities). Cairo is there and suitable for 2D visualization. If you need opengl, however, celtk is your choice (as of now). It looks like SBCL is pretty popular, so you might want to check it out, too. > btw, I note you mentioned "playing in one" in re the plots. If you want > to do more than display OpenGL, ie, use picking logic to make Ogl > "objects" into manipulables, it is possible Cello is what you want. But > I have not reinvented all that many widgets in Cello, just what I need, > so you might have some work there. Then again, the core Control and view > widgets in Cello make widget reinvention a snap. This, again, is a matter of taste, I suppose. Reinventing widgets with cello might be easy, however using existing widgets with cells-gtk is even easier. OTOH using cello you end up with pure lisp and have full control over the internals. Then, again, cells-gtk provides a standard native look and feel on linux (including your application always using the current gtk api, thus looking native even in the future or with a custom theme). Good luck and let us know if you have further questions. I cc'd the cells-gtk-devel list, which might be another good place to get further information. Peter > kt > -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ From hrapof at common-lisp.ru Thu Jan 3 19:40:13 2008 From: hrapof at common-lisp.ru (Dmitri Hrapof) Date: Thu, 03 Jan 2008 22:40:13 +0300 Subject: [cells-gtk-devel] Re: GUI programming in CL .. In-Reply-To: References: <477C400D.4030703@likelihood.uwaterloo.ca> <477C5359.1060503@optonline.net> Message-ID: <477D3A1D.6080701@common-lisp.ru> Happy New Year! I thought that maybe my limited experience would be of interest... I've been successfully using OpenGL with cells-gtk and clg for the last two years (using GtkGlExt and GtkDrawingArea) for real-time data visualization. GtkGlExt was recently abandoned but is mantained again now AFAIK. I also use Cairo together with OpenGL in order to draw antialiased rotated Unicode text of different font sizes. Unfortunately, I do not call Cairo and OpenGL functions to draw on the same surface, instead I create a texture with Cairo and display it with OpenGL. I have to confess I switched from cells-gtk to clg for the new version of my program as the latter let me use glade to build my UI (and, to tell the truth, I used only CFFI part of cells-gtk). SBCL is the Lisp used for this project. I made a small CFFI binding for GtkGlExt: http://www.common-lisp.ru/gtkgl.asd http://www.common-lisp.ru/gtk-gl-ext.lisp Sincerely yours, Dmitri From peter.hildebrandt at gmail.com Fri Jan 4 13:08:17 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Fri, 04 Jan 2008 14:08:17 +0100 Subject: [cells-gtk-devel] Re: GUI programming in CL .. In-Reply-To: <477D3A1D.6080701@common-lisp.ru> References: <477C400D.4030703@likelihood.uwaterloo.ca> <477C5359.1060503@optonline.net> <477D3A1D.6080701@common-lisp.ru> Message-ID: Hi Dimitri, On Thu, 03 Jan 2008 20:40:13 +0100, Dmitri Hrapof wrote: > Happy New Year! Same to you! > I thought that maybe my limited experience would be of interest... > I've been successfully using OpenGL with cells-gtk and clg for the last > two years (using GtkGlExt and GtkDrawingArea) for real-time data > visualization. GtkGlExt was recently abandoned but is mantained again > now AFAIK. Wow, that sounds good. I believed there must be someone out there who has done that before, but I could not persuade google to point me in the right direction. Thanks so much for sharing your experience. > I also use Cairo together with OpenGL in order to draw antialiased > rotated Unicode text of different font sizes. Unfortunately, I do not > call Cairo and OpenGL functions to draw on the same surface, instead I > create a texture with Cairo and display it with OpenGL. I have never tried this. What is the reason you cannot mix the two? Does it not work, or is it some issue with the bindings? > I have to confess I switched from cells-gtk to clg for the new version > of my program as the latter let me use glade to build my UI (and, to > tell the truth, I used only CFFI part of cells-gtk). If you're only using the CFFI part, this is the sensible thing to do. AFAICT clg is far more complete than cells-gtk. I suppose the focus of cells-gtk is a different one. Maybe one day we will build cells-gtk on the bindings of clg? > SBCL is the Lisp used for this project. > I made a small CFFI binding for GtkGlExt: > http://www.common-lisp.ru/gtkgl.asd > http://www.common-lisp.ru/gtk-gl-ext.lisp Again, thanks for sharing this. This will save me from reinventing the wheel here. Would it be ok for you if I use your bindings to integrate a GLDrawingArea widget in cells-gtk? Cheers, Peter > Sincerely yours, > Dmitri -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ From hrapof at common-lisp.ru Mon Jan 7 19:02:51 2008 From: hrapof at common-lisp.ru (Dmitri Hrapof) Date: Mon, 07 Jan 2008 22:02:51 +0300 Subject: [cells-gtk-devel] Re: GUI programming in CL .. In-Reply-To: References: <477C400D.4030703@likelihood.uwaterloo.ca> <477C5359.1060503@optonline.net> <477D3A1D.6080701@common-lisp.ru> Message-ID: <4782775B.1070809@common-lisp.ru> Sorry for a late reply, just returned from Zagreb. Peter Hildebrandt ?????: > I have never tried this. What is the reason you cannot mix the two? > Does it not work, or is it some issue with the bindings? I didn't delve too deep into Cairo/glitz/GtkGlExt, but I guess the problem is that Cairo and OpenGL use different offscreen buffers which are not readily reachable through existing APIs. So I could either use single-buffered mode (and get flickering) or mix OpenGL and Cairo calls (and get flickering, too). They promise to add OpenGL support to future version of GTK, though. > Again, thanks for sharing this. This will save me from reinventing > the wheel here. Would it be ok for you if I use your bindings to > integrate a GLDrawingArea widget in cells-gtk? Of course. Good luck, Dmitri From akopa.gmane.poster at gmail.com Tue Jan 8 07:51:20 2008 From: akopa.gmane.poster at gmail.com (Matthew D. Swank) Date: Tue, 08 Jan 2008 01:51:20 -0600 Subject: [cells-gtk-devel] Re: Re: trivial patches References: <200712311230.29695.peter.denno@nist.gov> Message-ID: On Mon, 31 Dec 2007 12:30:29 -0500, Peter Denno wrote: > On Sunday 30 December 2007 02:32:21 pm Matthew D. Swank wrote: >> Could I resubmit 4 patches from July? or did I also get commit >> access? > > I'm pretty sure these have been committed, but for the next few days I > don't have access to the computer that has my old email on it, so I > can't look back at what this is about. > > What are these changes? > Add container widget as a parent of appropriate widgets Index: cells-gtk/buttons.lisp =================================================================== RCS file: /project/cells-gtk/cvsroot/root/cells-gtk/buttons.lisp,v retrieving revision 1.6 diff -u -r1.6 buttons.lisp --- cells-gtk/buttons.lisp 16 Feb 2006 18:10:10 -0000 1.6 +++ cells-gtk/buttons.lisp 11 Jul 2007 01:27:13 -0000 @@ -18,7 +18,7 @@ (in-package :cgtk) -(def-widget button () +(def-widget button (container) ((stock :accessor stock :initarg :stock :initform (c-in nil)) (markup :accessor markup :initarg :markup :initform nil) (label :accessor label :initarg :label :initform (c-in nil))) Index: cells-gtk/layout.lisp =================================================================== RCS file: /project/cells-gtk/cvsroot/root/cells-gtk/layout.lisp,v retrieving revision 1.10 diff -u -r1.10 layout.lisp --- cells-gtk/layout.lisp 11 Aug 2006 13:07:55 -0000 1.10 +++ cells-gtk/layout.lisp 11 Jul 2007 01:27:14 -0000 @@ -18,7 +18,7 @@ (in-package :cgtk) -(def-widget box () +(def-widget box (container) () (homogeneous spacing) () @@ -40,7 +40,7 @@ () () () :new-args (c? (list (homogeneous self) (spacing self)))) -(def-widget table () +(def-widget table (container) ((elements :accessor elements :initarg :elements :initform (c-in nil)) (homogeneous :accessor homogeneous :initarg :homogeneous :initform nil) (rows-count :accessor rows-count :initarg :rows-count :initform (c? (length (elements self)))) @@ -116,7 +116,7 @@ #+clisp (call-next-method)) -(def-widget frame () +(def-widget frame (container) ((shadow :accessor shadow? :initarg :shadow :initform nil) (label :accessor label :initarg :label :initform (c-in nil))) (label-widget label-align shadow-type) @@ -163,7 +163,7 @@ (def-widget vseparator () () () ()) -(def-widget expander () +(def-widget expander (container) ((label :accessor label :initarg :label :initform (c-in nil))) (expanded spacing use-underline use-markup label-widget) () @@ -179,7 +179,7 @@ (gtk-container-add (id self) (id kid))) #+clisp (call-next-method)) -(def-widget scrolled-window () +(def-widget scrolled-window (container) () (policy placement shadow-type) () @@ -195,7 +195,7 @@ (gtk-scrolled-window-add-with-viewport (id self) (id kid)))) #+clisp (call-next-method)) -(def-widget notebook () +(def-widget notebook (container) ((tab-labels :accessor tab-labels :initarg :tab-labels :initform (c-in nil)) (tab-labels-widgets :accessor tab-labels-widgets :initform (c-in nil)) (show-page :accessor show-page :initarg :show-page :initform (c-in 0)) @@ -251,7 +251,7 @@ (def-c-output show-border ((self notebook)) (gtk-notebook-set-show-border (id self) new-value)) -(def-widget alignment () +(def-widget alignment (container) ((xalign :accessor xalign :initarg :xalign :initform 0.5) (yalign :accessor yalign :initarg :yalign :initform 0.5) (xscale :accessor xscale :initarg :xscale :initform 0) Index: cells-gtk/menus.lisp =================================================================== RCS file: /project/cells-gtk/cvsroot/root/cells-gtk/menus.lisp,v retrieving revision 1.16 diff -u -r1.16 menus.lisp --- cells-gtk/menus.lisp 11 Aug 2006 13:07:55 -0000 1.16 +++ cells-gtk/menus.lisp 11 Jul 2007 01:27:14 -0000 @@ -27,7 +27,7 @@ ;;; ============= Combo-box ============================ ;;; User should specify exactly one of :items or :roots ;;; If specify :roots, specify :children-fn too. -(def-widget combo-box () +(def-widget combo-box (container) ((items :accessor items :initarg :items :initform nil) (print-fn :accessor print-fn :initarg :print-fn :initform #'(lambda (item) (format nil "~a" item))) ; see below if :roots @@ -110,7 +110,7 @@ (def-object tooltips () () () ()) -(def-widget toolbar () +(def-widget toolbar (container) ((orientation :accessor orientation :initarg :orientation :initform (c-in nil)) (style :accessor style :initarg :style :initform (c-in nil))) (show-arrow tooltips) @@ -141,7 +141,7 @@ (:both-horiz 3) (t 0))))) -(def-widget tool-item () +(def-widget tool-item (container) () (homogeneous expand is-important) ()) @@ -188,7 +188,7 @@ (setf (stock-id self) (string-downcase (format nil "gtk-~a" new-value))))) ;;; ============= Menu ============================ -(def-widget menu-shell () +(def-widget menu-shell (container) () () () :padding 0) @@ -206,7 +206,7 @@ (title) ()) -(def-widget menu-item () +(def-widget menu-item (item) ((label :accessor label :initarg :label :initform (c-in nil)) (label-widget :accessor label-widget :initarg :label-widget :initform nil) (accel-label-widget :accessor accel-label-widget :initform (c? (and (label self) Index: cells-gtk/textview.lisp =================================================================== RCS file: /project/cells-gtk/cvsroot/root/cells-gtk/textview.lisp,v retrieving revision 1.11 diff -u -r1.11 textview.lisp --- cells-gtk/textview.lisp 19 Feb 2007 17:08:21 -0000 1.11 +++ cells-gtk/textview.lisp 11 Jul 2007 01:27:14 -0000 @@ -35,7 +35,7 @@ ;; It can even reset it, if you don't like this arrangement. (gtk-text-buffer-set-modified buf nil))) -(def-widget text-view () +(def-widget text-view (container) ((buffer :accessor buffer :initarg :buffer :initform (mk-text-buffer)) (populate-popup :accessor populate-popup :initarg :populate-popup :initform (c-in nil)) (depopulate-popup :accessor depopulate-popup :initarg :depopulate-popup :initform (c-in nil)) Index: cells-gtk/tree-view.lisp =================================================================== RCS file: /project/cells-gtk/cvsroot/root/cells-gtk/tree-view.lisp,v retrieving revision 1.17 diff -u -r1.17 tree-view.lisp --- cells-gtk/tree-view.lisp 11 Aug 2006 13:09:28 -0000 1.17 +++ cells-gtk/tree-view.lisp 11 Jul 2007 01:27:14 -0000 @@ -37,7 +37,7 @@ (defun fail (&rest args) (declare (ignore args)) nil) -(def-widget tree-view () +(def-widget tree-view (container) ((columns-def :accessor columns-def :initarg :columns :initform nil) (column-types :accessor column-types :initform (c? (mapcar #'first (columns-def self)))) (column-inits :accessor column-inits :initform (c? (mapcar #'second (columns-def self)))) Index: cells-gtk/widgets.lisp =================================================================== RCS file: /project/cells-gtk/cvsroot/root/cells-gtk/widgets.lisp,v retrieving revision 1.19 diff -u -r1.19 widgets.lisp --- cells-gtk/widgets.lisp 7 Jun 2006 16:50:15 -0000 1.19 +++ cells-gtk/widgets.lisp 11 Jul 2007 01:27:15 -0000 @@ -309,7 +309,17 @@ () "~a is a bin container, must have only one kid" container)) -(def-widget window () +(def-widget container () + () + (border-width resize-mode) + ()) + +(def-widget item (container) + () + () + ()) + +(def-widget window (container) ((wintype :accessor wintype :initarg wintype :initform 0) (title :accessor title :initarg :title :initform (c? (string (class-name (class-of self))))) @@ -368,7 +378,7 @@ (gtk-container-add (id self) (id kid))) #+clisp (call-next-method)) -(def-widget event-box () +(def-widget event-box (container) ((visible-window :accessor visible-window :initarg :visible-window :initform nil)) (above-child) () Index: gtk-ffi/gtk-other.lisp =================================================================== RCS file: /project/cells-gtk/cvsroot/root/gtk-ffi/gtk-other.lisp,v retrieving revision 1.13 diff -u -r1.13 gtk-other.lisp --- gtk-ffi/gtk-other.lisp 16 Feb 2006 18:06:06 -0000 1.13 +++ gtk-ffi/gtk-other.lisp 11 Jul 2007 01:27:16 -0000 @@ -42,7 +42,16 @@ (gtk-container-remove :void ((container :pointer) (widget :pointer))) - + (gtk-container-set-border-width :void + ((container :pointer) + (width :unsigned-int))) + (gtk-container-get-border-width :unsigned-int + ((container :pointer))) + (gtk-container-set-resize-mode :void + ((container :pointer) + (mode :unsigned-int))) + (gtk-container-get-resize-mode :unsigned-int + ((container :pointer))) ;;box (gtk-box-pack-start :void ((box :pointer) From akopa.gmane.poster at gmail.com Tue Jan 8 07:54:30 2008 From: akopa.gmane.poster at gmail.com (Matthew D. Swank) Date: Tue, 08 Jan 2008 01:54:30 -0600 Subject: [cells-gtk-devel] Re: Re: trivial patches References: <200712311230.29695.peter.denno@nist.gov> Message-ID: On Mon, 31 Dec 2007 12:30:29 -0500, Peter Denno wrote: >> Could I resubmit 4 patches from July? or did I also get commit >> access? > > I'm pretty sure these have been committed, but for the next few days I > don't have access to the computer that has my old email on it, so I > can't look back at what this is about. > > What are these changes? Wrap resizable attribute. Index: cells-gtk/widgets.lisp =================================================================== RCS file: /project/cells-gtk/cvsroot/root/cells-gtk/widgets.lisp,v retrieving revision 1.19 diff -u -r1.19 widgets.lisp --- cells-gtk/widgets.lisp 7 Jun 2006 16:50:15 -0000 1.19 +++ cells-gtk/widgets.lisp 12 Jul 2007 21:25:22 -0000 @@ -323,6 +323,9 @@ ; :md-name :main-window :new-args (c? (list (wintype self)))) +(def-c-output resizable ((self window)) + (gtk-window-set-resizable (id self) new-value)) + (def-c-output width ((self window)) (when new-value (gtk-window-set-default-size (id self) From akopa.gmane.poster at gmail.com Tue Jan 8 07:57:46 2008 From: akopa.gmane.poster at gmail.com (Matthew D. Swank) Date: Tue, 08 Jan 2008 01:57:46 -0600 Subject: [cells-gtk-devel] Re: Re: trivial patches References: <200712311230.29695.peter.denno@nist.gov> Message-ID: On Mon, 31 Dec 2007 12:30:29 -0500, Peter Denno wrote: >> Could I resubmit 4 patches from July? or did I also get commit >> access? > > I'm pretty sure these have been committed, but for the next few days I > don't have access to the computer that has my old email on it, so I > can't look back at what this is about. > > What are these changes? Add Combo Box Entry widget Index: cells-gtk/menus.lisp =================================================================== RCS file: /project/cells-gtk/cvsroot/root/cells-gtk/menus.lisp,v retrieving revision 1.16 diff -u -r1.16 menus.lisp --- cells-gtk/menus.lisp 11 Aug 2006 13:07:55 -0000 1.16 +++ cells-gtk/menus.lisp 13 Jul 2007 14:04:48 -0000 @@ -106,6 +106,12 @@ (progn (gtk-combo-box-set-active (id self) 0) (setf (md-value self) (car (items self))))))) +;;; ============= Combo-box-entry ============================ +(def-widget combo-box-entry (combo-box) + () + (text-column) + ()) + ;;; ============= Toolbar/Toolbutton ============================ (def-object tooltips () () () ()) Index: gtk-ffi/gtk-other.lisp =================================================================== RCS file: /project/cells-gtk/cvsroot/root/gtk-ffi/gtk-other.lisp,v retrieving revision 1.13 diff -u -r1.13 gtk-other.lisp --- gtk-ffi/gtk-other.lisp 16 Feb 2006 18:06:06 -0000 1.13 +++ gtk-ffi/gtk-other.lisp 13 Jul 2007 14:04:49 -0000 @@ -548,6 +548,17 @@ ((combo-box :pointer) (iter :pointer))) + ;;combo-box-entry + (gtk-combo-box-entry-new :pointer ()) + (gtk-combo-box-entry-new-text :pointer ()) + (gtk-combo-box-entry-new-with-model :pointer ((tree-model :pointer) + (text-column :int))) + (gtk-combo-box-entry-get-text-column :int + ((combo-box-entry :pointer))) + (gtk-combo-box-entry-set-text-column :void + ((combo-box-entry :pointer) + (column :int))) + ;;calendar (gtk-calendar-new :pointer ()) (gtk-calendar-get-date :void From akopa.gmane.poster at gmail.com Tue Jan 8 08:01:46 2008 From: akopa.gmane.poster at gmail.com (Matthew D. Swank) Date: Tue, 08 Jan 2008 02:01:46 -0600 Subject: [cells-gtk-devel] Re: Re: trivial patches References: <200712311230.29695.peter.denno@nist.gov> Message-ID: On Mon, 31 Dec 2007 12:30:29 -0500, Peter Denno wrote: >> Could I resubmit 4 patches from July? or did I also get commit >> access? > > I'm pretty sure these have been committed, but for the next few days I > don't have access to the computer that has my old email on it, so I > can't look back at what this is about. > > What are these changes? Typo fix. Index: cells-gtk/entry.lisp =================================================================== RCS file: /project/cells-gtk/cvsroot/root/cells-gtk/entry.lisp,v retrieving revision 1.4 diff -u -r1.4 entry.lisp --- cells-gtk/entry.lisp 12 Feb 2005 14:48:19 -0000 1.4 +++ cells-gtk/entry.lisp 30 Dec 2007 19:10:57 -0000 @@ -25,14 +25,14 @@ #+no (def-gtk widget entry nil - ((auto-update :accessor auto-update :initarg :auto-aupdate :initform nil) + ((auto-update :accessor auto-update :initarg :auto-update :initform nil) (completion :accessor completion :initarg :completion :initform nil) (text :accessor text :initarg :text :initform (c-in nil)) (init :accessor init :initarg :init :initform nil)) (editable has-frame max-length) (changed activate)) (def-widget entry () - ((auto-update :accessor auto-update :initarg :auto-aupdate :initform nil) + ((auto-update :accessor auto-update :initarg :auto-update :initform nil) (completion :accessor completion :initarg :completion :initform nil) (text :accessor text :initarg :text :initform (c-in nil)) (init :accessor init :initarg :init :initform nil)) Index: cells-gtk/test-gtk/test-dialogs.lisp =================================================================== RCS file: /project/cells-gtk/cvsroot/root/cells-gtk/test-gtk/test-dialogs.lisp,v retrieving revision 1.2 diff -u -r1.2 cells-gtk/test-gtk/test-dialogs.lisp --- cells-gtk/test-gtk/test-dialogs.lisp 27 Feb 2005 03:17:28 -0000 1.2 +++ cells-gtk/test-gtk/test-dialogs.lisp 8 Jan 2008 07:29:41 -0000 @@ -42,7 +42,7 @@ :title "My Title" :message-type :question :buttons-type :ok-cancel - :content-area (mk-entry :auto-aupdate t))))) + :content-area (mk-entry :auto-update t))))) (setf (text (fm^ :message-response)) (md-value dialog)))))) (loop for message-type in '(:info :warning :question :error) collect (make-instance 'test-message :message-type message-type)))) Index: cells-gtk/test-gtk/test-entry.lisp =================================================================== RCS file: /project/cells-gtk/cvsroot/root/cells-gtk/test-gtk/test-entry.lisp,v retrieving revision 1.2 diff -u -r1.2 cells-gtk/test-gtk/test-entry.lisp --- cells-gtk/test-gtk/test-entry.lisp 5 Dec 2004 06:33:31 -0000 1.2 +++ cells-gtk/test-gtk/test-entry.lisp 8 Jan 2008 07:29:41 -0000 @@ -47,7 +47,7 @@ (with-markup (:strikethrough (not (md-value (fm^ :cool)))) "cool!"))) :selectable t) - (mk-entry :md-name :entry :auto-aupdate t :init "Testing")))) + (mk-entry :md-name :entry :auto-update t :init "Testing")))) (defun test-entry-2 () (c? (list From Bormuth at web.de Thu Jan 17 10:45:23 2008 From: Bormuth at web.de (Bormuth at web.de) Date: Thu, 17 Jan 2008 11:45:23 +0100 Subject: [cells-gtk-devel] UTF-8 support Message-ID: <927966956@web.de> Hi list, is cells-gtk supposed to handle encoding transparently ? On SBCL I tried (mk-label :text "foo ???? bar") with some special characters between foo and bar. To my disappointment the label fails to display completely. Shouldn't cells-gtk validate and eventually convert all strings it takes? Or can I somehow tell SBCL to emit strings in UTF8 only ? Cheers ______________________________________________________________________________ Jetzt neu! Im riesigen WEB.DE Club SmartDrive Dateien freigeben und mit Freunden teilen! http://www.freemail.web.de/club/smartdrive_ttc.htm/?mc=021134 From peter.hildebrandt at gmail.com Thu Jan 17 11:16:12 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Thu, 17 Jan 2008 12:16:12 +0100 Subject: [cells-gtk-devel] UTF-8 support In-Reply-To: <927966956@web.de> References: <927966956@web.de> Message-ID: <478F38FC.3050507@gmail.com> Bormuth at web.de wrote: > Hi list, > > is cells-gtk supposed to handle encoding transparently ? > > On SBCL I tried > > (mk-label :text "foo ???? bar") > > with some special characters between foo and bar. To my > disappointment the label fails to display completely. > > Shouldn't cells-gtk validate and eventually convert all > strings it takes? Or can I somehow tell SBCL to emit > strings in UTF8 only ? Seconded. Using charcodes instead of the literal characters does not help. Where's the right entry point to get started with this? Maybe something in cffi/gtk-ffi? Ken, I cc'd you because I feel you have quite a bit of intuition with cffi/gtk-ffi issues. Maybe you have an idea where we could get started. Peter. > Cheers > > > ______________________________________________________________________________ > Jetzt neu! Im riesigen WEB.DE Club SmartDrive Dateien freigeben und mit > Freunden teilen! http://www.freemail.web.de/club/smartdrive_ttc.htm/?mc=021134 > > _______________________________________________ > cells-gtk-devel site list > cells-gtk-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cells-gtk-devel From peter.hildebrandt at gmail.com Thu Jan 17 11:24:12 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Thu, 17 Jan 2008 12:24:12 +0100 Subject: [cells-gtk-devel] Re: GUI programming in CL .. In-Reply-To: <4782775B.1070809@common-lisp.ru> References: <477C400D.4030703@likelihood.uwaterloo.ca> <477C5359.1060503@optonline.net> <477D3A1D.6080701@common-lisp.ru> <4782775B.1070809@common-lisp.ru> Message-ID: <478F3ADC.3030207@gmail.com> Dimitri, Thanks for your response. I've been travelling for the last week as well, hence the delay. Dmitri Hrapof wrote: > Sorry for a late reply, just returned from Zagreb. > > Peter Hildebrandt ?????: >> I have never tried this. What is the reason you cannot mix the two? >> Does it not work, or is it some issue with the bindings? > I didn't delve too deep into Cairo/glitz/GtkGlExt, but I guess the > problem is that Cairo and OpenGL use different offscreen buffers which > are not readily reachable through existing APIs. So I could either use > single-buffered mode (and get flickering) or mix OpenGL and Cairo calls > (and get flickering, too). > They promise to add OpenGL support to future version of GTK, though. I see. Makes perfect sense. For now the way I will go with cells-gtk is to create a general drawing-area widget based on the gtk drawing area, and then subclass it for (a) cairo and (b) opengl drawing. For my current application this seems to be well sufficient. After all, the two address quite distinct use cases, so this approach appears sensible to me. If someone really needs to mix the two, they can follow your approach with cairo rendering into a bitmap. >> Again, thanks for sharing this. This will save me from reinventing >> the wheel here. Would it be ok for you if I use your bindings to >> integrate a GLDrawingArea widget in cells-gtk? > Of course. Thanks, I'm working on it right now. I'm factoring out the commonalities of the gl-drawing-area and the cairo-drawing-area (causing some more delays, cf. Slobodan's thread on c.l.l) but I will release a patch soon. Peter > Good luck, > Dmitri From hrapof at common-lisp.ru Thu Jan 17 11:32:13 2008 From: hrapof at common-lisp.ru (Dmitri Hrapof) Date: Thu, 17 Jan 2008 14:32:13 +0300 Subject: [cells-gtk-devel] UTF-8 support In-Reply-To: <927966956@web.de> References: <927966956@web.de> Message-ID: <478F3CBD.5090100@common-lisp.ru> Bormuth at web.de wrote: > Hi list, > > is cells-gtk supposed to handle encoding transparently ? > > On SBCL I tried > > (mk-label :text "foo ???? bar") > > with some special characters between foo and bar. To my > disappointment the label fails to display completely. > > Shouldn't cells-gtk validate and eventually convert all > strings it takes? Or can I somehow tell SBCL to emit > strings in UTF8 only ? > With cells-gtk I had to convert strings to utf-8 explicitly. (defun sto (s) (sb-ext:string-to-octets s :external-format :utf-8)) (gtk-label-new (sto "?????? ???????")) It worked, and I didn't look for another solution. (In CLORB, by the way, I meddled with marshalling/unmarshalling and made it transparent for utf-8 <-> Lisp string). And CLG handles utf-8 transparently. (Yes, I know I'm always saying CLG is better :-) In my defense I can say I plan to use cells to reimplement data model of my application). Sincerely yours, Dmitri From hrapof at common-lisp.ru Thu Jan 17 11:38:33 2008 From: hrapof at common-lisp.ru (Dmitri Hrapof) Date: Thu, 17 Jan 2008 14:38:33 +0300 Subject: [cells-gtk-devel] UTF-8 support In-Reply-To: <478F3CBD.5090100@common-lisp.ru> References: <927966956@web.de> <478F3CBD.5090100@common-lisp.ru> Message-ID: <478F3E39.9010500@common-lisp.ru> Dmitri Hrapof wrote: > And CLG handles utf-8 transparently. I meant "Unicode". From peter.hildebrandt at gmail.com Thu Jan 17 12:18:48 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Thu, 17 Jan 2008 13:18:48 +0100 Subject: [cells-gtk-devel] UTF-8 support In-Reply-To: <478F3CBD.5090100@common-lisp.ru> References: <927966956@web.de> <478F3CBD.5090100@common-lisp.ru> Message-ID: <478F47A8.3090001@gmail.com> > (defun sto (s) (sb-ext:string-to-octets s :external-format :utf-8)) > (gtk-label-new (sto "?????? ???????")) > > It worked, and I didn't look for another solution. Not for me -- It looks like I can't pass the result of string-to-octets where a :gtk-string is expected, for example: (*b* is the result of mk-button) (gtk-button-set-label (id *b*) (sto "s")) The value of STRING is #(115), which is not of type STRING. [Condition of type SIMPLE-TYPE-ERROR] What else do I need to use the result of sto in gtk api calls? Thanks, Peter > (In CLORB, by the > way, I meddled with marshalling/unmarshalling and made it transparent > for utf-8 <-> Lisp string). > > And CLG handles utf-8 transparently. (Yes, I know I'm always saying CLG > is better :-) In my defense I can say I plan to use cells to reimplement > data model of my application). > > Sincerely yours, > Dmitri > _______________________________________________ > cells-gtk-devel site list > cells-gtk-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cells-gtk-devel From hrapof at common-lisp.ru Thu Jan 17 12:45:47 2008 From: hrapof at common-lisp.ru (Dmitri Hrapof) Date: Thu, 17 Jan 2008 15:45:47 +0300 Subject: [Fwd: Re: [cells-gtk-devel] UTF-8 support] Message-ID: <478F4DFB.5070507@common-lisp.ru> Peter Hildebrandt wrote: > Not for me -- It looks like I can't pass the result of > string-to-octets where a :gtk-string is expected, for example: (*b* is > the result of mk-button) > > (gtk-button-set-label (id *b*) (sto "s")) > The value of STRING is #(115), which is not of type STRING. > [Condition of type SIMPLE-TYPE-ERROR] > > What else do I need to use the result of sto in gtk api calls? Hm, strange... I do not remember doing anything else... Who exactly is complaining about type mismatch? gtk-button-set-label expects :gtk-string, and :gtk-string is :pointer, not a Lisp string... (defmethod cffi:translate-to-foreign (value (type (eql :gtk-string))) (when (null value) (setf value "")) ; pod ??? (cffi:foreign-string-alloc value)) "The |foreign-string-alloc| function allocates a foreign string containing a Lisp string or |(unsigned-byte 8)| array." Sincerely yours, Dmitri From Bormuth at web.de Thu Jan 17 12:52:08 2008 From: Bormuth at web.de (Ingo Bormuth) Date: Thu, 17 Jan 2008 13:52:08 +0100 Subject: [cells-gtk-devel] UTF-8 support Message-ID: <928233582@web.de> > Peter Hildebrandt wrote: > > > Not for me -- It looks like I can't pass the result of > > string-to-octets where a :gtk-string is expected, for example: (*b* is > > the result of mk-button) > > Hm, strange... I do not remember doing anything else... > > Who exactly is complaining about type mismatch? This is what I get from SLIME: The value of STRING is #(69 56 53 46 52), which is not of type STRING. [Condition of type SIMPLE-TYPE-ERROR] Restarts: 0: [ABORT] Return to SLIME's top level. 1: [TERMINATE-THREAD] Terminate this thread (#) Backtrace: 0: ((LAMBDA (CELLS-GTK::C)) #) 1: ((LAMBDA (CELLS-GTK::C)) #) 2: (START-APP MAIN-WINDOW) [...] _______________________________________________________________________ Jetzt neu! Sch?tzen Sie Ihren PC mit McAfee und WEB.DE. 30 Tage kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=022220 From Bormuth at web.de Thu Jan 17 12:58:39 2008 From: Bormuth at web.de (Ingo Bormuth) Date: Thu, 17 Jan 2008 13:58:39 +0100 Subject: [cells-gtk-devel] UTF-8 support Message-ID: <928249613@web.de> The following might be better. Code is: (mk-button :label (sb-ext:string-to-octets "foo ???? bar" :external-format :utf-8)) The value of STRING is #(102 111 111 32 195 164 195 182 195 188 ...), which is not of type STRING. [Condition of type SIMPLE-TYPE-ERROR] Restarts: 0: [STORE-VALUE] Supply a new value for STRING. 1: [ABORT] Return to SLIME's top level. 2: [TERMINATE-THREAD] Terminate this thread (#) Backtrace: 0: (SB-KERNEL:CHECK-TYPE-ERROR STRING #(102 111 111 32 195 164 195 182 195 188 ...) STRING NIL) 1: (CFFI:FOREIGN-STRING-ALLOC #) 2: ((SB-PCL::FAST-METHOD CFFI::TRANSLATE-TYPE-TO-FOREIGN (T CFFI::FOREIGN-TYPEDEF)) # # #(102 111 111 32 195 164 195 182 195 188 ...) #) 3: (GTK-FFI::GTK_BUTTON_SET_LABEL #.(SB-SYS:INT-SAP #X080A36A8) #(102 111 111 32 195 164 195 182 195 188 ...)) 4: (GTK-BUTTON-SET-LABEL #.(SB-SYS:INT-SAP #X080A36A8) #(102 111 111 32 195 164 195 182 195 188 ...)) 5: ((LAMBDA (SB-PCL::.PV. SB-PCL::.NEXT-METHOD-CALL. SB-PCL::.ARG0. SB-PCL::.ARG1. SB-PCL::.ARG2. SB-PCL::.ARG3. SB-PCL::.ARG4.)) # # LABEL BUTTON #(102 111 111 32 195 164 195 182 195 188 ...) NIL NIL) 6: ((LAMBDA ())) 7: (CELLS::FINISH-BUSINESS) 8: (CELLS::CALL-WITH-INTEGRITY # (:OUTPUT NIL) #) 9: ((SB-PCL::FAST-METHOD MD-AWAKEN (CELLS::MODEL-OBJECT)) #(8 NIL) # MAIN-WINDOW) 10: (TO-BE MAIN-WINDOW) 11: (START-APP MAIN-WINDOW) [...] ________________________________________________________ Bis 50 MB Dateianh?nge? Kein Problem! http://www.digitaledienste.web.de/freemail/club/lp/?lp=7 From hrapof at common-lisp.ru Thu Jan 17 13:12:11 2008 From: hrapof at common-lisp.ru (Dmitri Hrapof) Date: Thu, 17 Jan 2008 16:12:11 +0300 Subject: [cells-gtk-devel] UTF-8 support In-Reply-To: <928249613@web.de> References: <928249613@web.de> Message-ID: <478F542B.5040502@common-lisp.ru> Ingo Bormuth wrote: > The following might be better. > > Code is: (mk-button :label (sb-ext:string-to-octets "foo ???? bar" :external-format :utf-8)) > > > The value of STRING is #(102 111 111 32 195 164 195 182 195 188 > ...), which is not of type STRING. > [Condition of type SIMPLE-TYPE-ERROR] Yes, now it's clear. MK-BUTTON expects a Lisp string, being decent Lisp function, not some FFI abomination ;) So the solution is to place (sb-ext:string-to-octets "foo ???? bar" :external-format :utf-8) deeper, between MK-BUTTON and GTK-BUTTON-SET-LABEL. As I used extensively only FFI part of cells-gtk, I didn't have to do it. Good luck, Dmitri From Bormuth at web.de Thu Jan 17 13:16:56 2008 From: Bormuth at web.de (Ingo Bormuth) Date: Thu, 17 Jan 2008 14:16:56 +0100 Subject: [cells-gtk-devel] UTF-8 support Message-ID: <928288954@web.de> > Yes, now it's clear. > MK-BUTTON expects a Lisp string, being decent Lisp function, not some > FFI abomination ;) > So the solution is to place (sb-ext:string-to-octets "foo ???? bar" > :external-format :utf-8) deeper, between MK-BUTTON and GTK-BUTTON-SET-LABEL. > As I used extensively only FFI part of cells-gtk, I didn't have to do it. Thank you for your help. I'll go for it and report back on what I got. ______________________________________________________________________ XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club! Jetzt testen! http://produkte.web.de/club/?mc=021130 From peter.hildebrandt at gmail.com Thu Jan 17 13:22:01 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Thu, 17 Jan 2008 14:22:01 +0100 Subject: [cells-gtk-devel] UTF-8 support In-Reply-To: <478F542B.5040502@common-lisp.ru> References: <928249613@web.de> <478F542B.5040502@common-lisp.ru> Message-ID: <478F5679.5020109@gmail.com> Dmitri Hrapof wrote: > Ingo Bormuth wrote: >> The following might be better. >> >> Code is: (mk-button :label (sb-ext:string-to-octets "foo ???? bar" :external-format :utf-8)) >> >> >> The value of STRING is #(102 111 111 32 195 164 195 182 195 188 >> ...), which is not of type STRING. >> [Condition of type SIMPLE-TYPE-ERROR] > Yes, now it's clear. > MK-BUTTON expects a Lisp string, being decent Lisp function, not some > FFI abomination ;) > So the solution is to place (sb-ext:string-to-octets "foo ???? bar" > :external-format :utf-8) deeper, between MK-BUTTON and GTK-BUTTON-SET-LABEL. Nope. I think the problem is somewhere in cffi (maybe we're using different versions?). I'm doing: (gtk-button-set-label (id *b*) (sto "s")) and getting a backtrace similar to Ingo's some search shows: cffi/src/strings.lisp (defun foreign-string-alloc (string) "Allocate a foreign string containing Lisp string STRING. The string must be freed with FOREIGN-STRING-FREE." (check-type string string) (let* ((length (1+ (length string))) (ptr (foreign-alloc :char :count length))) (lisp-string-to-foreign string ptr length) ptr)) (check-type string string) is what causes the error. commenting this out pushes the error further down towards (defun lisp-string-to-foreign (string ptr size) "Copy at most SIZE-1 characters from a Lisp STRING to PTR. The foreign string will be null-terminated." (decf size) (loop with i = 0 for char across string while (< i size) do (%mem-set (char-code char) ptr :unsigned-char (post-incf i)) finally (%mem-set 0 ptr :unsigned-char i))) where the problem is in (%mem-set (char-code char) ptr :unsigned-char (post-incf i)) i.e. we don't need char-code if string is already an array. Therefore replace the line with: do (%mem-set (if (characterp char) (char-code char) char) ptr :unsigned-char (post-incf i)) and voila, (gtk-button-set-label (id *b*) (sto "?????????")) works. And so does: (mk-button :label (sto "?????????"))) I'm working to puyt the conversion deeper into cffi. Peter > As I used extensively only FFI part of cells-gtk, I didn't have to do it. > > Good luck, > Dmitri > _______________________________________________ > cells-gtk-devel site list > cells-gtk-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cells-gtk-devel From hrapof at common-lisp.ru Thu Jan 17 13:29:30 2008 From: hrapof at common-lisp.ru (Dmitri Hrapof) Date: Thu, 17 Jan 2008 16:29:30 +0300 Subject: [cells-gtk-devel] UTF-8 support In-Reply-To: <478F5679.5020109@gmail.com> References: <928249613@web.de> <478F542B.5040502@common-lisp.ru> <478F5679.5020109@gmail.com> Message-ID: <478F583A.4040702@common-lisp.ru> Peter Hildebrandt wrote: > > Dmitri Hrapof wrote: >> Yes, now it's clear. >> MK-BUTTON expects a Lisp string, being decent Lisp function, not some >> FFI abomination ;) >> So the solution is to place (sb-ext:string-to-octets "foo ???? bar" >> :external-format :utf-8) deeper, between MK-BUTTON and >> GTK-BUTTON-SET-LABEL. > > Nope. I think the problem is somewhere in cffi (maybe we're using > different versions?). I'm doing: Stupid me! Just reread my answer and saw the error, but wasn't fast enough to correct myself befor you did :) You are right, the difference is in CFFI, in FOREIGN-STRING-ALLOC Use CFFI 0.9.2 instead of CFFI included in cells-gtk tarball. Also note that darcs version of CFFI is a new version, and is not very compatible with 0.9.2 It may or it may not work with cells-gtk. Sincerely yours, Dmitri From peter.hildebrandt at gmail.com Thu Jan 17 13:39:42 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Thu, 17 Jan 2008 14:39:42 +0100 Subject: [cells-gtk-devel] UTF-8 support In-Reply-To: <478F583A.4040702@common-lisp.ru> References: <928249613@web.de> <478F542B.5040502@common-lisp.ru> <478F5679.5020109@gmail.com> <478F583A.4040702@common-lisp.ru> Message-ID: <478F5A9E.8070202@gmail.com> Changing lisp-string-to-foreign in cffi/src/strings.lisp like this fixes the problem (at least for sbcl): (defun lisp-string-to-foreign (string ptr size) "Copy at most SIZE-1 characters from a Lisp STRING to PTR. The foreign string will be null-terminated." (decf size) (loop with i = 0 for char across #-sbcl string #+sbcl (sb-ext:string-to-octets string :external-format :utf-8) while (< i #-sbcl size #+sbcl (length (sb-ext:string-to-octets string :external-format :utf-8))) do (%mem-set #-sbcl (char-code char) #+sbcl char ptr :unsigned-char (post-incf i)) finally (%mem-set 0 ptr :unsigned-char i))) I will look at the newer cffi and see how that plays out. Dmitri Hrapof wrote: > Peter Hildebrandt wrote: >> Dmitri Hrapof wrote: >>> Yes, now it's clear. >>> MK-BUTTON expects a Lisp string, being decent Lisp function, not some >>> FFI abomination ;) >>> So the solution is to place (sb-ext:string-to-octets "foo ???? bar" >>> :external-format :utf-8) deeper, between MK-BUTTON and >>> GTK-BUTTON-SET-LABEL. >> Nope. I think the problem is somewhere in cffi (maybe we're using >> different versions?). I'm doing: > Stupid me! Just reread my answer and saw the error, but wasn't fast > enough to correct myself befor you did :) > You are right, the difference is in CFFI, in FOREIGN-STRING-ALLOC > Use CFFI 0.9.2 instead of CFFI included in cells-gtk tarball. > Also note that darcs version of CFFI is a new version, and is not very > compatible with 0.9.2 > It may or it may not work with cells-gtk. > > Sincerely yours, > Dmitri From peter.hildebrandt at gmail.com Thu Jan 17 17:03:08 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Thu, 17 Jan 2008 18:03:08 +0100 Subject: [cells-gtk-devel] UTF-8 support -- Patch In-Reply-To: <478F5A9E.8070202@gmail.com> References: <928249613@web.de> <478F542B.5040502@common-lisp.ru> <478F5679.5020109@gmail.com> <478F583A.4040702@common-lisp.ru> <478F5A9E.8070202@gmail.com> Message-ID: <478F8A4C.3030603@gmail.com> I created a simple patch for gtk-ffi.lisp that adds a call to sb-ext:string-to-octets to all gtk functions that take strings. This way all gtk functions transparently accept utf-8 characters. Here's the patch http://www.washbear-network.de/peterblog/wp-content/uploads/2008/01/gtk-ffi-utf8-sbcl.patch Ingo, let me know whether that solves your problem. Or a version that works against my multithreaded [1] version http://www.washbear-network.de/peterblog/wp-content/uploads/2008/01/gtk-ffi-utf8-sbcl-threading.patch The patch requires the latest cffi, that is 0.9.2. Cells-gtk works fine with this. I have not looked at the other direction yet, that is, what happens if the user enters utf-8 characters somewhere. Any questions, let me know. Peter ----- [1] http://www.washbear-network.de/peterblog Peter Hildebrandt wrote: > > Changing lisp-string-to-foreign in cffi/src/strings.lisp like this fixes > the problem (at least for sbcl): > > (defun lisp-string-to-foreign (string ptr size) > "Copy at most SIZE-1 characters from a Lisp STRING to PTR. > The foreign string will be null-terminated." > (decf size) > (loop with i = 0 for char across #-sbcl string #+sbcl > (sb-ext:string-to-octets string :external-format :utf-8) > while (< i #-sbcl size #+sbcl (length (sb-ext:string-to-octets > string :external-format :utf-8))) > do (%mem-set #-sbcl (char-code char) > #+sbcl char > ptr :unsigned-char (post-incf i)) > finally (%mem-set 0 ptr :unsigned-char i))) > > I will look at the newer cffi and see how that plays out. > > > > Dmitri Hrapof wrote: >> Peter Hildebrandt wrote: >>> Dmitri Hrapof wrote: >>>> Yes, now it's clear. >>>> MK-BUTTON expects a Lisp string, being decent Lisp function, not some >>>> FFI abomination ;) >>>> So the solution is to place (sb-ext:string-to-octets "foo ???? bar" >>>> :external-format :utf-8) deeper, between MK-BUTTON and >>>> GTK-BUTTON-SET-LABEL. >>> Nope. I think the problem is somewhere in cffi (maybe we're using >>> different versions?). I'm doing: >> Stupid me! Just reread my answer and saw the error, but wasn't fast >> enough to correct myself befor you did :) >> You are right, the difference is in CFFI, in FOREIGN-STRING-ALLOC >> Use CFFI 0.9.2 instead of CFFI included in cells-gtk tarball. >> Also note that darcs version of CFFI is a new version, and is not very >> compatible with 0.9.2 >> It may or it may not work with cells-gtk. >> >> Sincerely yours, >> Dmitri > From peter.hildebrandt at gmail.com Fri Jan 18 12:56:48 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Fri, 18 Jan 2008 13:56:48 +0100 Subject: [cells-gtk-devel] UTF-8 support -- Patch In-Reply-To: <478F8A4C.3030603@gmail.com> References: <928249613@web.de> <478F542B.5040502@common-lisp.ru> <478F5679.5020109@gmail.com> <478F583A.4040702@common-lisp.ru> <478F5A9E.8070202@gmail.com> <478F8A4C.3030603@gmail.com> Message-ID: <4790A210.2020903@gmail.com> Peter Hildebrandt wrote: > > I created a simple patch for gtk-ffi.lisp that adds a call to > sb-ext:string-to-octets to all gtk functions that take strings. This > way all gtk functions transparently accept utf-8 characters. > > Here's the patch > http://www.washbear-network.de/peterblog/wp-content/uploads/2008/01/gtk-ffi-utf8-sbcl.patch And for the opposite direction: http://www.washbear-network.de/peterblog/wp-content/uploads/2008/01/gtk-ffi-utf8-sbcl-input.patch (you need both patches!) This lets you input utf-8 characters (eg. German umlauts) into entry widgets. With my threading patch you can test the following: (start-win 'gtk-app :kids (list (mk-vbox :kids (list (mk-entry :md-name :entry) (mk-label :text (c? (print (md-value (fm-other :entry))))))))) Whenever you press enter, the label will show the value entered, and the value is also printed to the console (=> it is properly accessible in gtk and lisp). Without the threading patch, you'd need a defmodel (defmodel test-utf8 (gtk-app) () (:default-initargs :kids (list (mk-vbox :kids (list (mk-entry :md-name :entry) (mk-label :text (c? (print (md-value (fm-other :entry))))))))))) (start-app 'test-utf8) Any questions, let me know. Peter. > > Ingo, let me know whether that solves your problem. > > Or a version that works against my multithreaded [1] version > http://www.washbear-network.de/peterblog/wp-content/uploads/2008/01/gtk-ffi-utf8-sbcl-threading.patch > > > The patch requires the latest cffi, that is 0.9.2. Cells-gtk works fine > with this. > > I have not looked at the other direction yet, that is, what happens if > the user enters utf-8 characters somewhere. > > Any questions, let me know. > > Peter > ----- > [1] http://www.washbear-network.de/peterblog > > Peter Hildebrandt wrote: >> >> Changing lisp-string-to-foreign in cffi/src/strings.lisp like this >> fixes the problem (at least for sbcl): >> >> (defun lisp-string-to-foreign (string ptr size) >> "Copy at most SIZE-1 characters from a Lisp STRING to PTR. >> The foreign string will be null-terminated." >> (decf size) >> (loop with i = 0 for char across #-sbcl string #+sbcl >> (sb-ext:string-to-octets string :external-format :utf-8) >> while (< i #-sbcl size #+sbcl (length (sb-ext:string-to-octets >> string :external-format :utf-8))) >> do (%mem-set #-sbcl (char-code char) >> #+sbcl char >> ptr :unsigned-char (post-incf i)) >> finally (%mem-set 0 ptr :unsigned-char i))) >> >> I will look at the newer cffi and see how that plays out. >> >> >> >> Dmitri Hrapof wrote: >>> Peter Hildebrandt wrote: >>>> Dmitri Hrapof wrote: >>>>> Yes, now it's clear. >>>>> MK-BUTTON expects a Lisp string, being decent Lisp function, not some >>>>> FFI abomination ;) >>>>> So the solution is to place (sb-ext:string-to-octets "foo ???? bar" >>>>> :external-format :utf-8) deeper, between MK-BUTTON and >>>>> GTK-BUTTON-SET-LABEL. >>>> Nope. I think the problem is somewhere in cffi (maybe we're using >>>> different versions?). I'm doing: >>> Stupid me! Just reread my answer and saw the error, but wasn't fast >>> enough to correct myself befor you did :) >>> You are right, the difference is in CFFI, in FOREIGN-STRING-ALLOC >>> Use CFFI 0.9.2 instead of CFFI included in cells-gtk tarball. >>> Also note that darcs version of CFFI is a new version, and is not very >>> compatible with 0.9.2 >>> It may or it may not work with cells-gtk. >>> >>> Sincerely yours, >>> Dmitri >> > From ibormuth at efil.de Fri Jan 18 16:31:14 2008 From: ibormuth at efil.de (Ingo Bormuth) Date: Fri, 18 Jan 2008 17:31:14 +0100 Subject: [cells-gtk-devel] UTF-8 support -- Patch In-Reply-To: <4790A210.2020903@gmail.com> References: <928249613@web.de> <478F542B.5040502@common-lisp.ru> <478F5679.5020109@gmail.com> <478F583A.4040702@common-lisp.ru> <478F5A9E.8070202@gmail.com> <478F8A4C.3030603@gmail.com> <4790A210.2020903@gmail.com> Message-ID: <20080118163114.GA10437@efil.de> On 2008-01-18 13:56, Peter Hildebrandt wrote: >> Ingo, let me know whether that solves your problem. Yes it works. Thank you very much !! I'm pretty new to lisp and cells-gtk in particular. I'm just blown away by your pace... >> Here's the patch >> http://www.washbear-network.de/peterblog/wp-content/uploads/2008/01/gtk-ffi-utf8-sbcl.patch > And for the opposite direction: > http://www.washbear-network.de/peterblog/wp-content/uploads/2008/01/gtk-ffi-utf8-sbcl-input.patch Funny this demo also works without your patches. The error seems to be symmetric. :) > Any questions, let me know. Most widgets work now. Just a list-view is still problematic. Entries containing special characters are still not displayed correctly: (mk-listbox :columns (def-columns (:string (:title "foo ???? bar"))) :items '( '("foo ???? bar") '("foo ???? bar"))) Should list-store check weather item-types is string and do the conversation? Best, Ingo -- Ingo Bormuth, voicebox & fax: +49-(0)-12125-10226517 public key 86326EC9, http://ibormuth.efil.de/contact From peter.hildebrandt at gmail.com Sat Jan 19 12:11:25 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Sat, 19 Jan 2008 13:11:25 +0100 Subject: [cells-gtk-devel] UTF-8 support -- Patch In-Reply-To: <20080118163114.GA10437@efil.de> References: <928249613@web.de> <478F542B.5040502@common-lisp.ru> <478F5679.5020109@gmail.com> <478F583A.4040702@common-lisp.ru> <478F5A9E.8070202@gmail.com> <478F8A4C.3030603@gmail.com> <4790A210.2020903@gmail.com> <20080118163114.GA10437@efil.de> Message-ID: <4791E8ED.6080006@gmail.com> Ingo, glad to hear it works. Ingo Bormuth wrote: > I'm pretty new to lisp and cells-gtk in particular. Welcome aboard. I said the same thing half a year ago. > I'm just blown away by your pace... Well, this is a problem I have faced before. At that point I just got started with cells-gtk, so I postponed to deal with it. Now your request prompted me to have a look at it again. >>> Here's the patch >>> http://www.washbear-network.de/peterblog/wp-content/uploads/2008/01/gtk-ffi-utf8-sbcl.patch >> And for the opposite direction: >> http://www.washbear-network.de/peterblog/wp-content/uploads/2008/01/gtk-ffi-utf8-sbcl-input.patch Hopefully I get my CVS commit privileges sorted out soon, so that I can commit those things. > Funny this demo also works without your patches. > The error seems to be symmetric. :) I suspected that, and the idea behind my test was rather to see whether my patch /breaks/ the symmetry. The console output should have been wrong without the patch, right? (i.e. that is why I put in the (print ...) in the example. > Most widgets work now. Just a list-view is still problematic. > Entries containing special characters are still not displayed correctly: > (mk-listbox :columns (def-columns (:string (:title "foo ???? bar"))) > :items '( '("foo ???? bar") '("foo ???? bar"))) > Thanks for identifying this. I had a feeling some widgets use custom methods to read/write strings from/to gtk. I did not have the time to figure out which ones, though. Looking into this right now. > Should list-store check weather item-types is string and do > the conversation? I'd try to stick the patch into gtk-ffi, since this is where it belongs IMO. (BTW, it is "whether" ;-) ) Best, Peter > Best, Ingo > > From peter.hildebrandt at gmail.com Sat Jan 19 12:11:34 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Sat, 19 Jan 2008 13:11:34 +0100 Subject: [cells-gtk-devel] UTF-8 support -- Patch In-Reply-To: <20080118163114.GA10437@efil.de> References: <928249613@web.de> <478F542B.5040502@common-lisp.ru> <478F5679.5020109@gmail.com> <478F583A.4040702@common-lisp.ru> <478F5A9E.8070202@gmail.com> <478F8A4C.3030603@gmail.com> <4790A210.2020903@gmail.com> <20080118163114.GA10437@efil.de> Message-ID: <4791E8F6.6040900@gmail.com> Ingo, glad to hear it works. Ingo Bormuth wrote: > I'm pretty new to lisp and cells-gtk in particular. Welcome aboard. I said the same thing half a year ago. > I'm just blown away by your pace... Well, this is a problem I have faced before. At that point I just got started with cells-gtk, so I postponed to deal with it. Now your request prompted me to have a look at it again. >>> Here's the patch >>> http://www.washbear-network.de/peterblog/wp-content/uploads/2008/01/gtk-ffi-utf8-sbcl.patch >> And for the opposite direction: >> http://www.washbear-network.de/peterblog/wp-content/uploads/2008/01/gtk-ffi-utf8-sbcl-input.patch Hopefully I get my CVS commit privileges sorted out soon, so that I can commit those things. > Funny this demo also works without your patches. > The error seems to be symmetric. :) I suspected that, and the idea behind my test was rather to see whether my patch /breaks/ the symmetry. The console output should have been wrong without the patch, right? (i.e. that is why I put in the (print ...) in the example. > Most widgets work now. Just a list-view is still problematic. > Entries containing special characters are still not displayed correctly: > (mk-listbox :columns (def-columns (:string (:title "foo ???? bar"))) > :items '( '("foo ???? bar") '("foo ???? bar"))) > Thanks for identifying this. I had a feeling some widgets use custom methods to read/write strings from/to gtk. I did not have the time to figure out which ones, though. Looking into this right now. > Should list-store check weather item-types is string and do > the conversation? I'd try to stick the patch into gtk-ffi, since this is where it belongs IMO. (BTW, it is "whether" ;-) ) Best, Peter > Best, Ingo > > From peter.hildebrandt at gmail.com Sat Jan 19 18:42:03 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Sat, 19 Jan 2008 19:42:03 +0100 Subject: [cells-gtk-devel] UTF-8 support -- Patch In-Reply-To: <20080118163114.GA10437@efil.de> References: <928249613@web.de> <478F542B.5040502@common-lisp.ru> <478F5679.5020109@gmail.com> <478F583A.4040702@common-lisp.ru> <478F5A9E.8070202@gmail.com> <478F8A4C.3030603@gmail.com> <4790A210.2020903@gmail.com> <20080118163114.GA10437@efil.de> Message-ID: <4792447B.3020803@gmail.com> > Most widgets work now. Just a list-view is still problematic. > Entries containing special characters are still not displayed correctly: > > (mk-listbox :columns (def-columns (:string (:title "foo ???? bar"))) > :items '( '("foo ???? bar") '("foo ???? bar"))) I fixed that one, too. The problem was roughly that the string was converted to utf-8 *twice*. cells-gtk read a utf-8 string back from gtk, forgot to decode it, then encoded it *again* and sent it back to gtk. The fix is fairly straight forward. However, I decided to move this stuff into a new file, thus factoring out the implementation dependent stuff. Thus the patch got somewhat big, maybe it does more than you want. I'll mail it in a second to the list and cc you. If you just want to get this working, just add the following function to gtk-utilities.lisp (defun utf-8-to-lisp (str) (when str #+sbcl (let ((s (sb-ext:string-to-octets str :external-format :utf-8))) (sb-ext:octets-to-string (coerce (loop for i from 0 below (length s) for b = (aref s i) collect b if (= b 195) do (incf i 2)) ; ph: gtk gives us 4 bytes per char -- no idea why. '(vector (unsigned-byte 8))) :external-format :utf-8)) #-(or sbcl) str)) and change the function gtk-tree-model-get-typed-item-value in gtk-utilities.lisp: .... (cond (ret$ (utf-8-to-lisp (uffi:convert-from-cstring ret$))) ; ph 01/2008: here we need to convert back from gtk utf-8 to lisp ((eq col-type :boolean) ... That did the trick for me. Peter > Should list-store check weather item-types is string and do > the conversation? > > Best, Ingo > > From peter.hildebrandt at gmail.com Sat Jan 19 18:50:30 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Sat, 19 Jan 2008 19:50:30 +0100 Subject: [cells-gtk-devel] cumulative patch Message-ID: <47924676.4050907@gmail.com> I did a bit of refactoring of my changes to cells-gtk over the last couple weeks and created a cumulative patch that adds all my changes to a current CVS checkout. The patch is available here: http://www.washbear-network.de/peterblog/wp-content/uploads/2008/01/cgtk-full-08-01-19.patch (I'm still waiting for my CVS privileges) You might need to create a symbolic link in some path of your central registry to ph-math/ph-math.asd to make this system asdf loadable. The major changes are: - All changes that require external libraries are now dependent on *features* defined in cells-gtk.asd. By default, they are all deactivated. THis includes threading, which now requires bordeaux-threads. To activate threading, uncomment the line ; (pushnew :cells-gtk-threads *features*) in cells-gtk.asd - Implementation-dependent stuff resides now in gtk-ffi-impl.sbcl. Currently this is only for the utf-8 handlers, because threading now uses bordeaux-threads. - Multithreading. Support start-win as an alternative to start-app to start an application in a seperate dispatcher thread. The REPL remains open and can be used to access and/or modify state. It is now built upon bordeaux-threads and thus less implementation dependent. - Cells-Tree-View. A treeview that corresponds to a cells family structure. Each row represents one node in the tree. Editing is supported. There is an example in test-gtk - Editable cells for tree-box and list-box. Just set (:editable t) in the cell renderer. A callback function is called to handle the edit. - Experimental utf-8 support on sbcl for output (titles, labels, etc.), input (entry, editable list boxes), and file/directory dialogs. - Preparation for drawing-area support using cairo and opengl. This is still work in progress, but the files and *features* are already there. - A few minor bug fixes: eval-when wrappers to prevent sbcl warnings, fixing when-bind*, fixing hangs on close, and others. More details (i.e. a summary over all affected files) can be found on my blog: http://www.washbear-network.de/peterblog/ Peter From ibormuth at efil.de Sun Jan 20 14:09:43 2008 From: ibormuth at efil.de (Ingo Bormuth) Date: Sun, 20 Jan 2008 15:09:43 +0100 Subject: [cells-gtk-devel] UTF-8 support -- Patch In-Reply-To: <4792447B.3020803@gmail.com> References: <928249613@web.de> <478F542B.5040502@common-lisp.ru> <478F5679.5020109@gmail.com> <478F583A.4040702@common-lisp.ru> <478F5A9E.8070202@gmail.com> <478F8A4C.3030603@gmail.com> <4790A210.2020903@gmail.com> <20080118163114.GA10437@efil.de> <4792447B.3020803@gmail.com> Message-ID: <20080120140943.GA9368@efil.de> Hi Peter, thank you for your cumulative patch. I'm really looking forward to playing with cells-trie-view, cairo and the threading code. > I fixed that one, too. The problem was roughly that the string was > converted to utf-8 *twice*. cells-gtk read a utf-8 string back from > gtk, forgot to decode it, then encoded it *again* and sent it back to gtk In my hands utf-8-to-lisp didn't work for multi byte characters like #\REGISTERED_SIGN. I changed it to (defun utf-8-to-lisp (str) (when str #+sbcl (sb-ext:octets-to-string (sb-ext:string-to-octets str :external-format :latin1) :external-format :utf-8) #-(or sbcl) str)) and now everything works like a charm. Btw, find the patch in my git repository at http://public.efil.de/gitweb/?p=cells-gtk/.git;a=commitdiff;h=48c5592f984460269bb09415b472a8495db73251 Btw', what do you think about putting all utf8 trancoding directly into gtk-ffi's macro def-gtk-function? The current usage (def-gtk-lib-functions :gtk (gtk-entry-set-text :void ((entry :pointer) (text :gtk-string))) (gtk-entry-get-text :pointer ((entry :pointer))) ... would become (def-gtk-lib-functions :gtk (gtk-entry-set-text :void ((entry :pointer) (text :string))) (gtk-entry-get-text :string ((entry :pointer))) ... In def-gtk-function we would have something along the line of (mapcar (lambda (arg) (if (equal (cdr arg) :string) (cons (lisp-to-gtk-string (car arg)) (:gtk-pointer)) arg)) arguments) and (if (equal return-type :string) (gtk-string-to-lisp result) result) to have all conversions handled transparently. Lisp-to-gtk-string should be similar to to-gtk-string. Note, to-gtk-string uses g-locale-to-utf8 which is itself defined using def-gtk-lib-functions. I'd just be interested in what you think of the approach and whether I missed something here. > > ... (BTW, it is "whether" ;-) ) > Danke, die beide bekomme ich immer durcheinander. Mal sehn' Wetter ich das in Zukunft hinbekomme :) Ingo -- Ingo Bormuth, voicebox & fax: +49-(0)-12125-10226517 public key 86326EC9, http://ibormuth.efil.de/contact From peter.hildebrandt at gmail.com Sun Jan 20 13:56:33 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Sun, 20 Jan 2008 14:56:33 +0100 Subject: [cells-gtk-devel] UTF-8 support -- Patch In-Reply-To: <20080120140943.GA9368@efil.de> References: <928249613@web.de> <478F542B.5040502@common-lisp.ru> <478F5679.5020109@gmail.com> <478F583A.4040702@common-lisp.ru> <478F5A9E.8070202@gmail.com> <478F8A4C.3030603@gmail.com> <4790A210.2020903@gmail.com> <20080118163114.GA10437@efil.de> <4792447B.3020803@gmail.com> <20080120140943.GA9368@efil.de> Message-ID: <47935311.4010507@gmail.com> Hi Ingo, > thank you for your cumulative patch. I'm really looking forward to > playing with cells-trie-view, cairo and the threading code. The cells-tree-view works nicely (c.f. the demo in test-gtk). The cairo stuff is still in the making. I'm trying to factor out the common elements of a drawing area canvas and then use that as a superclass for the cairo-drawing-area (using Tamas' cl-cairo2) and the gl-drawing-area (using gtk-gl-ext). I need both for my project (the cairo part is for a graphic network editor, the gl part for a 3d physics simulator based on cl-ode), so chances are I'll finish them soon. >> I fixed that one, too. The problem was roughly that the string was >> converted to utf-8 *twice*. cells-gtk read a utf-8 string back from >> gtk, forgot to decode it, then encoded it *again* and sent it back to gtk > > In my hands utf-8-to-lisp didn't work for multi byte characters > like #\REGISTERED_SIGN. I changed it to > > (defun utf-8-to-lisp (str) > (when str > #+sbcl (sb-ext:octets-to-string > (sb-ext:string-to-octets str :external-format :latin1) > :external-format :utf-8) > #-(or sbcl) str)) > > and now everything works like a charm. You got me there. Things are more complicated than both of us thought (I believe). Your stuff is obvious, and that's what I had at first. Turned out that e.g. the entry widget returned crap with that. I believe you spotted the problem (see below). > Btw, find the patch in my git repository at > http://public.efil.de/gitweb/?p=cells-gtk/.git;a=commitdiff;h=48c5592f984460269bb09415b472a8495db73251 Yep. Saw that. Maybe there's a point in having a common develop CVS/SVN/git somewhere? (I prefer CVS because then I don't have to reconfigure emacs ;-)) > Btw', what do you think about putting all utf8 trancoding directly > into gtk-ffi's macro def-gtk-function? Actually, check out gtk-ffi.lisp: (defmacro def-gtk-function (library name return-type arguments) [...] (let ((result ,(let ((fn `(,gtk-name ,@(mapcar #'(lambda (arg) (if (eql (cadr arg) :gtk-string) `(lisp-to-utf-8 ,(car arg)) (car arg))) arguments)))) [...] i.e. whenever a function accepts a gtk-string as a parameter, it is first processed lisp-to-utf-8. > (if (equal return-type :string) > (gtk-string-to-lisp result) > result) > > to have all conversions handled transparently. This one is more tricky (Yes, I thought about it, too). :gtk-string as a return type is a pointer, not a lisp data structure. That is, you can't process it directly using sb-ext:octets-to-string. The calling function usually makes some uffi call to create a lisp string from the pointer. OTOH, there is only five or six functions returning strings (grep :gtk-string$ *.lisp). Most of them are file boxes, and they seem to be fine. > Lisp-to-gtk-string should be similar to to-gtk-string. > Note, to-gtk-string uses g-locale-to-utf8 which is itself > defined using def-gtk-lib-functions. And here things get complicated. It is up to the calling function in cells-gtk to handle to-gtk-string, local-to-utf8 etc. And it looks like cells-gtk sometimes does it one way and sometimes the other. The title/label/text setting functions plainly pass the lisp string and do not care about locale conversions. So the def-gtk-lib... hook that is currently in place does the right thing. Reading stuff back from an entry is easy, since cffi:translate-from-foreign is the right place for the hook. The tree-view/list-view is a lot more complex, since they use the whole locale-to-utf8 conversion. There are g-values and this runtime-typing function (in gtk-utilities I believe) ... and honestly, I don't know where you should hook in there. > I'd just be interested in what you think of the approach > and whether I missed something here. I think you understand the mess at least as well as I do. Where to go from here is another question. I believe your patch breaks the entry widget. The problem really seems to be that we do the utf-8 conversion sometimes twice. And I am not quite sure how to deal with this. Maybe it is an option to "blacklist" the locale/utf8 functions so that they don't automatically call the sb-ext conversion? If you want to look into that, go ahead. I'm working on the object inspector (an extension of the tree view) and the drawing areas right now, so it's all yours. Peter >> ... (BTW, it is "whether" ;-) ) >> > > Danke, die beide bekomme ich immer durcheinander. > Mal sehn' Wetter ich das in Zukunft hinbekomme :) :-) Viel Erfolg! > Ingo > > From peter.denno at nist.gov Mon Jan 21 12:17:41 2008 From: peter.denno at nist.gov (Peter Denno) Date: Mon, 21 Jan 2008 07:17:41 -0500 Subject: [cells-gtk-devel] cumulative patch In-Reply-To: <47924676.4050907@gmail.com> References: <47924676.4050907@gmail.com> Message-ID: <200801210717.41816.peter.denno@nist.gov> On Saturday 19 January 2008 13:50, Peter Hildebrandt wrote: > I did a bit of refactoring of my changes to cells-gtk over the last > couple weeks and created a cumulative patch that adds all my > changes to a current CVS checkout. > > The patch is available here: > http://www.washbear-network.de/peterblog/wp-content/uploads/2008/01 >/cgtk-full-08-01-19.patch > > (I'm still waiting for my CVS privileges) Did you miss the message in which the sysadmin for common-lisp.net ask you for a gpg key? Or did you send one, and then nothing happened? -- Best regards, - Peter From peter.hildebrandt at gmail.com Sun Jan 27 13:02:29 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Sun, 27 Jan 2008 14:02:29 +0100 Subject: [cells-gtk-devel] New "First steps" how to Message-ID: <479C80E5.7050409@gmail.com> I wrote a first steps guide for people new to cells-gtk. It is supposed to guide you through the installation and help you fire up the demo (test-gtk) and your first "Hello world" application. http://www.washbear-network.de/peterblog/getting-started-with-cells-gtk/ Let me know whether it is any good. Peter From peter.hildebrandt at gmail.com Sun Jan 27 20:08:20 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Sun, 27 Jan 2008 21:08:20 +0100 Subject: [cells-gtk-devel] Patches committed to CVS Message-ID: <479CE4B4.3060007@gmail.com> I committed my recent patches to CVS today. I also included the patches sent by Matthew D Swank a while ago. . Matthew's patches: - Typo fix in the entry widget - Add Combo Box Entry widget - Wrap resizable attribute - Add container widget as a parent of appropriate widgets . All changes that require external libraries are now dependent on *features* defined in cells-gtk.asd. By default, they are all deactivated. THis includes threading, which now requires bordeaux-threads. . Implementation-dependent stuff resides now in gtk-ffi-impl.sbcl. Currently this is only for the utf-8 handlers, because threading now uses bordeaux-threads. . Multithreading. Support start-win as an alternative to start-app to start an application in a seperate dispatcher thread. The REPL remains open and can be used to access and/or modify state. It is now built upon bordeaux-threads and thus less implementation dependent. . Cells-Tree-View. A treeview that corresponds to a cells family structure. Each row represents one node in the tree. Editing is supported. . Editable cells for tree-box and list-box. Just set (:editable t) in the cell renderer. A callback function is called to handle the edit. . Experimantal utf-8 support on sbcl for output (titles, labels, etc.), input (entry, editable list boxes), and file/directory dialogs. . Preparation for drawing-area support using cairo and opengl. This is still work in progress, but the files and *features* are already there. . A few minor bug fixes: eval-when wrappers to prevent sbcl warnings, fixing when-bind*, fixing hangs on close, and others. Let me know if anything is broken now. Peter From david at lichteblau.com Sun Jan 27 22:13:02 2008 From: david at lichteblau.com (David Lichteblau) Date: Sun, 27 Jan 2008 23:13:02 +0100 Subject: [cells-gtk-devel] Where is ph-maths? Message-ID: <20080127221302.GC16179@radon> Hi, (still trying to get cell-gtk into clbuild) Now that I'm using the right cells, I'm having trouble with cell-gtk's dependency on ph-maths. I noticed that the cumulative patch from washbear-network.de adds both that dependency and the actual ph-maths files, but in CVS I see only the former. I tried cvs up -Pd in the normal cells-gtk repository. Is that the right one? Thanks, David From peter.hildebrandt at gmail.com Sun Jan 27 23:23:39 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Mon, 28 Jan 2008 00:23:39 +0100 Subject: [cells-gtk-devel] Where is ph-maths? In-Reply-To: <20080127221302.GC16179@radon> References: <20080127221302.GC16179@radon> Message-ID: <479D127B.1030803@gmail.com> David Lichteblau wrote: > Hi, > > (still trying to get cell-gtk into clbuild) > > Now that I'm using the right cells, I'm having trouble with cell-gtk's > dependency on ph-maths. Sorry, my bad. I forgot that cvs does not automatically add new files. Fixed that. Now you should find everything you need in CVS. That is, anonymous CVS is a bit delayed (15 min or so they say). I checked it in a minute ago, so you might have to wait a bit. > I tried cvs up -Pd in the normal cells-gtk repository. Is that the > right one? The cvs checkout command I use is for cells-gtk: cvs -z3 -d :pserver:anonymous:anonymous at common-lisp.net:/project/cells-gtk/cvsroot co root for cells: cvs -z3 -d :pserver:anonymous:anonymous at common-lisp.net:/project/cells-gtk/cvsroot co cells All asd files I need to symlink are: cells.asd gtk-ffi.asd ph-utils.asd test-gtk.asd cells-gtk.asd ph-maths.asd pod-utils.asd utils-kt.asd They are all in the two checkouts above. I added a libcellsgtk.so to CVS, which might save you from having to recompile. It'd be nice to hear whether that works for anyone. HTH, Peter > > Thanks, > David > _______________________________________________ > cells-gtk-devel site list > cells-gtk-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cells-gtk-devel From david at lichteblau.com Sun Jan 27 23:51:11 2008 From: david at lichteblau.com (David Lichteblau) Date: Mon, 28 Jan 2008 00:51:11 +0100 Subject: [cells-gtk-devel] Where is ph-maths? In-Reply-To: <479D127B.1030803@gmail.com> References: <20080127221302.GC16179@radon> <479D127B.1030803@gmail.com> Message-ID: <20080127235111.GA30933@radon> Quoting Peter Hildebrandt (peter.hildebrandt at gmail.com): > Sorry, my bad. I forgot that cvs does not automatically add new files. > Fixed that. Now you should find everything you need in CVS. Thank you, that part works now. Do you happen to have a patch so that it works with cffi from darcs? d. From peter.hildebrandt at gmail.com Sun Jan 27 23:56:11 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Mon, 28 Jan 2008 00:56:11 +0100 Subject: [cells-gtk-devel] Where is ph-maths? In-Reply-To: <20080127235111.GA30933@radon> References: <20080127221302.GC16179@radon> <479D127B.1030803@gmail.com> <20080127235111.GA30933@radon> Message-ID: <479D1A1B.7040705@gmail.com> David Lichteblau wrote: > Quoting Peter Hildebrandt (peter.hildebrandt at gmail.com): >> Sorry, my bad. I forgot that cvs does not automatically add new files. >> Fixed that. Now you should find everything you need in CVS. > > Thank you, that part works now. Glad to hear that. > Do you happen to have a patch so that it works with cffi from darcs? I have not looked into this yet. Anyone else? BTW, are you integrating bordeaux-threads in clbuilder? I am wondering whether the threading support in cells-gtk should be enabled by default. Right now it is featured out in cvs, because I am not sure how wide spread bordeaux-threads are. Other opinions? Peter > > d. From peter.hildebrandt at gmail.com Mon Jan 28 09:40:16 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Mon, 28 Jan 2008 10:40:16 +0100 Subject: [cells-gtk-devel] New "First steps" how to In-Reply-To: <87zluq4jet.fsf@q-software-solutions.de> References: <479C80E5.7050409@gmail.com> <87zluq4jet.fsf@q-software-solutions.de> Message-ID: <479DA300.1030202@gmail.com> Hello Friedrich, Friedrich Dominicus wrote: > Well AFAIKT it is imcomplete. I tried the same yesterday and at least > kenny-utils was needed here also and as often with such stuff it does > not compile but that's another story. Well, there is no kenny-utils involved with cells-gtk. I do not even have a library by that name. Maybe you have a different version of cells? I updated the document to explain how to use cells from the cells-gtk cvs. This should help. Note that there are at least two versions of cells around, and cells-gtk requires the older. There is ongoing work to port it to the newer, but that is for another day. Also, the document lacked the symlink to ph-maths.asd. Included that, two now. Finally I committed a few upgrades/patches last night, so you might want to update you copy from cvs. Regards, Peter > Regards > Friedrich > From peter.hildebrandt at gmail.com Mon Jan 28 13:56:38 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Mon, 28 Jan 2008 14:56:38 +0100 Subject: [cells-gtk-devel] New "First steps" how to In-Reply-To: <874pcy442j.fsf@q-software-solutions.de> References: <479C80E5.7050409@gmail.com> <87zluq4jet.fsf@q-software-solutions.de> <479DA300.1030202@gmail.com> <874pcy442j.fsf@q-software-solutions.de> Message-ID: <479DDF16.2060006@gmail.com> Friedrich Dominicus wrote: > Well here's an excert from my cells.asd file > > :components ((:module "utils-kt" > :serial t > :components ((:file "defpackage") > > So utils-kt is needed... Alright, that comes with cells, in the utils-kt sub directory. I fixed the explanation on my how to this morning. Please check back there in the section about cells. I explain how you pull the matching cells from cvs and add the symlinks to cells.asd and utils-kt.asd. The latest utils-kt which comes with the latest cells does not compile on sbcl. I ran into that yesterday and informed the maintainer (Ken Tilton). But, again, the version that is needed for cells-gtk compiles out of the box on sbcl. HTH, Peter > Regards > Friedrich > > From peter.hildebrandt at gmail.com Mon Jan 28 15:34:36 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Mon, 28 Jan 2008 16:34:36 +0100 Subject: [cells-gtk-devel] Re: Comments II for "First steps" how to In-Reply-To: <87r6g24i6i.fsf@q-software-solutions.de> References: <479C80E5.7050409@gmail.com> <87r6g24i6i.fsf@q-software-solutions.de> Message-ID: <479DF60C.1030307@gmail.com> Friedrich, I take your feedback very seriously. I started from scratch with a fresh sbcl config (on ubuntu 7.10) and went step by step through the guide. I found a number of typos/inconsistencies which are all fixed now. For me, thinks work perfectly now. So let us try to track down what is different for you and how we can handle those cases. Friedrich Dominicus wrote: > Trying to compile the libcellsgtk.so library has not worked without > modifcation to the Makefile: > all: > gcc -fPIC -c gtk-adds.c `pkg-config --cflags --libs gtk+-2.0` > gcc -shared -o libcellsgtk.so gtk-adds.o `pkg-config --cflags --libs gtk+-2.0` For me the current makefile is fine. I am not a C programmer, so what does -fPIC do? I see you removed glib from the pkg-config command. gtk-adds.c includes glib -- does that make a difference? My gcc is "gcc (GCC) 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)". > Trying to comile cells-gtk results in another error: > Execution of a form compiled with errors. > Form: > (DEFCTYPE GTK-STRING POINTER DOCUMENTATION > string type for cffi type translation) > Compile-time error: > (during macroexpansion of (CFFI:DEFCTYPE :GTK-STRING ...)) > error while parsing arguments to DEFMACRO CFFI:DEFCTYPE: > invalid number of elements in > (:GTK-STRING :POINTER :DOCUMENTATION > "string type for cffi type translation") .. > [Condition of type SB-INT:COMPILED-PROGRAM-ERROR] You are using a non-supported version of cffi. Try the latest version (not the darcs tree) from the cffi project page. I describe this in more detail in my guide. Current work is on making cells-gtk work with the latest Cells, so there are no resources to work on CFFI right now, especially since cells-gtk works with the latest release. Regards, Peter From leandror at tutopia.com Tue Jan 29 23:45:10 2008 From: leandror at tutopia.com (=?ISO-8859-1?Q?Leandro_R=EDos?=) Date: Tue, 29 Jan 2008 21:45:10 -0200 Subject: [cells-gtk-devel] Problems with demo Message-ID: <479FBA86.8020208@tutopia.com> Hi, I'm having problems to run the demo of cells-gtk. I compiled libcellsgtk.so (I'm running Ubuntu 7.10 AMD64 and SBCL 1.0.6) When I run (test-gtk:gtk-demo) sbcl halts with this error: Unhandled memory fault at #x400000004B. [Condition of type SB-SYS:MEMORY-FAULT-ERROR] Restarts: 0: [ABORT] Return to SLIME's top level. 1: [TERMINATE-THREAD] Terminate this thread (#) Backtrace: 0: (SB-SYS:MEMORY-FAULT-ERROR) 1: (SB-SYS:MEMORY-FAULT-ERROR) 2: ("foreign function: #x41D7B2") 3: ("foreign function: #x41D880") If I enable debug: ------------------------------------------------------------------- CL-USER> (test-gtk:gtk-demo t) eval (INIT-GTK) Calling (gtk-adds-g-thread-supported ) (gtk-adds-g-thread-supported ) returns 1--> NIL eval (SHOW-WIN APP-NAME TERMINATE-ON-CLOSE T) eval (SETF APP (APPLY #'MAKE-INSTANCE APP-NAME VISIBLE (C-IN NIL) INITARGS)) Calling (gtk-statusbar-new ) (gtk-statusbar-new ) returns #.(SB-SYS:INT-SAP #X00AF7330) Calling (gtk-statusbar-get-context-id #.(SB-SYS:INT-SAP #X00AF7330) MAIN) (gtk-statusbar-get-context-id #.(SB-SYS:INT-SAP #X00AF7330) MAIN) returns 1 Calling (gtk-list-store-newv 2 #.(SB-SYS:INT-SAP #X00ABAF90)) ------------------------------------------------------------------- And the debugger pops up with above error. If I modify the model test-gtk like: (defmodel test-gtk (gtk-app) () (:default-initargs :title "GTK Testing" ;;:tooltips nil ;;dkwt ;;:tooltips-enable nil ;;dkwt :icon (namestring *small-image*) :stock-icons (list (list :my-g (namestring *stock-icon-image*))) :position :center :splash-screen-image (namestring *splash-image*) :width 650 :height 550 :kids (let ((tabs '("Buttons" "Display" "Layout" ;"Menus" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< HERE "Dialogs" "Addon" "Entry" "Textview" ;"Tree-view" <<<<<<<<<<<<<<<<<<<<<<<<<<<<< HERE ;"Drawing" ))) (list (mk-notebook :tab-labels tabs :kids (loop for test-name in tabs collect (make-instance (intern (string-upcase (format nil "test-~a" test-name)) :test-gtk)))))))) the demo runs, but the treeview and menu demos are missing (of course). Using Cells 2.0 and CFFI 0.9.2, from asdf-install and cells-gtk from CVS Any ideas? Thanks in advance, Leandro From peter.hildebrandt at gmail.com Wed Jan 30 00:22:56 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Wed, 30 Jan 2008 01:22:56 +0100 Subject: [cells-gtk-devel] Problems with demo In-Reply-To: <479FBA86.8020208@tutopia.com> References: <479FBA86.8020208@tutopia.com> Message-ID: <479FC360.4040502@gmail.com> Leandro, welcome aboard. As to the error you are reporting, I am pretty much in the dark right now. The interesting thing is, Friedrich (I cc'd him) has seen the exact same error today. It is not an issue for me (or other people on the list here). Since both of you are runnign into the exact same issue, maybe we can track it down. I noticed both of you of 64bit machines (I am on an ancient Pentium-M). It might be an issue with (and 64bit cffi gtk). Your sbcl is quite a bit older than Friedrich's, so I doubt that the problem lies with sbcl. Your error is: > Unhandled memory fault at #x400000004B. > [Condition of type SB-SYS:MEMORY-FAULT-ERROR] Friedrich reported the exact same thing: Unhandled memory fault at #x400000004B. [Condition of type SB-SYS:MEMORY-FAULT-ERROR] I am just speculating here, but: I have never seen a memory fault starting with anything but #x00 -- if my maths is correct, you need more than 32bit to express the fault address there. Forgive me if this is nonsense. Your backtrace: > Backtrace: > 0: (SB-SYS:MEMORY-FAULT-ERROR) > 1: (SB-SYS:MEMORY-FAULT-ERROR) > 2: ("foreign function: #x41D7B2") > 3: ("foreign function: #x41D880") Friedrich's backtrace: Backtrace: 0: (SB-SYS:MEMORY-FAULT-ERROR) 1: (SB-SYS:MEMORY-FAULT-ERROR) 2: ("foreign function: #x41DC32") 3: ("foreign function: #x41DD00") In both cases the memory fault appears to be raised in a C function and then being caught by sbcl. Since I cannot reproduce this problem, here's a few ideas how to narrow down the problem further: - check the last few (say 50) lines of the (gtk-demo t) output when you comment out only the menus or only the tree-view page. If it is consistent, send us a longer version of the trace (~200 lines). This will give me a better idea about what is going on before the crash. - comment out parts of the demos in test-menus.lisp and test-tree-view.lisp. If you could get those demos to run this way, it'd be great to see which subpart of the demo causes the problem. On a different note, we are currently working on porting cells-gtk to cells3 and cffi from darcs. I doubt that this might remedy your issue, but it might be worth giving it a try on your config once we have something stable. The menus turned out to be a difficult issue in this respect, too. HTH, Peter Leandro R?os wrote: > Hi, > > I'm having problems to run the demo of cells-gtk. I compiled > libcellsgtk.so (I'm running Ubuntu 7.10 AMD64 and SBCL 1.0.6) When I run > (test-gtk:gtk-demo) sbcl halts with this error: > > Unhandled memory fault at #x400000004B. > [Condition of type SB-SYS:MEMORY-FAULT-ERROR] > > Restarts: > 0: [ABORT] Return to SLIME's top level. > 1: [TERMINATE-THREAD] Terminate this thread (# {1002AB65E1}>) > > Backtrace: > 0: (SB-SYS:MEMORY-FAULT-ERROR) > 1: (SB-SYS:MEMORY-FAULT-ERROR) > 2: ("foreign function: #x41D7B2") > 3: ("foreign function: #x41D880") > > If I enable debug: > > ------------------------------------------------------------------- > CL-USER> (test-gtk:gtk-demo t) > > eval (INIT-GTK) > Calling (gtk-adds-g-thread-supported ) > (gtk-adds-g-thread-supported ) returns 1--> NIL > eval (SHOW-WIN APP-NAME TERMINATE-ON-CLOSE T) > eval (SETF APP > (APPLY #'MAKE-INSTANCE APP-NAME VISIBLE (C-IN NIL) INITARGS)) > Calling (gtk-statusbar-new ) > (gtk-statusbar-new ) returns #.(SB-SYS:INT-SAP #X00AF7330) > Calling (gtk-statusbar-get-context-id #.(SB-SYS:INT-SAP #X00AF7330) MAIN) > (gtk-statusbar-get-context-id #.(SB-SYS:INT-SAP #X00AF7330) MAIN) > returns 1 > Calling (gtk-list-store-newv 2 #.(SB-SYS:INT-SAP #X00ABAF90)) > > ------------------------------------------------------------------- > > And the debugger pops up with above error. > > If I modify the model test-gtk like: > > (defmodel test-gtk (gtk-app) > () > (:default-initargs > :title "GTK Testing" > ;;:tooltips nil ;;dkwt > ;;:tooltips-enable nil ;;dkwt > :icon (namestring *small-image*) > :stock-icons (list (list :my-g (namestring *stock-icon-image*))) > :position :center > :splash-screen-image (namestring *splash-image*) > :width 650 :height 550 > :kids (let ((tabs '("Buttons" > "Display" > "Layout" > ;"Menus" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< HERE > "Dialogs" > "Addon" > "Entry" > "Textview" > ;"Tree-view" <<<<<<<<<<<<<<<<<<<<<<<<<<<<< HERE > ;"Drawing" > ))) > (list (mk-notebook > :tab-labels tabs > :kids (loop for test-name in tabs > collect (make-instance > (intern (string-upcase > (format nil "test-~a" > test-name)) > :test-gtk)))))))) > > the demo runs, but the treeview and menu demos are missing (of course). > > Using Cells 2.0 and CFFI 0.9.2, from asdf-install and cells-gtk from CVS > > Any ideas? > > Thanks in advance, > > Leandro > > _______________________________________________ > cells-gtk-devel site list > cells-gtk-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cells-gtk-devel From varuzza at gmail.com Wed Jan 30 02:07:57 2008 From: varuzza at gmail.com (Leonardo Varuzza) Date: Wed, 30 Jan 2008 00:07:57 -0200 Subject: [cells-gtk-devel] Problems with demo In-Reply-To: <479FBA86.8020208@tutopia.com> References: <479FBA86.8020208@tutopia.com> Message-ID: <5d9c2e640801291807q5534c76ara87f8220a1f2333b@mail.gmail.com> I have the same error executing the demo with SBCL 1.0.13.53 in Unbuntu 7.10 AMD64. Another problem occur when compiling gtk-ffi: /usr/bin/ld: gtk-adds.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC gtk-adds.o: could not read symbols: Bad value I need to use -fPIC option to compile the library. On Jan 29, 2008 9:45 PM, Leandro R?os wrote: > Hi, > > I'm having problems to run the demo of cells-gtk. I compiled > libcellsgtk.so (I'm running Ubuntu 7.10 AMD64 and SBCL 1.0.6) When I run > (test-gtk:gtk-demo) sbcl halts with this error: > > Unhandled memory fault at #x400000004B. > [Condition of type SB-SYS:MEMORY-FAULT-ERROR] > > Restarts: > 0: [ABORT] Return to SLIME's top level. > 1: [TERMINATE-THREAD] Terminate this thread (# {1002AB65E1}>) > > Backtrace: > 0: (SB-SYS:MEMORY-FAULT-ERROR) > 1: (SB-SYS:MEMORY-FAULT-ERROR) > 2: ("foreign function: #x41D7B2") > 3: ("foreign function: #x41D880") > > If I enable debug: > > ------------------------------------------------------------------- > CL-USER> (test-gtk:gtk-demo t) > > eval (INIT-GTK) > Calling (gtk-adds-g-thread-supported ) > (gtk-adds-g-thread-supported ) returns 1--> NIL > eval (SHOW-WIN APP-NAME TERMINATE-ON-CLOSE T) > eval (SETF APP > (APPLY #'MAKE-INSTANCE APP-NAME VISIBLE (C-IN NIL) INITARGS)) > Calling (gtk-statusbar-new ) > (gtk-statusbar-new ) returns #.(SB-SYS:INT-SAP #X00AF7330) > Calling (gtk-statusbar-get-context-id #.(SB-SYS:INT-SAP #X00AF7330) MAIN) > (gtk-statusbar-get-context-id #.(SB-SYS:INT-SAP #X00AF7330) MAIN) > returns 1 > Calling (gtk-list-store-newv 2 #.(SB-SYS:INT-SAP #X00ABAF90)) > > ------------------------------------------------------------------- > > And the debugger pops up with above error. > > If I modify the model test-gtk like: > > (defmodel test-gtk (gtk-app) > () > (:default-initargs > :title "GTK Testing" > ;;:tooltips nil ;;dkwt > ;;:tooltips-enable nil ;;dkwt > :icon (namestring *small-image*) > :stock-icons (list (list :my-g (namestring *stock-icon-image*))) > :position :center > :splash-screen-image (namestring *splash-image*) > :width 650 :height 550 > :kids (let ((tabs '("Buttons" > "Display" > "Layout" > ;"Menus" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< HERE > "Dialogs" > "Addon" > "Entry" > "Textview" > ;"Tree-view" <<<<<<<<<<<<<<<<<<<<<<<<<<<<< HERE > ;"Drawing" > ))) > (list (mk-notebook > :tab-labels tabs > :kids (loop for test-name in tabs > collect (make-instance > (intern (string-upcase > (format nil > "test-~a" test-name)) > :test-gtk)))))))) > > the demo runs, but the treeview and menu demos are missing (of course). > > Using Cells 2.0 and CFFI 0.9.2, from asdf-install and cells-gtk from CVS > > Any ideas? > > Thanks in advance, > > Leandro > > _______________________________________________ > cells-gtk-devel site list > cells-gtk-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cells-gtk-devel > -- The most fundamental particles in this product are held together by a "gluing" force about which little is currently known and whose adhesive power can therefore not be permanently guaranteed. From peter.hildebrandt at gmail.com Wed Jan 30 12:15:23 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Wed, 30 Jan 2008 13:15:23 +0100 Subject: [cells-gtk-devel] Problems with demo In-Reply-To: <5d9c2e640801291807q5534c76ara87f8220a1f2333b@mail.gmail.com> References: <479FBA86.8020208@tutopia.com> <5d9c2e640801291807q5534c76ara87f8220a1f2333b@mail.gmail.com> Message-ID: <47A06A5B.30201@gmail.com> Leonardo, Leonardo Varuzza wrote: > I have the same error executing the demo with SBCL 1.0.13.53 in > Unbuntu 7.10 AMD64. So it is three of you, and all on AMD64s. This *is* strange. If anyone of you feels adventurous, it'd be great if you could investigate that further and try to pin down where the problem is. Can you confirm that it is confined to the tree view and menu demo? As I said before, we are working on a port to cells3 and cffi-darcs, which might solve things *if* it is a cells or cffi issue. If it is a gtk thing we might need to create a work around. I'd ge most grateful if anyone of you 64bit guys can dig deeper here, since I cannot reproduce the problem on my four year old machine. I'll be happy to respond to questions or help with the general understanding of gtk/cells/cells-gtk. > Another problem occur when compiling gtk-ffi: > > /usr/bin/ld: gtk-adds.o: relocation R_X86_64_32 against `a local > symbol' can not be used when making a shared object; recompile with > -fPIC > gtk-adds.o: could not read symbols: Bad value > > I need to use -fPIC option to compile the library. Thanks for pointing it out. I committed that to CVS yesterday. Somehow my gcc silently does the right thing. Maybe they changed it to be more picky in the current or 64bit version. Best, Peter > On Jan 29, 2008 9:45 PM, Leandro R?os wrote: >> Hi, >> >> I'm having problems to run the demo of cells-gtk. I compiled >> libcellsgtk.so (I'm running Ubuntu 7.10 AMD64 and SBCL 1.0.6) When I run >> (test-gtk:gtk-demo) sbcl halts with this error: >> >> Unhandled memory fault at #x400000004B. >> [Condition of type SB-SYS:MEMORY-FAULT-ERROR] >> >> Restarts: >> 0: [ABORT] Return to SLIME's top level. >> 1: [TERMINATE-THREAD] Terminate this thread (#> {1002AB65E1}>) >> >> Backtrace: >> 0: (SB-SYS:MEMORY-FAULT-ERROR) >> 1: (SB-SYS:MEMORY-FAULT-ERROR) >> 2: ("foreign function: #x41D7B2") >> 3: ("foreign function: #x41D880") >> >> If I enable debug: >> >> ------------------------------------------------------------------- >> CL-USER> (test-gtk:gtk-demo t) >> >> eval (INIT-GTK) >> Calling (gtk-adds-g-thread-supported ) >> (gtk-adds-g-thread-supported ) returns 1--> NIL >> eval (SHOW-WIN APP-NAME TERMINATE-ON-CLOSE T) >> eval (SETF APP >> (APPLY #'MAKE-INSTANCE APP-NAME VISIBLE (C-IN NIL) INITARGS)) >> Calling (gtk-statusbar-new ) >> (gtk-statusbar-new ) returns #.(SB-SYS:INT-SAP #X00AF7330) >> Calling (gtk-statusbar-get-context-id #.(SB-SYS:INT-SAP #X00AF7330) MAIN) >> (gtk-statusbar-get-context-id #.(SB-SYS:INT-SAP #X00AF7330) MAIN) >> returns 1 >> Calling (gtk-list-store-newv 2 #.(SB-SYS:INT-SAP #X00ABAF90)) >> >> ------------------------------------------------------------------- >> >> And the debugger pops up with above error. >> >> If I modify the model test-gtk like: >> >> (defmodel test-gtk (gtk-app) >> () >> (:default-initargs >> :title "GTK Testing" >> ;;:tooltips nil ;;dkwt >> ;;:tooltips-enable nil ;;dkwt >> :icon (namestring *small-image*) >> :stock-icons (list (list :my-g (namestring *stock-icon-image*))) >> :position :center >> :splash-screen-image (namestring *splash-image*) >> :width 650 :height 550 >> :kids (let ((tabs '("Buttons" >> "Display" >> "Layout" >> ;"Menus" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< HERE >> "Dialogs" >> "Addon" >> "Entry" >> "Textview" >> ;"Tree-view" <<<<<<<<<<<<<<<<<<<<<<<<<<<<< HERE >> ;"Drawing" >> ))) >> (list (mk-notebook >> :tab-labels tabs >> :kids (loop for test-name in tabs >> collect (make-instance >> (intern (string-upcase >> (format nil >> "test-~a" test-name)) >> :test-gtk)))))))) >> >> the demo runs, but the treeview and menu demos are missing (of course). >> >> Using Cells 2.0 and CFFI 0.9.2, from asdf-install and cells-gtk from CVS >> >> Any ideas? >> >> Thanks in advance, >> >> Leandro >> >> _______________________________________________ >> cells-gtk-devel site list >> cells-gtk-devel at common-lisp.net >> http://common-lisp.net/mailman/listinfo/cells-gtk-devel >> > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > cells-gtk-devel site list > cells-gtk-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cells-gtk-devel From leandror at tutopia.com Thu Jan 31 01:04:19 2008 From: leandror at tutopia.com (=?UTF-8?B?TGVhbmRybyBSw61vcw==?=) Date: Wed, 30 Jan 2008 23:04:19 -0200 Subject: [cells-gtk-devel] Problems with demo In-Reply-To: <479FC360.4040502@gmail.com> References: <479FBA86.8020208@tutopia.com> <479FC360.4040502@gmail.com> Message-ID: <47A11E93.1030006@tutopia.com> Peter Hildebrandt escribi?: > > Leandro, > > welcome aboard. Thanks! Sorry for getting back late. I've been doing some debugging, and this is what I found so far: The error is raised in SBCL's %make-alien function, file target-alienval.lisp. More precisely: (defun %make-alien (bits) (declare (type index bits)) (alien-funcall (extern-alien "malloc" (function system-area-pointer unsigned)) (ash (the index (+ bits 7)) -3))) <<<<<<<) Backtrace: 0: (CFFI:FOREIGN-ALLOC :INT) 1: (GTK-FFI:GTK-LIST-STORE-NEW (:STRING :STRING)) 2: ((LAMBDA (CELLS::SLOT-C &AUX (CELLS:SELF (CELLS::C-MODEL CELLS::SLOT-C)) (CELLS:.CACHE (CELLS::C-VALUE CELLS::SLOT-C)))) [?#:=[0]ID/LIST-STORE]) 3: ((FLET CELLS::BODY)) 4: (CELLS::C-CALCULATE-AND-SET [?#:=[0]ID/LIST-STORE]) 5: ((SB-PCL::FAST-METHOD CELLS::C-AWAKEN-CELL (CELLS::C-DEPENDENT)) # # [?#:=[0]ID/LIST-STORE]) 6: ((LAMBDA ())) 7: (CELLS::CALL-WITH-INTEGRITY # NIL #) 8: (CELLS:C-AWAKEN [?#:=[0]ID/LIST-STORE]) 9: ((SB-PCL::FAST-METHOD CELLS:MD-AWAKEN (CELLS::MODEL-OBJECT)) (#(8) . #()) # LIST-STORE) 10: (CELLS:TO-BE LIST-STORE) 11: ((SB-PCL::FAST-METHOD CELLS::C-OUTPUT-SLOT-NAME PROGN ((EQL 'CELLS-GTK:TREE-MODEL) CELLS-GTK:TREE-VIEW T T T)) # # # LISTBOX LIST-STORE # #) 12: ((LAMBDA (SB-PCL::.PV-CELL. SB-PCL::.NEXT-METHOD-CALL. SB-PCL::.ARG0. SB-PCL::.ARG1. SB-PCL::.ARG2. SB-PCL::.ARG3. SB-PCL::.ARG4.)) # # CELLS-GTK:TREE-MODEL LISTBOX LIST-STORE NIL T) 13: ((LAMBDA (SB-PCL::.PV-CELL. SB-PCL::.NEXT-METHOD-CALL. SB-PCL::.ARG0. SB-PCL::.ARG1. SB-PCL::.ARG2. SB-PCL::.ARG3. SB-PCL::.ARG4.)) # # # # # # #) 14: ((LAMBDA ())) 15: (CELLS::FINISH-BUSINESS) 16: (CELLS::CALL-WITH-INTEGRITY # NIL #) 17: (CELLS::MD-SLOT-VALUE LISTBOX CELLS-GTK:TREE-MODEL) 18: ((SB-PCL::FAST-METHOD CELLS-GTK:TREE-MODEL (CELLS-GTK:TREE-VIEW)) # # LISTBOX) 19: (CELLS-GTK:MK-LISTBOX) 20: ((LAMBDA ())) 21: ((SB-PCL::FAST-METHOD SB-PCL::DEFAULT-INITARGS (SB-PCL::SLOT-CLASS T T)) # # # NIL ((:TAB-LABELS (LIST "Listbox" "Treebox" "Cells-Tree-View") #) (:KIDS (LIST #) #) (:DEF-GTK-CLASS-NAME 'CELLS-GTK:NOTEBOOK #) (:CURRENT-PAGE (CELLS:C-IN NIL) #) (:SHOW-TABS (CELLS:C-IN T) #) (:ON-DELETE-EVENT (CELLS:C-IN #'#) #) (:MD-NAME NIL #) ..)) 22: ((SB-PCL::FAST-METHOD MAKE-INSTANCE (CLASS)) # # #) 23: ((LAMBDA ())) 24: ((SB-PCL::FAST-METHOD SB-PCL::DEFAULT-INITARGS (SB-PCL::SLOT-CLASS T T)) # # # (:VISIBLE [i0:=[0]ANONCELL/ANONMD] :TERMINATE-ON-CLOSE T) ((:TITLE "GTK Testing" #) (:ICON (NAMESTRING TEST-GTK::*SMALL-IMAGE*) #) (:STOCK-ICONS (LIST #) #) (:POSITION :CENTER #) (:SPLASH-SCREEN-IMAGE (NAMESTRING TEST-GTK::*SPLASH-IMAGE*) #) ..)) 25: ((SB-PCL::FAST-METHOD MAKE-INSTANCE (CLASS)) # # #) 26: (CELLS-GTK::SHOW-WIN TEST-GTK::TEST-GTK) 27: (CELLS-GTK:START-APP TEST-GTK::TEST-GTK) 28: (TEST-GTK:GTK-DEMO NIL) 29: (SB-INT:SIMPLE-EVAL-IN-LEXENV (TEST-GTK:GTK-DEMO) #) 30: (SWANK::EVAL-REGION "(test-gtk::gtk-demo) " T) 31: ((LAMBDA ())) 32: ((LAMBDA (SWANK-BACKEND::FN)) #) 33: (SWANK::CALL-WITH-BUFFER-SYNTAX #) 34: (SWANK:LISTENER-EVAL "(test-gtk::gtk-demo) ") 35: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK:LISTENER-EVAL "(test-gtk::gtk-demo) ") #) 36: ((LAMBDA ())) 37: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) # #) 38: ((LAMBDA ())) 39: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) # #) 40: (SWANK::CALL-WITH-REDIRECTED-IO # #) 41: (SWANK::CALL-WITH-CONNECTION # #) 42: (SWANK::HANDLE-REQUEST #) 43: (SWANK::REPL-LOOP #) 44: (SWANK::REPL-LOOP #) 45: (SWANK::CALL-WITH-BINDINGS NIL #) 46: ((LAMBDA ())) 47: ("foreign function: #x41D7B2") 48: ("foreign function: #x415971") Next step, it hangs. It seems that the problem originates in the call to (cells:md-slot-value list-store cells-gtk:new-args) only, calling the function with other parameters succeeds. I don't know enough about cffi or sbcl internals to determine if it is a malformed call from cffi or a bug in sbcl itself. If you need me to perform any test you can think of, I'll be pleased to do so. Thanks for your help, Peter. Leandro