Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: get 'libinput Accel Profiles Available' failed #126

Merged
merged 1 commit into from
Dec 26, 2024

Conversation

zsien
Copy link
Contributor

@zsien zsien commented Dec 26, 2024

libinput currently supports three profiles:
"adaptive", "flat" and "custom".

Log: 修复无法设置鼠标加速
PMS: bug-294369

@zsien zsien requested a review from a team December 26, 2024 02:21
@zsien zsien force-pushed the zs/fix/accelprofiles branch from 0a901ff to ac4641a Compare December 26, 2024 05:06
libinput currently supports three profiles:
"adaptive", "flat" and "custom".

Log: 修复无法设置鼠标加速
PMS: bug-294369
@zsien zsien force-pushed the zs/fix/accelprofiles branch from ac4641a to 454e8d7 Compare December 26, 2024 05:26
@deepin-ci-robot
Copy link

deepin pr auto review

代码审查意见:

  1. 注释更新:在libinput.go文件中,注释已经更新以反映新的功能,这是好的做法。但是,建议在注释中添加对新增的custom配置的解释,以便其他开发者理解其用途。

  2. 错误处理:在libinputSetAccelProfile函数中,当getInt8Prop返回错误时,函数直接返回错误。这可能不是最佳实践,因为错误处理应该更加细致,例如记录错误或提供更详细的错误信息。

  3. 代码重复:在libinputSetAccelProfile函数中,当useAdaptiveProfilefalse时,prop[2]被设置为0。这实际上与useAdaptiveProfiletrue时的逻辑相同,可以考虑简化代码。

  4. 函数签名变更:在libinputGetAccelProfilelibinputSetAccelProfile函数中,函数签名已经从接受两个参数变为接受三个参数。这可能会导致调用这些函数的代码出现问题,需要检查并更新所有相关的调用。

  5. 注释格式:在mouse.go文件中,注释的格式不一致,有些注释使用了//,有些使用了//后跟空格,建议统一注释格式以提高代码的可读性。

  6. 错误信息:在mouse.go文件中,EnableMiddleButtonEmulationEnableWheelEmulation函数在参数未改变时返回nil,这可能不是最佳的用户体验,建议返回一个更明确的指示,例如"No change needed"

  7. 错误处理:在mouse.go文件中,SetMiddleButtonEmulationTimeoutSetWheelEmulationTimeout等函数在isLibinputUsedglobalWaylandtrue时返回一个固定的错误信息。这可能不足以帮助用户解决问题,建议提供更具体的错误信息或解决方案。

  8. 代码风格:在libinput.gomouse.go文件中,代码缩进和格式不一致,建议使用统一的代码风格工具(如gofmt)来格式化代码。

综上所述,代码的更新是合理的,但需要注意错误处理、代码重复、函数签名变更和注释的一致性等方面的问题,以确保代码的质量和可维护性。

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ECQZXC, zsien

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@zsien zsien merged commit 13ff8dc into linuxdeepin:master Dec 26, 2024
16 of 17 checks passed
@zsien zsien deleted the zs/fix/accelprofiles branch December 26, 2024 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants