bge.render.setMousePosition fails silently with Xwayland
Open, Needs TriagePublic


System Information
Operating system and graphics card
Fedora 26 Linux 4.15.6-200.fc26.x86_64 + Intel HD Graphics 530 + GeForce GTX 960M
with Xwayland

Blender Version
Broken: blender-2.79-linux-glibc219-x86_64 5bcd8ac9adbfa (from d.b.o)
Worked: same version with Xorg instead of Xwayland

Short description of error
bge.render.setMousePosition works with X server, but it fails silently with Xwayland.

Exact steps for others to reproduce the error
Based on a (as simple as possible) attached .blend file with minimum amount of steps

import bge
bge.logic.mouse.visible = True
center = bge.render.getWindowWidth() // 2, bge.render.getWindowHeight() // 2



a temp workaround is to place a object that is a mouse representative,
use simpleMouse or your own code to manage your own X offset and Y offset from frame to frame,

use camera projection matrix to raycast instead of using mouseover.hitObject()

if you need a temp work around let me know

(I did this in the past to avoid the mouse moving at all when it's supposed to be locked in a place)

Follow up, my ticket might have lack details. The problem is that the mouse used to be looked to the viewer using ""mouse look" script.

My current workaround is to use movement delta instead of relative to window center.

However, since Wayland, the mouse is not moved by setMousePosition(), and get out of the window.

another workaround is to disable Wayland:
add "WaylandEnable=false" in /etc/gdm/custom.conf under the [daemon] field, or run:

sudo  sed -i.bak s/\#WaylandEnable=false/WaylandEnable=false/g /etc/gdm/custom.conf

BGE bug reports are redundant at this point. The next version of Blender (2.8) will not have a game engine so reporting bugs will not be beneficial. I'd suggest you use UPBGE, although I'm pretty sure that the project is dead now because all the developers have left. You may need to look into developing on a new platform such as Godot Engine, Unreal Engine, or Unity. Farewell BGE!

lordloki contributed to upbge yesterday.


here is upbge updated to 2.79c Or whatever master was 1.5 weeks ago or so.

we also have mac build instructions for 0.2.4