Exemple #1
0
func initDBusIFC() error {
	var err error
	dspObj, err = libdsp.NewDisplay("com.deepin.daemon.Display",
		"/com/deepin/daemon/Display")
	if err != nil {
		finalizeDBusIFC()
		return err
	}

	areaObj, err = libarea.NewXMouseArea("com.deepin.api.XMouseArea",
		"/com/deepin/api/XMouseArea")
	if err != nil {
		finalizeDBusIFC()
		return err
	}

	launchObj, err = launcher.NewLauncher("com.deepin.dde.launcher",
		"/com/deepin/dde/launcher")
	if err != nil {
		finalizeDBusIFC()
		return err
	}

	return nil
}
Exemple #2
0
func Start() {
	if dockProperty != nil {
		return
	}

	logger.BeginTracing()

	initDeepin()

	if logger.GetLogLevel() == log.LevelDebug {
		os.Setenv("G_MESSAGES_DEBUG", "all")
	}

	if !initDisplay() {
		Stop()
		return
	}

	var err error

	XU, err = xgbutil.NewConn()
	if err != nil {
		startFailed(err)
		return
	}

	TrayXU, err = xgbutil.NewConn()
	if err != nil {
		startFailed(err)
		return
	}

	initAtom()

	dockProperty = NewDockProperty()
	err = dbus.InstallOnSession(dockProperty)
	if err != nil {
		startFailed("register dbus interface failed:", err)
		return
	}

	entryProxyerManager = NewEntryProxyerManager()
	err = dbus.InstallOnSession(entryProxyerManager)
	if err != nil {
		startFailed("register dbus interface failed:", err)
		return
	}

	entryProxyerManager.watchEntries()

	dockedAppManager = NewDockedAppManager()
	err = dbus.InstallOnSession(dockedAppManager)
	if err != nil {
		startFailed("register dbus interface failed:", err)
		return
	}

	setting = NewSetting()
	if setting == nil {
		startFailed("get setting failed")
	}
	err = dbus.InstallOnSession(setting)
	if err != nil {
		startFailed("register dbus interface failed:", err)
		return
	}

	dockProperty.updateDockHeight(DisplayModeType(setting.GetDisplayMode()))

	hideModemanager =
		NewHideStateManager(HideModeType(setting.GetHideMode()))
	err = dbus.InstallOnSession(hideModemanager)
	if err != nil {
		startFailed("register dbus interface failed:", err)
		return
	}
	hideModemanager.UpdateState()

	clientManager := NewClientManager()
	err = dbus.InstallOnSession(clientManager)
	if err != nil {
		startFailed("register dbus interface failed:", err)
		return
	}
	go clientManager.listenRootWindow()

	region = NewRegion()
	err = dbus.InstallOnSession(region)
	if err != nil {
		startFailed("register dbus interface failed:", err)
		return
	}

	areaImp, err = xmousearea.NewXMouseArea(
		"com.deepin.api.XMouseArea",
		"/com/deepin/api/XMouseArea",
	)
	mouseArea, err = NewXMouseAreaProxyer(areaImp, err)

	if err != nil {
		startFailed("register xmouse area failed:", err)
		return
	}

	err = dbus.InstallOnSession(mouseArea)
	if err != nil {
		startFailed(err)
		return
	}

	dbus.Emit(mouseArea, "InvalidId")
	mouseArea.connectMotionInto(func(_, _ int32, id string) {
		if mouseAreaTimer != nil {
			mouseAreaTimer.Stop()
			mouseAreaTimer = nil
		}
		mouseAreaTimer = time.AfterFunc(TOGGLE_HIDE_TIME, func() {
			logger.Info("MouseIn:", id)
			mouseAreaTimer = nil
			hideModemanager.UpdateState()
		})
	})

	mouseArea.connectMotionOut(func(_, _ int32, id string) {
		if mouseAreaTimer != nil {
			mouseAreaTimer.Stop()
			mouseAreaTimer = nil
		}
		logger.Info("MouseOut:", id)
		hideModemanager.UpdateState()
	})

	initialize()
}