Skip to content

Commit

Permalink
feat: 添加鼠标和触摸板开关接口
Browse files Browse the repository at this point in the history
添加鼠标和触摸板开关接口

Log:
  • Loading branch information
dengbo11 committed Jun 2, 2023
1 parent 735deb1 commit f2ee58c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
10 changes: 10 additions & 0 deletions inputdevices/exported_methods_auto.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion inputdevices/ifc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package inputdevices

import (
"github.com/godbus/dbus/v5"
langselector "github.com/linuxdeepin/dde-daemon/langselector1"
"github.com/linuxdeepin/go-lib/dbusutil"
"github.com/linuxdeepin/dde-daemon/langselector1"
)

func (m *Mouse) Reset() *dbus.Error {
Expand All @@ -17,6 +17,14 @@ func (m *Mouse) Reset() *dbus.Error {
return nil
}

func (m *Mouse) Enable(enabled bool) *dbus.Error {
if err := m.enable(enabled); err != nil {
return dbusutil.ToError(err)
}

return nil
}

func (tp *TrackPoint) Reset() *dbus.Error {
for _, key := range tp.setting.ListKeys() {
tp.setting.Reset(key)
Expand All @@ -31,6 +39,11 @@ func (tpad *Touchpad) Reset() *dbus.Error {
return nil
}

func (tpad *Touchpad) Enable(enabled bool) *dbus.Error {
tpad.enable(enabled)
return nil
}

func (w *Wacom) Reset() *dbus.Error {
for _, key := range w.setting.ListKeys() {
w.setting.Reset(key)
Expand Down
13 changes: 13 additions & 0 deletions inputdevices/mouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,19 @@ func (m *Mouse) disableTouchPad() {
touchPad.enable(false)
}

func (m *Mouse) enable(enabled bool) error {
for _, v := range m.devInfos {
err := v.Enable(enabled)
if err != nil {
logger.Debugf("Enable left handed for '%d - %v' failed: %v",
v.Id, v.Name, err)
return err
}
}

return nil
}

func (m *Mouse) enableLeftHanded() {
enabled := m.LeftHanded.Get()
for _, v := range m.devInfos {
Expand Down

0 comments on commit f2ee58c

Please sign in to comment.