fix(app): an update keeps the window as it was, and doesn't take the focus #34
No reviewers
Labels
No labels
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
priority
critical
priority
high
priority
low
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Beanstalk!34
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Beanstalk:fix/update-focus"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
When the app updates itself between tests (auto-update, #19), it starts its new copy, and the new copy always showed its window and activated it. So an update could pull Beanstalk to the front over whatever the tester was doing, even when the window was behind other windows, minimized, or closed to the tray.
What changed
The new copy opens the window the way the old one had it, and takes the focus only when the old window had it.
Core/RestartWindow.cs:RestartWindow(Focused, Behind, Minimized, Hidden) andRestartWindowState.Of(open, minimized, active)says which one the old window was.BEANSTALK_RESTART_WINDOWcarries it to the new copy, which takes it out of its environment at once (Take()), so nothing the app starts sees it. A value it doesn't know, or none, means a normal start.App.RestartAsyncpasses the window's state toAgentService.StartNew(how).ShowActivated = false, so it doesn't take the focus.Nothing changes on screen except whether the window comes forward, so there are no screenshots.
Testing
Take()clearing the variable.dotnet build agent/App -c Release: no warnings.ShowActivated = falseshows the window without activating it) or on GNOME/KDE. That needs an update while the window is behind another one, on the next nightly.