Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct read-xauth-entry to work with empty string number field #10

Merged
merged 5 commits into from
Aug 26, 2013
Merged

Conversation

mgi
Copy link
Contributor

@mgi mgi commented Dec 5, 2012

This patch fixes issue #4 of read-xauth-entry

render-trapezoids-1 in order to make it work (don't understand why
right now). Here's follow some code to test it:

(defun quux ()
  (let* ((dpy (open-display ""))
         (screen (first (display-roots dpy)))
         (root (screen-root screen))
         (win (create-window :parent root :x 0 :y 0 :width 320 :height 320
                             :event-mask (make-event-mask :key-press
                                                          :structure-notify)))
         (win-h (drawable-height win))
         (win-w (drawable-width win))
         (win-fmt (find-window-picture-format win))
         (background (create-pixmap :drawable win :width win-w :height win-h
                                    :depth (picture-format-depth win-fmt)))
         (drawingarea (render-create-picture background :format win-fmt
                                                        :poly-edge :smooth
                                                        :poly-mode :imprecise))
         (bg-color (list #xffff #xffff #xffff #xffff))
         (blue-brush (brush win (list 0 0 #xffff #x6fff)))
         (red-brush (brush win (list #xffff 0 0 #x6fff)))
         (mask-format (first (find-matching-picture-formats dpy :alpha 8
                                                                :red 0
                                                                :green 0
                                                                :blue 0))))
    (setf (window-background win) background)
    (render-fill-rectangle drawingarea :src bg-color 0 0 win-w win-h)
    (map-window win)
    (do () ((event-case (dpy) (:map-notify () t))))

    (do ()
        ((event-case (dpy :timeout (/ 50 1000))
           (:key-press () t)))
      (let* ((dx 30)
             (dy 30)
             (db 10)
             (x (random win-w))
             (y (random win-h))
             (traps (list y (+ y dy)
                          x y (- x db) (+ y dy)
                          (+ x dx) y (+ x dx db) (+ y dy))))
          (xlib::render-trapezoids-1 drawingarea :over blue-brush
                                     0 0 mask-format traps))
      (let* ((dx 10)
             (dy 25)
             (x (random win-w))
             (y (random win-h))
             (triangle (make-array 6 :element-type 'card32
                                     :initial-contents
                                     (list x y (+ x dx) (+ y dy) (abs (- x dx)) (+ y dy)))))
        (xlib::render-triangles-1 drawingarea :over red-brush
                                  0 0 mask-format triangle))
      (clear-area win))
    (render-free-picture red-brush)
    (render-free-picture blue-brush)
    (render-free-picture drawingarea)
    (free-pixmap background)
    (unmap-window win)
    (close-display dpy)))
xach added a commit that referenced this pull request Aug 26, 2013
correct read-xauth-entry to work with empty string number field
@xach xach merged commit ea596f2 into sharplispers:master Aug 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants