Skip to content

Commit acca4b5

Browse files
committed
fix: 适配PS鼠标类型的触控板
适配PS鼠标类型的触控板 Log: PMS: BUG-352421 Influence: 输入设备-触控板
1 parent 8511fe6 commit acca4b5

3 files changed

Lines changed: 20 additions & 13 deletions

File tree

dxinput/touchpad.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2018 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -53,14 +53,24 @@ func NewTouchpad(id int32) (*Touchpad, error) {
5353
}
5454

5555
func NewTouchpadFromDevInfo(dev *DeviceInfo) (*Touchpad, error) {
56-
if dev == nil || dev.Type != DevTypeTouchpad {
57-
return nil, fmt.Errorf("Not a touchpad device(%d - %s)", dev.Id, dev.Name)
56+
if dev == nil {
57+
return nil, errors.New("device info is nil")
58+
}
59+
60+
if dev.Type != DevTypeTouchpad && dev.Type != DevTypeMouse {
61+
return nil, fmt.Errorf("unsupported device type: %v (device: %d - %s)",
62+
dev.Type, dev.Id, dev.Name)
63+
}
64+
65+
isLibinputUsed := utils.IsPropertyExist(dev.Id, libinputPropTapEnabled)
66+
if !isLibinputUsed && dev.Type == DevTypeMouse {
67+
isLibinputUsed = utils.IsPropertyExist(dev.Id, libinputPropButtonScrollingButton)
5868
}
5969

6070
return &Touchpad{
6171
Id: dev.Id,
6272
Name: dev.Name,
63-
isLibinputUsed: utils.IsPropertyExist(dev.Id, libinputPropTapEnabled),
73+
isLibinputUsed: isLibinputUsed,
6474
}, nil
6575
}
6676

go.mod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ require (
77
github.com/fogleman/gg v1.3.0
88
github.com/godbus/dbus/v5 v5.1.0
99
github.com/gosexy/gettext v0.0.0-20160830220431-74466a0a0c4a
10-
github.com/linuxdeepin/go-dbus-factory v0.0.0-20251106065250-e58866b2c218
10+
github.com/linuxdeepin/go-dbus-factory v0.0.0-20260227070938-bcb8d12841ab
1111
github.com/linuxdeepin/go-gir v0.0.0-20251127080441-d9c47dbb6da4
12-
github.com/linuxdeepin/go-lib v0.0.0-20251106065207-1fdf101312e6
12+
github.com/linuxdeepin/go-lib v0.0.0-20260205120541-a1f572ce1442
1313
github.com/linuxdeepin/go-x11-client v0.0.0-20230131052004-7503e2337ee1
14-
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
1514
github.com/stretchr/testify v1.8.1
1615
gopkg.in/alecthomas/kingpin.v2 v2.2.6
1716
)

go.sum

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,17 @@ github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn
2727
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
2828
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
2929
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
30-
github.com/linuxdeepin/go-dbus-factory v0.0.0-20251106065250-e58866b2c218 h1:bifQcTysGUacNXM5PK9IWDPCG8Jb/+JzKwy3w8APYq0=
31-
github.com/linuxdeepin/go-dbus-factory v0.0.0-20251106065250-e58866b2c218/go.mod h1:dfpixHkqiijg3P7w5QArkMyC7+vlHcutN5R6zHIn8is=
30+
github.com/linuxdeepin/go-dbus-factory v0.0.0-20260227070938-bcb8d12841ab h1:tzTj6afLE47xQ8oRdeH/xBwgc1Jfo6loOCZyAVO21/4=
31+
github.com/linuxdeepin/go-dbus-factory v0.0.0-20260227070938-bcb8d12841ab/go.mod h1:dfpixHkqiijg3P7w5QArkMyC7+vlHcutN5R6zHIn8is=
3232
github.com/linuxdeepin/go-gir v0.0.0-20250812023606-b28aaee32ac9/go.mod h1:a0tox5vepTQu5iO6rdKc4diGT+fkyXZlRROM8ULEvaI=
3333
github.com/linuxdeepin/go-gir v0.0.0-20251127080441-d9c47dbb6da4 h1:CsW+3eOerOSANbQWEXOWNqJuzl7/W9QIJu9wHvB0g/I=
3434
github.com/linuxdeepin/go-gir v0.0.0-20251127080441-d9c47dbb6da4/go.mod h1:a0tox5vepTQu5iO6rdKc4diGT+fkyXZlRROM8ULEvaI=
35-
github.com/linuxdeepin/go-lib v0.0.0-20251106065207-1fdf101312e6 h1:ntYWER7pULMpTQykPiENOGh7pxSPCspV3Ql8mZA+IBc=
36-
github.com/linuxdeepin/go-lib v0.0.0-20251106065207-1fdf101312e6/go.mod h1:2d0hhhqpr9UP9DRgnzU4y6nwdgUtM0qV94Wf0bzAI2g=
35+
github.com/linuxdeepin/go-lib v0.0.0-20260205120541-a1f572ce1442 h1:CuqOgdz4wxhvUIjuOnQX36Wq0zSnMQd94YqoiwH681E=
36+
github.com/linuxdeepin/go-lib v0.0.0-20260205120541-a1f572ce1442/go.mod h1:2d0hhhqpr9UP9DRgnzU4y6nwdgUtM0qV94Wf0bzAI2g=
3737
github.com/linuxdeepin/go-x11-client v0.0.0-20220830090948-78fe92b727bb/go.mod h1:KwpmRZ47A/0a2l9V0V6aTlkuNaqy5j1fOqMFJONuIMY=
3838
github.com/linuxdeepin/go-x11-client v0.0.0-20230131052004-7503e2337ee1 h1:UZo2ftrgFtf5O4jtG0dJ+i/AeFy8LXjNewBRDhwzFxA=
3939
github.com/linuxdeepin/go-x11-client v0.0.0-20230131052004-7503e2337ee1/go.mod h1:KwpmRZ47A/0a2l9V0V6aTlkuNaqy5j1fOqMFJONuIMY=
4040
github.com/mozillazg/go-pinyin v0.19.0/go.mod h1:iR4EnMMRXkfpFVV5FMi4FNB6wGq9NV6uDWbUuPhP4Yc=
41-
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
42-
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
4341
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
4442
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
4543
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

0 commit comments

Comments
 (0)