Skip to content

Commit

Permalink
fix: 解决PS鼠标类型的触控板引起的崩溃问题
Browse files Browse the repository at this point in the history
解决PS鼠标类型的触控板引起的崩溃问题

Log: 解决PS鼠标类型的触控板引起的崩溃问题
pms: BUG-298693
  • Loading branch information
fly602 committed Jan 7, 2025
1 parent 2620c0f commit 8f2560a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions dxinput/touchpad.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,18 @@ func NewTouchpad(id int32) (*Touchpad, error) {
}

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

isLibinputUsed := utils.IsPropertyExist(dev.Id, libinputPropTapEnabled)
if !isLibinputUsed && dev.Type == DevTypeMouse {
isLibinputUsed = utils.IsPropertyExist(dev.Id, libinputPropButtonScrollingButton)
}
return &Touchpad{
Id: dev.Id,
Name: dev.Name,
isLibinputUsed: utils.IsPropertyExist(dev.Id, libinputPropTapEnabled),
isLibinputUsed: isLibinputUsed,
}, nil
}

Expand Down
3 changes: 2 additions & 1 deletion dxinput/utils/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ list_device(int* num)
DeviceInfo* devs = NULL;
for (i = 0; i < all_num; i++) {
if ((xinfos[i].use != XISlavePointer &&
xinfos[i].use != XISlaveKeyboard)) {
xinfos[i].use != XISlaveKeyboard &&
xinfos[i].use != XIFloatingSlave)) {
continue;
}

Expand Down

0 comments on commit 8f2560a

Please sign in to comment.