Mouse cursor moves after mouse middle button up if xinput coordinate transformation matrix is used #85014

Closed
opened 2021-01-24 11:04:23 +01:00 by Nikita Lisitsa · 12 comments

System Information
Operating system: Gentoo Linux, kernel version 5.4.72
Graphics card: GeForce GFX 1060 6GB

Blender Version
Broken: 2.90.1, 2.91.0, 2.92.0-alpha
I'm normally using a blender version from the cg overlay to have newer versions & richer feature support, but the problem reproduces exactly with blender version from the official portage repositories.

Short description of error
I'm using xinput coordinate transformation matrix to make the mouse cursor move faster (my mouse seems to be slower on Y that on X, so I used it to fix that). While using this, I noticed that blender erroneously moves the mouse cursor: after the mouse wheel (middle button) is clicked and the cursor is moved just a bit (i.e. one pixel), the cursor gets teleported to a different location, usually about a few hundered pixels to the right and down.

If e.g. only the Y-axis diagonal value of the transformation matrix differs from the default of 1.0 (as in the identity matrix), the cursor gets moved exactly down. After experimenting with different values I noticed that if the Y-axis diagonal value of the matrix is set to 2.0, the Y mouse position (in screen pixels) after click is about 2 times the previous position; if set to 3.0, the Y mouse position after click is about 3 times the previous position, etc. So, it appears as if the transformation matrix was applied once to the mouse cursor after the mouse middle button is pressed, which to my understanding shouldn't be happening.

The effect reproduces even is xinput transformation matrix is applied while blender is already running.

Exact steps for others to reproduce the error
On a system that uses X window system,

  • Run xinput to find out the exact relevant device id (mine is Logitech USB Receiver Mouse id=10)
  • Run xinput --list-props <device-id> to find the property id of the matrix (mine is Coordinate Transformation Matrix (157))
  • Run xinput --set-prop <device-id> <propery-id> 1.0 0.0 0.0 0.0 2.0 0.0 0.0 0.0 1.0
  • Open blender and try rotating the camera with the middle mouse button, or simply click the middle mouse button and move the cursor a little
**System Information** Operating system: Gentoo Linux, kernel version 5.4.72 Graphics card: GeForce GFX 1060 6GB **Blender Version** Broken: 2.90.1, 2.91.0, 2.92.0-alpha I'm normally using a blender version from the [cg ](https://github.com/brothermechanic/cg) overlay to have newer versions & richer feature support, but the problem reproduces exactly with blender version from the official portage repositories. **Short description of error** I'm using xinput coordinate transformation matrix to make the mouse cursor move faster (my mouse seems to be slower on Y that on X, so I used it to fix that). While using this, I noticed that blender erroneously moves the mouse cursor: after the mouse wheel (middle button) is clicked and the cursor is moved just a bit (i.e. one pixel), the cursor gets teleported to a different location, usually about a few hundered pixels to the right and down. If e.g. only the Y-axis diagonal value of the transformation matrix differs from the default of 1.0 (as in the identity matrix), the cursor gets moved exactly down. After experimenting with different values I noticed that if the Y-axis diagonal value of the matrix is set to 2.0, the Y mouse position (in screen pixels) after click is about 2 times the previous position; if set to 3.0, the Y mouse position after click is about 3 times the previous position, etc. So, it appears as if the transformation matrix was applied once to the mouse cursor after the mouse middle button is pressed, which to my understanding shouldn't be happening. The effect reproduces even is xinput transformation matrix is applied while blender is already running. **Exact steps for others to reproduce the error** On a system that uses X window system, - Run `xinput` to find out the exact relevant device id (mine is `Logitech USB Receiver Mouse id=10`) - Run `xinput --list-props <device-id>` to find the property id of the matrix (mine is `Coordinate Transformation Matrix (157)`) - Run `xinput --set-prop <device-id> <propery-id> 1.0 0.0 0.0 0.0 2.0 0.0 0.0 0.0 1.0` - Open blender and try rotating the camera with the middle mouse button, or simply click the middle mouse button and move the cursor a little
Author

