<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Dear,<div><br></div><div>In the following code I do not understand why *CONTEXT* is the same before (FUNCALL ...)</div><div>and within the called function unlike *WIDTH*, *HEIGHT* and *X*</div><div><br></div><div>Unlike *CONTEXT*, *X* is 123 before calling the lambda (FUNCALL ..) and 456 within the defined lambda. I would like *CONTEXT* to be lexically defined as *X*, *WIDTH*</div><div><br></div><div>Thank you for your help</div><div>Kind regards</div><div>Taoufik</div><div><br></div><div><div>(LET* ((*DISPLAY* (XOPENDISPLAY ":0.0"))</div><div> (*SCREEN* (XDEFAULTSCREEN *DISPLAY*))</div><div> (*ROOT* (XDEFAULTROOTWINDOW *DISPLAY*))</div><div> (*VISUAL* (XDEFAULTVISUAL *DISPLAY* *SCREEN*))</div><div> (*DEPTH* (XDEFAULTDEPTH *DISPLAY* *SCREEN*))</div><div> (*WHITEPIXEL* (XWHITEPIXEL *DISPLAY* *SCREEN*))</div><div> (*ATTRIBUTES*</div><div> (LIST :X</div><div> 100</div><div> :Y</div><div> 100</div><div> :WIDTH</div><div> 400</div><div> :HEIGHT</div><div> 400</div><div> :BACKGROUND-PIXEL</div><div> *WHITEPIXEL*</div><div> :EVENT-MASK</div><div> (LOGIOR BUTTONPRESSMASK)))</div><div> (*WINDOW* (MY-CREATE-WINDOW *DISPLAY* *ROOT* *VISUAL* *ATTRIBUTES*))</div><div> <font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b>(*WIDTH* (GETATTR :WIDTH *ATTRIBUTES*))</b></span></font></div><div> (*HEIGHT* (GETATTR :HEIGHT *ATTRIBUTES*))</div><div> <font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b>(*CONTEXT*</b></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b> (MY-CREATE-CONTEXT</b></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b> *DISPLAY*</b></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b> *VISUAL*</b></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b> *WINDOW*</b></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b> *ROOT*</b></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b> *WIDTH*</b></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b> *HEIGHT*)</b></span></font>)</div><div> (*PARENT* *WINDOW*)</div><div> (*ALL-CONTEXTS* NIL)</div><div> (*EVENT-HANDLERS* NIL)</div><div> <font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b>(*x* 123)</b></span></font>)</div><div> (SET-WINDOW-SIZE-HINTS *DISPLAY* *WINDOW* *WIDTH* *WIDTH* *HEIGHT* *HEIGHT*)</div><div> (XSTORENAME *DISPLAY* *WINDOW* "Test")</div><div> (XMAPWINDOW *DISPLAY* *WINDOW*)</div><div> (LABELS ((ADD-EVENT-HANDLER (EVENTTYPE HANDLER)</div><div> (PUSH (CONS (CONS EVENTTYPE *WINDOW*) HANDLER) *EVENT-HANDLERS*))</div><div> (REFRESH NIL</div><div> (DOLIST (C (REVERSE *ALL-CONTEXTS*))</div><div> (CAIRO_PAINT (XLIB-CONTEXT C)))</div><div> (CAIRO_PAINT (XLIB-CONTEXT *CONTEXT*)))</div><div> (EVENT-LOOP NIL</div><div> (LET ((WM-PROTOCOLS (XINTERNATOM *DISPLAY* "WM_PROTOCOLS" 1)))</div><div> (WITH-FOREIGN-OBJECT</div><div> (XEV :LONG 24)</div><div> (DO ((GOT-CLOSE-SIGNAL NIL))</div><div> (GOT-CLOSE-SIGNAL)</div><div> (XNEXTEVENT *DISPLAY* XEV)</div><div> (WITH-FOREIGN-SLOTS</div><div> ((TYPE WINDOW SERIAL) XEV XANYEVENT)</div><div> (FORMAT T</div><div> "event ~A serial ~A window ~A *window* ~A~%"</div><div> TYPE</div><div> SERIAL</div><div> WINDOW</div><div> *WINDOW*)</div><div> (COND ((= TYPE CLIENTMESSAGE)</div><div> (WITH-FOREIGN-SLOTS</div><div> ((MESSAGE-TYPE DATA0) XEV XCLIENTMESSAGEEVENT)</div><div> (IF (AND (= WINDOW *WINDOW*)</div><div> (= MESSAGE-TYPE WM-PROTOCOLS)</div><div> (= DATA0 (WM-DELETE-WINDOW *CONTEXT*)))</div><div> (PROGN (FORMAT T "close application~%")</div><div> (SETF GOT-CLOSE-SIGNAL T)))))</div><div> (T</div><div> (LET ((E</div><div> (ASSOC (CONS TYPE WINDOW)</div><div> *EVENT-HANDLERS*</div><div> :TEST</div><div> 'EQUAL)))</div><div> (FORMAT T</div><div> "handle event type=~A *context*=~A *width* ~A *height* ~A window ~A *x* ~A~%"</div><div> TYPE</div><div> *context* *width* *height* window *x*)</div><div> (FORCE-OUTPUT T)</div><div> (IF (NOT (NULL E)) <font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b>(FUNCALL (CDR E) XEV)</b></span></font>)</div><div> (REFRESH))))))))</div><div> (DOLIST (C (REVERSE *ALL-CONTEXTS*)) (DESTROY-CONTEXT C))</div><div> (XCLOSEDISPLAY *DISPLAY*)))</div><div> (PROGN (LET* ((*ATTRIBUTES*</div><div> (LIST :X</div><div> 10</div><div> :Y</div><div> 10</div><div> :WIDTH</div><div> 100</div><div> :HEIGHT</div><div> 100</div><div> :EVENT-MASK</div><div> (LOGIOR BUTTONPRESSMASK BUTTONRELEASEMASK)))</div><div> (*WINDOW* (MY-CREATE-WINDOW *DISPLAY* *PARENT* *VISUAL* *ATTRIBUTES*))</div><div> <font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b>(*WIDTH* (GETATTR :WIDTH *ATTRIBUTES*))</b></span></font></div><div> (*HEIGHT* (GETATTR :HEIGHT *ATTRIBUTES*))</div><div> <font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b>(*CONTEXT*</b></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b> (MY-CREATE-CONTEXT</b></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b> *DISPLAY*</b></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b> *VISUAL*</b></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b> *WINDOW*</b></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b> *PARENT*</b></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b> *WIDTH*</b></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b> *HEIGHT*))</b></span></font></div><div> (*PARENT* *WINDOW*)</div><div> <font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><b>(*x* 456</b></span></font>))</div><div> (PUSH *CONTEXT* *ALL-CONTEXTS*)</div><div> (XMAPWINDOW *DISPLAY* *WINDOW*)</div><div> (LABELS ((ADD-EVENT-HANDLER (EVENTTYPE HANDLER)</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span> (format t ">>> *context* ~A *width* ~A *height* ~A~%" *context* *width* *height*)</div><div> (PUSH (CONS (CONS EVENTTYPE *WINDOW*) HANDLER) *EVENT-HANDLERS*)))</div><div> (PROGN (LET ((COUNT 0) (POSX 0) (POSY 0))</div><div> (ADD-EVENT-HANDLER EXPOSE</div><div> #'(LAMBDA (EVENT)</div><div> (WITH-FOREIGN-SLOTS</div><div> ((TYPE WINDOW SERIAL) EVENT XEXPOSEEVENT)</div><div> (FORMAT T</div><div> "Expose... *x* ~A context ~A width=~A height=~A~%" *x*</div><div> *CONTEXT*</div><div> *WIDTH*</div><div> *HEIGHT*)</div><div> (SET-SOURCE-RGB 0.5 0.5 0.5)</div><div> (RECTANGLE 0 0 *WIDTH* *HEIGHT*)</div><div> (SET-SOURCE-RGB 0 0 0)</div><div> (FILL-PATH)</div><div> (MOVE-TO 20 200)</div><div> (SET-SOURCE-RGB 0.5 0.5 0.5)</div><div> (INCF COUNT)</div><div> (SHOW-TEXT (FORMAT NIL "count ~A" COUNT)))))</div><div> )))))</div><div> (EVENT-LOOP)))</div><div><br></div><div>>>>> output</div><div><div>event 12 serial 131 window 6291458 *window* 6291457</div><div>handle event type=12 *context*=#<MY-XLIB-CONTEXT pointer: #<A Foreign Pointer #x80D000>, width: 400, height: 400, pixel-based-p: T> *width* 400 *height* 400 window 6291458 *x* 123</div><div>Expose... *x* 456 context #<MY-XLIB-CONTEXT pointer: #<A Foreign Pointer #x80D000>, width: 400, height: 400, pixel-based-p: T> width=100 height=100</div><div>event 33 serial 191 window 6291457 *window* 6291457</div><div><br></div><div><br></div><div><br></div></div></div></body></html>