From: Greg Menke
Subject: CAPI question
Date: 
Message-ID: <m31y16hg51.fsf@europa.pienet>
Since this isn't a bug, I didn't want to bother Xanalys with it.  I
have a capi interface with a few display-panes in it that I want to
periodically update as a background process executes.  Repeated (setf
(display-pane-text ... doesn't work, I only get the first one.  

The task that creates and displays the interface is waiting in a
mailbox read and the working process is calling
process-allow-scheduling, so I don't think CAPI is waiting for idle
before updating the screen.

I know the task is running as I've paused and inspected it.  This
algorithm did work on a P166, so I'm suspecting some kind of timing
sensitivity, but I don't have much of a clue at this point.

Thanks for any hints,

Greg Menke

From: Nils Goesche
Subject: Re: CAPI question
Date: 
Message-ID: <lyn0ju6sn0.fsf@cartan.de>
Greg Menke <··········@toadmail.com> writes:

> Since this isn't a bug, I didn't want to bother Xanalys with it.  I
> have a capi interface with a few display-panes in it that I want to
> periodically update as a background process executes.  Repeated
> (setf (display-pane-text ... doesn't work, I only get the first one.
> 
> The task that creates and displays the interface is waiting in a
> mailbox read and the working process is calling
> process-allow-scheduling, so I don't think CAPI is waiting for idle
> before updating the screen.
> 
> I know the task is running as I've paused and inspected it.  This
> algorithm did work on a P166, so I'm suspecting some kind of timing
> sensitivity, but I don't have much of a clue at this point.

Hm, I think it should work (I am doing the same thing in a little
monitoring program, assuming I understood you correctly).  Here is a
small example.  Does this work for you?

(defpackage "DISP"
  (:use "CL" "CAPI")
  (:export "DISP"))

(in-package "DISP")

(define-interface disp ()
  ((timer :initform nil :reader disp-timer)
   (start :initform (get-internal-real-time) :accessor disp-start))
  (:panes
   (odd display-pane :title "Odd")
   (even display-pane :title "Even"))
  (:layouts
   (all column-layout '(odd even)))
  (:default-initargs
   :destroy-callback (lambda (self)
                       (mp:unschedule-timer (disp-timer self)))
   :title "Display Panes" :auto-menus nil))

(defmethod disp-update ((self disp))
  (with-slots (start odd even) self
    (let* ((now (get-internal-real-time))
           (span (round (/ (- now start) internal-time-units-per-second))))
      (setf (display-pane-text odd) (format nil "~D" (1+ (* 2 span)))
            (display-pane-text even) (format nil "~D" (* 2 span))))))

(defun disp-timer-fun (self)
  (execute-with-interface
   self #'disp-update self))

(defmethod initialize-instance :after ((self disp) &key)
  (let ((timer (mp:make-named-timer "Disp Timer" 'disp-timer-fun self)))
    (setf (slot-value self 'timer) timer)
    (mp:schedule-timer-relative timer 1 2)))

(defun disp ()
  (display (make-instance 'disp)))

Regards,
-- 
Nils G�sche
"Don't ask for whom the <CTRL-G> tolls."

PGP key ID 0x0655CFA0
From: Nils Goesche
Subject: Re: CAPI question
Date: 
Message-ID: <lyisui6sd5.fsf@cartan.de>
I <······@cartan.de> wrote:

> (defun disp-timer-fun (self)
>   (execute-with-interface
>    self #'disp-update self))

I forgot to mention the essential point, namely that use of
EXECUTE-WITH-INTERFACE is very important here.

Sorry,
-- 
Nils G�sche
"Don't ask for whom the <CTRL-G> tolls."

PGP key ID 0x0655CFA0
From: Greg Menke
Subject: Re: CAPI question
Date: 
Message-ID: <m3fzpfa1ht.fsf@europa.pienet>
Nils Goesche <······@cartan.de> writes:

> I <······@cartan.de> wrote:
> 
> > (defun disp-timer-fun (self)
> >   (execute-with-interface
> >    self #'disp-update self))
> 
> I forgot to mention the essential point, namely that use of
> EXECUTE-WITH-INTERFACE is very important here.

The problem wasn't execute-with-interface- or possibly, that wasn't
yet my problem.  I emailed Lispworks support & they said the behavior
I was seeing was related to a bug in the fairly old lesstif I'm
using.  I'm upgrading now- we'll see how that goes.

Gregm
From: Greg Menke
Subject: Re: CAPI question
Date: 
Message-ID: <m3adfn9yer.fsf@europa.pienet>
Greg Menke <··········@toadmail.com> writes:

> Nils Goesche <······@cartan.de> writes:
> 
> > I <······@cartan.de> wrote:
> > 
> > > (defun disp-timer-fun (self)
> > >   (execute-with-interface
> > >    self #'disp-update self))
> > 
> > I forgot to mention the essential point, namely that use of
> > EXECUTE-WITH-INTERFACE is very important here.
> 
> The problem wasn't execute-with-interface- or possibly, that wasn't
> yet my problem.  I emailed Lispworks support & they said the behavior
> I was seeing was related to a bug in the fairly old lesstif I'm
> using.  I'm upgrading now- we'll see how that goes.
> 


Switching to Openmotif 2.1.30 fixed the problem.

Gregm
From: Greg Menke
Subject: Re: CAPI question
Date: 
Message-ID: <m3vfyg9gn3.fsf@europa.pienet>
Nils Goesche <······@cartan.de> writes:

> Greg Menke <··········@toadmail.com> writes:
> 
> > Since this isn't a bug, I didn't want to bother Xanalys with it.  I
> > have a capi interface with a few display-panes in it that I want to
> > periodically update as a background process executes.  Repeated
> > (setf (display-pane-text ... doesn't work, I only get the first one.
> > 
> > The task that creates and displays the interface is waiting in a
> > mailbox read and the working process is calling
> > process-allow-scheduling, so I don't think CAPI is waiting for idle
> > before updating the screen.
> > 
> > I know the task is running as I've paused and inspected it.  This
> > algorithm did work on a P166, so I'm suspecting some kind of timing
> > sensitivity, but I don't have much of a clue at this point.
> 
> Hm, I think it should work (I am doing the same thing in a little
> monitoring program, assuming I understood you correctly).  Here is a
> small example.  Does this work for you?


All I get is the first values in both boxes.  Very strange, and I'm
thinking its not a timing problem as I am even unable to change the
contents of display-panes from the listener after they've been set
once.

I'm using 4.2.7 on Linux 2.2 kernel, what are you using?

Gregm
From: Nils Goesche
Subject: Re: CAPI question
Date: 
Message-ID: <87he9zrkag.fsf@darkstar.cartan>
Greg Menke <··········@toadmail.com> writes:

> Nils Goesche <······@cartan.de> writes:
> 
> > Hm, I think it should work (I am doing the same thing in a
> > little monitoring program, assuming I understood you
> > correctly).  Here is a small example.  Does this work for
> > you?
> 
> All I get is the first values in both boxes.  Very strange, and
> I'm thinking its not a timing problem as I am even unable to
> change the contents of display-panes from the listener after
> they've been set once.
> 
> I'm using 4.2.7 on Linux 2.2 kernel, what are you using?

The same.  Hm.  I am using OpenMotif.  Do you use LessTif?

Regards,
-- 
Nils G�sche
Ask not for whom the <CONTROL-G> tolls.

PGP key ID #xD26EF2A0
From: Greg Menke
Subject: Re: CAPI question
Date: 
Message-ID: <m3ptona57c.fsf@europa.pienet>
Nils Goesche <···@cartan.de> writes:

> Greg Menke <··········@toadmail.com> writes:
> 
> > Nils Goesche <······@cartan.de> writes:
> > 
> > > Hm, I think it should work (I am doing the same thing in a
> > > little monitoring program, assuming I understood you
> > > correctly).  Here is a small example.  Does this work for
> > > you?
> > 
> > All I get is the first values in both boxes.  Very strange, and
> > I'm thinking its not a timing problem as I am even unable to
> > change the contents of display-panes from the listener after
> > they've been set once.
> > 
> > I'm using 4.2.7 on Linux 2.2 kernel, what are you using?
> 
> The same.  Hm.  I am using OpenMotif.  Do you use LessTif?
> 

Lesstif, but the version they recommend.  I am not suffering any of
the weird problems that come with using alternate versions.  I know
CAPI acted properly before with the same version of Lesstif.  I'll
give the software a try on another machine today.

Gregm