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

chore: not set plymouth when set scale #245

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Build-Depends:
golang-go,
golang-golang-x-xerrors-dev,
golang-gopkg-check.v1-dev,
golang-github-adrg-xdg-dev,
jq,
libsecret-1-dev,
libxcursor-dev,
Expand Down
10 changes: 3 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,24 @@ module github.com/linuxdeepin/startdde
go 1.20

require (
github.com/adrg/xdg v0.4.0
github.com/davecgh/go-spew v1.1.1
github.com/fsnotify/fsnotify v1.6.0
github.com/godbus/dbus/v5 v5.1.0
github.com/linuxdeepin/dde-api v0.0.0-20230427024816-e46a1f75f190
github.com/linuxdeepin/go-dbus-factory v0.0.0-20230419033528-8cf26ec99c5d
github.com/linuxdeepin/go-dbus-factory v0.0.0-20231107015654-3237acc2c551
github.com/linuxdeepin/go-gir v0.0.0-20230413065249-b60cd1aca477
github.com/linuxdeepin/go-lib v0.0.0-20230406092403-b4b4282fc513
github.com/linuxdeepin/go-lib v0.0.0-20231107015720-6018bdcd69dd
github.com/linuxdeepin/go-x11-client v0.0.0-20230329071904-56c906e1ab5d
github.com/stretchr/testify v1.8.2
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
)