Added subscriber: @lisyarus

Added subscriber: @lisyarus
Member

Added subscriber: @filedescriptor

Added subscriber: @filedescriptor
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

I can reproduce this on 2.92.0 Beta, branch: master, commit date: 2021-01-25 06:40, hash: 7f9ed0178a. The jump happens after the middle mouse button is released.

I can reproduce this on 2.92.0 Beta, branch: master, commit date: 2021-01-25 06:40, hash: `7f9ed0178a`. The jump happens after the middle mouse button is released.
Member

Added subscriber: @JulianEisel

Added subscriber: @JulianEisel
Member

This would probably be an issue in X specific event handling then. It is a rather obscure issue and I'd guess it's there for a long time.

I can't check this currently but personally also wouldn't prioritize this. Marking as known issue.

This would probably be an issue in X specific event handling then. It is a rather obscure issue and I'd guess it's there for a long time. I can't check this currently but personally also wouldn't prioritize this. Marking as known issue.

Added subscriber: @Pik-1

Added subscriber: @Pik-1

I'm also affected, commit 8618c4159c.

It seems to happen whenever the mouse is grabbed (the --debug option disables that and "fixes" the issue). So the mouse jumps when performing pretty much any action, making the software unusable. Of course the low priority is justified (we can just revert to the identity matrix in xinput when using Blender), but it took me a while to figure it out. If it's not too much of a hack maybe there could be a warning in the meantime?

If I can find the time I'll investigate it further.

I'm also affected, commit 8618c4159c7b0c9bddf6b86522dee383de7207cf. It seems to happen whenever the mouse is grabbed (the --debug option disables that and "fixes" the issue). So the mouse jumps when performing pretty much any action, making the software unusable. Of course the low priority is justified (we can just revert to the identity matrix in xinput when using Blender), but it took me a while to figure it out. If it's not too much of a hack maybe there could be a warning in the meantime? If I can find the time I'll investigate it further.

Alright so after a bit of debugging and git-blaming, I realized I'm bad at looking for existing bug reports.

The issue was already raised and fixed in #48901, then the fix was reverted in #50383 because it messed with Xinerama, due to this 6-year-old bug in libX (which may be NVidia's fault according to a comment). I thought Xinerama was obsolete but apparently RandR doesn't perfectly handle multiple graphics cards(?).

So until Wayland takes over the (Linux desktop) world, I guess we have to choose between xinput transformation matrix and proper multi-GPU.

Could the macro used in Ghost to control this (USE_X11_XINPUT_WARP) be exposed in the CMake config? This way we can easily choose at compile-time.

Alright so after a bit of debugging and git-blaming, I realized I'm bad at looking for existing bug reports. The issue was already raised and fixed in #48901, then the fix was reverted in #50383 because it messed with Xinerama, due to [this 6-year-old bug in libX ](https://gitlab.freedesktop.org/xorg/lib/libxi/-/issues/5) (which may be NVidia's fault according to a comment). I thought Xinerama was obsolete but apparently RandR doesn't perfectly handle multiple graphics cards(?). So until Wayland takes over the (Linux desktop) world, I guess we have to choose between xinput transformation matrix and proper multi-GPU. Could the macro used in Ghost to control this (`USE_X11_XINPUT_WARP`) be exposed in the CMake config? This way we can easily choose at compile-time.
Author

Bastien, thank you a lot for investigation! I agree that it is an obscure and minor issue. I'd personally be fine if it was closed as a duplicate, but as a Gentoo user I would highly appreciate a compile-time flag as well :)

Bastien, thank you a lot for investigation! I agree that it is an obscure and minor issue. I'd personally be fine if it was closed as a duplicate, but as a Gentoo user I would highly appreciate a compile-time flag as well :)

Added subscriber: @sh6heer

Added subscriber: @sh6heer

Closed as duplicate of #48901

Closed as duplicate of #48901
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#85014
No description provided.