How to set cursor shape using clx
Actually it's just the same as using xlib.
1. open a font named "cursor", it's a collection of different cursor shapes.
2. create a cursor object which can be used in somewhere like :cursor of window or grab-pointer.
example:
(defun create-cursor (char) (let ((cursor-font (xlib:open-font *display* "cursor")) (black (xlib:make-color :red 0.0 :green 0.0 :blue 0.0)) (white (xlib:make-color :red 1.0 :green 1.0 :blue 1.0))) (xlib:create-glyph-cursor :source-font cursor-font :source-char char :mask-font cursor-font :mask-char (1+ char) :background black :foreground white))) (defvar *cursor* (create-cursor 68)) (setf (xlib:window-cursor screen-root) *cursor)
the effect is to make the default cursor shape an arrow (indicated by 68).
No comments:
Post a Comment