require (
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/kr/text v0.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/youpy/go-riff v0.1.0 // indirect
github.com/youpy/go-wav v0.3.2 // indirect
github.com/zaf/g711 v0.0.0-20220109202201-cf0017bf0359 // indirect
golang.org/x/sys v0.3.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
17 changes: 4 additions & 13 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls=
github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
Expand Down Expand Up @@ -41,7 +39,6 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
Expand All @@ -61,13 +58,14 @@ github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/linuxdeepin/dde-api v0.0.0-20230427024816-e46a1f75f190 h1:o3qpI7XTA4bX9aqFp/bvPc1UvmVwvaYfikFZUNZZeIc=
github.com/linuxdeepin/dde-api v0.0.0-20230427024816-e46a1f75f190/go.mod h1:plHSVHmj6Uvkp2QGQEnc+kZFV/AUZcA2LM5FU8CYvy4=
github.com/linuxdeepin/go-dbus-factory v0.0.0-20230407013947-6ff704a21ca7/go.mod h1:iIlTR50SA8MJ9ORPyMOpKWMF4g+AUorbER5AX0RD9Jk=
github.com/linuxdeepin/go-dbus-factory v0.0.0-20230419033528-8cf26ec99c5d h1:X8f2l2olq/m1n3AVB/d3kNXPlpke3OZpu9J2QOYz3Kw=
github.com/linuxdeepin/go-dbus-factory v0.0.0-20230419033528-8cf26ec99c5d/go.mod h1:iIlTR50SA8MJ9ORPyMOpKWMF4g+AUorbER5AX0RD9Jk=
github.com/linuxdeepin/go-dbus-factory v0.0.0-20231107015654-3237acc2c551 h1:9JXWCYNjoW/Q99Ytd2bpgaYyn3m3JHtB0hwHM5ubjkc=
github.com/linuxdeepin/go-dbus-factory v0.0.0-20231107015654-3237acc2c551/go.mod h1:iIlTR50SA8MJ9ORPyMOpKWMF4g+AUorbER5AX0RD9Jk=
github.com/linuxdeepin/go-gir v0.0.0-20230331033513-a8d7a9e89f9b/go.mod h1:a0tox5vepTQu5iO6rdKc4diGT+fkyXZlRROM8ULEvaI=
github.com/linuxdeepin/go-gir v0.0.0-20230413065249-b60cd1aca477 h1:IJkQFx4mLZPX9STHJ9XV3vIW8mwL8GrQcnK38a323R8=
github.com/linuxdeepin/go-gir v0.0.0-20230413065249-b60cd1aca477/go.mod h1:a0tox5vepTQu5iO6rdKc4diGT+fkyXZlRROM8ULEvaI=
github.com/linuxdeepin/go-lib v0.0.0-20230406092403-b4b4282fc513 h1:4qux/rKQwaJSuEp9Vq2UN47cS9oM5JQZ84ajBv3m2uk=
github.com/linuxdeepin/go-lib v0.0.0-20230406092403-b4b4282fc513/go.mod h1:KwMO4bz9iFACoMIIawtpx5S23T0uaYxr9uLcKZ37Y6E=
github.com/linuxdeepin/go-lib v0.0.0-20231107015720-6018bdcd69dd h1:ax5ac8oFSYZQqe7nDwcwlBIkVCSulOpZ/XeFhsEEJVc=
github.com/linuxdeepin/go-lib v0.0.0-20231107015720-6018bdcd69dd/go.mod h1:KwMO4bz9iFACoMIIawtpx5S23T0uaYxr9uLcKZ37Y6E=
github.com/linuxdeepin/go-x11-client v0.0.0-20220830090948-78fe92b727bb/go.mod h1:KwpmRZ47A/0a2l9V0V6aTlkuNaqy5j1fOqMFJONuIMY=
github.com/linuxdeepin/go-x11-client v0.0.0-20230131052004-7503e2337ee1/go.mod h1:KwpmRZ47A/0a2l9V0V6aTlkuNaqy5j1fOqMFJONuIMY=
github.com/linuxdeepin/go-x11-client v0.0.0-20230329071904-56c906e1ab5d h1:FYvSF95wgsMpah80xtLCOMqompAbjkaMRmn9RBMBzo8=
Expand Down Expand Up @@ -95,7 +93,6 @@ github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeR
github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc=
github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM=
github.com/onsi/gomega v1.24.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand All @@ -111,22 +108,18 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/youpy/go-riff v0.1.0 h1:vZO/37nI4tIET8tQI0Qn0Y79qQh99aEpponTPiPut7k=
github.com/youpy/go-riff v0.1.0/go.mod h1:83nxdDV4Z9RzrTut9losK7ve4hUnxUR8ASSz4BsKXwQ=
github.com/youpy/go-wav v0.3.2 h1:NLM8L/7yZ0Bntadw/0h95OyUsen+DQIVf9gay+SUsMU=
github.com/youpy/go-wav v0.3.2/go.mod h1:0FCieAXAeSdcxFfwLpRuEo0PFmAoc+8NU34h7TUvk50=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/zaf/g711 v0.0.0-20190814101024-76a4a538f52b/go.mod h1:T2h1zV50R/q0CVYnsQOQ6L7P4a2ZxH47ixWcMXFGyx8=
github.com/zaf/g711 v0.0.0-20220109202201-cf0017bf0359 h1:P9yeMx2iNJxJqXEwLtMjSwWcD2a0AlFmFByeosMZhLM=
github.com/zaf/g711 v0.0.0-20220109202201-cf0017bf0359/go.mod h1:ySLGJD8AQluMQuu5JDvfJrwsBra+8iX1jFsKS8KfB2I=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down Expand Up @@ -180,7 +173,6 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down Expand Up @@ -235,5 +227,4 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
83 changes: 2 additions & 81 deletions xsettings/scale.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"math"
"os"
"path/filepath"
Expand Down Expand Up @@ -60,7 +59,7 @@ func (m *XSManager) setScaleFactor(scale float64, emitSignal bool) {
gsWrapGDI.SetInt("cursor-size", cursorSize)
gsWrapGDI.Unref()

m.setScaleFactorForPlymouth(int(windowScale), emitSignal)
m.emitSignalSetScaleFactor(true, emitSignal)
}

func parseScreenFactors(str string) map[string]float64 {
Expand Down Expand Up @@ -281,33 +280,6 @@ func (m *XSManager) getScreenScaleFactors() map[string]float64 {
return parseScreenFactors(factorsJoined)
}

const plymouthConfigFile = "/etc/plymouth/plymouthd.conf"

func (m *XSManager) setScaleFactorForPlymouthReal(factor int, emitSignal bool) {
logger.Debug("scalePlymouth", factor)
currentFactor := 0
theme, err := getPlymouthTheme(plymouthConfigFile)
if err == nil {
currentFactor = getPlymouthThemeScaleFactor(theme)
} else {
logger.Warning(err)
}

if currentFactor == factor {
logger.Debug("quick end scalePlymouth", factor)
m.emitSignalSetScaleFactor(true, emitSignal)
return
}

m.emitSignalSetScaleFactor(false, emitSignal)
err = m.sysDaemon.ScalePlymouth(0, uint32(factor))
m.emitSignalSetScaleFactor(true, emitSignal)

logger.Debug("end scalePlymouth", factor)
if err != nil {
logger.Warning(err)
}
}

func (m *XSManager) emitSignalSetScaleFactor(done, emitSignal bool) {
if !emitSignal {
Expand All @@ -323,46 +295,6 @@ func (m *XSManager) emitSignalSetScaleFactor(done, emitSignal bool) {
}
}

func (m *XSManager) startScaleFactorForPlymouth(factor int, emitSignal bool) {
logger.Debug("startScaleFactorForPlymouth", factor)
go func() {
m.setScaleFactorForPlymouthReal(factor, emitSignal)
m.endScaleFactorForPlymouth()
}()
}

func (m *XSManager) endScaleFactorForPlymouth() {
m.plymouthScalingMu.Lock()
defer m.plymouthScalingMu.Unlock()

if len(m.plymouthScalingTasks) == 0 {
// stop
m.plymouthScaling = false
} else {
factor := m.plymouthScalingTasks[len(m.plymouthScalingTasks)-1]
logger.Debug("use last in tasks:", factor, m.plymouthScalingTasks)
m.plymouthScalingTasks = nil
m.startScaleFactorForPlymouth(factor, true)
}
}

func (m *XSManager) setScaleFactorForPlymouth(factor int, emitSignal bool) {
if factor > 2 {
factor = 2
}
m.plymouthScalingMu.Lock()

if m.plymouthScaling {
m.plymouthScalingTasks = append(m.plymouthScalingTasks, factor)
logger.Debug("add to tasks", factor)
} else {
m.plymouthScaling = true
m.startScaleFactorForPlymouth(factor, emitSignal)
}

m.plymouthScalingMu.Unlock()
}

func getPlymouthTheme(file string) (string, error) {
var kf = keyfile.NewKeyFile()
err := kf.LoadFromFile(file)
Expand All @@ -373,19 +305,8 @@ func getPlymouthTheme(file string) (string, error) {
return kf.GetString("Daemon", "Theme")
}

func getPlymouthThemeScaleFactor(theme string) int {
switch theme {
case "deepin-logo", "deepin-ssd-logo", "uos-ssd-logo":
return 1
case "deepin-hidpi-logo", "deepin-hidpi-ssd-logo", "uos-hidpi-ssd-logo":
return 2
default:
return 0
}
}

func (m *XSManager) updateGreeterQtTheme(kf *keyfile.KeyFile) error {
tempFile, err := ioutil.TempFile("", "startdde-qt-theme-")
tempFile, err := os.CreateTemp("", "startdde-qt-theme-")
if err != nil {
return err
}
Expand Down
90 changes: 0 additions & 90 deletions xsettings/scale_test.go

This file was deleted.