Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 8 of 8

Thread: OT: How to hide mouse cursor under X?

  1. #1
    Senior Member OpenGL Guru Humus's Avatar
    Join Date
    Mar 2000
    Location
    Stockholm, Sweden
    Posts
    2,444

    OT: How to hide mouse cursor under X?

    Sorry for the off-topic, but at least it's needed for an OpenGL framework. I'm porting my framework to Linux.

    Anyway, I'm quite new to X programming. Despite heavy googling I have not found any appropriate function for hiding the mouse cursor. Having the busy cursor in the middle of the screen of a fullscreen app feels a little annoying. What function do I use to hide it?

  2. #2
    Junior Member Regular Contributor fenris's Avatar
    Join Date
    Mar 2000
    Location
    Cincinnati, Ohio USA
    Posts
    152

    Re: OT: How to hide mouse cursor under X?

    You can use XDefineCursor. The SDL source code demonstrates it's usage rather well (src/video/x11/SDL_x11mouse.c), as well as the X man pages.

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Oct 2000
    Posts
    531

    Re: OT: How to hide mouse cursor under X?

    afaik it's indeed only possible to hide it by using a 0x0 pixmap..

    Great btw to see your framework coming to Linux!
    I would really like to see those new demos running in realtime

  4. #4
    Junior Member Regular Contributor
    Join Date
    Apr 2002
    Posts
    101

    Re: OT: How to hide mouse cursor under X?

    Humus,
    Are you using XGrabPointer when you switch to a fullscreen mode? If you do, you can create a blank cursor image (either through font or glyph) before you call XGrabPointer and use that cursor when you issue that call, or else use XDefineCursor aftwards.

    richardve,
    as far as I know, you are not allowed to create a 0x0 pixmap
    From the XCreatePixmap man page
    [snip]
    The width and height arguments must be nonzero, or a BadValue error results.
    [/snip]
    I think Humus is going to need to try and find a font or glyph that is blank and create a cursor out of that.

    Dan

  5. #5
    Member Regular Contributor Julien Cayzac's Avatar
    Join Date
    Aug 2001
    Location
    Yokohama, Japan
    Posts
    251

    Re: OT: How to hide mouse cursor under X?

    Originally posted by Dan82181:
    The width and height arguments must be nonzero, or a BadValue error results.
    True, but you can use a 1x1 bitmap with an empty mask.

    Julien.

  6. #6
    Senior Member OpenGL Guru Humus's Avatar
    Join Date
    Mar 2000
    Location
    Stockholm, Sweden
    Posts
    2,444

    Re: OT: How to hide mouse cursor under X?

    Thanks all.
    Using a 1x1 blank cursor worked fine

  7. #7
    Advanced Member Frequent Contributor
    Join Date
    Oct 2000
    Posts
    531

    Re: OT: How to hide mouse cursor under X?

    Dan82181, it was early.. I meant 1x1 but I wrote 0x0

  8. #8
    Junior Member Regular Contributor
    Join Date
    Apr 2002
    Posts
    101

    Re: OT: How to hide mouse cursor under X?

    Yes, I haven't used pixmap cursors that much. I knew that pixmaps couldn't be 0x0, but I had totally forgotten about the mask used when creating the cursor. But don't feel bad, I never think straight until about half way through my second pot of coffee

    Dan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •