2つのポインタxinputデバイスを1つのデバイスに結合できますか?

2つのポインタxinputデバイスを1つのデバイスに結合できますか?

VirtualBox mouse integration私は、既存のポインタ入力に加えて、2番目のポインタ入力を生成する「マウス統合」機能を備えたVirtualBoxを使用しています。

$ xinput
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ VirtualBox mouse integration              id=9    [slave  pointer  (2)]
⎜   ↳ ImExPS/2 Generic Explorer Mouse           id=11   [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)]
    ↳ Sleep Button                              id=7    [slave  keyboard (3)]
    ↳ Video Bus                                 id=8    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=10   [slave  keyboard (3)]

このスレッドには、「VirtualBoxのマルチカーソル入力」の問題の詳細が含まれています。マウスを動かすとスクロールできない - Win10のFedora 28 VMゲスト

このスレッドによると、VirtualBox mouse integration移動イベントのみが受信され、他のデバイスはスクロールイベントのみを受信します。したがって、マウスが動くとスクロールが機能しないこれは、多くのプログラムが一度に1つのアクティブ入力デバイスのみを許可するためです。

デスクトッププログラムがそのデバイスをアクティブ入力デバイスとして使用できるように、これら2つの入力デバイスを「仮想」入力デバイスに組み合わせることは可能ですか?

マウス入力イベントは以下から確認できます。

xinput test-xi2 --root

マイコンピュータでは、他のデバイスから送信されたマウスの位置とスクロールイベントが明確に表示されます。

EVENT type 17 (RawMotion)
    device: 2 (9)
    detail: 0
    flags: 
    valuators:
          0: 1704.97 (1704.97)
          1: 39323.40 (39323.40)

EVENT type 6 (Motion)
    device: 9 (9)
    detail: 0
    flags: 
    root: 55.23/570.23
    event: 55.23/570.23
    buttons:
    modifiers: locked 0x10 latched 0 base 0 effective: 0x10
    group: locked 0 latched 0 base 0 effective: 0
    valuators:
        0: 1704.97
        1: 39323.40
    windows: root 0x532 event 0x532 child 0x4600003
EVENT type 17 (RawMotion)
    device: 2 (12)
    detail: 0
    flags: 
    valuators:
          3: 15.00 (15.00)

EVENT type 6 (Motion)
    device: 12 (12)
    detail: 0
    flags: 
    root: 55.23/571.23
    event: 55.23/571.23
    buttons:
    modifiers: locked 0x10 latched 0 base 0 effective: 0x10
    group: locked 0 latched 0 base 0 effective: 0
    valuators:
        3: -1470.00
    windows: root 0x532 event 0x532 child 0x4600003
EVENT type 15 (RawButtonPress)
    device: 2 (12)
    detail: 5
    flags: emulated
    valuators:

EVENT type 4 (ButtonPress)
    device: 12 (12)
    detail: 5
    flags: emulated
    root: 55.23/571.23
    event: 55.23/571.23
    buttons:
    modifiers: locked 0x10 latched 0 base 0 effective: 0x10
    group: locked 0 latched 0 base 0 effective: 0
    valuators:
    windows: root 0x532 event 0x532 child 0x4600003
EVENT type 16 (RawButtonRelease)
    device: 2 (12)
    detail: 5
    flags: emulated
    valuators:

EVENT type 5 (ButtonRelease)
    device: 12 (12)
    detail: 5
    flags: emulated
    root: 55.23/571.23
    event: 55.23/571.23
    buttons: 5
    modifiers: locked 0x10 latched 0 base 0 effective: 0x10
    group: locked 0 latched 0 base 0 effective: 0
    valuators:
    windows: root 0x532 event 0x532 child 0x4600003

ベストアンサー1

以下を使用してコーディングが必要なので、完全な答えではありません。レヴィデフただし、両方の入力デバイスの排他的な読み取りを「キャッチ」して、そのイベントを単一のストリームにまとめる新しいUinput仮想デバイスを作成することは可能です。別の読み取りイベントと書き込みイベントを使用できるC例がありますが、このPythonの単一ページ地図時間興味深いビルディングブロックのサンプルセクションがたくさんあります(同じURL、ページ上の他のポイント)。

  1. 複数のデバイスからイベントを読み取るここ

  2. お使いのデバイスに排他的にアクセスここ

  3. 他のデバイスの機能を使用してuinputデバイスを作成するここ

  4. 入力注入ここ

Rustプログラムがあります効果的なevdevデバイスの多くのマージとマッピングを実行できます。必要なタスクを実行するように構成できることを確認する必要があります。

おすすめ記事