為什麼滑鼠遊標在螢幕右邊緣時會跳躍,導致奇怪的應用程式行為(例如 eclipse)?

為什麼滑鼠遊標在螢幕右邊緣時會跳躍,導致奇怪的應用程式行為(例如 eclipse)?

當我將滑鼠移到螢幕右邊緣時,無論進入右邊緣時的垂直位置如何,它都會跳到螢幕右邊緣頂部向下約 25% 的點。

此後,我注意到 Eclipse 中出現了奇怪的行為,上下文選單在錯誤的位置彈出(通常在遊標左側很遠的地方)。重新啟動 Eclipse 後,Eclipse 中的問題消失了,但在我第一次移動到螢幕右邊緣時又出現了。

我的系統是 Mageia 8、Plasma 桌面、Breeze 主題、Linux 5.10.41、AMD64(Ryzen Threadripper 3960X 24 核心處理器),配備兩個 NVIDIA GPU(GeForce RTX 2080 SUPER),連接一台 4k 顯示器。

滑鼠跳轉總是發生,與 Eclipse 是否運作無關。

答案1

造成此問題的原因是我的 xorg.conf 配置了兩個螢幕,但我只連接了一台顯示器。

這是我原來的 xorg.conf:

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 465.24.02

# File generated by XFdrake (rev 262502)
# **********************************************************************
# Refer to the xorg.conf man page for details about the format of
# this file.
# **********************************************************************

Section "ServerLayout"

    #Option "Xinerama"
    Identifier     "layout1"
    Screen         "screen1" 0 0
    Screen         "screen2" RightOf "screen1"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Module"
    Load           "v4l" # Video for Linux
    Load           "glx"
EndSection

Section "ServerFlags"

 # allows the server to start up even if the mouse does not work
    #DontZoom # disable <Ctrl><Alt><KP_+>/<KP_-> (resolution switching)
    Option         "allowmouseopenfail"
    Option         "DontZap" "False" # disable <Ctrl><Alt><BS> (server abort)
EndSection

Section "InputDevice"

    # generated from data in "/etc/sysconfig/keyboard"
    Identifier     "Keyboard0"
    Driver         "kbd"
    Option         "XkbLayout" "us"
    Option         "XkbModel" "pc105"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "Monitor"

    # Apple iMac modes
    Identifier     "monitor1"
    VendorName     "Plug'n Play"
    ModeLine       "1024x768" 78.525 1024 1049 1145 1312 768 769 772 800 +hsync +vsync
    ModeLine       "800x600" 62.357 800 821 901 1040 600 601 604 632 +hsync +vsync
    ModeLine       "640x480" 49.886 640 661 725 832 480 481 484 514 +hsync +vsync
    ModeLine       "832x624" 57 832 876 940 1152 624 625 628 667 -hsync -vsync
    ModeLine       "800x600" 100 800 816 824 840 600 616 624 640 -hsync -vsync
    ModeLine       "1152x768" 78.741 1152 1173 1269 1440 768 769 772 800 +vsync
    ModeLine       "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
    ModeLine       "1024x768" 65 1024 1048 1184 1344 768 771 777 806 -hsync -vsync
    ModeLine       "1024x768" 112.62 1024 1076 1248 1420 768 768 780 808 +hsync +vsync
    ModeLine       "1280x1024" 135 1280 1288 1392 1664 1024 1027 1030 1064
    ModeLine       "1280x1024" 134.989 1280 1317 1429 1688 1024 1025 1028 1066 +hsync +vsync
    ModeLine       "768x576" 50.00 768 832 846 1000 576 590 595 630
    ModeLine       "768x576" 63.07 768 800 960 1024 576 578 590 616
EndSection

