Mouse focus issues when hiding/showing pointer


If I switch bShowMouseCursor to true after it was set to false, I can notice two bugs :

  • it won’t actually show until there is an event (mouse movement on Windows, mouse click on Linux) if this happens
  • on a Slate menu, there is no focus management (buttons don’t have hover effects anymore, etc) until the above happens

How can I fix that ?

Thanks !

I have the same problem. On Ubuntu, I need a click to hide the cursor.

Is it possible to just hide the cursor, without changing the input behaviour ?

Thanks !

Does anyone know about this ?

I have had this issue and here is my theory. I think it is fine. I think it is the nature of working in the editor itself. If you run the game in stand alone or fully built mode I think it will work fine.

The problem may be that when you switch to the cursor on or off in the editor game the focus switches back to the editor itself instead of staying within the game (like when you hit Shift+F1). That is why you have to first click in the window to get context back to the game playing in the editor (again my theory not tested fact)

However that does not mean it is not a bug :slight_smile: so maybe we should switch this question to the actual bug report

Thanks for helping !

Unfortunately the problem is exactly the same when launching as standalone, cooked binary, new editor window, or in editor. This is an issue with the way mouse input is handled internally.

See, the bShowMouseCursor flag is much more than its name says. It changes the way the mouse is handled, on Linux it looks to be resetting the mouse position to mid-screen when clicking for example, on Windows it causes various focus issues.

I would like to simply make the cursor disappear (just not drawing it), preferably without patching the engine.

Well without patching the engine you could toggle on or off a user widget that represents the location of the mouse cursor and turns off any mouse input you may have (like camera rotations, etc)… You’d have to update it each frame but that’s not uncommon. I used a video a long time ago on how to create a custom mouse widget that may do exactly what you want.

Custom Mouse Cursor

Yeah, but on Linux, doing that will reset the mouse position every time you click on something. What I need is the (correct) behaviour of bShowMouseCursor, without the cursor itself. bShowMouseCursor set to false has buggy behaviour.

I agree, I kind of think this may be considered a bug? I suggest changing the category of this question to Bug Report and tagging it as a bug. An Epic Staff member may be able to help us both resolve this answer.

Because I’ve experienced this behavior on windows as well, but I cant’ help but think surely others have had this problem as well and yet I’ve not been able to find anything about it. I do know that 4.7 added some support for custom mouse but I’m not entirely sure what that was.

Also for your problem with the mouse position resetting… did you try storing the mouse X and Y position in a Vector2D restoring it when a click action happens?

Posted as a bug here : [4.7.6] Mouse cursor visibility issues - Rendering - Unreal Engine Forums

Hopefully Epic will address the issue some day.

From what others have said, it looks like Linux would require a click, so this is most likely not portable.

I had a similar problem and faked mouse movement through FSlateApplication to get it to work (on Windows only). See my answer to ‘Mouse Cursor not changing until moved’.