简体   繁体   中英

Avalonia UI mouse cursor not hiding correctly on Raspberry Pi

I've recently been trying to develop a small GUI application for my raspberry using avalonia ui. The application should run in full-screen mode and hide the cursor when it is running in full screen. For that I've set up a timer that starts as soon as the mouse stops moving.

Running the application in Windows, everything works as expected. Three seconds after the mouse stops moving, it hides itself.

On the raspberry the application starts in full screen, but the cursor doesn't hide, it just flickers. At least as long as the mouse wasn't moved since starting the application. By manually moving the mouse after the application started everything works fine again.

The main issue I'm facing is, that the app starts itself when the raspberry has started up and it's unpractical to have someone that needs to move the mouse in order for the cursor to hide.

Does anyone have a possible solution?

So after a bit trial and error I've managed to create a simple workaround on how to fix it.

By installing the xdotool package for on the rapsberry you can move the mose from commandline.

With this I've set up a script that starts the program and after a delay of 5 seconds moves the mouse.

I've also recently been working on a small GUI application for my RaspberryPI using AvaloniaUI, running in a very similar manner. I observed the same effect when setting the Cursor to None . This seems like a bug. My work-around was to install an OS level solution, unclutter.

sudo apt-get install unclutter

Unclutter hides the cursor after approximately 1 second of inactivity by default, which will work for my project, if this does not work for you there are ways to set the idle time. You can experiment with timing by using…

@unclutter -idle 3

Check their documentation for setting the idle time permanently.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM