From daniel at turtleware.eu Tue Feb 1 10:23:02 2022 From: daniel at turtleware.eu (=?utf-8?Q?Daniel_Kochma=C5=84ski?=) Date: Tue, 01 Feb 2022 10:23:02 +0000 Subject: updating-output issues In-Reply-To: References: Message-ID: Hey Paul, regarding the attached code: why do you expect a call to clear-output-record when it is only moved around? how the issue is visible in the attached code (except for that (trace clear-output-record) doesn't yield anything). Mind that recently I rewrote parts of the incremental redisplay to fix some issues - I'm not sure whether these changes are already propagated to quicklisp. btw when you draw the border it makes the window bigger with each iteration, because the line thickness is 1 and it is not filled, so drawing (x1 y1 x2 y2) actually covers the area (x1 y1 x2+1 y2+1). As of the second issue, could you supply a code that triggers the issue? Thanks! Best regards, Daniel -- Daniel Kochmański ;; aka jackdaniel | Przemyśl, Poland TurtleWare - Daniel Kochmański | www.turtleware.eu "Be the change that you wish to see in the world." - Mahatma Gandhi ------- Original Message ------- On Friday, January 28th, 2022 at 19:26, Paul Werkowski wrote: > I've been revisiting a clim project from 15 years ago which was to provide clim graphics to Dan Corkhill's very nice GBBopen blackboard system. I have an initial version now working nicely on Lispworks clim-2.0 on Windows. It is close to running with McCLIM as well. > > I have two issues, updating-output appears to work in that the :cache-test is respected but where Lispworks clim calls clear-output-record when a displayed object moves or is deleted McCLIM does not do so. I have attached a simple demo that shows that problem. Just click right or left anywhere in the pane to move the green disk left or right to see the problem. > > The other issue is that redisplay-frame-pane (not used in the demo) always causes an infinite recursion that finally results in a blown stack. Part of the problem is with window-clear which in addition to using medium-clear-area, etc to clear the screen also sets window size to zero and then calls compose-space. I have an :around method that avoids that problem but the redisplay recursion persists. My workaround for that is to just call the display function directly but that does not allow updating-output to work correctly. > > Paul -------------- next part -------------- An HTML attachment was scrubbed... URL: From pw at snoopy.qozzy.com Tue Feb 1 13:40:13 2022 From: pw at snoopy.qozzy.com (Paul Werkowski) Date: Tue, 1 Feb 2022 08:40:13 -0500 Subject: updating-output issues In-Reply-To: References: Message-ID: <1c982c38-a542-9fda-8fbb-474564924d11@snoopy.qozzy.com> Hey Paul, regarding the attached code: why do you expect a call to clear-output-record when it is only moved around? how the issue is visible in the attached code (except for that (trace clear-output-record) doesn't yield anything). Just noting that LispWorks CLIM calls clear-output-record restoring the previously drawn area. That may be from LispWorks CLIM using redisplay-output-record ,as shown in the following trace, which is supposed to take care to restore anything previously covered. I don't a clear understanding of how all this works as yet. UTEST 5 > (testme) 0 CLEAR-OUTPUT-RECORD > ...   >> CLIM-INTERNALS::RECORD : # 0 CLEAR-OUTPUT-RECORD < ...   << VALUE-0 : 0 draw-unit #> --draw-circle draw-unit #> --draw-circle Now I click right once. 0 REDISPLAY-OUTPUT-RECORD > ...   >> CLIM-INTERNALS::RECORD            : #   >> STREAM                            : #   >> CLIM-INTERNALS::CHECK-OVERLAPPING : T   1 CLEAR-OUTPUT-RECORD > ...     >> CLIM-INTERNALS::RECORD : #   1 CLEAR-OUTPUT-RECORD < ...     << VALUE-0 : 0 draw-unit #>   1 CLEAR-OUTPUT-RECORD > ...     >> CLIM-INTERNALS::RECORD : #   1 CLEAR-OUTPUT-RECORD < ...     << VALUE-0 : NIL   1 CLEAR-OUTPUT-RECORD > ...     >> CLIM-INTERNALS::RECORD : #> /x 140.0:162.0 y 140.0:162.0/ 22C60F2F>   1 CLEAR-OUTPUT-RECORD < ...     << VALUE-0 : NIL --draw-circle draw-unit #> 0 REDISPLAY-OUTPUT-RECORD < ...   << VALUE-0 : NIL On 2/1/2022 5:23 AM, Daniel Kochmański wrote: > Mind that recently I rewrote parts of the incremental redisplay to fix > some issues - I'm not sure whether these changes are already > propagated to quicklisp. > I don't use quicklisp but do use github desktop to check on things. I found a bunch of changes yesterday and found that my hack of calling the display function for redisplay now works where before changes made to the display were computed but not shown on the screen. I had observed a lot of stuff in the output record cache that I could not account for which is now gone. > btw when you draw the border it makes the window bigger with each > iteration, because the line thickness is 1 and it is not filled, so > drawing (x1 y1 x2 y2) actually covers the area (x1 y1 x2+1 y2+1). > I had not even noticed that problem! Thanks for the info. > As of the second issue, could you supply a code that triggers the > issue? Thanks! That would be redisplay-frame-pane causing infinite recursion. I shall work something up. Thanks for looking at this. Paul -------------- next part -------------- An HTML attachment was scrubbed... URL: From pw at snoopy.qozzy.com Tue Feb 1 14:33:33 2022 From: pw at snoopy.qozzy.com (Paul Werkowski) Date: Tue, 1 Feb 2022 09:33:33 -0500 Subject: updating-output issues In-Reply-To: <1c982c38-a542-9fda-8fbb-474564924d11@snoopy.qozzy.com> References: <1c982c38-a542-9fda-8fbb-474564924d11@snoopy.qozzy.com> Message-ID: For the recursion problem: I add the following to the example code (complete example attached) (defmethod resize-sheet :after ((sheet example-pane) w h) (declare (ignore w h)) ;;(clear-window) (redisplay-frame-pane (pane-frame sheet) sheet)) I use this when I want to display to expand/shrink via pointer motion. Here, just running (testme) results in blowing stack. LispWorks CLIM works fine. Paul -------------- next part -------------- (defpackage utest (:use :clim :clim-lisp)) (in-package :utest) (defclass unit ()()) (define-presentation-type unit ()) (defclass test-unit (unit) ((x-value :initarg :x :accessor x-of) (y-value :initarg :y :accessor y-of) (color :initarg :color :accessor color-of) (size :initform 10)) (:default-initargs :x 10 :y 10 :color +green+)) (defmethod print-object ((obj test-unit) stream) (print-unreadable-object (obj stream :type t) (format stream "<~d ~d>" (x-of obj)(y-of obj)))) (defclass example-pane (application-pane) ((units :initform nil :initarg :units :accessor units-of) (dx :initform 10) (dy :initform 10)) (:default-initargs :width 300 :height 300 :incremental-redisplay t :display-function 'example-pane-displayer)) (defmethod draw-unit ((pane example-pane)(unit test-unit)) (with-slots ((x x-value) (y y-value) size color) unit (format *trace-output* "~&draw-unit ~a~%" unit) (updating-output (pane :unique-id unit :cache-value (list* x y size color) :cache-test #'equalp) (with-output-as-presentation (pane unit 'unit) (format *trace-output* "~&--draw-circle~%") (draw-circle* pane x y size :ink (color-of unit)))))) #+notyet (define-presentation-method highlight-presentation ((type unit) record stream state) (with-bounding-rectangle* (x0 y0 xz yz) record (declare (ignorable xz yz)) (let ((ink (if (eql state :highlight) +flipping-ink+ +background-ink+))) (draw-rectangle* stream (1- x0)(1- y0) xz yz :ink ink :filled nil)))) (defmethod example-pane-displayer (frame (pane example-pane)) (declare (ignore frame)) (with-bounding-rectangle* (x1 y1 x2 y2) pane (updating-output (pane :cache-value (list* x1 y1 x2 y2) :cache-test #'equalp) (draw-rectangle* pane x1 y1 (1- x2)(1- y2) :ink +blue+ :filled nil)) (with-first-quadrant-coordinates (pane x1 y2) (dolist (unit (units-of pane)) (draw-unit pane unit)) ))) (define-application-frame utest () ((x-dim :initform 'x :initarg :x-dim) (y-dim :initform 'y :initarg :y-dim)) (:menu-bar t) #-mcclim(:command-table t) #+mcclim(:command-table (utest)) (:panes (p1 (make-pane 'example-pane :units (list (make-instance 'test-unit :x 150 :y 150 :color +green+) (make-instance 'test-unit :x 250 :y 50 :color +blue+)) :width 300 :height 300 :max-width +fill+ :max-height +fill+ ))) (:layouts (default p1))) (define-utest-command (com-move-unit)((which '(member :x :y)) (unit 'test-unit) (pane 'example-pane) (direction '(member :up :down :left :rignt))) (declare (ignorable pane)) (with-slots (x-value y-value) unit (let ((incr 5.0)) (case which (:x (incf x-value (case direction (:left (- incr))(:right incr)))) (:y (incf y-value (case direction (:up incr)(:down (- incr)))))) ))) (define-presentation-to-command-translator xlate-move-unit-l (blank-area com-move-unit utest :pointer-documentation "Move Left" :gesture :select) ;; object is blank-area (object window x y) (declare (ignore object x y)) (terpri *trace-output*) (let* ((units (units-of window)) (unit (first units))) `(:x ,unit ,window :left))) (define-presentation-to-command-translator xlate-move-unit-r (blank-area com-move-unit utest :pointer-documentation "Move Right" :gesture :menu) ;; object is blank-area (object window x y) (declare (ignore object x y)) (let* ((units (units-of window)) (unit (first units))) `(:x ,unit ,window :right))) (defmethod resize-sheet :after ((sheet example-pane) w h) (declare (ignore w h)) ;(window-clear sheet) (redisplay-frame-pane (pane-frame sheet) sheet)) (defun testme () (run-frame-top-level (make-application-frame 'utest :left 950 :top 40)))