ValveSoftware / Dota-2

Tracker for issues specific to Linux and Mac in the Reborn client. If you have a general issue or non-system-specific feature request please go to dev.dota2.com
469 stars 38 forks source link

[Linux] Chat wheel always moves mouse to top left corner with Razer mouse #1264

Open skogler opened 7 years ago

skogler commented 7 years ago

Since a few months ago, the chat wheel window center detection is broken for me. It always moves the mouse to the top left corner of the window, approximately one hundred pixels inside. I disconnected every input device except for keyboard and mouse.

Things I have tested so far which do not change this behaviour:

EDIT

The problem is related to the Razer DeathAdder 2013 I am using. With a 'normal' mouse the problem does not occur. This might be related to an odd X11 detection of the mouse, where it has some more devices than usual in xinput. This is not an issue in any other application than Dota 2 though.

xinput output with Razer DeathAdder 2013:

⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ HID 046a:010d                             id=9    [slave  pointer  (2)]
⎜   ↳ Razer Razer DeathAdder 2013               id=11   [slave  pointer  (2)]
⎜   ↳ Razer Razer DeathAdder 2013               id=15   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Power Button                              id=7    [slave  keyboard (3)]
    ↳ HID 046a:010d                             id=8    [slave  keyboard (3)]
    ↳ HD Webcam C525                            id=10   [slave  keyboard (3)]
    ↳ HID 046a:010d                             id=14   [slave  keyboard (3)]
    ↳ Razer Razer DeathAdder 2013               id=12   [slave  keyboard (3)]
    ↳ Razer Razer DeathAdder 2013               id=13   [slave  keyboard (3)]

vs. with a simple Logitech mouse:

⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ HID 046a:010d                             id=9    [slave  pointer  (2)]
⎜   ↳ Logitech USB Optical Mouse                id=16   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Power Button                              id=7    [slave  keyboard (3)]
    ↳ HID 046a:010d                             id=8    [slave  keyboard (3)]
    ↳ HD Webcam C525                            id=10   [slave  keyboard (3)]
    ↳ HID 046a:010d                             id=14   [slave  keyboard (3)]

Steam hardware information:

Computer Information:
    Manufacturer:  Unknown
    Model:  Unknown
    Form Factor: Desktop
    No Touch Input Detected

Processor Information:
    CPU Vendor:  GenuineIntel
    CPU Brand:  Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz
    CPU Family:  0x6
    CPU Model:  0x3c
    CPU Stepping:  0x3
    CPU Type:  0x0
    Speed:  3900 Mhz
    8 logical processors
    4 physical processors
    HyperThreading:  Supported
    FCMOV:  Supported
    SSE2:  Supported
    SSE3:  Supported
    SSSE3:  Supported
    SSE4a:  Unsupported
    SSE41:  Supported
    SSE42:  Supported
    AES:  Supported
    AVX:  Supported
    CMPXCHG16B:  Supported
    LAHF/SAHF:  Supported
    PrefetchW:  Unsupported

Network Information:
    Network Speed:  

Operating System Version:
    "Arch Linux" (64 bit)
    Kernel Name:  Linux
    Kernel Version:  4.11.7-1-ARCH
    X Server Vendor:  The X.Org Foundation
    X Server Release:  11903000
    X Window Manager:  i3
    Steam Runtime Version:  <Runtime disabled>

Video Card:
    Driver:  NVIDIA Corporation GeForce GTX 970/PCIe/SSE2

    Driver Version:  4.5.0 NVIDIA 381.22
    OpenGL Version: 4.5
    Desktop Color Depth: 24 bits per pixel
    Monitor Refresh Rate: 60 Hz
    VendorID:  0x10de
    DeviceID:  0x13c2
    Revision Not Detected
    Number of Monitors:  2
    Number of Logical Video Cards:  1
    Primary Display Resolution:  1920 x 1080
    Desktop Resolution: 3840 x 1080
    Primary Display Size: 20.91" x 11.73"  (23.94" diag)
                                            53.1cm x 29.8cm  (60.8cm diag)
    Primary Bus: PCI Express 16x
    Primary VRAM: 4096 MB
    Supported MSAA Modes:  2x 4x 8x 16x 

Sound card:
    Audio device: AV200

Memory:
    RAM:  15982 Mb

Miscellaneous:
    UI Language:  English
    LANG:  en_GB.utf8
    Microphone:  Not set
    Steam Controller Cable and Base:  Not set
    Total Hard Disk Space Available:  112280 Mb
    Largest Free Hard Disk Block:  1583 Mb
    VR Headset: None detected
gdrewb-valve commented 7 years ago

Dota uses SDL for all pointer operations and doesn't know anything about specific hardware. Maybe the SDL dev knows more?

skogler commented 7 years ago

I'll try to create a minimal SDL2 test application to reproduce this issue, and to see if it really is a SDL2 bug.

Does Dota use SDL_WarpMouseInWindow to set the mouse position within the window? Or does it do SDL_SetRelativeMouseMode and draw the cursor circle in the middle by itself? I'd guess the latter.

gdrewb-valve commented 7 years ago

When in a game and you don't have some other UI up things should be in relative mouse mode.

kisak-valve commented 7 years ago

Hello @skogler, are you using any launch options with Dota 2?

skogler commented 7 years ago

hi, no I am not using any at the moment.

skogler commented 7 years ago

I can confirm there is a bug in SDL2, where SDL_WarpMouseInWindow does not correctly set the mouse position with the Razer DeathAdder mouse. I discovered this with the following small test program:

https://gist.github.com/skogler/9d9ab1b3e977d25901afe6fa1c2d608f

This just draws a rectangle where the mouse is currently at, according to SDL2. You can hold the middle mouse button to draw a 'Chat wheel' dummy. Then, when you release the mouse, the position of the mouse should be restored. This works for the normal mouse, but not with the DeathAdder.

Grief commented 6 years ago

@skogler it's probably not actual for you anymore, but I just found the root cause of this bug which happened to me and my G600 mouse. It might be not the exact case for you but still.

My mouse has very high dpi and I tweaked it with xinput, setting Coordinate Transformation Matrix to something like 1 0 0 0 1 0 0 0 1.6 on every boot. When I reset it back to 1 0 0 0 1 0 0 0 1, everything became fine.

mvrozanti commented 4 years ago

But what if you want to actually change mouse sensitivity through xinput?

This happens whenever the transformation matrix has values that are not 0 or 1.