Skip to content

Commit 8f2560a

Browse files
committed
fix: 解决PS鼠标类型的触控板引起的崩溃问题
解决PS鼠标类型的触控板引起的崩溃问题 Log: 解决PS鼠标类型的触控板引起的崩溃问题 pms: BUG-298693
1 parent 2620c0f commit 8f2560a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

dxinput/touchpad.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,18 @@ func NewTouchpad(id int32) (*Touchpad, error) {
5353
}
5454

5555
func NewTouchpadFromDevInfo(dev *DeviceInfo) (*Touchpad, error) {
56-
if dev == nil || dev.Type != DevTypeTouchpad {
56+
if dev == nil || (dev.Type != DevTypeTouchpad && dev.Type != DevTypeMouse) {
5757
return nil, fmt.Errorf("Not a touchpad device(%d - %s)", dev.Id, dev.Name)
5858
}
5959

60+
isLibinputUsed := utils.IsPropertyExist(dev.Id, libinputPropTapEnabled)
61+
if !isLibinputUsed && dev.Type == DevTypeMouse {
62+
isLibinputUsed = utils.IsPropertyExist(dev.Id, libinputPropButtonScrollingButton)
63+
}
6064
return &Touchpad{
6165
Id: dev.Id,
6266
Name: dev.Name,
63-
isLibinputUsed: utils.IsPropertyExist(dev.Id, libinputPropTapEnabled),
67+
isLibinputUsed: isLibinputUsed,
6468
}, nil
6569
}
6670

dxinput/utils/list.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ list_device(int* num)
5151
DeviceInfo* devs = NULL;
5252
for (i = 0; i < all_num; i++) {
5353
if ((xinfos[i].use != XISlavePointer &&
54-
xinfos[i].use != XISlaveKeyboard)) {
54+
xinfos[i].use != XISlaveKeyboard &&
55+
xinfos[i].use != XIFloatingSlave)) {
5556
continue;
5657
}
5758

0 commit comments

Comments
 (0)