Section "Monitor"

    # Apple iMac modes
    Identifier     "monitor2"
    ModeLine       "1024x768" 78.525 1024 1049 1145 1312 768 769 772 800 +hsync +vsync
    ModeLine       "800x600" 62.357 800 821 901 1040 600 601 604 632 +hsync +vsync
    ModeLine       "640x480" 49.886 640 661 725 832 480 481 484 514 +hsync +vsync
    ModeLine       "832x624" 57 832 876 940 1152 624 625 628 667 -hsync -vsync
    ModeLine       "800x600" 100 800 816 824 840 600 616 624 640 -hsync -vsync
    ModeLine       "1152x768" 78.741 1152 1173 1269 1440 768 769 772 800 +vsync
    ModeLine       "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
    ModeLine       "1024x768" 65 1024 1048 1184 1344 768 771 777 806 -hsync -vsync
    ModeLine       "1024x768" 112.62 1024 1076 1248 1420 768 768 780 808 +hsync +vsync
    ModeLine       "1280x1024" 135 1280 1288 1392 1664 1024 1027 1030 1064
    ModeLine       "1280x1024" 134.989 1280 1317 1429 1688 1024 1025 1028 1066 +hsync +vsync
    ModeLine       "768x576" 50.00 768 832 846 1000 576 590 595 630
    ModeLine       "768x576" 63.07 768 800 960 1024 576 578 590 616
EndSection

Section "Device"
    Identifier     "device1"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "NVIDIA GeForce 635 series and later"
    BusID          "PCI:33:0:0"
    Screen          0
EndSection

Section "Device"
    Identifier     "device2"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "NVIDIA GeForce 635 series and later"
    BusID          "PCI:74:0:0"
    Screen          0
EndSection

Section "Screen"
    Identifier     "screen1"
    Device         "device1"
    Monitor        "monitor1"
    DefaultDepth    24
    Option         "DPMS"
    SubSection     "Display"
        Depth       24
        Modes      "nvidia-auto-select"
    EndSubSection
EndSection

Section "Screen"
    Identifier     "screen2"
    Device         "device2"
    Monitor        "monitor2"
    DefaultDepth    24
    Option         "DPMS"
    SubSection     "Display"
        Depth       24
        Modes      "nvidia-auto-select"
    EndSubSection
EndSection

如果我註解掉Screen該部分中的第二個部分,並在最後ServerLayout註解​​掉第二個部分的定義,則問題將得到解決(重新啟動後)。Screen滑鼠不再在邊緣跳躍,並且 Eclipse 上下文選單始終在遊標下方彈出。

此 xorg.conf 檔案是由 NVIDIA 驅動程式安裝程式建立的。

這是有效的新 xorg.conf 檔案:

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 465.24.02

# File generated by XFdrake (rev 262502)
# **********************************************************************
# Refer to the xorg.conf man page for details about the format of
# this file.
# **********************************************************************

Section "ServerLayout"

    #Option "Xinerama"
    Identifier     "layout1"
    Screen         "screen1" 0 0
#    Screen         "screen2" RightOf "screen1"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Module"
    Load           "v4l" # Video for Linux
    Load           "glx"
EndSection

Section "ServerFlags"

 # allows the server to start up even if the mouse does not work
    #DontZoom # disable <Ctrl><Alt><KP_+>/<KP_-> (resolution switching)
    Option         "allowmouseopenfail"
    Option         "DontZap" "False" # disable <Ctrl><Alt><BS> (server abort)
EndSection

