0

I am trying to hide the mouse pointer via:

(setq x-pointer-shape x-pointer-invisible)
(setq x-sensitive-text-pointer-shape x-pointer-invisible)
(setq void-text-area-pointer 'text)
(set-mouse-color (cdr (assoc 'mouse-color (frame-parameters))))

The last command is supposed to make the previous changes effective (it works with other pointer shapes), but in the case of x-pointer-invisible I get the error can't set cursor shape: BadValue.

Any ideas on how to fix this, or another way to make the mouse pointer invisible? I am looking for temporary invisibility that can be toggled on the fly.

Drew
  • 75,699
  • 9
  • 109
  • 225
Stefano
  • 131
  • 7
  • The error is produces by `x_set_mouse_color` in `src/xfns.c:1282` and is an error that is returned by the X server after the function `XCreateFontCursor` is called, so outside of emacs control. I suspect that you either are doing it wrong or you cannot use this method at all, but that's all I can say: I don't know how to do it right or whether another method exists. Some searching uncovered [this](https://stackoverflow.com/questions/660613/how-do-you-hide-the-mouse-pointer-under-linux-x11) but AFAICT the situation is far from satisfactory. – NickD Jul 08 '20 at 19:22
  • https://emacs.stackexchange.com/tags/elisp/info – Drew Jul 08 '20 at 19:56
  • A guess is that `x-pointer-invisible` isn't supported on your platform (or perhaps by Emacs?). – Drew Jul 08 '20 at 19:57
  • Thanks, @NickD and @Drew. For context, I have tried several ```x-pointer-*``` shapes and only ```x-pointer-invisible``` gives problems. I am on Linux/X11. – Stefano Jul 08 '20 at 20:05
  • Maybe google to see if `x-pointer-invisible` is supported on GNU Linux/X11? – Drew Jul 08 '20 at 20:07
  • In the past, I used [disable-mouse](https://github.com/purcell/disable-mouse), which worked pretty well, maybe you can trigger some event on the mouse movement to disable/enable this minor mode. Good luck! – Fermin MF Jul 09 '20 at 13:58
  • @f-sasa, thank you for the suggestion. I have tried it out and ```disable-mouse``` does not work for me (Emacs 26.3 on Linux). – Stefano Jul 10 '20 at 13:35

0 Answers0