#39 Add CREATE-FONT-CURSOR to new-clx module

closed-invalid
Sam Steingold
5
2008-10-28
2008-10-28
Drutsa Pavel
No

The new-clx module use libX11 through FFI.
libX11 has three functions to create new cursor:
1. XCreateFontCursor - < No CLX analog >
2. XCreatePixmapCursor - CREATE-CURSOR
3. XCreateGlyphCursor - CREATE-GPYPH-CURSOR
So, In clx module I found only CREATE-GPYPH-CURSOR and CREATE-CURSOR .

libX11 man page says about 'XCreateFontCursor':
.......
X provides a set of standard cursor shapes in a special font named cursor.
Applications are encouraged to use this interface for their cursors because
the font can be customized for the individual displaytype. The shape argument
specifies which glyph of the standard fonts to use.
..............
In addition 'XCreateFontCursor' it's handled by 'XCursor' extension and X server shows me an animated and/or modern cursor.

Discussion

  • Sam Steingold
    Sam Steingold
    2008-10-28

    do you mean these:

    /*****************************************************************
    * CURSOR STUFF
    *****************************************************************/

    /* QueryBestSize Class */

    #define CursorShape 0 /* largest size that can be displayed */
    #define TileShape 1 /* size tiled fastest */
    #define StippleShape 2 /* size stippled fastest */

    also, how do other clx implementation implement interface to XCreateFontCursor?

     
  • Drutsa Pavel
    Drutsa Pavel
    2008-10-28

    Sory.
    A little libX11 source code hack give me a very simple solution.

    (defvar *white-color* (make-color :red 1 :green 1 :blue 1))
    (defvar *black-color* (make-color :red 0 :green 0 :blue 0))

    (defun create-font-cursor (&key display shape-id)
    (let ((c-font (open-font display "cursor")))
    (create-glyph-cursor :source-font c-font
    :source-char shape-id
    :mask-font c-font
    :mask-char (+1 shape-id)
    :foreground *white-color*
    :background *black-color* )))

    And nothing magic.
    I can define constants from C header file for 'human readable' shape names.
    It's not necessary to be this function in the CLX package.

     
  • Drutsa Pavel
    Drutsa Pavel
    2008-10-28

    • status: open --> closed-invalid
     
  • Sam Steingold
    Sam Steingold
    2008-10-28

    good.
    please feel free to submit more core for clx test suite