Section "InputDevice"

    # generated from data in "/etc/sysconfig/keyboard"
    Identifier     "Keyboard0"
    Driver         "kbd"
    Option         "XkbLayout" "us"
    Option         "XkbModel" "pc105"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "Monitor"

    # Apple iMac modes
    Identifier     "monitor1"
    VendorName     "Plug'n Play"
    ModeLine       "1024x768" 78.525 1024 1049 1145 1312 768 769 772 800 +hsync +vsync
    ModeLine       "800x600" 62.357 800 821 901 1040 600 601 604 632 +hsync +vsync
    ModeLine       "640x480" 49.886 640 661 725 832 480 481 484 514 +hsync +vsync
    ModeLine       "832x624" 57 832 876 940 1152 624 625 628 667 -hsync -vsync
    ModeLine       "800x600" 100 800 816 824 840 600 616 624 640 -hsync -vsync
    ModeLine       "1152x768" 78.741 1152 1173 1269 1440 768 769 772 800 +vsync
    ModeLine       "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
    ModeLine       "1024x768" 65 1024 1048 1184 1344 768 771 777 806 -hsync -vsync
    ModeLine       "1024x768" 112.62 1024 1076 1248 1420 768 768 780 808 +hsync +vsync
    ModeLine       "1280x1024" 135 1280 1288 1392 1664 1024 1027 1030 1064
    ModeLine       "1280x1024" 134.989 1280 1317 1429 1688 1024 1025 1028 1066 +hsync +vsync
    ModeLine       "768x576" 50.00 768 832 846 1000 576 590 595 630
    ModeLine       "768x576" 63.07 768 800 960 1024 576 578 590 616
EndSection

Section "Monitor"

    # Apple iMac modes
    Identifier     "monitor2"
    ModeLine       "1024x768" 78.525 1024 1049 1145 1312 768 769 772 800 +hsync +vsync
    ModeLine       "800x600" 62.357 800 821 901 1040 600 601 604 632 +hsync +vsync
    ModeLine       "640x480" 49.886 640 661 725 832 480 481 484 514 +hsync +vsync
    ModeLine       "832x624" 57 832 876 940 1152 624 625 628 667 -hsync -vsync
    ModeLine       "800x600" 100 800 816 824 840 600 616 624 640 -hsync -vsync
    ModeLine       "1152x768" 78.741 1152 1173 1269 1440 768 769 772 800 +vsync
    ModeLine       "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
    ModeLine       "1024x768" 65 1024 1048 1184 1344 768 771 777 806 -hsync -vsync
    ModeLine       "1024x768" 112.62 1024 1076 1248 1420 768 768 780 808 +hsync +vsync
    ModeLine       "1280x1024" 135 1280 1288 1392 1664 1024 1027 1030 1064
    ModeLine       "1280x1024" 134.989 1280 1317 1429 1688 1024 1025 1028 1066 +hsync +vsync
    ModeLine       "768x576" 50.00 768 832 846 1000 576 590 595 630
    ModeLine       "768x576" 63.07 768 800 960 1024 576 578 590 616
EndSection

Section "Device"
    Identifier     "device1"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "NVIDIA GeForce 635 series and later"
    BusID          "PCI:33:0:0"
    Screen          0
EndSection

Section "Device"
    Identifier     "device2"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "NVIDIA GeForce 635 series and later"
    BusID          "PCI:74:0:0"
    Screen          0
EndSection

Section "Screen"
    Identifier     "screen1"
    Device         "device1"
    Monitor        "monitor1"
    DefaultDepth    24
    Option         "DPMS"
    SubSection     "Display"
        Depth       24
        Modes      "nvidia-auto-select"
    EndSubSection
EndSection

#Section "Screen"
#    Identifier     "screen2"
#    Device         "device2"
#    Monitor        "monitor2"
#    DefaultDepth    24
#    Option         "DPMS"
#    SubSection     "Display"
#        Depth       24
#        Modes      "nvidia-auto-select"
#    EndSubSection
#EndSection

答案2

感謝您展示瞭如何修復遊標穿過螢幕右邊緣的問題。有一個簡單的解決方案:將 screen2 定義中的 替換為 ,RightOf "screen1"保持0 0其他所有不變。您可以使用您最喜歡的文字編輯器來執行此操作(我使用 gedit),但請記住您必須是超級使用者。 CLI指令是: $ sudo gedit /etc/X11/xorg.conf然後尋找、取代、儲存並重新啟動。

相關內容