Skip to content

Commit

Permalink
fix: 设置手势的动作后,发送infos变化的信号
Browse files Browse the repository at this point in the history
设置手势的动作后,发送infos变化的信号

Log: 设置手势的动作后,发送infos变化的信号
pms: TASK-362119
  • Loading branch information
fly602 committed Jan 9, 2025
1 parent b28541e commit a64761d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
5 changes: 2 additions & 3 deletions gesture1/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ func (d *Daemon) Start() error {
if d.manager != nil {
return nil
}

service := loader.GetService()
var err error
d.manager, err = newManager()
d.manager, err = newManager(service)
if err != nil {
logger.Error("failed to initialize gesture manager:", err)
return err
}

service := loader.GetService()
err = service.Export(dbusServicePath, d.manager)
if err != nil {
logger.Error("failed to export gesture:", err)
Expand Down
16 changes: 16 additions & 0 deletions gesture1/gesture1_dbusutil.go

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

4 changes: 3 additions & 1 deletion gesture1/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func setUseWayland(value bool) {

type Manager struct {
wm wm.Wm
service *dbusutil.Service
sysDaemon daemon.Daemon
systemSigLoop *dbusutil.SignalLoop
mu sync.RWMutex
Expand Down Expand Up @@ -91,7 +92,7 @@ type Manager struct {
availableGestures map[string][]string
}

func newManager() (*Manager, error) {
func newManager(service *dbusutil.Service) (*Manager, error) {
setUseWayland(len(os.Getenv("WAYLAND_DISPLAY")) != 0)
sessionConn, err := dbus.SessionBus()
if err != nil {
Expand Down Expand Up @@ -127,6 +128,7 @@ func newManager() (*Manager, error) {
notification: notification.NewNotification(sessionConn),
launchpad: launchpad.NewLauncher(sessionConn),
availableGestures: make(map[string][]string),
service: service,
}
dsg := configManager.NewConfigManager(systemConn)
powerConfigManagerPath, err := dsg.AcquireManager(0, "org.deepin.dde.daemon", "org.deepin.dde.daemon.gesture", "")
Expand Down
4 changes: 4 additions & 0 deletions gesture1/manager_ifc.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ func (m *Manager) SetGesture(name string, direction string, fingers int32, actio
gesture.Direction == direction &&
gesture.Fingers == fingers {
gesture.ActionName = action
err := m.emitPropChangedInfos(m.Infos)
if err != nil {
logger.Warning(err)
}
m.saveGestureConfig()
break
}
Expand Down

0 comments on commit a64761d

Please sign in to comment.