[mcclim-devel] How stream-pointer-position should work?
![](https://secure.gravatar.com/avatar/6de273025b46fb0ee7d471518e3b2453.jpg?s=120&d=mm&r=g)
Hello, If I call stream-pointer-position on the stream without scroller, it returns an expected position. However, when the stream has a scroller, the function returns the position inside viewport regardless position of scrollbars, i. e. from upper left corner of viewport, not from the stream's origin. I have played with map-sheet-position-to-child and map-sheet-position-to-parent but faced with the different behaviour of these functions, which depends on how scrolling declared inside define-application-frame. To be more presise, it depends on internal structure of application-pane with scroller: in McCLIM it has also border-pane as a parent (why?). I think, the programmer shouldn't keep in mind such implementation details. So, what is the right behavior of stream-pointer-position if the stream has a scroller? Shouldn't it return the real coordinates on stream as pointer events do? Specification says: stream-pointer-position [Generic Function] Arguments: stream &key pointer Summary: Returns the current position of the pointing device pointer for the extended input stream stream as two values, the x and y positions in the stream's drawing surface coordinate system. If pointer is not supplied, it defaults to the stream-primary-pointer of the stream.
![](https://secure.gravatar.com/avatar/6de273025b46fb0ee7d471518e3b2453.jpg?s=120&d=mm&r=g)
"Evgeny M. Zubok" <evgeny.zubok@tochka.ru> writes:
So, what is the right behavior of stream-pointer-position if the stream has a scroller? Shouldn't it return the real coordinates on stream as pointer events do?
I found an answer to my question. I have just found CLIM implementation from Allegro CL (I only used it with lesstif backend instead motif). To test I create a pane 'canvas' with :min-height 2000 :min-width 2000 and layout (scrolling (:height 500 :width 500) ...). In define-presentation-action for blank-area I call stream-pointer-position and print string "TEST", starting that point . In Allegro's CLIM implementation the strings appear where I have pressed pointer button; in McCLIM they appear only at the first page of canvas, even if I have pressed button on blank-area on other pages. So, I think, this is bug in McCLIM. Sample code: (defpackage :stream-pointer-position-bug (:use :clim-lisp :clim)) (in-package :stream-pointer-position-bug) (defun run () (run-frame-top-level (make-application-frame 'main))) (define-application-frame main () () (:menu-bar nil) (:panes (canvas (scrolling (:height 500 :width 500) (make-pane 'application-pane :display-time nil :background +black+ :foreground +white+ :min-width 2000 :min-height 2000 :scroll-bars t :display-function #'draw-circle :name 'canvas :output-record (make-instance 'standard-tree-output-history))))) (:layouts (:main canvas))) (defun draw-circle (frame pane) (declare (ignore frame)) (draw-circle* pane 1500 1500 70 :filled t :ink +yellow+)) (define-presentation-action test (blank-area nil main :gesture :select) (presentation window) (declare (ignore presentation)) (multiple-value-bind (x y) (stream-pointer-position window) (draw-text* window "TEST" x y)))
participants (1)
-
Evgeny M. Zubok