[client] Fix Linux UI flickering on state updates (#4886)

This commit is contained in:
Viktor Liu
2025-12-24 11:06:13 +01:00
committed by GitHub
parent b7e98acd1f
commit fc4932a23f

View File

@@ -312,6 +312,8 @@ type serviceClient struct {
daemonVersion string daemonVersion string
updateIndicationLock sync.Mutex updateIndicationLock sync.Mutex
isUpdateIconActive bool isUpdateIconActive bool
settingsEnabled bool
profilesEnabled bool
showNetworks bool showNetworks bool
wNetworks fyne.Window wNetworks fyne.Window
wProfiles fyne.Window wProfiles fyne.Window
@@ -907,7 +909,7 @@ func (s *serviceClient) updateStatus() error {
var systrayIconState bool var systrayIconState bool
switch { switch {
case status.Status == string(internal.StatusConnected): case status.Status == string(internal.StatusConnected) && !s.mUp.Disabled():
s.connected = true s.connected = true
s.sendNotification = true s.sendNotification = true
if s.isUpdateIconActive { if s.isUpdateIconActive {
@@ -921,6 +923,7 @@ func (s *serviceClient) updateStatus() error {
s.mUp.Disable() s.mUp.Disable()
s.mDown.Enable() s.mDown.Enable()
s.mNetworks.Enable() s.mNetworks.Enable()
s.mExitNode.Enable()
go s.updateExitNodes() go s.updateExitNodes()
systrayIconState = true systrayIconState = true
case status.Status == string(internal.StatusConnecting): case status.Status == string(internal.StatusConnecting):
@@ -1274,19 +1277,22 @@ func (s *serviceClient) checkAndUpdateFeatures() {
return return
} }
s.updateIndicationLock.Lock()
defer s.updateIndicationLock.Unlock()
// Update settings menu based on current features // Update settings menu based on current features
if features != nil && features.DisableUpdateSettings { settingsEnabled := features == nil || !features.DisableUpdateSettings
s.setSettingsEnabled(false) if s.settingsEnabled != settingsEnabled {
} else { s.settingsEnabled = settingsEnabled
s.setSettingsEnabled(true) s.setSettingsEnabled(settingsEnabled)
} }
// Update profile menu based on current features // Update profile menu based on current features
if s.mProfile != nil { if s.mProfile != nil {
if features != nil && features.DisableProfiles { profilesEnabled := features == nil || !features.DisableProfiles
s.mProfile.setEnabled(false) if s.profilesEnabled != profilesEnabled {
} else { s.profilesEnabled = profilesEnabled
s.mProfile.setEnabled(true) s.mProfile.setEnabled(profilesEnabled)
} }
} }
} }